summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libs/ardour/route.cc31
-rw-r--r--libs/ardour/session_process.cc16
2 files changed, 19 insertions, 28 deletions
diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc
index 0aa69e91ec..f411631e9e 100644
--- a/libs/ardour/route.cc
+++ b/libs/ardour/route.cc
@@ -383,6 +383,8 @@ Route::process_output_buffers (BufferSet& bufs,
*/
bool run_disk_writer = false;
if (_disk_writer && speed != 0) {
+ samplecnt_t latency_preroll = _session.remaining_latency_preroll ();
+ run_disk_writer = latency_preroll < nframes + (_signal_latency + _output->latency ());
if (end_sample - _disk_writer->input_latency () < _session.transport_sample ()) {
run_disk_writer = true;
}
@@ -3728,38 +3730,11 @@ Route::latency_preroll (pframes_t nframes, samplepos_t& start_sample, samplepos_
return nframes;
}
- samplecnt_t route_offset = playback_latency ();
-
- if (latency_preroll > route_offset + nframes) {
+ if (latency_preroll > playback_latency ()) {
no_roll_unlocked (nframes, start_sample - latency_preroll, end_sample - latency_preroll);
return 0;
}
- if (latency_preroll > route_offset) {
-
- samplecnt_t skip = latency_preroll - route_offset;
- no_roll_unlocked (skip, start_sample - latency_preroll, start_sample - latency_preroll + skip);
-
- if (nframes == skip) {
- return 0;
- }
-
- Glib::Threads::RWLock::ReaderLock lm (_processor_lock);
- for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) {
- boost::shared_ptr<IOProcessor> iop = boost::dynamic_pointer_cast<IOProcessor> (*i);
- if (iop) {
- iop->increment_port_buffer_offset (skip);
- }
- }
- _input->increment_port_buffer_offset (skip);
- _output->increment_port_buffer_offset (skip);
-
- start_sample -= route_offset;
- end_sample -= route_offset;
-
- return nframes - skip;
- }
-
start_sample -= latency_preroll;
end_sample -= latency_preroll;
return nframes;
diff --git a/libs/ardour/session_process.cc b/libs/ardour/session_process.cc
index a7db77c716..32c8f99734 100644
--- a/libs/ardour/session_process.cc
+++ b/libs/ardour/session_process.cc
@@ -311,6 +311,22 @@ Session::process_with_events (pframes_t nframes)
ns = std::min ((samplecnt_t)nframes, _count_in_samples);
}
+ boost::shared_ptr<RouteList> r = routes.reader ();
+ for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
+ samplecnt_t route_offset = (*i)->playback_latency ();
+ if (_remaining_latency_preroll > route_offset + ns) {
+ /* route will no-roll for complete pre-roll cycle */
+ continue;
+ }
+ if (_remaining_latency_preroll > route_offset) {
+ /* route may need partial no-roll and partial roll from
+ * (_transport_sample - _remaining_latency_preroll) .. +ns.
+ * shorten and split the cycle.
+ */
+ ns = std::min (ns, (_remaining_latency_preroll - route_offset));
+ }
+ }
+
if (_count_in_samples > 0) {
run_click (_transport_sample - _count_in_samples, ns);
assert (_count_in_samples >= ns);