- /* catch AllNotesOff message and turn off all notes
- */
-
- if (ev.type() == MIDI_CTL_ALL_NOTES_OFF) {
- cerr << "State tracker sees ALL_NOTES_OFF, silenceing " << sizeof (_active_notes) << endl;
- memset (_active_notes, 0, sizeof (_active_notes));
- _on = 0;
- } else {
- track_note_onoffs (ev);
- }
+void
+MidiStateTracker::track (const uint8_t* evbuf)
+{
+ const uint8_t type = evbuf[0] & 0xF0;
+ const uint8_t chan = evbuf[0] & 0x0F;
+ switch (type) {
+ case MIDI_CTL_ALL_NOTES_OFF:
+ reset();
+ break;
+ case MIDI_CMD_NOTE_ON:
+ add(evbuf[1], chan);
+ break;
+ case MIDI_CMD_NOTE_OFF:
+ remove(evbuf[1], chan);
+ break;