summaryrefslogtreecommitdiff
path: root/scripts/_varispeed_callback.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/_varispeed_callback.lua
parent2b7a89ecffa92a616cd61774d42bea1e99db6f79 (diff)
prefix no-inst script with an underscore and skip install
Diffstat (limited to 'scripts/_varispeed_callback.lua')
-rw-r--r--scripts/_varispeed_callback.lua32
1 files changed, 32 insertions, 0 deletions
diff --git a/scripts/_varispeed_callback.lua b/scripts/_varispeed_callback.lua
new file mode 100644
index 0000000000..c61a15d897
--- /dev/null
+++ b/scripts/_varispeed_callback.lua
@@ -0,0 +1,32 @@
+ardour {
+ ["type"] = "EditorHook",
+ name = "Varispeed Test - 100ms Callback",
+ author = "Ardour Lua Task Force",
+ 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
+ Session:request_transport_speed (speed)
+ end
+ end
+end