13
0
livetrax/share/scripts/_session_test.lua

35 lines
1.1 KiB
Lua
Raw Normal View History

2016-02-23 09:44:41 -05:00
ardour {
["type"] = "session",
2016-05-14 17:59:32 -04:00
name = "Good Night",
author = "Ardour Lua Task Force",
2016-02-23 09:44:41 -05:00
description = [[
2016-05-14 17:59:32 -04:00
Example Ardour Session Script.
Session scripts are called at the beginning of every process-callback (before doing any audio processing).
This example stops the transport after rolling for a configurable time which can be set when instantiating the script.]]
2016-02-23 09:44:41 -05:00
}
function sess_params ()
return
{
["print"] = { title = "Debug Print (yes/no)", default = "no", optional = true },
["time"] = { title = "Timeout (sec)", default = "90", optional = false },
}
end
function factory (params)
return function (n_samples)
local p = params["print"] or "no"
local timeout = params["time"] or 90
a = a or 0
if p ~= "no" then print (a, n_samples, Session:sample_rate (), Session:transport_rolling ()) end -- debug output (not rt safe)
2016-02-23 09:44:41 -05:00
if (not Session:transport_rolling()) then
a = 0
return
end
a = a + n_samples
if (a > timeout * Session:sample_rate()) then
Session:request_transport_speed(0.0, true, ARDOUR.TransportRequestSource.TRS_Engine)
2016-02-23 09:44:41 -05:00
end
end
end