summaryrefslogtreecommitdiff
path: root/libs/ardour/midi_port.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2013-10-21 11:24:31 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2013-10-21 11:24:31 -0400
commit3e4b60872414b26bcc9d7632f91364f5246e1692 (patch)
treebeab6ed330c0eaa2dc497d34844eb197a900caca /libs/ardour/midi_port.cc
parent78e3864c5d065aff26be30cbb2b2cd3651d52ffc (diff)
fix endless messages about MIDI events being dropped.
track-owned MIDI port buffers (at the Ardour level) get ::flush_buffers() called twice, once by Delivery::flush_buffers() which is called at the end of MidiTrack::rol() to push data out in graph order, and then finally as a last-chance effort in PortManager::cycle_end(). This should not cause a repeated attempt to write the same data, but it was. Fixed by marking the buffer empty once its data has been flushed into a backend port buffer.
Diffstat (limited to 'libs/ardour/midi_port.cc')
-rw-r--r--libs/ardour/midi_port.cc16
1 files changed, 15 insertions, 1 deletions
diff --git a/libs/ardour/midi_port.cc b/libs/ardour/midi_port.cc
index de2263fad6..ae168356b6 100644
--- a/libs/ardour/midi_port.cc
+++ b/libs/ardour/midi_port.cc
@@ -174,12 +174,21 @@ MidiPort::flush_buffers (pframes_t nframes)
{
if (sends_output ()) {
- void* port_buffer = port_engine.get_buffer (_port_handle, nframes);
+ void* port_buffer = 0;
if (_resolve_required) {
+ port_buffer = port_engine.get_buffer (_port_handle, nframes);
/* resolve all notes at the start of the buffer */
resolve_notes (port_buffer, 0);
_resolve_required = false;
+ }
+
+ if (_buffer->empty()) {
+ return;
+ }
+
+ if (!port_buffer) {
+ port_buffer = port_engine.get_buffer (_port_handle, nframes);
}
for (MidiBuffer::iterator i = _buffer->begin(); i != _buffer->end(); ++i) {
@@ -201,6 +210,11 @@ MidiPort::flush_buffers (pframes_t nframes)
<< " + " << _port_buffer_offset << endl;
}
}
+
+ /* done.. the data has moved to the port buffer, mark it so
+ */
+
+ _buffer->clear ();
}
}