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.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 (),
|
2019-06-15 19:30:34 -04:00
|
|
|
tostring (pch:containsSamplePos (ARDOUR.Properties.Start)),
|
|
|
|
tostring (pch:containsSamplePos (ARDOUR.Properties.Length))
|
2016-02-23 09:44:41 -05:00
|
|
|
))
|
|
|
|
io.close (file)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|