From 489c9ace9f87b50ee5de08da811ed89fa8083646 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 26 Oct 2022 21:03:08 +0200 Subject: [PATCH] Fix looping automation - see also 6a55146f --- libs/ardour/plugin_insert.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libs/ardour/plugin_insert.cc b/libs/ardour/plugin_insert.cc index 46795dc807..59e526de3f 100644 --- a/libs/ardour/plugin_insert.cc +++ b/libs/ardour/plugin_insert.cc @@ -1379,6 +1379,7 @@ PluginInsert::automate_and_run (BufferSet& bufs, samplepos_t start, samplepos_t while (nframes) { samplecnt_t cnt = min (timepos_t (start).distance (next_event.when).samples(), (samplecnt_t) nframes); + assert (cnt > 0); connect_and_run (bufs, start, start + cnt * speed, speed, cnt, offset, true); @@ -1389,7 +1390,7 @@ PluginInsert::automate_and_run (BufferSet& bufs, samplepos_t start, samplepos_t map_loop_range (start, end); - if (!find_next_event (next_event.when, timepos_t (end), next_event)) { + if (!find_next_event (std::min (timepos_t (start), next_event.when), timepos_t (end), next_event)) { break; } }