LuaProc: sort MIDI events

This allows plugins to produce an unsorted list of events.
see also https://discourse.ardour.org/t/lua-arpeggiator-plugin-anyone/108862/64?u=x42
This commit is contained in:
Robin Gareus 2023-06-30 15:47:21 +02:00
parent c5511040ec
commit 71d45286f4
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -887,7 +887,10 @@ LuaProc::connect_and_run (BufferSet& bufs,
}
if (size > 0 && size < 64) {
if (tme >= 1 && tme < nframes + 1) {
mbuf.push_back(tme - 1 + offset, Evoral::MIDI_EVENT, size, data);
Evoral::Event<samplepos_t> ev;
ev.set (data, size, tme - 1 + offset);
ev.set_event_type (Evoral::MIDI_EVENT);
mbuf.insert_event (ev);
} else {
std::cerr << string_compose ("LuaException: MIDI Event timestamp %1 is out of bounds (0, %2)\n", tme, nframes + 1);
}