+void
+MidiStateTracker::add (uint8_t note, uint8_t chn)
+{
+ if (_active_notes[note+128 * chn] == 0) {
+ ++_on;
+ }
+ ++_active_notes[note + 128 * chn];
+
+ if (_active_notes[note+128 * chn] > 1) {
+ cerr << this << " note " << (int) note << '/' << (int) chn << " was already on, now at " << (int) _active_notes[note+128*chn] << endl;
+ }
+
+ DEBUG_TRACE (PBD::DEBUG::MidiTrackers, string_compose ("%1 ON %2/%3 voices %5 total on %4\n",
+ this, (int) note, (int) chn, _on,
+ (int) _active_notes[note+128 * chn]));
+}
+
+void
+MidiStateTracker::remove (uint8_t note, uint8_t chn)
+{
+ switch (_active_notes[note + 128 * chn]) {
+ case 0:
+ break;
+ case 1:
+ --_on;
+ _active_notes [note + 128 * chn] = 0;
+ break;
+ default:
+ --_active_notes [note + 128 * chn];
+ break;
+
+ }
+ DEBUG_TRACE (PBD::DEBUG::MidiTrackers, string_compose ("%1 OFF %2/%3 current voices = %5 total on %4\n",
+ this, (int) note, (int) chn, _on,
+ (int) _active_notes[note+128 * chn]));
+}
+
+void