diff options
author | Robin Gareus <robin@gareus.org> | 2020-02-23 20:48:02 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2020-02-23 20:48:02 +0100 |
commit | 180843f9bd28b191c7404245ba0a121107992511 (patch) | |
tree | c60312dc09f76c2f55ba2383245c427e15c38dea /share/scripts/_hook_test.lua | |
parent | bf649cd68ad46c34a656700aa6cb89416d648c64 (diff) |
Also move Lua scripts to share subfolder
Diffstat (limited to 'share/scripts/_hook_test.lua')
-rw-r--r-- | share/scripts/_hook_test.lua | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/share/scripts/_hook_test.lua b/share/scripts/_hook_test.lua new file mode 100644 index 0000000000..c5b00445ce --- /dev/null +++ b/share/scripts/_hook_test.lua @@ -0,0 +1,41 @@ +ardour { + ["type"] = "EditorHook", + name = "Callback Example", + author = "Ardour Lua Task Force", + description = "Rewind On Solo Change, Write a file when regions are moved", +} + +function signals () + s = LuaSignal.Set() + --s:add ({[LuaSignal.SoloActive] = true, [LuaSignal.RegionPropertyChanged] = true}) + s:add ( + { + [LuaSignal.SoloActive] = true, + [LuaSignal.RegionPropertyChanged] = true + } + ) + --for k,v in pairs (s:table()) do print (k, v) end + return s +end + +function factory (params) + return function (signal, ref, ...) + print (signal, ref, ...) + + if (signal == LuaSignal.SoloActive) then + Session:goto_start() + end + + if (signal == LuaSignal.RegionPropertyChanged) then + obj,pch = ... + file = io.open ("/tmp/test" ,"a") + io.output (file) + io.write (string.format ("Region: '%s' pos-changed: %s, length-changed: %s\n", + obj:name (), + tostring (pch:containsSamplePos (ARDOUR.Properties.Start)), + tostring (pch:containsSamplePos (ARDOUR.Properties.Length)) + )) + io.close (file) + end + end +end |