mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-09 08:14:58 +01:00
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:
parent
59f12bd31a
commit
09dd3fc369
3 changed files with 8 additions and 4 deletions
|
|
@ -1256,9 +1256,11 @@ AlsaAudioBackend::midi_event_put (
|
||||||
assert (buffer && port_buffer);
|
assert (buffer && port_buffer);
|
||||||
AlsaMidiBuffer& dst = * static_cast<AlsaMidiBuffer*>(port_buffer);
|
AlsaMidiBuffer& dst = * static_cast<AlsaMidiBuffer*>(port_buffer);
|
||||||
if (dst.size () && (pframes_t)dst.back ()->timestamp () > timestamp) {
|
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",
|
fprintf (stderr, "AlsaMidiBuffer: it's too late for this event. %d > %d\n",
|
||||||
(pframes_t)dst.back ()->timestamp (), timestamp);
|
(pframes_t)dst.back ()->timestamp (), timestamp);
|
||||||
return -1;
|
#endif
|
||||||
}
|
}
|
||||||
dst.push_back (boost::shared_ptr<AlsaMidiEvent>(new AlsaMidiEvent (timestamp, buffer, size)));
|
dst.push_back (boost::shared_ptr<AlsaMidiEvent>(new AlsaMidiEvent (timestamp, buffer, size)));
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
|
|
@ -1227,9 +1227,11 @@ CoreAudioBackend::midi_event_put (
|
||||||
if (!buffer || !port_buffer) return -1;
|
if (!buffer || !port_buffer) return -1;
|
||||||
CoreMidiBuffer& dst = * static_cast<CoreMidiBuffer*>(port_buffer);
|
CoreMidiBuffer& dst = * static_cast<CoreMidiBuffer*>(port_buffer);
|
||||||
if (dst.size () && (pframes_t)dst.back ()->timestamp () > timestamp) {
|
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);
|
(pframes_t)dst.back ()->timestamp (), timestamp);
|
||||||
return -1;
|
#endif
|
||||||
}
|
}
|
||||||
dst.push_back (boost::shared_ptr<CoreMidiEvent>(new CoreMidiEvent (timestamp, buffer, size)));
|
dst.push_back (boost::shared_ptr<CoreMidiEvent>(new CoreMidiEvent (timestamp, buffer, size)));
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
|
|
@ -981,8 +981,8 @@ DummyAudioBackend::midi_event_put (
|
||||||
assert (buffer && port_buffer);
|
assert (buffer && port_buffer);
|
||||||
DummyMidiBuffer& dst = * static_cast<DummyMidiBuffer*>(port_buffer);
|
DummyMidiBuffer& dst = * static_cast<DummyMidiBuffer*>(port_buffer);
|
||||||
if (dst.size () && (pframes_t)dst.back ()->timestamp () > timestamp) {
|
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");
|
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)));
|
dst.push_back (boost::shared_ptr<DummyMidiEvent>(new DummyMidiEvent (timestamp, buffer, size)));
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue