2016-03-19 08:15:37 -04:00
|
|
|
ardour {
|
|
|
|
["type"] = "EditorHook",
|
|
|
|
name = "OSC Callback Example",
|
2016-07-12 09:21:23 -04:00
|
|
|
author = "Ardour Lua Task Force",
|
2016-03-19 08:15:37 -04:00
|
|
|
description = "Send OSC messages",
|
|
|
|
}
|
|
|
|
|
|
|
|
function action_params ()
|
|
|
|
return
|
|
|
|
{
|
|
|
|
["uri"] = { title = "OSC URI ", default = "osc.udp://localhost:7890"},
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function signals ()
|
|
|
|
s = LuaSignal.Set()
|
|
|
|
s:add (
|
|
|
|
{
|
|
|
|
[LuaSignal.SoloActive] = true,
|
|
|
|
[LuaSignal.RegionPropertyChanged] = true,
|
|
|
|
[LuaSignal.Exported] = true,
|
|
|
|
[LuaSignal.TransportStateChange] = true
|
|
|
|
}
|
|
|
|
)
|
|
|
|
return s
|
|
|
|
end
|
|
|
|
|
|
|
|
function factory (params)
|
|
|
|
return function (signal, ref, ...)
|
2019-04-07 16:48:56 -04:00
|
|
|
local uri = params["uri"] or "osc.udp://localhost:7890"
|
2016-03-26 09:54:45 -04:00
|
|
|
local tx = ARDOUR.LuaOSC.Address (uri)
|
2016-03-19 08:15:37 -04:00
|
|
|
-- debug print (stdout)
|
|
|
|
-- print (signal, ref, ...)
|
|
|
|
|
|
|
|
if (signal == LuaSignal.Exported) then
|
|
|
|
tx:send ("/session/exported", "ss", ...)
|
|
|
|
elseif (signal == LuaSignal.SoloActive) then
|
|
|
|
tx:send ("/session/solo_changed", "")
|
|
|
|
elseif (signal == LuaSignal.TransportStateChange) then
|
|
|
|
tx:send ("/session/transport", "if",
|
2017-09-26 23:03:10 -04:00
|
|
|
Session:transport_sample(), Session:transport_speed())
|
2016-03-19 08:15:37 -04:00
|
|
|
elseif (signal == LuaSignal.RegionPropertyChanged) then
|
|
|
|
obj,pch = ...
|
|
|
|
tx:send ("/region_property_changed", "sTTiii",
|
|
|
|
obj:name (),
|
|
|
|
(pch:containsFramePos (ARDOUR.Properties.Start)),
|
|
|
|
(pch:containsFramePos (ARDOUR.Properties.Length)),
|
|
|
|
obj:position (), obj:start (), obj:length ())
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|