13
0
livetrax/share/scripts/_hook_test.lua

44 lines
1.1 KiB
Lua
Raw Normal View History

2016-02-23 09:44:41 -05:00
ardour {
["type"] = "EditorHook",
name = "Callback Example",
2020-09-30 16:06:35 -04:00
author = "Ardour Team",
2016-02-23 09:44:41 -05:00
description = "Rewind On Solo Change, Write a file when regions are moved",
}
function signals ()
s = LuaSignal.Set()
--s:add ({[LuaSignal.SoloActive] = true, [LuaSignal.RegionsPropertyChanged] = true})
2016-02-23 09:44:41 -05:00
s:add (
{
[LuaSignal.SoloActive] = true,
[LuaSignal.RegionsPropertyChanged] = true
2016-02-23 09:44:41 -05:00
}
)
--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.RegionsPropertyChanged) then
rl,pch = ...
2016-02-23 09:44:41 -05:00
file = io.open ("/tmp/test" ,"a")
io.output (file)
for region in rl:iter() do
2022-09-27 12:58:53 -04:00
io.write (string.format ("Region: '%s' length@pos-changed: %s Start-changed: %s\n",
region:name (),
2022-09-27 12:58:53 -04:00
tostring (pch:containsTimeCnt (ARDOUR.Properties.Length)),
tostring (pch:containsTimePos (ARDOUR.Properties.Start))
))
end
2016-02-23 09:44:41 -05:00
io.close (file)
end
end
end