13
0

Update Lua scripts to use new transport request API

This commit is contained in:
Robin Gareus 2019-11-26 17:02:41 +01:00
parent c10df23a0f
commit 7d8918034a
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
6 changed files with 10 additions and 11 deletions

View File

@ -23,13 +23,13 @@ function factory ()
-- event at 09:30:00 UTC (here: rec-arm + roll)
if (now >= hhmmss (09, 30, 00) and _last_time < hhmmss (09, 30, 00)) then
Session:maybe_enable_record (false)
Session:request_transport_speed (1.0, true)
Session:request_transport_speed (1.0, true, ARDOUR.TransportRequestSource.TRS_UI)
end
-- event at 09:32:00 UTC (here: rec-stop)
if (now >= hhmmss (09, 32, 00) and _last_time < hhmmss (09, 32, 00)) then
Session:disable_record (false, false)
Session:request_transport_speed (0.0, true)
Session:request_transport_speed (0.0, true, ARDOUR.TransportRequestSource.TRS_UI)
end
_last_time = now

View File

@ -26,7 +26,7 @@ function factory ()
-- maybe-enable may fail if there are no tracks or step-entry is active
-- roll transport if record-enable suceeded:
if ARDOUR.Session.RecordState.Enabled == Session:record_status() then
Session:request_transport_speed (1.0, true) -- ...and go.
Session:request_transport_speed (1.0, true, ARDOUR.TransportRequestSource.TRS_UI) -- ...and go.
end
return
end

View File

@ -28,7 +28,7 @@ function factory (params)
end
a = a + n_samples
if (a > timeout * Session:sample_rate()) then
Session:request_transport_speed(0.0, true)
Session:request_transport_speed(0.0, true, ARDOUR.TransportRequestSource.TRS_Engine)
end
end
end

View File

@ -26,7 +26,7 @@ function factory (params)
if speed < -0.25 then delta = delta * -1 end
if speed > 0.25 then delta = delta * -1 end
speed = speed + delta
Session:request_transport_speed (speed)
Session:request_transport_speed (speed, true, ARDOUR.TransportRequestSource.TRS_UI)
end
end
end

View File

@ -26,15 +26,14 @@ function factory ()
return
end
-- since ardour may split the process cycle for events,
-- n_samples may be smaller.
local blk = Session:get_block_size ()
-- 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.
if (pos + n_samples + blk >= m and pos + n_samples < m) then
Session:request_transport_speed (0.0, true)
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)
end
end
end

View File

@ -44,7 +44,7 @@ function dsp_runmap (bufs, in_map, out_map, n_samples, offset)
if b ~= ARDOUR.ChanMapping.Invalid then -- check if channel is mapped
local a = ARDOUR.DSP.compute_peak(bufs:get_audio(b):data(offset), n_samples, 0) -- compute digital peak
if a > threshold then
Session:request_transport_speed(1.0, true)
Session:request_transport_speed (1.0, true, ARDOUR.TransportRequestSource.TRS_UI)
end
if a > level then level = a end -- max level of all channels
end