![Wireplumber - 同时输出到同一声卡上的多个接收器](https://linux22.com/image/225569/Wireplumber%20-%20%E5%90%8C%E6%97%B6%E8%BE%93%E5%87%BA%E5%88%B0%E5%90%8C%E4%B8%80%E5%A3%B0%E5%8D%A1%E4%B8%8A%E7%9A%84%E5%A4%9A%E4%B8%AA%E6%8E%A5%E6%94%B6%E5%99%A8.png)
我正在使用Fedora 38(6.5.6-200.fc38.x86_64)wireplumber:使用libwireplumber 0.4.14编译pipewire:使用libpipewire 0.3.81编译
所以我尝试同时输出到同一个声卡上的多个接收器。找到这篇文章:https://wiki.archlinux.org/title/WirePlumber 在 2.6(同时输出到同一声卡上的多个接收器)下描述了我的场景。 (我想......)所以我尝试了。但它不起作用(只有一个连接并选定的接收器发出声音)
在执行所描述的场景之前,我只能在 pavucontrol 中选择一个接收器。之后我的所有接收器都是可选的 -> 所以这是进步,但不是我所期望的。我更深入地研究,我认为维基文章描述的内容不正确,或者我没有正确理解它。
我认为output-mappings = analog-stereo hdmi-stereo
不是维基描述的那样。无法找到“输出映射中的多个描述接收器”的另一个来源。另一方面,这是 ALSA 卡配置文件配置文件,用于定义特征而不是链接接收器。
因此,在深入挖掘之后,我认为这需要在电线管工中完成。在我无法通过谷歌搜索完成这项工作后,我问chatgpt。他的想法是一个将流路由到接收器的接线工策略。
但它不起作用,或者我做得不正确。该文档也对我没有帮助。
让我们来了解一下技术吧。
首先我检查输出是否在内核端工作
aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC233 Analog [ALC233 Analog]
Subdevices: 0/1
Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 3: HDMI 0 [VSEVEN]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 7: HDMI 1 [TD1655]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 8: HDMI 2 [HDMI 2]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 9: HDMI 3 [HDMI 3]
Subdevices: 1/1
Subdevice #0: subdevice #0
systemctl --user mask pipewire{,-pulse} wireplumber --no
speaker-test -Dhw:0,0 -c2 => works! headphone jack
speaker-test -Dhw:0,3 -c2 => works! displayport Port
speaker-test -Dhw:0,7 -c2 => works! hdmi(2) Port
systemctl --user unmask pipewire{,-pulse} wireplumber --no
调整 alsa 和wireplumber(来自 archwiki 的 2.6)
vim /usr/share/alsa-card-profile/mixer/profile-sets/multiple.conf
添加:
[General]
auto-profiles = no
[Mapping analog-stereo]
device-strings = front:%f
channel-map = left,right
paths-output = analog-output analog-output-lineout analog-output-speaker analog-output-headphones analog-output-headphones-2
paths-input = analog-input-front-mic analog-input-rear-mic analog-input-internal-mic analog-input-dock-mic analog-input analog-input-mic analog-input-linein analog-input-aux analog-input-video analog-input-tvtuner analog-input-fm analog-input-mic-line analog-input-headphone-mic analog-input-headset-mic
priority = 15
[Mapping hdmi-stereo]
description = Digital Stereo (HDMI)
device-strings = hdmi:%f
paths-output = hdmi-output-0
channel-map = left,right
priority = 9
direction = output
[Profile multiple]
description = Output to All
output-mappings = analog-stereo hdmi-stereo
vim /usr/share/wireplumber/main.lua.d/51-alsa-custom.lua
rule = {
matches = {
{
{ "device.nick", "matches", "HDA Intel PCH" },
},
},
apply_properties = {
["api.alsa.use-acp"] = true,
["api.acp.auto-profile"] = false,
["api.acp.auto-port"] = false,
["device.profile-set"] = "multiple.conf",
["device.profile"] = "multiple",
},
}
table.insert(alsa_monitor.rules,rule)
检查接线工(如果我们现在拥有所有 (2) 个水槽)
wpctl status
Audio
├─ Devices:
│ 40. Built-in Audio [alsa]
│
├─ Sinks:
│ * 41. Built-in Audio Analog Stereo [vol: 0.79 MUTED]
│ 42. Built-in Audio Digital Stereo (HDMI) [vol: 0.72]
│
├─ Sink endpoints:
│
├─ Sources:
│
├─ Source endpoints:
│
└─ Streams:
53. Chromium
54. output_FL > ALC233 Analog:playback_FL [active]
55. output_FR > ALC233 Analog:playback_FR [active]
2 个可用的接收器(我们之前看到的第三个接收器未出于测试目的而连接)。
在执行上述步骤之前,我只能看到一个处于 wpctl 状态的接收器。
创建接线员策略
注意:我检查了正确的媒体名称和节点名称,pactl list sinks
甚至尝试了一些变化。
vim /usr/share/wireplumber/policy.lua.d/15-chromium-sink.lua
policy = {
{
{
matches = {
{
{ "media.name", "==", "Playback" }
}
},
actions = {
{ type = "route", path = "alsa_output.pci-0000_00_1f.3.analog-stereo" },
{ type = "route", path = "alsa_output.pci-0000_00_1f.3.hdmi-stereo" }
}
}
}
}
我重新启动后或刚刚重新启动wireplumber(和铬),systemctl --user restart wireplumber
但它不起作用。 (仅在一个接收器上输出)
接线工错误日志
我找不到我的政策的相关日志。
不知道该政策是否被使用或是否正确......
在wireplumber服务重新启动后journalctl显示:
Oct 13 10:38:48 xxx wireplumber[907]: stopped by signal: Terminated
Oct 13 10:38:48 xxx systemd[896]: Stopping wireplumber.service - Multimedia Service Session Manager...
Oct 13 10:38:48 xxx wireplumber[907]: disconnected from pipewire
Oct 13 10:38:48 xxx systemd[896]: Stopped wireplumber.service - Multimedia Service Session Manager.
Oct 13 10:38:48 xxx systemd[896]: Started wireplumber.service - Multimedia Service Session Manager.
Oct 13 10:38:48 xxx wireplumber[2059]: SPA handle 'api.libcamera.enum.manager' could not be loaded; is it installed?
Oct 13 10:38:48 xxx wireplumber[2059]: PipeWire's libcamera SPA missing or broken. libcamera not supported.
Oct 13 10:38:48 xxx wireplumber[2059]: GetManagedObjects() failed: org.freedesktop.DBus.Error.NameHasNoOwner
Oct 13 10:38:48 xxx wireplumber[2059]: <WpSiAudioAdapter:0x558c5887c3c0> Object activation aborted: proxy destroyed
Oct 13 10:38:48 xxx wireplumber[2059]: <WpSiAudioAdapter:0x558c5887c3c0> failed to activate item: Object activation aborted: proxy destroyed
解决方法测试1
使用pactl load-module module-combine-sink
创建组合水槽。如果我手动将 Chromium 设置为该接收器并pavucontrol
输出到所有设备。但如何使用wireplumber 直接自动执行此操作。
解决方法测试2
如此处所述https://discussion.fedoraproject.org/t/configure-audio-for-simultaneous-output/74946/7
pactl load-module module-null-sink media.class=Audio/Sink sink_name=my-combined-sink channel_map=stereo
启动qjackctl
并在“图表”下链接连接。目前还不知道如何使这种改变永久化。
这必须直接与wireplumber一起工作 - 对吗?对吧? ;)