diff options
author | Robin Gareus <robin@gareus.org> | 2017-09-30 05:25:27 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2017-09-30 05:25:27 +0200 |
commit | 5ada17eba0195d90f0685776251b384efdf5168e (patch) | |
tree | d42cac8f4d4d75bcca02e2fccd25d644f7f453b6 /libs/ardour/midi_port.cc | |
parent | 72fb8a5342f19ccf88ff9e59de36c57e3f172a22 (diff) |
Fix MIDI port offsets.
AudioPort::get_audio_buffer() can offset the buffer simply by offsetting
a pointer. This allows to get an offset buffer for a given port.
For MIDI there's no such concept. A method writing to a MIDI buffer
which is backed by a Port can at best offset it by the global port-buffer
offset (static Port::port_offset), but not by the individual target port's
offset.
Diffstat (limited to 'libs/ardour/midi_port.cc')
-rw-r--r-- | libs/ardour/midi_port.cc | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/libs/ardour/midi_port.cc b/libs/ardour/midi_port.cc index a728ce2a44..4a6cc3a3af 100644 --- a/libs/ardour/midi_port.cc +++ b/libs/ardour/midi_port.cc @@ -272,12 +272,13 @@ MidiPort::flush_buffers (pframes_t nframes) } #endif - assert (ev.time() < (nframes + _global_port_buffer_offset + _port_buffer_offset)); + assert (ev.time() < (nframes + _global_port_buffer_offset)); - if (ev.time() >= _global_port_buffer_offset + _port_buffer_offset) { - if (port_engine.midi_event_put (port_buffer, (pframes_t) ev.time(), ev.buffer(), ev.size()) != 0) { - cerr << "write failed, drop flushed note off on the floor, time " - << ev.time() << " > " << _global_port_buffer_offset + _port_buffer_offset << endl; + if (ev.time() >= _global_port_buffer_offset) { + if (port_engine.midi_event_put (port_buffer, (pframes_t) ev.time() + _port_buffer_offset, ev.buffer(), ev.size()) != 0) { + cerr << "write failed, dropped event, time " + << ev.time() << " + " << _port_buffer_offset + << " > " << _global_port_buffer_offset << endl; } } else { cerr << "drop flushed event on the floor, time " << ev.time() |