13
0

Fix duplicate Port flush_buffer calls (#9481)

Since 62fc1d3c2e, Delivery buffers were flushed twice.
Once by copy_to_outputs() and again later by
Delivery::flush_buffers. This resulted in duplicate events
during export (see 576840c09e, MIDI buffers are not cleared
after flush to allow export processing to grab the data from
the port-buffers).

The workaround in 62fc1d3c2e is only relevant for ClickIO,
other Deliveries (Send is a Delivery) are explicitly flushed
by Route::flush_processor_buffers_locked.
This commit is contained in:
Robin Gareus 2023-10-17 05:46:44 +02:00
parent 576840c09e
commit 44a2ef9098
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
5 changed files with 10 additions and 12 deletions

View File

@ -193,6 +193,7 @@ public:
void collect_input (BufferSet& bufs, pframes_t nframes, ChanCount offset);
void copy_to_outputs (BufferSet& bufs, DataType type, pframes_t nframes, samplecnt_t offset);
void flush_buffers (pframes_t nframes);
/* AudioTrack::deprecated_use_diskstream_connections() needs these */

View File

@ -534,16 +534,10 @@ void
Delivery::flush_buffers (samplecnt_t nframes)
{
/* io_lock, not taken: function must be called from Session::process() calltree */
if (!_output) {
if (_output) {
_output->flush_buffers (nframes);
return;
}
PortSet& ports (_output->ports());
for (PortSet::iterator i = ports.begin(); i != ports.end(); ++i) {
i->flush_buffers (nframes);
}
}
void

View File

@ -1688,9 +1688,13 @@ IO::copy_to_outputs (BufferSet& bufs, DataType type, pframes_t nframes, samplecn
port_buffer.read_from (*prev, nframes, offset);
++o;
}
}
void
IO::flush_buffers (pframes_t nframes)
{
/* when port is both externally and internally connected,
* make data directly available to downstream internal ports */
* make data available to downstream internal ports */
for (auto const& p : _ports) {
p->flush_buffers (nframes);
}

View File

@ -495,9 +495,7 @@ IOPlug::connect_and_run (samplepos_t start, pframes_t n_samples)
}
}
}
for (PortSet::iterator i = ports.begin(); i != ports.end(); ++i) {
i->flush_buffers (n_samples);
}
_output->flush_buffers (n_samples);;
const samplecnt_t l = effective_latency ();
if (_plugin_signal_latency != l) {

View File

@ -251,6 +251,7 @@ Session::run_click (samplepos_t start, samplepos_t nframes)
_click_gain->run (bufs, 0, 0, 1.0, nframes, false);
_click_io->copy_to_outputs (bufs, DataType::AUDIO, nframes, 0);
_click_io->flush_buffers (nframes);
}
void