diff options
author | Robin Gareus <robin@gareus.org> | 2015-03-09 05:41:36 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2015-03-09 05:41:36 +0100 |
commit | 09dd3fc369f0b9c666e5930353ca55def84d9e4e (patch) | |
tree | bfa557f8f591f361704c4d4c72c0de39b77d365d /libs | |
parent | 59f12bd31a3baa0bd81beb77e7f77647b7c37e82 (diff) |
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)
Diffstat (limited to 'libs')
-rw-r--r-- | libs/backends/alsa/alsa_audiobackend.cc | 4 | ||||
-rw-r--r-- | libs/backends/coreaudio/coreaudio_backend.cc | 6 | ||||
-rw-r--r-- | libs/backends/dummy/dummy_audiobackend.cc | 2 |
3 files changed, 8 insertions, 4 deletions
diff --git a/libs/backends/alsa/alsa_audiobackend.cc b/libs/backends/alsa/alsa_audiobackend.cc index a18d58ee58..8befb9219c 100644 --- a/libs/backends/alsa/alsa_audiobackend.cc +++ b/libs/backends/alsa/alsa_audiobackend.cc @@ -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; diff --git a/libs/backends/coreaudio/coreaudio_backend.cc b/libs/backends/coreaudio/coreaudio_backend.cc index 8946aea0a7..50477b6d08 100644 --- a/libs/backends/coreaudio/coreaudio_backend.cc +++ b/libs/backends/coreaudio/coreaudio_backend.cc @@ -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; diff --git a/libs/backends/dummy/dummy_audiobackend.cc b/libs/backends/dummy/dummy_audiobackend.cc index 462f1b9dc3..cf49c7d5e8 100644 --- a/libs/backends/dummy/dummy_audiobackend.cc +++ b/libs/backends/dummy/dummy_audiobackend.cc @@ -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; |