Delivery::run() now offsets data delivered to MIDI ports by the global port offset

if the output is then re-used, MIDI data is readjusted to not use the global port offset
This commit is contained in:
Paul Davis 2016-09-13 13:40:02 -05:00
parent ab160ca748
commit fbc8504f9e

View File

@ -307,23 +307,41 @@ Delivery::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, do
} else {
// Do a 1:1 copy of data to output ports
/* Do a 1:1 copy of data to output ports
Audio is handled separately because we use 0 for the offset,
since the port offset is only used for timestamped events
(i.e. MIDI).
*/
// audio is handled separately because we use 0 for the offset
// XXX how does this interact with Port::increment_global_port_buffer_offset ?
if (bufs.count().n_audio() > 0) {
_output->copy_to_outputs (bufs, DataType::AUDIO, nframes, 0);
}
for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) {
if (*t != DataType::AUDIO && bufs.count().get(*t) > 0) {
_output->copy_to_outputs (bufs, *t, nframes, ports.port(0)->port_offset());
_output->copy_to_outputs (bufs, *t, nframes, Port::port_offset());
}
}
}
if (result_required) {
bufs.read_from (output_buffers (), nframes);
/* "bufs" are internal, meaning they should never reflect
split-cycle offsets. So shift events back in time from where
they were for the external buffers associated with Ports.
*/
BufferSet& outs (output_buffers());
for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) {
uint32_t n = 0;
for (BufferSet::iterator b = bufs.begin (*t); b != bufs.end (*t); ++b) {
b->read_from (outs.get (*t, n++), nframes, (*t == DataType::AUDIO ? 0 : -Port::port_offset()));
}
}
}
out: