summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2019-11-26 17:02:41 +0100
committerRobin Gareus <robin@gareus.org>2019-11-26 17:02:41 +0100
commit7d8918034a77168abcb0ee750762d2ed55646fae (patch)
treebaa88384d19c92a21bc22a1b200e718d313294f3 /scripts
parentc10df23a0f58ab22fb4ced922557cda532f32cf3 (diff)
Update Lua scripts to use new transport request API
Diffstat (limited to 'scripts')
-rw-r--r--scripts/_cron.lua4
-rw-r--r--scripts/_midi_rec_start.lua2
-rw-r--r--scripts/_session_test.lua2
-rw-r--r--scripts/_varispeed_callback.lua2
-rw-r--r--scripts/stop_at_marker.lua9
-rw-r--r--scripts/voice_activate.lua2
6 files changed, 10 insertions, 11 deletions
diff --git a/scripts/_cron.lua b/scripts/_cron.lua
index 8ec1cd797c..3f412d9ddd 100644
--- a/scripts/_cron.lua
+++ b/scripts/_cron.lua
@@ -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
diff --git a/scripts/_midi_rec_start.lua b/scripts/_midi_rec_start.lua
index 235609b037..b2e03ba28b 100644
--- a/scripts/_midi_rec_start.lua
+++ b/scripts/_midi_rec_start.lua
@@ -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
diff --git a/scripts/_session_test.lua b/scripts/_session_test.lua
index cc7032ac02..f6adea38c7 100644
--- a/scripts/_session_test.lua
+++ b/scripts/_session_test.lua
@@ -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
diff --git a/scripts/_varispeed_callback.lua b/scripts/_varispeed_callback.lua
index c61a15d897..fe3f2721c1 100644
--- a/scripts/_varispeed_callback.lua
+++ b/scripts/_varispeed_callback.lua
@@ -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
diff --git a/scripts/stop_at_marker.lua b/scripts/stop_at_marker.lua
index 32205432f9..5b4b8d5109 100644
--- a/scripts/stop_at_marker.lua
+++ b/scripts/stop_at_marker.lua
@@ -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
diff --git a/scripts/voice_activate.lua b/scripts/voice_activate.lua
index 64c1ba059b..ef4380b9bb 100644
--- a/scripts/voice_activate.lua
+++ b/scripts/voice_activate.lua
@@ -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