summaryrefslogtreecommitdiff
path: root/scripts/_session_test.lua
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2016-08-10 03:12:11 +0200
committerRobin Gareus <robin@gareus.org>2016-08-10 03:12:11 +0200
commita8143ea44e83a87fb6a9500d59409a14a94ad655 (patch)
tree3aac8610dc26fb63abd4cc1c7afe864714a2f408 /scripts/_session_test.lua
parent2b7a89ecffa92a616cd61774d42bea1e99db6f79 (diff)
prefix no-inst script with an underscore and skip install
Diffstat (limited to 'scripts/_session_test.lua')
-rw-r--r--scripts/_session_test.lua34
1 files changed, 34 insertions, 0 deletions
diff --git a/scripts/_session_test.lua b/scripts/_session_test.lua
new file mode 100644
index 0000000000..6a4a372f8d
--- /dev/null
+++ b/scripts/_session_test.lua
@@ -0,0 +1,34 @@
+ardour {
+ ["type"] = "session",
+ name = "Good Night",
+ author = "Ardour Lua Task Force",
+ description = [[
+ 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.]]
+}
+
+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:frame_rate (), Session:transport_rolling ()) end -- debug output (not rt safe)
+ if (not Session:transport_rolling()) then
+ a = 0
+ return
+ end
+ a = a + n_samples
+ if (a > timeout * Session:frame_rate()) then
+ Session:request_transport_speed(0.0, true)
+ end
+ end
+end