Event API consistency; reorder arguments (time, type, payload)
This commit is contained in:
parent
c5d7ed3015
commit
f9cdf533ba
@ -234,9 +234,9 @@ Amp::apply_gain (BufferSet& bufs, samplecnt_t sample_rate, samplecnt_t nframes,
|
||||
if (initial > GAIN_COEFF_SMALL && rv <= GAIN_COEFF_SMALL) {
|
||||
for (uint8_t channel = 0; channel <= 0xF; channel++) {
|
||||
uint8_t ev[3] = { ((uint8_t) (MIDI_CMD_CONTROL | channel)), ((uint8_t) MIDI_CTL_SUSTAIN), 0 };
|
||||
mb.push_back (nframes - 1, 3, ev);
|
||||
mb.push_back (nframes - 1, Evoral::MIDI_EVENT, 3, ev);
|
||||
ev[1] = MIDI_CTL_ALL_NOTES_OFF;
|
||||
mb.push_back (nframes - 1, 3, ev);
|
||||
mb.push_back (nframes - 1, Evoral::MIDI_EVENT, 3, ev);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ public:
|
||||
void skip_to (TimeType when);
|
||||
|
||||
bool push_back(const Evoral::Event<TimeType>& event);
|
||||
bool push_back(TimeType time, size_t size, const uint8_t* data, Evoral::EventType event_type = Evoral::MIDI_EVENT);
|
||||
bool push_back(TimeType time, Evoral::EventType event_type, size_t size, const uint8_t* data);
|
||||
|
||||
uint8_t* reserve(TimeType time, Evoral::EventType event_type, size_t size);
|
||||
|
||||
|
@ -83,7 +83,7 @@ AsyncMIDIPort::flush_output_fifo (MIDI::pframes_t nframes)
|
||||
assert (evp->buffer());
|
||||
|
||||
for (size_t n = 0; n < vec.len[0]; ++n, ++evp) {
|
||||
if (mb.push_back (evp->time(), evp->size(), evp->buffer(), evp->event_type ())) {
|
||||
if (mb.push_back (evp->time(), evp->event_type (), evp->size(), evp->buffer())) {
|
||||
written++;
|
||||
}
|
||||
}
|
||||
@ -96,7 +96,7 @@ AsyncMIDIPort::flush_output_fifo (MIDI::pframes_t nframes)
|
||||
assert (evp->buffer());
|
||||
|
||||
for (size_t n = 0; n < vec.len[1]; ++n, ++evp) {
|
||||
if (mb.push_back (evp->time(), evp->size(), evp->buffer(), evp->event_type ())) {
|
||||
if (mb.push_back (evp->time(), evp->event_type (), evp->size(), evp->buffer())) {
|
||||
written++;
|
||||
}
|
||||
}
|
||||
@ -297,7 +297,7 @@ AsyncMIDIPort::write (const MIDI::byte * msg, size_t msglen, MIDI::timestamp_t t
|
||||
timestamp = _last_write_timestamp;
|
||||
}
|
||||
|
||||
if (mb.push_back (timestamp, msglen, msg)) {
|
||||
if (mb.push_back (timestamp, Evoral::MIDI_EVENT, msglen, msg)) {
|
||||
ret = msglen;
|
||||
_last_write_timestamp = timestamp;
|
||||
|
||||
|
@ -254,11 +254,11 @@ Auditioner::roll (pframes_t nframes, samplepos_t start_sample, samplepos_t end_s
|
||||
_queue_panic = false;
|
||||
for (uint8_t chn = 0; chn < 0xf; ++chn) {
|
||||
uint8_t buf[3] = { ((uint8_t) (MIDI_CMD_CONTROL | chn)), ((uint8_t) MIDI_CTL_SUSTAIN), 0 };
|
||||
mbuf.push_back(0, 3, buf);
|
||||
mbuf.push_back(0, Evoral::MIDI_EVENT, 3, buf);
|
||||
buf[1] = MIDI_CTL_ALL_NOTES_OFF;
|
||||
mbuf.push_back(0, 3, buf);
|
||||
mbuf.push_back(0, Evoral::MIDI_EVENT, 3, buf);
|
||||
buf[1] = MIDI_CTL_RESET_CONTROLLERS;
|
||||
mbuf.push_back(0, 3, buf);
|
||||
mbuf.push_back(0, Evoral::MIDI_EVENT, 3, buf);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -301,7 +301,7 @@ BufferSet::forward_lv2_midi(LV2_Evbuf* buf, size_t i, bool purge_ardour_buffer)
|
||||
uint8_t* data;
|
||||
lv2_evbuf_get(i, &samples, &subframes, &type, &size, &data);
|
||||
if (type == URIMap::instance().urids.midi_MidiEvent) {
|
||||
mbuf.push_back(samples, size, data);
|
||||
mbuf.push_back(samples, Evoral::MIDI_EVENT, size, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -331,7 +331,7 @@ BufferSet::flush_lv2_midi(bool input, size_t i)
|
||||
#endif
|
||||
if (type == URIMap::instance().urids.midi_MidiEvent) {
|
||||
// TODO: Make Ardour event buffers generic so plugins can communicate
|
||||
mbuf.push_back(samples, size, data);
|
||||
mbuf.push_back(samples, Evoral::MIDI_EVENT, size, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -615,7 +615,7 @@ DiskWriter::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_samp
|
||||
/* This may fail if buf is larger than _gui_feed_buffer, but it's not really
|
||||
the end of the world if it does.
|
||||
*/
|
||||
_gui_feed_buffer.push_back ((*i).time() + start_sample, (*i).size(), (*i).buffer());
|
||||
_gui_feed_buffer.push_back ((*i).time() + start_sample, Evoral::MIDI_EVENT, (*i).size(), (*i).buffer());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2731,7 +2731,7 @@ LuaBindings::dsp (lua_State* L)
|
||||
.addFunction ("resize", &MidiBuffer::resize)
|
||||
.addFunction ("copy", (void (MidiBuffer::*)(MidiBuffer const * const))&MidiBuffer::copy)
|
||||
.addFunction ("push_event", (bool (MidiBuffer::*)(const Evoral::Event<samplepos_t>&))&MidiBuffer::push_back)
|
||||
.addFunction ("push_back", (bool (MidiBuffer::*)(samplepos_t, size_t, const uint8_t*, Evoral::EventType))&MidiBuffer::push_back)
|
||||
.addFunction ("push_back", (bool (MidiBuffer::*)(samplepos_t, Evoral::EventType, size_t, const uint8_t*))&MidiBuffer::push_back)
|
||||
// TODO iterators..
|
||||
.addExtCFunction ("table", &luabridge::CFunc::listToTable<const Evoral::Event<samplepos_t>, MidiBuffer>)
|
||||
.endClass()
|
||||
|
@ -776,7 +776,7 @@ LuaProc::connect_and_run (BufferSet& bufs,
|
||||
data[size] = di.value ();
|
||||
}
|
||||
if (size > 0 && size < 64) {
|
||||
mbuf.push_back(tme - 1, size, data);
|
||||
mbuf.push_back(tme - 1, Evoral::MIDI_EVENT, size, data);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -115,7 +115,7 @@ MidiBuffer::read_from (const Buffer& src, samplecnt_t nframes, sampleoffset_t ds
|
||||
const Evoral::Event<TimeType> ev(*i, false);
|
||||
|
||||
if (ev.time() >= 0 && ev.time() < nframes) {
|
||||
push_back (ev.time(), ev.size(), ev.buffer(), ev.event_type ());
|
||||
push_back (ev.time(), ev.event_type (), ev.size(), ev.buffer());
|
||||
} else {
|
||||
cerr << "\t!!!! MIDI event @ " << ev.time() << " skipped, not within range 0 .. " << nframes << endl;
|
||||
PBD::stacktrace (cerr, 30);
|
||||
@ -146,7 +146,7 @@ MidiBuffer::merge_from (const Buffer& src, samplecnt_t /*nframes*/, sampleoffset
|
||||
bool
|
||||
MidiBuffer::push_back(const Evoral::Event<TimeType>& ev)
|
||||
{
|
||||
return push_back (ev.time(), ev.size(), ev.buffer(), ev.event_type ());
|
||||
return push_back (ev.time(), ev.event_type (), ev.size(), ev.buffer());
|
||||
}
|
||||
|
||||
|
||||
@ -158,7 +158,7 @@ MidiBuffer::push_back(const Evoral::Event<TimeType>& ev)
|
||||
* @return false if operation failed (not enough room)
|
||||
*/
|
||||
bool
|
||||
MidiBuffer::push_back(TimeType time, size_t size, const uint8_t* data, Evoral::EventType event_type)
|
||||
MidiBuffer::push_back(TimeType time, Evoral::EventType event_type, size_t size, const uint8_t* data)
|
||||
{
|
||||
const size_t stamp_size = sizeof(TimeType);
|
||||
const size_t etype_size = sizeof(Evoral::EventType);
|
||||
|
@ -163,9 +163,9 @@ MidiPort::get_midi_buffer (pframes_t nframes)
|
||||
ev[0] = 0x80 | (buf[0] & 0x0F); /* note off */
|
||||
ev[1] = buf[1];
|
||||
ev[2] = 0x40; /* default velocity */
|
||||
_buffer->push_back (timestamp, size, ev);
|
||||
_buffer->push_back (timestamp, Evoral::MIDI_EVENT, size, ev);
|
||||
} else {
|
||||
_buffer->push_back (timestamp, size, buf);
|
||||
_buffer->push_back (timestamp, Evoral::MIDI_EVENT, size, buf);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -106,17 +106,17 @@ MIDISceneChanger::rt_deliver (MidiBuffer& mbuf, samplepos_t when, boost::shared_
|
||||
MIDIOutputActivity (); /* EMIT SIGNAL */
|
||||
|
||||
if ((cnt = msc->get_bank_msb_message (buf, sizeof (buf))) > 0) {
|
||||
mbuf.push_back (when, cnt, buf);
|
||||
mbuf.push_back (when, Evoral::MIDI_EVENT, cnt, buf);
|
||||
|
||||
if ((cnt = msc->get_bank_lsb_message (buf, sizeof (buf))) > 0) {
|
||||
mbuf.push_back (when, cnt, buf);
|
||||
mbuf.push_back (when, Evoral::MIDI_EVENT, cnt, buf);
|
||||
}
|
||||
|
||||
last_delivered_bank = msc->bank();
|
||||
}
|
||||
|
||||
if ((cnt = msc->get_program_message (buf, sizeof (buf))) > 0) {
|
||||
mbuf.push_back (when, cnt, buf);
|
||||
mbuf.push_back (when, Evoral::MIDI_EVENT, cnt, buf);
|
||||
|
||||
last_delivered_program = msc->program();
|
||||
}
|
||||
|
@ -337,7 +337,7 @@ RTMidiBuffer::read (MidiBuffer& dst, samplepos_t start, samplepos_t end, MidiSta
|
||||
|
||||
}
|
||||
|
||||
if (!dst.push_back (evtime, size, addr)) {
|
||||
if (!dst.push_back (evtime, Evoral::MIDI_EVENT, size, addr)) {
|
||||
DEBUG_TRACE (DEBUG::MidiRingBuffer, string_compose ("MidiRingBuffer: overflow in destination MIDI buffer, stopped after %1 events, dst size = %2\n", count, dst.size()));
|
||||
break;
|
||||
}
|
||||
|
@ -467,7 +467,7 @@ Session::send_full_time_code (samplepos_t const t, MIDI::pframes_t nframes)
|
||||
// Send message at offset 0, sent time is for the start of this cycle
|
||||
|
||||
MidiBuffer& mb (_midi_ports->mtc_output_port()->get_midi_buffer (nframes));
|
||||
mb.push_back (0, sizeof (msg), msg);
|
||||
mb.push_back (0, Evoral::MIDI_EVENT, sizeof (msg), msg);
|
||||
|
||||
_pframes_since_last_mtc = 0;
|
||||
return 0;
|
||||
@ -569,7 +569,7 @@ Session::send_midi_time_code_for_cycle (samplepos_t start_sample, samplepos_t en
|
||||
assert (out_stamp < nframes);
|
||||
|
||||
MidiBuffer& mb (_midi_ports->mtc_output_port()->get_midi_buffer(nframes));
|
||||
if (!mb.push_back (out_stamp, 2, mtc_msg)) {
|
||||
if (!mb.push_back (out_stamp, Evoral::MIDI_EVENT, 2, mtc_msg)) {
|
||||
error << string_compose(_("Session: cannot send quarter-frame MTC message (%1)"), strerror (errno))
|
||||
<< endmsg;
|
||||
return -1;
|
||||
|
@ -298,7 +298,7 @@ intptr_t Session::vst_callback (
|
||||
for (int n = 0 ; n < v->numEvents; ++n) {
|
||||
VstMidiEvent *vme = (VstMidiEvent*) (v->events[n]->dump);
|
||||
if (vme->type == kVstMidiType) {
|
||||
plug->midi_buffer()->push_back(vme->deltaSamples, 3, (uint8_t*)vme->midiData);
|
||||
plug->midi_buffer()->push_back(vme->deltaSamples, Evoral::MIDI_EVENT, 3, (uint8_t*)vme->midiData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -228,7 +228,7 @@ MidiClockTicker::send_midi_clock_event (pframes_t offset, pframes_t nframes)
|
||||
static uint8_t msg = MIDI_CMD_COMMON_CLOCK;
|
||||
|
||||
MidiBuffer& mb (_midi_port->get_midi_buffer (nframes));
|
||||
mb.push_back (offset, 1, &msg);
|
||||
mb.push_back (offset, Evoral::MIDI_EVENT, 1, &msg);
|
||||
|
||||
DEBUG_TRACE (DEBUG::MidiClock, string_compose ("Tick with offset %1\n", offset));
|
||||
}
|
||||
@ -240,7 +240,7 @@ MidiClockTicker::send_start_event (pframes_t offset, pframes_t nframes)
|
||||
|
||||
static uint8_t msg = { MIDI_CMD_COMMON_START };
|
||||
MidiBuffer& mb (_midi_port->get_midi_buffer (nframes));
|
||||
mb.push_back (offset, 1, &msg);
|
||||
mb.push_back (offset, Evoral::MIDI_EVENT, 1, &msg);
|
||||
|
||||
DEBUG_TRACE (DEBUG::MidiClock, string_compose ("Start %1\n", _next_tick));
|
||||
}
|
||||
@ -252,7 +252,7 @@ MidiClockTicker::send_continue_event (pframes_t offset, pframes_t nframes)
|
||||
|
||||
static uint8_t msg = { MIDI_CMD_COMMON_CONTINUE };
|
||||
MidiBuffer& mb (_midi_port->get_midi_buffer (nframes));
|
||||
mb.push_back (offset, 1, &msg);
|
||||
mb.push_back (offset, Evoral::MIDI_EVENT, 1, &msg);
|
||||
|
||||
DEBUG_TRACE (DEBUG::MidiClock, string_compose ("Continue %1\n", _next_tick));
|
||||
}
|
||||
@ -264,7 +264,7 @@ MidiClockTicker::send_stop_event (pframes_t offset, pframes_t nframes)
|
||||
|
||||
static uint8_t msg = MIDI_CMD_COMMON_STOP;
|
||||
MidiBuffer& mb (_midi_port->get_midi_buffer (nframes));
|
||||
mb.push_back (offset, 1, &msg);
|
||||
mb.push_back (offset, Evoral::MIDI_EVENT, 1, &msg);
|
||||
|
||||
DEBUG_TRACE (DEBUG::MidiClock, string_compose ("Stop %1\n", _next_tick));
|
||||
}
|
||||
@ -286,7 +286,7 @@ MidiClockTicker::send_position_event (uint32_t midi_beats, pframes_t offset, pfr
|
||||
msg[2] = midi_beats >> 7;
|
||||
|
||||
MidiBuffer& mb (_midi_port->get_midi_buffer (nframes));
|
||||
mb.push_back (offset, 3, &msg[0]);
|
||||
mb.push_back (offset, Evoral::MIDI_EVENT, 3, &msg[0]);
|
||||
|
||||
DEBUG_TRACE (DEBUG::MidiClock, string_compose ("Song Position Sent: %1 to %2 (events now %3, buf = %4)\n", midi_beats, _midi_port->name (), mb.size (), &mb));
|
||||
}
|
||||
|
@ -374,25 +374,25 @@ VST3PI::vst3_to_midi_buffers (BufferSet& bufs, ChanMapping const& out_map)
|
||||
switch (e.type) {
|
||||
case Vst::Event::kDataEvent:
|
||||
/* sysex */
|
||||
mb.push_back (e.sampleOffset, e.data.size, (uint8_t const*)e.data.bytes);
|
||||
mb.push_back (e.sampleOffset, Evoral::MIDI_EVENT, e.data.size, (uint8_t const*)e.data.bytes);
|
||||
break;
|
||||
case Vst::Event::kNoteOffEvent:
|
||||
data[0] = 0x80 | e.noteOff.channel;
|
||||
data[1] = e.noteOff.pitch;
|
||||
data[2] = vst_to_midi (e.noteOff.velocity);
|
||||
mb.push_back (e.sampleOffset, 3, data);
|
||||
mb.push_back (e.sampleOffset, Evoral::MIDI_EVENT, 3, data);
|
||||
break;
|
||||
case Vst::Event::kNoteOnEvent:
|
||||
data[0] = 0x90 | e.noteOn.channel;
|
||||
data[1] = e.noteOn.pitch;
|
||||
data[2] = vst_to_midi (e.noteOn.velocity);
|
||||
mb.push_back (e.sampleOffset, 3, data);
|
||||
mb.push_back (e.sampleOffset, Evoral::MIDI_EVENT, 3, data);
|
||||
break;
|
||||
case Vst::Event::kPolyPressureEvent:
|
||||
data[0] = 0xa0 | e.noteOff.channel;
|
||||
data[1] = e.polyPressure.pitch;
|
||||
data[2] = vst_to_midi (e.polyPressure.pressure);
|
||||
mb.push_back (e.sampleOffset, 3, data);
|
||||
mb.push_back (e.sampleOffset, Evoral::MIDI_EVENT, 3, data);
|
||||
break;
|
||||
case Vst::Event::kLegacyMIDICCOutEvent:
|
||||
switch (e.midiCCOut.controlNumber) {
|
||||
@ -422,7 +422,7 @@ VST3PI::vst3_to_midi_buffers (BufferSet& bufs, ChanMapping const& out_map)
|
||||
data[2] = e.midiCCOut.value2;
|
||||
break;
|
||||
}
|
||||
mb.push_back (e.sampleOffset, e.midiCCOut.controlNumber == Vst::kCtrlProgramChange ? 2 : 3, data);
|
||||
mb.push_back (e.sampleOffset, Evoral::MIDI_EVENT, e.midiCCOut.controlNumber == Vst::kCtrlProgramChange ? 2 : 3, data);
|
||||
break;
|
||||
|
||||
case Vst::Event::kNoteExpressionValueEvent:
|
||||
|
Loading…
Reference in New Issue
Block a user