23 #include <glibmm/threads.h>
27 #include "ardour/debug.h"
32 template <
typename T>
class EventSink;
33 template <
typename T>
class EventList;
49 virtual void track (
const uint8_t* evbuf);
50 virtual void dump (std::ostream&)
const;
54 void add (uint8_t note, uint8_t chn);
55 void remove (uint8_t note, uint8_t chn);
62 template<
typename Time>
67 bool empty()
const {
return _on == 0; }
68 uint16_t
on()
const {
return _on; }
69 bool active (uint8_t note, uint8_t channel)
const {
70 return _active_notes[(channel*128)+note] > 0;
73 template<
typename Time>
79 uint8_t _active_notes[128*16];
84 template<
typename Time>
92 for (
int channel = 0; channel < 16; ++channel) {
93 const int coff = channel << 7;
94 for (
int note = 0; note < 128; ++note) {
95 uint8_t cnt = _active_notes[note + coff];
97 uint8_t buffer[3] = { ((uint8_t) (cmd | channel)), uint8_t (note), (uint8_t) velocity };
106 _active_notes [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 push_notes(MidiBuffer &dst, samplepos_t time, bool reset, int cmd, int velocity)
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 push_notes(Evoral::EventSink< Time > &dst, Time time, bool reset, int cmd, int velocity)
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 add(uint8_t note, uint8_t chn)
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)
Glib::Threads::RWLock::WriterLock WriterLock
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