From 3cf888498a9837be4cf19394fe554d1cdb9efde5 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Mon, 18 Nov 2019 15:10:15 +0100 Subject: [PATCH] Fix automation lookup when rolling backwards --- libs/ardour/plugin_insert.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libs/ardour/plugin_insert.cc b/libs/ardour/plugin_insert.cc index 94f7ee4cbb..9b4aa17b0c 100644 --- a/libs/ardour/plugin_insert.cc +++ b/libs/ardour/plugin_insert.cc @@ -1292,13 +1292,14 @@ PluginInsert::automate_and_run (BufferSet& bufs, samplepos_t start, samplepos_t while (nframes) { - samplecnt_t cnt = min (((samplecnt_t) ceil (next_event.when) - start), (samplecnt_t) nframes); + samplecnt_t cnt = min ((samplecnt_t) ceil (fabs (next_event.when - start)), (samplecnt_t) nframes); + assert (cnt > 0); connect_and_run (bufs, start, start + cnt * speed, speed, cnt, offset, true); nframes -= cnt; offset += cnt; - start += cnt; + start += cnt * speed; map_loop_range (start, end);