2016-07-23 11:39:53 -04:00
|
|
|
ardour {
|
|
|
|
["type"] = "EditorHook",
|
|
|
|
name = "Varispeed Test - 100ms Callback",
|
2020-09-30 16:06:35 -04:00
|
|
|
author = "Ardour Team",
|
2016-07-23 11:39:53 -04:00
|
|
|
description = "An example script that invokes a callback a every 0.1sec and modifies the transport speed",
|
|
|
|
}
|
|
|
|
|
|
|
|
function signals ()
|
|
|
|
s = LuaSignal.Set()
|
|
|
|
s:add (
|
|
|
|
{
|
|
|
|
[LuaSignal.LuaTimerDS] = true,
|
|
|
|
}
|
|
|
|
)
|
|
|
|
return s
|
|
|
|
end
|
|
|
|
|
|
|
|
function factory (params)
|
|
|
|
-- upindex variables
|
|
|
|
local cnt = 0
|
|
|
|
local speed = 0
|
|
|
|
local delta = 0.01
|
|
|
|
return function (signal, ref, ...)
|
|
|
|
cnt = (cnt + 1) % 5 -- divide clock: every half a second
|
|
|
|
if cnt == 0 then
|
|
|
|
if speed < -0.25 then delta = delta * -1 end
|
|
|
|
if speed > 0.25 then delta = delta * -1 end
|
|
|
|
speed = speed + delta
|
2019-11-26 11:02:41 -05:00
|
|
|
Session:request_transport_speed (speed, true, ARDOUR.TransportRequestSource.TRS_UI)
|
2016-07-23 11:39:53 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|