25 #include "ardour/debug.h"
30 template <
typename T>
class EventSink;
31 template <
typename T>
class EventList;
47 virtual void track (
const uint8_t* evbuf);
48 virtual void dump (std::ostream&)
const;
58 template<
typename Time>
63 bool empty()
const {
return _on == 0; }
64 uint16_t
on()
const {
return _on; }
65 bool active (uint8_t note, uint8_t channel)
const {
66 return _active_notes[(channel*128)+note] > 0;
69 template<
typename Time>
74 void add (uint8_t note, uint8_t chn, uint8_t velocity);
75 void remove (uint8_t note, uint8_t chn);
78 uint8_t _active_notes[128*16];
79 uint8_t _active_velocities[128*16];
82 template<
typename Time>
90 for (
int channel = 0; channel < 16; ++channel) {
91 const int coff = channel << 7;
92 for (
int note = 0; note < 128; ++note) {
93 uint8_t cnt = _active_notes[note + coff];
94 uint8_t vel = _active_velocities[note + coff];
96 uint8_t buffer[3] = { ((uint8_t) (cmd | channel)), uint8_t (note), vel};
105 _active_notes [note + coff] = 0;
106 _active_velocities [note + coff] = 0;
123 void dump (std::ostream&)
const;
133 uint16_t pressure[16];
134 uint8_t control[16][127];
void track(const Evoral::Event< Time > &ev)
void resolve_notes(MidiSource &src, const Source::WriterLock &lock, Temporal::Beats time)
void track(const MidiBuffer::const_iterator &from, const MidiBuffer::const_iterator &to)
virtual void dump(std::ostream &) const
bool active(uint8_t note, uint8_t channel) const
void resolve_notes(MidiBuffer &buffer, samplepos_t time, bool reset=true)
void flush_notes(Evoral::EventSink< Time > &sink, Time time, bool reset=true)
virtual ~MidiNoteTracker()
void flush_notes(MidiBuffer &buffer, samplepos_t time, bool reset=true)
void add(uint8_t note, uint8_t chn, uint8_t velocity)
void push_notes(Evoral::EventSink< Time > &dst, Time time, bool reset, int cmd)
void resolve_notes(Evoral::EventSink< samplepos_t > &buffer, samplepos_t time)
void remove(uint8_t note, uint8_t chn)
virtual void track(const uint8_t *evbuf)
void resolve_state(Evoral::EventSink< samplepos_t > &, Evoral::EventList< samplepos_t > const &, samplepos_t time, bool reset=true)
void track(const uint8_t *evbuf)
void resolve_diff(MidiStateTracker const &other, Evoral::EventSink< samplepos_t > &, samplepos_t time, bool reset=true)
void dump(std::ostream &) const
void flush(MidiBuffer &, samplepos_t, bool reset)
virtual uint32_t write(Time time, EventType type, uint32_t size, const uint8_t *buf)=0
const uint8_t * buffer() const
std::string string_compose(const std::string &fmt, const T1 &o1)
#define DEBUG_TRACE(bits, str)
Temporal::samplepos_t samplepos_t