summaryrefslogtreecommitdiff
path: root/scripts/stop_at_marker.lua
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2020-01-31 01:45:24 +0100
committerRobin Gareus <robin@gareus.org>2020-01-31 01:49:56 +0100
commite03136646d3301e2cbd6d9c8a05f28c0ebbdacb3 (patch)
treef5fe5e174076116c59fd900d2c287844b11f628a /scripts/stop_at_marker.lua
parentd14d396967a71d06645fafede441dd519306c527 (diff)
Fix "stop at marker" script for A6
Diffstat (limited to 'scripts/stop_at_marker.lua')
-rw-r--r--scripts/stop_at_marker.lua14
1 files 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