Changeset 1319
- Timestamp:
- 12/21/07 18:03:17 (10 months ago)
- Location:
- trunk/src
- Files:
-
- 12 modified
-
buze/ExceptionDialog.cpp (modified) (2 diffs)
-
buzelib/Document.cpp (modified) (5 diffs)
-
buzelib/Document.h (modified) (3 diffs)
-
buzelib/FileBrowserView.cpp (modified) (1 diff)
-
buzelib/MachineParameterView.cpp (modified) (1 diff)
-
buzelib/MachineView.cpp (modified) (2 diffs)
-
buzelib/PatternView.cpp (modified) (8 diffs)
-
buzelib/PatternView.h (modified) (2 diffs)
-
buzelib/WaveTableView.cpp (modified) (2 diffs)
-
buzelib/buze.rc (modified) (2 diffs)
-
buzelib/res/keyboard_patterneditor.txt (modified) (2 diffs)
-
buzelib/resource.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/buze/ExceptionDialog.cpp
r1251 r1319 59 59 zzub::BuzzWriter writer(&outf); 60 60 std::vector<zzub::metaplugin*> plugins; 61 MessageBox("SAVE SONG HERE1");62 61 if (writer.writePlayer(player, plugins, true)) { 63 62 sprintf(szScratch, "Successfully saved current song to %s.", szDumpPath); … … 65 64 sprintf(szScratch, "Error while saving song to %s.", szDumpPath); 66 65 } 67 MessageBox("SAVE SONG HERE2");68 66 outf.close(); 69 67 szResult = szScratch; 70 68 } else { 71 MessageBox("SAVE SONG HERE3");72 69 szResult = "Could not create temp file."; 73 70 } 74 MessageBox("SAVE SONG HERE4");75 71 76 72 if (szResult) -
trunk/src/buzelib/Document.cpp
r1316 r1319 70 70 71 71 void CDocument::selectMachine(metaplugin* machine) { 72 resetKeyjazz();72 player->resetKeyjazz(); 73 73 player->midiNoteMachine = machine; 74 74 … … 728 728 729 729 730 void CDocument::resetKeyjazz() {731 // todo: set note off for all current playing keys732 keyjazz.clear();733 }734 735 736 737 738 739 740 730 // machine properties (working on selected machine) 741 731 void CDocument::setMachineName(metaplugin* machine, std::string name) { … … 1287 1277 if (mit == m_pFocusedPattern.end()) return 0; 1288 1278 return mit->second; 1289 }1290 1291 1292 bool CDocument::isNotePlaying(metaplugin* m, int note) {1293 for (size_t i = 0; i<keyjazz.size(); i++)1294 if (keyjazz[i].note == note) return true;1295 return false;1296 1279 } 1297 1280 … … 1310 1293 1311 1294 void CDocument::playMachineNote(metaplugin* m, int note, int prevNote) { 1312 // create a blank 1-row pattern we're going to play 1313 zzub::pattern* p = new zzub::pattern(m->loader->plugin_info, m->getConnections(), m->getTracks(), 1); 1314 1315 bool multiChannel; 1316 size_t noteGroup = -1; 1317 size_t noteParameter = -1; 1318 m->findNoteColumn(noteParameter, noteGroup, multiChannel); 1319 if (noteParameter == -1) return ; 1320 1321 if (multiChannel) { 1322 // play note on track 1323 if (note == note_value_off) { 1324 // find which track this note was played in and play a note-stop 1325 for (size_t i = 0; i<keyjazz.size(); i++) { 1326 if (keyjazz[i].note == prevNote || prevNote == -1) { 1327 patterntrack* pt = p->getPatternTrack(keyjazz[i].group, keyjazz[i].track); 1328 pt->setValue(0, noteParameter, note_value_off); 1329 keyjazz.erase(keyjazz.begin() + i); 1330 i--; 1331 if (prevNote != -1) break; 1332 } 1333 } 1334 } else { 1335 size_t lowestTime = UINT_MAX; 1336 int lowestTrack = -1; 1337 int foundTrack = -1; 1338 size_t lowestIndex; 1339 1340 vector<bool> foundTracks(m->getTracks()); 1341 for (size_t i = 0; i < foundTracks.size(); i++) 1342 foundTracks[i] = false; 1343 1344 for (size_t j = 0; j < keyjazz.size(); j++) { 1345 foundTracks[keyjazz[j].track] = true; 1346 if (keyjazz[j].timestamp < lowestTime) { 1347 lowestTime = keyjazz[j].timestamp; 1348 lowestTrack = keyjazz[j].track; 1349 lowestIndex = j; 1350 } 1351 } 1352 1353 for (size_t i = 0; i < foundTracks.size(); i++) { 1354 if (foundTracks[i] == false) { 1355 foundTrack = i; 1356 break; 1357 } 1358 } 1359 if (foundTrack == -1) { 1360 foundTrack = lowestTrack; 1361 keyjazz.erase(keyjazz.begin()+lowestIndex); 1362 } 1363 1364 patterntrack* pt = p->getPatternTrack(noteGroup, foundTrack); 1365 pt->setValue(0, noteParameter, note); 1366 1367 // find an available track or the one with lowest timestamp 1368 KeyjazzInfo ki = {player->workPos, noteGroup, foundTrack, note }; 1369 keyjazz.push_back(ki); 1370 } 1371 } else { 1372 // play global note - no need for track counting 1373 if (note == note_value_off) { 1374 for (int i = 0; i<keyjazz.size(); i++) { 1375 if (keyjazz[i].note == prevNote) { 1376 keyjazz.clear(); 1377 1378 patterntrack* pt = p->getPatternTrack(noteGroup, 0); 1379 pt->setValue(0, noteParameter, note); 1380 break; 1381 } 1382 } 1383 } else { 1384 KeyjazzInfo ki = {player->workPos, 1, 0, note }; 1385 keyjazz.clear(); 1386 keyjazz.push_back(ki); 1387 1388 patterntrack* pt = p->getPatternTrack(noteGroup, 0); 1389 pt->setValue(0, noteParameter, note); 1390 } 1391 } 1392 1393 player->lock(); 1394 m->playPatternRow(p, 0, true); 1395 m->tickAsync(); 1396 player->unlock(); 1397 1398 delete p; 1399 } 1295 player->playMachineNote(m, note, prevNote, 0); 1296 } 1297 1298 // from player.cpp: 1299 namespace zzub { 1300 extern bool isNotePlaying(zzub::metaplugin* plugin, const std::vector<zzub::keyjazz_note>& keyjazz, int note); 1301 }; 1400 1302 1401 1303 void CDocument::playStream(int note, std::string pluginUri, std::string dataUrl) { 1402 1304 if (!streamplayer) return ; 1305 if (isNotePlaying(streamplayer, player->keyjazz, note)) { 1306 return ; 1307 } 1403 1308 1404 1309 zzub::mem_archive archive; … … 1409 1314 player->lock(); 1410 1315 streamplayer->machine->init(&archive); 1316 1411 1317 playMachineNote(streamplayer, note, 0); 1412 1318 /* streamplayer->setParameter(1, 0, 0, note, false); // note -
trunk/src/buzelib/Document.h
r1318 r1319 3 3 class CPropertyProvider; 4 4 class CConfiguration; 5 6 struct KeyjazzInfo {7 size_t timestamp;8 size_t group, track;9 int note;10 };11 12 5 13 6 struct pattern_position { … … 101 94 int lastSaveUndoPosition; // use to display "Are you sure you want to quit"-message 102 95 103 std::vector<KeyjazzInfo> keyjazz;104 void resetKeyjazz();105 106 96 std::string currentFileName; 107 97 std::string currentDirectory; … … 275 265 276 266 void setCurrentFile(std::string fileName); 277 bool isNotePlaying(zzub::metaplugin* m, int note); 267 278 268 // note = buzz note or NOTE_OFF, prevNote = note for which NOTE_OFF is set or -1 279 269 void playMachineNote(zzub::metaplugin* m, int note, int prevNote); -
trunk/src/buzelib/FileBrowserView.cpp
r1297 r1319 207 207 208 208 CFileInfo* fileInfo = selectedFiles[0]; 209 if (mainFrame->document->isNotePlaying(mainFrame->document->streamplayer, note)) return 0;210 209 211 210 std::string file = fileInfo->fullName; -
trunk/src/buzelib/MachineParameterView.cpp
r1306 r1319 149 149 if (!plugin || ((plugin->getFlags() & PLUGIN_FLAGS_MASK) != GENERATOR_PLUGIN_FLAGS)) return 0; 150 150 } 151 152 if (document->isNotePlaying(plugin, note)) return 0;153 151 154 152 document->playMachineNote(plugin, note, 0); -
trunk/src/buzelib/MachineView.cpp
r1318 r1319 201 201 if (m == 0) return 0; 202 202 203 if (document->isNotePlaying(m, note)) return 0;204 205 //if (m->getType() != plugin_type_generator) return 0; // only generators206 207 203 document->playMachineNote(m, note, 0); 208 204 return 0; … … 215 211 metaplugin* m = document->getSelectedMachine(0); 216 212 if (m == 0) return 0; 217 218 //if (m->getType() != plugin_type_generator) return 0; // only generators219 220 if (!document->isNotePlaying(m, note)) return 0;221 213 222 214 document->playMachineNote(m, zzub::note_value_off, note); -
trunk/src/buzelib/PatternView.cpp
r1318 r1319 1398 1398 size_t index; 1399 1399 pattern_position pos = document->getPatternPosition(machine, pattern); 1400 pattern->patternToLinear(pos.group, pos.track, pos.column, index);1400 index = patternEditor.GetColumnIndex(pos.group, pos.track, pos.column); 1401 1401 patternEditor.GetSelectionRect(&sel); 1402 1402 … … 1413 1413 size_t index; 1414 1414 pattern_position pos = document->getPatternPosition(machine, pattern); 1415 pattern->patternToLinear(pos.group, pos.track, pos.column, index);1415 index = patternEditor.GetColumnIndex(pos.group, pos.track, pos.column); 1416 1416 patternEditor.GetSelectionRect(&sel); 1417 1417 … … 1421 1421 patternEditor.SelectRange(sel.left, sel.top, index, pos.row); 1422 1422 } 1423 return 0; 1424 } 1425 1426 LRESULT CPatternView::OnUnSelect(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) { 1427 patternEditor.SelectRange(-1, -1, -1, -1); 1423 1428 return 0; 1424 1429 } … … 1429 1434 // 2. is the current selection length dividable with our beat highlight, if not, start new selection 1430 1435 // 3. set or double existing selection 1431 /*RECT sel;1436 RECT sel; 1432 1437 size_t index; 1433 1438 pattern_position pos = document->getPatternPosition(machine, pattern); 1434 pattern->patternToLinear(pos.group, pos.track, pos.column, index);1435 patternEditor. getSelectionRect(&sel);1439 index = patternEditor.GetColumnIndex(pos.group, pos.track, pos.column); 1440 patternEditor.GetSelectionRect(&sel); 1436 1441 1437 1442 if (sel.left == -1) { … … 1454 1459 1455 1460 patternEditor.SelectRange(sel.left, pos.row, sel.right, targetLength); 1456 */1461 1457 1462 return 0; 1458 1463 } … … 1460 1465 LRESULT CPatternView::OnSelectColumns(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) { 1461 1466 // select column, track, group or all 1462 /*RECT sel;1467 RECT sel; 1463 1468 size_t index; 1464 1469 pattern_position pos = document->getPatternPosition(machine, pattern); 1465 pattern->patternToLinear(pos.group, pos.track, pos.column, index);1466 patternEditor. getSelectionRect(&sel);1470 index = patternEditor.GetColumnIndex(pos.group, pos.track, pos.column); 1471 patternEditor.GetSelectionRect(&sel); 1467 1472 1468 1473 int firstColumn = index; … … 1471 1476 if (sel.top == 0 && sel.bottom == pattern->getRows()-1) { 1472 1477 size_t thisTrackFirstColumn, thisGroupFirstColumn; 1473 pattern->patternToLinear(pos.group, pos.track, 0, thisTrackFirstColumn);1474 pattern->patternToLinear(pos.group, 0, 0, thisGroupFirstColumn);1478 thisTrackFirstColumn = patternEditor.GetColumnIndex(pos.group, pos.track, 0); 1479 thisGroupFirstColumn = patternEditor.GetColumnIndex(pos.group, 0, 0); 1475 1480 size_t thisTrackNumColumns = 1; 1476 1481 size_t thisGroupNumColumns = 1; … … 1515 1520 1516 1521 patternEditor.SelectRange(firstColumn, 0, lastColumn, pattern->getRows()-1); 1517 */ 1522 1518 1523 return 0; 1519 1524 } -
trunk/src/buzelib/PatternView.h
r1318 r1319 177 177 COMMAND_ID_HANDLER(ID_PATTERNEDITOR_SELECT_BEGIN, OnSelectBegin) 178 178 COMMAND_ID_HANDLER(ID_PATTERNEDITOR_SELECT_END, OnSelectEnd) 179 COMMAND_ID_HANDLER(ID_PATTERNEDITOR_SELECT_UN, OnUnSelect) 179 180 COMMAND_ID_HANDLER(ID_PATTERNEDITOR_SELECT_COLUMNS, OnSelectColumns) 180 181 COMMAND_ID_HANDLER(ID_PATTERNEDITOR_SELECT_ROWS, OnSelectRows) … … 302 303 LRESULT OnSelectBegin(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); 303 304 LRESULT OnSelectEnd(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); 305 LRESULT OnUnSelect(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); 304 306 LRESULT OnSelectRows(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); 305 307 LRESULT OnSelectColumns(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); -
trunk/src/buzelib/WaveTableView.cpp
r1312 r1319 448 448 449 449 if (!document->streamplayer) return 0; 450 if (document->isNotePlaying(document->streamplayer, note)) return 0;451 450 452 451 document->playStream(note, "@zzub.org/stream/wavetable;1", stringFromInt(index+1)); 453 452 return 0; 454 //return this->waveEditorCtrl.OnKeyDown(uMsg, wParam, lParam, bHandled);455 453 } 456 454 … … 479 477 480 478 LRESULT CWaveTableView::OnLoadWave(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { 481 MessageBox("Load wave not implemented ");479 MessageBox("Load wave not implemented. Instead, try to drag + drop files onto the wave table."); 482 480 return 0; 483 481 } -
trunk/src/buzelib/buze.rc
r1317 r1319 835 835 "E", ID_PATTERNEDITOR_SELECT_END, VIRTKEY, SHIFT, CONTROL, 836 836 NOINVERT 837 "U", ID_PATTERNEDITOR_SELECT_UN, VIRTKEY, SHIFT, CONTROL, 838 NOINVERT 837 839 "L", ID_PATTERNEDITOR_SELECT_COLUMNS, VIRTKEY, SHIFT, CONTROL, 838 840 NOINVERT … … 1247 1249 1248 1250 1251 -
trunk/src/buzelib/res/keyboard_patterneditor.txt
r1292 r1319 60 60 Ctrl+L Solo/unsolo current machine 61 61 Ctrl+R Randomize selection 62 Ctrl+T Toggle column editor for number columns 63 Ctrl+U Unselect 62 64 Ctrl+Up Show pattern for next machine 63 65 Ctrl+Down Show pattern for previous machine … … 68 70 Space Paste current parameter value 69 71 Ctrl+Space Paste current group values 70 Ctrl+T Toggle column editor for number columns71 72 (keyboard notes) Edit notes -
trunk/src/buzelib/resource.h
r1318 r1319 407 407 #define ID_ANALYZER_MODE_FIRST 53539 408 408 #define ID_ANALYZER_MODE_LAST 53559 409 409 #define ID_PATTERNEDITOR_SELECT_UN 53560 410 410 // Next default values for new objects 411 411 //
