summaryrefslogtreecommitdiff
path: root/libs/ardour/delivery.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2016-09-13 13:40:02 -0500
committerPaul Davis <paul@linuxaudiosystems.com>2016-09-13 14:11:29 -0500
commitfbc8504f9eb74d5e96799fa816015b147f689328 (patch)
treed0d8f2786ad182c4c50780bfd7c5f0393445e26b /libs/ardour/delivery.cc
parentab160ca7484971239f4fe0420acb74186887d21d (diff)
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
Diffstat (limited to 'libs/ardour/delivery.cc')
-rw-r--r--libs/ardour/delivery.cc28
1 files changed, 23 insertions, 5 deletions
diff --git a/libs/ardour/delivery.cc b/libs/ardour/delivery.cc
index 9f5051704f..bc49c9be69 100644
--- a/libs/ardour/delivery.cc
+++ b/libs/ardour/delivery.cc
@@ -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: