diff options
author | Robin Gareus <robin@gareus.org> | 2014-05-25 19:43:37 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2014-05-25 19:43:37 +0200 |
commit | 5b2da3caf70822fa71baff1c898f65567aecc7f8 (patch) | |
tree | 08fa37c8ec88045f54f4319a4c1719ae27d0b9ce /libs/ardour/route.cc | |
parent | 1e3a955fc079a052e7f765374d10b9af97403530 (diff) |
compensate for processor latency during bounce
Diffstat (limited to 'libs/ardour/route.cc')
-rw-r--r-- | libs/ardour/route.cc | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index 4d7bb5802d..2727f511cb 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -536,6 +536,68 @@ Route::process_output_buffers (BufferSet& bufs, } } +void +Route::bounce_process (BufferSet& buffers, framepos_t start, framecnt_t nframes, + boost::shared_ptr<Processor> endpoint, bool include_endpoint, bool for_export) +{ + /* If no processing is required, there's no need to go any further. */ + if (!endpoint && !include_endpoint) { + return; + } + + for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) { + + if (!include_endpoint && (*i) == endpoint) { + break; + } + + /* if we're not exporting, stop processing if we come across a routing processor. */ + + if (!for_export && (*i)->does_routing()) { + break; + } + + /* don't run any processors that does routing. + * oh, and don't bother with the peak meter either. + */ + if (!(*i)->does_routing() && !boost::dynamic_pointer_cast<PeakMeter>(*i)) { + (*i)->run (buffers, start, start+nframes, nframes, true); + } + + //buffers.set_count ((*i)->output_streams()); + + if ((*i) == endpoint) { + break; + } + } +} + +framecnt_t +Route::bounce_get_latency (boost::shared_ptr<Processor> endpoint, bool include_endpoint, bool for_export) const +{ + framecnt_t latency = 0; + if (!endpoint && !include_endpoint) { + return latency; + } + + for (ProcessorList::const_iterator i = _processors.begin(); i != _processors.end(); ++i) { + + if (!include_endpoint && (*i) == endpoint) { + break; + } + if (!for_export && (*i)->does_routing()) { + break; + } + if (!(*i)->does_routing() && !boost::dynamic_pointer_cast<PeakMeter>(*i)) { + latency += (*i)->signal_latency (); + } + if ((*i) == endpoint) { + break; + } + } + return latency; +} + ChanCount Route::n_process_buffers () { |