#ifndef __ardour_midi_state_tracker_h__
#define __ardour_midi_state_tracker_h__
+#include <glibmm/threads.h>
+
+#include "temporal/beats.h"
#include "ardour/midi_buffer.h"
namespace Evoral {
public:
MidiStateTracker();
- void track (const MidiBuffer::iterator& from, const MidiBuffer::iterator& to);
+ void track (const MidiBuffer::const_iterator& from, const MidiBuffer::const_iterator& to);
+ void track (const uint8_t* evbuf);
void add (uint8_t note, uint8_t chn);
void remove (uint8_t note, uint8_t chn);
- void resolve_notes (MidiBuffer& buffer, framepos_t time);
- void resolve_notes (Evoral::EventSink<framepos_t>& buffer, framepos_t time);
- void resolve_notes (MidiSource& src, Evoral::MusicalTime time);
+ void resolve_notes (MidiBuffer& buffer, samplepos_t time);
+ void resolve_notes (Evoral::EventSink<samplepos_t>& buffer, samplepos_t time);
+ void resolve_notes (MidiSource& src, const Glib::Threads::Mutex::Lock& lock, Temporal::Beats time);
void dump (std::ostream&);
void reset ();
bool empty() const { return _on == 0; }
template<typename Time>
void track (const Evoral::Event<Time>& ev) {
- const uint8_t type = ev.buffer()[0] & 0xF0;
- const uint8_t chan = ev.buffer()[0] & 0x0F;
- switch (type) {
- case MIDI_CTL_ALL_NOTES_OFF:
- reset();
- break;
- case MIDI_CMD_NOTE_ON:
- add(ev.buffer()[1], chan);
- break;
- case MIDI_CMD_NOTE_OFF:
- remove(ev.buffer()[1], chan);
- break;
- }
+ track (ev.buffer());
}
private: