13
0

Fix "stop at marker" script for A6

This commit is contained in:
Robin Gareus 2020-01-31 01:45:24 +01:00
parent d14d396967
commit e03136646d
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -19,6 +19,7 @@ function factory ()
-- find first marker after the current playhead position, ignore loop + punch ranges -- find first marker after the current playhead position, ignore loop + punch ranges
-- (this only works when rolling forward, to extend this example see -- (this only works when rolling forward, to extend this example see
-- http://manual.ardour.org/lua-scripting/class_reference/#ARDOUR:Locations ) -- http://manual.ardour.org/lua-scripting/class_reference/#ARDOUR:Locations )
--
local m = loc:first_mark_after (pos, false) local m = loc:first_mark_after (pos, false)
if (m == -1) then if (m == -1) then
@ -26,14 +27,11 @@ function factory ()
return return
end end
-- due to "first_mark_after" m is always > pos:
-- transport stop can only happen on a process-cycle boundary. -- assert(pos < m)
-- This callback happens from within the process callback, -- so in the cycle that crosses "m" we need to stop at 'm'
-- so we need to queue it ahead of time. if (pos + n_samples >= m) then
local blk = Session:get_block_size () Session:request_locate (m, ARDOUR.LocateTransportDisposition.MustStop, ARDOUR.TransportRequestSource.TRS_Engine)
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)
end end
end end
end end