From 5b113c9c5b510abb3f619a7e82441f9f17379181 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Thu, 12 Mar 2020 02:23:49 +0100 Subject: [PATCH] Fix un/bypassing Aux-send panners This fixes issues with send-panner bypass whenever the target bus input-count is different from the send's channel count. -- Previously, when the aux-send panner was bypassed, data was copied using BufferSet::read_from(). This sets the channel count of the output buffer set (here: mixbufs) to match the input (here: bufs). e.g. mono to stereo, "1 in -> 2 out" out was changed to "1 in -> 1 out". Un-bypassing the panner later does not reconfigure the I/O. Mixbufs remained mono, and PannerShell::run() "1 in -> 1 out" does nothing. The panner was effectively not functional. --- libs/ardour/internal_send.cc | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/libs/ardour/internal_send.cc b/libs/ardour/internal_send.cc index 2dd90d010f..6bc67a0059 100644 --- a/libs/ardour/internal_send.cc +++ b/libs/ardour/internal_send.cc @@ -226,7 +226,21 @@ InternalSend::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sa } else { /* no panner or panner is bypassed */ assert (mixbufs.available () >= bufs.count ()); - mixbufs.read_from (bufs, nframes); + /* BufferSet::read_from() changes the channel-conut, + * so we manually copy bufs -> mixbufs + */ + for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) { + /* iterate over outputs */ + BufferSet::iterator i = bufs.begin (*t); + for (BufferSet::iterator o = mixbufs.begin (*t); o != mixbufs.end (*t); ++o) { + if (i == bufs.end (*t)) { + o->silence (nframes, 0); + } else { + o->read_from (*i, nframes); + ++i; + } + } + } } /* main gain control: * mute & bypass/enable */