*/
#include <iostream>
-#include <ardour/event_type_map.h>
-#include <ardour/midi_state_tracker.h>
+#include "ardour/event_type_map.h"
+#include "ardour/midi_state_tracker.h"
using namespace std;
using namespace ARDOUR;
}
void
-MidiStateTracker::track_note_onoffs (const Evoral::MIDIEvent &event)
+MidiStateTracker::reset ()
+{
+ _active_notes.reset ();
+}
+
+void
+MidiStateTracker::track_note_onoffs (const Evoral::MIDIEvent<MidiBuffer::TimeType>& event)
{
if (event.is_note_on()) {
_active_notes [event.note() + 128 * event.channel()] = true;
bool ret = false;
for (MidiBuffer::iterator i = from; i != to; ++i) {
- const Evoral::MIDIEvent ev(*i, false);
+ const Evoral::MIDIEvent<MidiBuffer::TimeType> ev(*i, false);
if (ev.event_type() == LoopEventType) {
ret = true;
continue;
for (int note = 0; note < 128; ++note) {
if (_active_notes[channel * 128 + note]) {
uint8_t buffer[3] = { MIDI_CMD_NOTE_OFF | channel, note, 0 };
- Evoral::MIDIEvent noteoff (time, MIDI_CMD_NOTE_OFF, 3, buffer, false);
+ Evoral::MIDIEvent<MidiBuffer::TimeType> noteoff
+ (time, MIDI_CMD_NOTE_OFF, 3, buffer, false);
dst.push_back (noteoff);
}
}
+void
+MidiStateTracker::dump (ostream& o)
+{
+ o << "******\n";
+ for (int c = 0; c < 16; ++c) {
+ for (int x = 0; x < 128; ++x) {
+ if (_active_notes[c * 128 + x]) {
+ o << "Channel " << c+1 << " Note " << x << " is on\n";
+ }
+ }
+ }
+ o << "+++++\n";
+}