Fix wireplumber auto connect

This commit is contained in:
Christian Colglazier 2024-06-23 09:21:29 -04:00
parent 390daca277
commit 49abb1b949
3 changed files with 49 additions and 13 deletions

View File

@ -1 +0,0 @@
load_script("/home/aqua/.config/wireplumber/scripts/auto-connect-ports.lua")

View File

@ -32,6 +32,41 @@ function link_port(output_port, input_port)
return true return true
end end
function delete_link(link_om, output_port, input_port)
print("Trying to delete")
if not input_port or not output_port then
print("No ports")
return false
end
local link = link_om:lookup {
Constraint {
"link.input.node", "equals", input_port.properties["node.id"]
},
Constraint {
"link.input.port", "equals", input_port.properties["object.id"],
},
Constraint {
"link.output.node", "equals", output_port.properties["node.id"],
},
Constraint {
"link.output.port", "equals", output_port.properties["object.id"],
}
}
if not link then
print("No link!")
return
end
print("Deleting link!")
link:request_destroy()
end
-- Automatically link ports together by their specific audio channels. -- Automatically link ports together by their specific audio channels.
-- --
-- ┌──────────────────┐ ┌───────────────────┐ -- ┌──────────────────┐ ┌───────────────────┐
@ -131,9 +166,6 @@ function auto_connect_ports(args)
end end
end end
-- pw-cli list-objects | grep object.path
-- Connect to speakers -- Connect to speakers
auto_connect_ports { auto_connect_ports {
output = Constraint { "object.path", "matches", "speakers:*" }, output = Constraint { "object.path", "matches", "speakers:*" },
@ -144,12 +176,3 @@ auto_connect_ports {
} }
} }
-- Connect to mic
auto_connect_ports {
output = Constraint { "object.path", "matches", "alsa:pcm:2:hw:2,0:capture:*" },
input = Constraint { "object.path", "matches", "sm7b-processed:" },
connect = {
["AUX0"] = "FL",
["AUX1"] = "FR"
}
}

View File

@ -0,0 +1,14 @@
wireplumber.components = [
{
name = /home/aqua/.config/wireplumber/scripts/auto-connect-ports.lua,
type = script/lua
provides = custom.my-script
}
]
wireplumber.profiles = {
main = {
custom.my-script = required
}
}