From 820f99d484c635ec1d33a6f589f22e88c55c491b Mon Sep 17 00:00:00 2001 From: "Julien \"_FrnchFrgg_\" RIVAUD" Date: Sat, 9 Jul 2016 01:07:16 +0200 Subject: [PATCH] Make Delivery::run more Datatype-agnostic Note that checking the number of output ports is not needed because IO::copy_to_outputs() will stop if there are less ports of the right type than buffers (or even none). --- libs/ardour/delivery.cc | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/libs/ardour/delivery.cc b/libs/ardour/delivery.cc index 565a6740fd..89719e4259 100644 --- a/libs/ardour/delivery.cc +++ b/libs/ardour/delivery.cc @@ -297,22 +297,28 @@ Delivery::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, do _panshell->run (bufs, output_buffers(), start_frame, end_frame, nframes); - // MIDI data will not have been delivered by the panner + // non-audio data will not have been delivered by the panner - if (bufs.count().n_midi() > 0 && ports.count().n_midi () > 0) { - _output->copy_to_outputs (bufs, DataType::MIDI, nframes, ports.port(0)->port_offset()); + 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()); + } } } else { // Do a 1:1 copy of data to output ports - if (bufs.count().n_audio() > 0 && ports.count().n_audio () > 0) { + // 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); } - if (bufs.count().n_midi() > 0 && ports.count().n_midi () > 0) { - _output->copy_to_outputs (bufs, DataType::MIDI, nframes, ports.port(0)->port_offset()); + 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()); + } } }