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()
|
2021-05-07 16:45:28 -04:00
|
|
|
--s:add ({[LuaSignal.SoloActive] = true, [LuaSignal.RegionsPropertyChanged] = true})
|
2016-02-23 09:44:41 -05:00
|
|
|
s:add (
|
|
|
|
{
|
|
|
|
[LuaSignal.SoloActive] = true,
|
2021-05-07 16:45:28 -04:00
|
|
|
[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
|
|
|
|
|
2021-05-07 16:45:28 -04:00
|
|
|
if (signal == LuaSignal.RegionsPropertyChanged) then
|
|
|
|
rl,pch = ...
|
2016-02-23 09:44:41 -05:00
|
|
|
file = io.open ("/tmp/test" ,"a")
|
|
|
|
io.output (file)
|
2021-05-07 16:45:28 -04:00
|
|
|
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",
|
2021-05-07 16:45:28 -04:00
|
|
|
region:name (),
|
2022-09-27 12:58:53 -04:00
|
|
|
tostring (pch:containsTimeCnt (ARDOUR.Properties.Length)),
|
|
|
|
tostring (pch:containsTimePos (ARDOUR.Properties.Start))
|
2021-05-07 16:45:28 -04:00
|
|
|
))
|
|
|
|
end
|
2016-02-23 09:44:41 -05:00
|
|
|
io.close (file)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|