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.
This commit is contained in:
Robin Gareus 2020-02-20 01:48:22 +01:00
parent c8f1146124
commit 89bd6cafa0
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -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<DiskReader> (*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<Delivery> (*p)
@ -1822,6 +1834,14 @@ Route::try_configure_processors_unlocked (ChanCount in, ProcessorStreams* err)
return list<pair<ChanCount, ChanCount> > ();
}
}
if (boost::dynamic_pointer_cast<DiskWriter> (*p)) {
assert (in == out);
disk_io = out;
}
/* next processor's in == this processor's out*/
in = out;
} else {
if (err) {