diff --git a/libs/ardour/ardour/audio_port.h b/libs/ardour/ardour/audio_port.h index 01b42d1a21..ce699e0010 100644 --- a/libs/ardour/ardour/audio_port.h +++ b/libs/ardour/ardour/audio_port.h @@ -42,6 +42,8 @@ public: void cycle_end (pframes_t); void cycle_split (); + void flush_buffers (pframes_t nframes); + /* reset SRC, clear out any state */ void reinit (bool with_ratio); diff --git a/libs/ardour/audio_port.cc b/libs/ardour/audio_port.cc index 4cee8150da..19fb11ccb6 100644 --- a/libs/ardour/audio_port.cc +++ b/libs/ardour/audio_port.cc @@ -127,6 +127,22 @@ AudioPort::cycle_split () { } +void +AudioPort::flush_buffers (pframes_t nframes) +{ + if (!sends_output() || !_port_handle || !in_cycle ()) { + return; + } + if (!externally_connected () || !internally_connected ()) { + return; + } + /* port is both internally and externnally connected, make + * data available to internal connections which directly use + * port_engine.get_buffer () without resampling. + */ + copy_vector ((float*)port_engine.get_buffer (_port_handle, nframes), &_data[_global_port_buffer_offset], nframes); +} + void AudioPort::reinit (bool with_ratio) { diff --git a/libs/ardour/io.cc b/libs/ardour/io.cc index 2bacde4300..57f5b55ecd 100644 --- a/libs/ardour/io.cc +++ b/libs/ardour/io.cc @@ -1700,6 +1700,12 @@ IO::copy_to_outputs (BufferSet& bufs, DataType type, pframes_t nframes, samplecn port_buffer.read_from (*prev, nframes, offset); ++o; } + + /* when port is both externally and internally connected, + * make data directly available to downstream internal ports */ + for (auto const& p : _ports) { + p->flush_buffers (nframes); + } } boost::shared_ptr