Update Lua scripts to use new transport request API
This commit is contained in:
parent
c10df23a0f
commit
7d8918034a
|
@ -23,13 +23,13 @@ function factory ()
|
||||||
-- event at 09:30:00 UTC (here: rec-arm + roll)
|
-- event at 09:30:00 UTC (here: rec-arm + roll)
|
||||||
if (now >= hhmmss (09, 30, 00) and _last_time < hhmmss (09, 30, 00)) then
|
if (now >= hhmmss (09, 30, 00) and _last_time < hhmmss (09, 30, 00)) then
|
||||||
Session:maybe_enable_record (false)
|
Session:maybe_enable_record (false)
|
||||||
Session:request_transport_speed (1.0, true)
|
Session:request_transport_speed (1.0, true, ARDOUR.TransportRequestSource.TRS_UI)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- event at 09:32:00 UTC (here: rec-stop)
|
-- event at 09:32:00 UTC (here: rec-stop)
|
||||||
if (now >= hhmmss (09, 32, 00) and _last_time < hhmmss (09, 32, 00)) then
|
if (now >= hhmmss (09, 32, 00) and _last_time < hhmmss (09, 32, 00)) then
|
||||||
Session:disable_record (false, false)
|
Session:disable_record (false, false)
|
||||||
Session:request_transport_speed (0.0, true)
|
Session:request_transport_speed (0.0, true, ARDOUR.TransportRequestSource.TRS_UI)
|
||||||
end
|
end
|
||||||
|
|
||||||
_last_time = now
|
_last_time = now
|
||||||
|
|
|
@ -26,7 +26,7 @@ function factory ()
|
||||||
-- maybe-enable may fail if there are no tracks or step-entry is active
|
-- maybe-enable may fail if there are no tracks or step-entry is active
|
||||||
-- roll transport if record-enable suceeded:
|
-- roll transport if record-enable suceeded:
|
||||||
if ARDOUR.Session.RecordState.Enabled == Session:record_status() then
|
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
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
|
@ -28,7 +28,7 @@ function factory (params)
|
||||||
end
|
end
|
||||||
a = a + n_samples
|
a = a + n_samples
|
||||||
if (a > timeout * Session:sample_rate()) then
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -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
|
||||||
if speed > 0.25 then delta = delta * -1 end
|
if speed > 0.25 then delta = delta * -1 end
|
||||||
speed = speed + delta
|
speed = speed + delta
|
||||||
Session:request_transport_speed (speed)
|
Session:request_transport_speed (speed, true, ARDOUR.TransportRequestSource.TRS_UI)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -26,15 +26,14 @@ function factory ()
|
||||||
return
|
return
|
||||||
end
|
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.
|
-- transport stop can only happen on a process-cycle boundary.
|
||||||
-- This callback happens from within the process callback,
|
-- This callback happens from within the process callback,
|
||||||
-- so we need to queue it ahead of time.
|
-- so we need to queue it ahead of time.
|
||||||
if (pos + n_samples + blk >= m and pos + n_samples < m) then
|
local blk = Session:get_block_size ()
|
||||||
Session:request_transport_speed (0.0, true)
|
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
|
||||||
|
|
|
@ -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
|
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
|
local a = ARDOUR.DSP.compute_peak(bufs:get_audio(b):data(offset), n_samples, 0) -- compute digital peak
|
||||||
if a > threshold then
|
if a > threshold then
|
||||||
Session:request_transport_speed(1.0, true)
|
Session:request_transport_speed (1.0, true, ARDOUR.TransportRequestSource.TRS_UI)
|
||||||
end
|
end
|
||||||
if a > level then level = a end -- max level of all channels
|
if a > level then level = a end -- max level of all channels
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user