瀏覽代碼

distinguish beats with on only from those with off-on via their colour

Fabian Peter Hammerle 10 年之前
父節點
當前提交
0aefc3eda7
共有 2 個文件被更改,包括 9 次插入16 次删除
  1. 5 12
      PlaybackScreen.cpp
  2. 4 4
      colors.h

+ 5 - 12
PlaybackScreen.cpp

@@ -250,7 +250,11 @@ midi::LaunchpadColor PlaybackScreen::getBeatColor(std::shared_ptr<midi::NoteOnMe
         bool isNextBeat = (sequencer.player.getNextBeat() == beatIndex);
         if(*onIndex_it == beatIndex) {
             // on msg on current beat
-            return isNextBeat ? colors::activeOnBeat : colors::inactiveOnBeat;
+            if(noteInfo.offBeatIndices.find(*onIndex_it) != noteInfo.offBeatIndices.end()) {
+                return isNextBeat ? colors::activeOffOnBeat : colors::inactiveOffOnBeat;
+            } else {
+                return isNextBeat ? colors::activeOnBeat : colors::inactiveOnBeat;
+            }
         } else {
             // continuing msg from previous beat ?
             BeatIndexMultiset::const_iterator offIndex_it 
@@ -261,17 +265,6 @@ midi::LaunchpadColor PlaybackScreen::getBeatColor(std::shared_ptr<midi::NoteOnMe
             }
         }
     }
-
-    const midi::MessageList& beat = sequencer.beats[beatIndex];
-    if(beat.contains(*onMsg_ptr)) {
-        if(sequencer.player.getNextBeat() == beatIndex) {
-            return colors::activeMessage;
-        } else {
-            return colors::inactiveMessage;
-        }
-    } else {
-        return colors::dark;
-    }
 }
     
 bool PlaybackScreen::beatsInSequence(BeatIndex a, BeatIndex b, BeatIndex c) 

+ 4 - 4
colors.h

@@ -11,10 +11,10 @@ Color dark(0, 0);
 Color activeOption(3, 3);
 Color inactiveOption(1, 2);
 
-Color inactiveMessage(1, 2);
-Color activeMessage(3, 2);
-Color inactiveOnBeat(2, 0);
-Color activeOnBeat(3, 1);
+Color inactiveOnBeat(0, 2);
+Color activeOnBeat(2, 3);
+Color inactiveOffOnBeat(2, 0);
+Color activeOffOnBeat(3, 2);
 Color inactiveContinuingBeat(1, 1);
 Color activeContinuingBeat(2, 2);