some backends can handle incorrectly ordered midi events.

(that can happen if multiple sources send to the same
ouput port, in particular async midi events)
This commit is contained in:
Robin Gareus 2015-03-09 05:41:36 +01:00
parent 59f12bd31a
commit 09dd3fc369
3 changed files with 8 additions and 4 deletions

View file

@ -1227,9 +1227,11 @@ CoreAudioBackend::midi_event_put (
if (!buffer || !port_buffer) return -1;
CoreMidiBuffer& dst = * static_cast<CoreMidiBuffer*>(port_buffer);
if (dst.size () && (pframes_t)dst.back ()->timestamp () > timestamp) {
fprintf (stderr, "CoreMidiBuffer: it's too late for this event. %d > %d\n",
#ifndef NDEBUG
// nevermind, ::get_buffer() sorts events
fprintf (stderr, "CoreMidiBuffer: unordered event: %d > %d\n",
(pframes_t)dst.back ()->timestamp (), timestamp);
return -1;
#endif
}
dst.push_back (boost::shared_ptr<CoreMidiEvent>(new CoreMidiEvent (timestamp, buffer, size)));
return 0;