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
1 changed files with 6 additions and 8 deletions

View File

@ -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