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

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

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;

View file

@ -981,8 +981,8 @@ DummyAudioBackend::midi_event_put (
assert (buffer && port_buffer);
DummyMidiBuffer& dst = * static_cast<DummyMidiBuffer*>(port_buffer);
if (dst.size () && (pframes_t)dst.back ()->timestamp () > timestamp) {
// nevermind, ::get_buffer() sorts events, but always print warning
fprintf (stderr, "DummyMidiBuffer: it's too late for this event.\n");
return -1;
}
dst.push_back (boost::shared_ptr<DummyMidiEvent>(new DummyMidiEvent (timestamp, buffer, size)));
return 0;