From 89bd6cafa01f5062adcace2913f926d147d05720 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Thu, 20 Feb 2020 01:48:22 +0100 Subject: [PATCH] Force Disk-Reader channel count to match Disk-Writer I/O. This handles some special cases where a plugin is added after the disk-writer but before the disk-reader. The plugin may add/remove ports (e.g. an instrument: MIDI to audio, or some stereo to mono processors). However we need to ensure that any data that is recorded will be played back. This is a new take replacing b2bc934e2. --- libs/ardour/route.cc | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index 245c598a07..a2e1a4fbf0 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -464,6 +464,11 @@ Route::process_output_buffers (BufferSet& bufs, bool re_inject_oob_data = false; if ((*i) == _disk_reader) { + /* ignore port-count from prior plugins, use DR's count. + * see also Route::try_configure_processors_unlocked + */ + bufs.set_count ((*i)->output_streams()); + /* Well now, we've made it past the disk-writer and to the disk-reader. * Time to decide what to do about monitoring. * @@ -1751,8 +1756,15 @@ Route::try_configure_processors_unlocked (ChanCount in, ProcessorStreams* err) DEBUG_TRACE (DEBUG::Processors, string_compose ("%1: configure processors\n", _name)); DEBUG_TRACE (DEBUG::Processors, "{\n"); + ChanCount disk_io = in; + for (ProcessorList::iterator p = _processors.begin(); p != _processors.end(); ++p, ++index) { + if (boost::dynamic_pointer_cast (*p)) { + /* disk-reader has the same i/o as disk-writer */ + in = max (in, disk_io); + } + if ((*p)->can_support_io_configuration(in, out)) { if (boost::dynamic_pointer_cast (*p) @@ -1822,6 +1834,14 @@ Route::try_configure_processors_unlocked (ChanCount in, ProcessorStreams* err) return list > (); } } + + if (boost::dynamic_pointer_cast (*p)) { + assert (in == out); + disk_io = out; + } + + + /* next processor's in == this processor's out*/ in = out; } else { if (err) {