diff --git a/libs/ardour/ardour/io.h b/libs/ardour/ardour/io.h index 5d4d916832..8ebf4e78a0 100644 --- a/libs/ardour/ardour/io.h +++ b/libs/ardour/ardour/io.h @@ -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 */ diff --git a/libs/ardour/delivery.cc b/libs/ardour/delivery.cc index e94551df50..0586b57a1f 100644 --- a/libs/ardour/delivery.cc +++ b/libs/ardour/delivery.cc @@ -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 diff --git a/libs/ardour/io.cc b/libs/ardour/io.cc index 07682f28e1..720376404e 100644 --- a/libs/ardour/io.cc +++ b/libs/ardour/io.cc @@ -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); } diff --git a/libs/ardour/io_plug.cc b/libs/ardour/io_plug.cc index 14e32b03d4..1fccf87b3a 100644 --- a/libs/ardour/io_plug.cc +++ b/libs/ardour/io_plug.cc @@ -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) { diff --git a/libs/ardour/session_click.cc b/libs/ardour/session_click.cc index 089c3e61b8..9a64916191 100644 --- a/libs/ardour/session_click.cc +++ b/libs/ardour/session_click.cc @@ -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