From e03136646d3301e2cbd6d9c8a05f28c0ebbdacb3 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Fri, 31 Jan 2020 01:45:24 +0100 Subject: [PATCH] Fix "stop at marker" script for A6 --- scripts/stop_at_marker.lua | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/scripts/stop_at_marker.lua b/scripts/stop_at_marker.lua index 5b4b8d5109..651d2d2a3c 100644 --- a/scripts/stop_at_marker.lua +++ b/scripts/stop_at_marker.lua @@ -19,6 +19,7 @@ function factory () -- find first marker after the current playhead position, ignore loop + punch ranges -- (this only works when rolling forward, to extend this example see -- http://manual.ardour.org/lua-scripting/class_reference/#ARDOUR:Locations ) + -- local m = loc:first_mark_after (pos, false) if (m == -1) then @@ -26,14 +27,11 @@ function factory () return end - - -- transport stop can only happen on a process-cycle boundary. - -- This callback happens from within the process callback, - -- so we need to queue it ahead of time. - local blk = Session:get_block_size () - if (pos + blk<= m and pos + blk + n_samples > m ) then - -- TODO use session event API, schedule stop at marker's time - Session:request_transport_speed (0.0, true, ARDOUR.TransportRequestSource.TRS_Engine) + -- due to "first_mark_after" m is always > pos: + -- assert(pos < m) + -- so in the cycle that crosses "m" we need to stop at 'm' + if (pos + n_samples >= m) then + Session:request_locate (m, ARDOUR.LocateTransportDisposition.MustStop, ARDOUR.TransportRequestSource.TRS_Engine) end end end