You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// If tracklist changes update Mixer View and ensure sanity of track and bank focus
@@ -229,27 +232,43 @@ class NiMidiSurface: public BaseSurface {
229
232
// SetSurfaceSelected() is less economical because it will be called multiple times (also for unselecting tracks).
230
233
// However, SetSurfaceSelected() is the more robust choice because of: https://forum.cockos.com/showpost.php?p=2138446&postcount=15
231
234
232
-
// Note: SetSurfaceSelected is also called on project tab change
235
+
// Note: SetSurfaceSelected is also called on project tab change or when record arming. However, <selected> will only be true if a track selection has changed.
233
236
this->_metronomeUpdate(); //check if metronome status has changed when switching project tabs
237
+
// Track selection has changed:
234
238
if (selected) {
235
239
int id = CSurf_TrackToID(track, false);
236
240
int numInBank = id % BANK_NUM_TRACKS;
237
241
int oldBankStart = this->_bankStart;
238
242
this->_bankStart = id - numInBank;
239
243
if (this->_bankStart != oldBankStart) {
240
244
// Update everything
241
-
this->_allMixerUpdate();
245
+
this->_allMixerUpdate();// Note: this will also update the g_muteStateBank and g_soloStateBank caches
242
246
}
243
247
else {
244
248
// Update track names
245
249
this->_namesMixerUpdate();
246
250
}
247
251
// Let Keyboard know about changed track selection
this->_sendCc(CMD_TOGGLE_SEL_TRACK_SOLO, solo ? 1 : 0); // ToDo: Button light does not work yet - why? Is an extra track_available required? Or instance? Or SysEx?
339
+
this->_sendSysex(CMD_TOGGLE_SEL_TRACK_SOLO, solo ? 1 : 0, 0);
303
340
}
304
341
if ((id >= this->_bankStart) && (id <= this->_bankEnd)) {
305
342
int numInBank = id % BANK_NUM_TRACKS;
@@ -340,7 +377,6 @@ class NiMidiSurface: public BaseSurface {
340
377
void_onMidiEvent(MIDI_event_t* event) override {
341
378
if (event->midi_message[0] != MIDI_CC) {
342
379
return;
343
-
// ToDo: Analyze other incoming MIDI messages too, like Sysex, MCU etc
344
380
}
345
381
unsignedchar& command = event->midi_message[1];
346
382
unsignedchar& value = event->midi_message[2];
@@ -413,6 +449,7 @@ class NiMidiSurface: public BaseSurface {
413
449
// ToDo: Scrubbing very slow. Rather than just amplifying this value
414
450
// have to evaluate incoming MIDI stream to allow for both fine as well
415
451
// coarse scrubbing
452
+
// Or move to next beat, bar etc
416
453
CSurf_ScrubAmt(convertSignedMidiValue(value));
417
454
break;
418
455
case CMD_TRACK_SELECTED:
@@ -513,7 +550,7 @@ class NiMidiSurface: public BaseSurface {
513
550
}
514
551
// If no tracks are soloed then muted tracks shall show no peaks
515
552
else {
516
-
if (*(bool*)GetSetMediaTrackInfo(track, "B_MUTE", nullptr)) {
553
+
if (g_muteStateBank[numInBank]) {
517
554
peakBank[j] = 1;
518
555
peakBank[j + 1] = 1;
519
556
}
@@ -526,8 +563,8 @@ class NiMidiSurface: public BaseSurface {
526
563
}
527
564
}
528
565
else {
529
-
// Tracks muted by solo show peaks but they appear greyed out. Muted tracks that are NOT soloed shall show no peaks.
530
-
if ((g_soloStateBank[numInBank] == 0) && (*(bool*)GetSetMediaTrackInfo(track, "B_MUTE", nullptr))) {
566
+
//Muted tracks that are NOT soloed shall show no peaks. Tracks muted by solo show peaks but they appear greyed out.
567
+
if ((g_soloStateBank[numInBank] == 0) && (g_muteStateBank[numInBank])) {
531
568
peakBank[j] = 1;
532
569
peakBank[j + 1] = 1;
533
570
}
@@ -553,6 +590,7 @@ class NiMidiSurface: public BaseSurface {
553
590
this->_bankEnd = this->_bankStart + BANK_NUM_TRACKS - 1; // avoid ambiguity: track counting always zero based
554
591
int numTracks = CSurf_NumTracks(false);
555
592
// Set bank select button lights
593
+
// ToDo: Consider optimizing this piece of code
556
594
int bankLights = 3; // left and right on
557
595
if (numTracks < BANK_NUM_TRACKS) {
558
596
bankLights = 0; // left and right off
@@ -613,6 +651,7 @@ class NiMidiSurface: public BaseSurface {
613
651
int selected = *(int*)GetSetMediaTrackInfo(track, "I_SELECTED", nullptr);
0 commit comments