Prevent issues when changing processors while recording #10017
Processor changes trigger configure_io() which resulted in a call to reset_write_sources(), which is a disaster while recording. This allows adding plugins while recording, and prevents adding any plugins before the disk-writer that change the channel-count while recording, or changing strict-i/o to the same effect.
This commit is contained in:
@@ -82,6 +82,7 @@ public:
|
||||
PBD::Signal<void()> AlignmentStyleChanged;
|
||||
|
||||
bool configure_io (ChanCount in, ChanCount out);
|
||||
bool can_support_io_configuration (const ChanCount& in, ChanCount& out);
|
||||
|
||||
std::list<std::shared_ptr<Source>>& last_capture_sources ();
|
||||
void reset_last_capture_sources ();
|
||||
|
||||
@@ -1461,6 +1461,28 @@ DiskWriter::steal_write_source_name ()
|
||||
return std::string();
|
||||
}
|
||||
|
||||
bool
|
||||
DiskWriter::can_support_io_configuration (const ChanCount& in, ChanCount& out)
|
||||
{
|
||||
if (record_enabled() && _session.actively_recording()) {
|
||||
bool changed = false;
|
||||
std::shared_ptr<ChannelList const> c = channels.reader();
|
||||
if (in.n_audio() != c->size()) {
|
||||
changed = true;
|
||||
}
|
||||
if ((0 == in.n_midi ()) != (0 == _midi_buf)) {
|
||||
changed = true;
|
||||
}
|
||||
if (changed) {
|
||||
out.set (DataType::AUDIO, c->size());
|
||||
out.set (DataType::MIDI, (0 == _midi_buf) ? 0 : 1);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return DiskIOProcessor::can_support_io_configuration (in, out);
|
||||
}
|
||||
|
||||
bool
|
||||
DiskWriter::configure_io (ChanCount in, ChanCount out)
|
||||
{
|
||||
@@ -1481,6 +1503,14 @@ DiskWriter::configure_io (ChanCount in, ChanCount out)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (record_enabled() && _session.actively_recording()) {
|
||||
/* Cannot reset write source, while recording.
|
||||
* see also ::can_support_io_configuration() above.
|
||||
*/
|
||||
assert (0);
|
||||
return !changed;
|
||||
}
|
||||
|
||||
if (record_enabled() || changed) {
|
||||
reset_write_sources (false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user