ardour { ["type"] = "Snippet", name = "disconnect_click" }
function factory () return function ()
local a = Session:engine()
-- Get all audio output ports
_, t = a:get_backend_ports ("", ARDOUR.DataType("audio"), ARDOUR.PortFlags.IsOutput, C.StringVector())
for n in t[4]:iter() do
if n:find("Click/audio_out") then
print("Disconnecting", n)
-- Get current connections for this port
local _, ct = a:get_connections(n, C.StringVector())
-- Disconnect each connected port
for c in ct[2]:iter() do
print(" -> Disconnecting from", c)
a:disconnect(n, c)
end
end
end
print("Click outputs disconnected.")
end end