mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-11 00:56:33 +01:00
Flush audio-buffers for internal connections
Forward data for ports that are both internally and externally connected. e.g. click-io may be connected to a track as well as physical outputs. Since the port is externally connected, data is written to an internal buffer _data[], and only at cycle-end resampled to engine-buffers. However a track's recording the metronome is not externally connected. Hence data is directly read from the engine-buffers. Summing also happens at engine level, so data has to be written back for downstream ports to read them in the same cycle.
This commit is contained in:
parent
77bb262c26
commit
62fc1d3c2e
3 changed files with 24 additions and 0 deletions
|
|
@ -42,6 +42,8 @@ public:
|
||||||
void cycle_end (pframes_t);
|
void cycle_end (pframes_t);
|
||||||
void cycle_split ();
|
void cycle_split ();
|
||||||
|
|
||||||
|
void flush_buffers (pframes_t nframes);
|
||||||
|
|
||||||
/* reset SRC, clear out any state */
|
/* reset SRC, clear out any state */
|
||||||
void reinit (bool with_ratio);
|
void reinit (bool with_ratio);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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
|
void
|
||||||
AudioPort::reinit (bool with_ratio)
|
AudioPort::reinit (bool with_ratio)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1700,6 +1700,12 @@ IO::copy_to_outputs (BufferSet& bufs, DataType type, pframes_t nframes, samplecn
|
||||||
port_buffer.read_from (*prev, nframes, offset);
|
port_buffer.read_from (*prev, nframes, offset);
|
||||||
++o;
|
++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<Port>
|
boost::shared_ptr<Port>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue