summaryrefslogtreecommitdiff
path: root/libs/ardour/route.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2017-10-31 03:51:08 +0100
committerRobin Gareus <robin@gareus.org>2017-10-31 03:51:08 +0100
commit3b785b9d357b9c929ba061b306eacf2247737091 (patch)
treeb41984c956d08ece3a5044ad47c854013075d993 /libs/ardour/route.cc
parent9a2433eacfb311e3996997118123378f662589ae (diff)
Small steps towards rolling backwards..
Diffstat (limited to 'libs/ardour/route.cc')
-rw-r--r--libs/ardour/route.cc24
1 files changed, 16 insertions, 8 deletions
diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc
index 59106beaac..29225404d9 100644
--- a/libs/ardour/route.cc
+++ b/libs/ardour/route.cc
@@ -360,14 +360,18 @@ Route::process_output_buffers (BufferSet& bufs,
* By the Time T=0 is reached (dt=15 later) that sample is audible.
*/
- start_sample += _signal_latency;
- end_sample += _signal_latency;
-
- start_sample += _output->latency ();
- end_sample += _output->latency ();
-
const double speed = (is_auditioner() ? 1.0 : _session.transport_speed ());
+ const sampleoffset_t latency_offset = _signal_latency + _output->latency ();
+ if (speed < 0) {
+ /* when rolling backwards this can become negative */
+ start_sample -= latency_offset;
+ end_sample -= latency_offset;
+ } else {
+ start_sample += latency_offset;
+ end_sample += latency_offset;
+ }
+
/* Note: during intial pre-roll 'start_sample' as passed as argument can be negative.
* Functions calling process_output_buffers() will set "run_disk_reader"
* to false if the pre-roll count-down is larger than playback_latency ().
@@ -386,7 +390,7 @@ Route::process_output_buffers (BufferSet& bufs,
* given that
*/
bool run_disk_writer = false;
- if (_disk_writer && speed != 0) {
+ 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 ()) {
@@ -514,7 +518,11 @@ Route::process_output_buffers (BufferSet& bufs,
pspeed = 0;
}
- (*i)->run (bufs, start_sample - latency, end_sample - latency, pspeed, nframes, *i != _processors.back());
+ if (speed < 0) {
+ (*i)->run (bufs, start_sample + latency, end_sample + latency, pspeed, nframes, *i != _processors.back());
+ } else {
+ (*i)->run (bufs, start_sample - latency, end_sample - latency, pspeed, nframes, *i != _processors.back());
+ }
bufs.set_count ((*i)->output_streams());