Sample Header Ad - 728x90

Wireplumber - Simultaneous output to multiple sinks on the same sound card

1 vote
0 answers
1346 views
I'm using Fedora 38 (6.5.6-200.fc38.x86_64 ) wireplumber: Compiled with libwireplumber 0.4.14 pipewire: Compiled with libpipewire 0.3.81 So i try to Simultaneous output to multiple sinks on the same sound card. Found this Article: https://wiki.archlinux.org/title/WirePlumber And under 2.6 ( Simultaneous output to multiple sinks on the same sound card) my Scenario is described. (i thought ...) So i tryed that. But it doesnt work (only one connected and selected Sink gets Sound) Before doing the described scenario i only could select one Sink in pavucontrol. After that all my Sinks are selectable -> so that was progress but not what i was expecting. I dig deeper and i think what the Wiki Article describes is not correct or i dont understand it correctly. I think output-mappings = analog-stereo hdmi-stereo does not what the wiki describes. Couldnt find another source of "multiple describe sinks in output-mappings". And on the other hand this is the ALSA card profile configuration file, which are used to define the characteristics and not linking sinks. ---- so after digging even deeper i think this needs to be done in wireplumber. After i couldnt make this work with googling around i ask chatgpt. His idea was a wireplumber Policy for routing a Stream to the Sinks. But it doesn't work or I'm not doing it correctly. The documentation doesn't help me either. --- lets get technical. ## First i checked if the Outputs are working Kernel Side 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 ## adjusting alsa and wireplumber (2.6 from archwiki) vim /usr/share/alsa-card-profile/mixer/profile-sets/multiple.conf add:
[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)
## check wireplumber (if we now have all (2) sinks) 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 Sinks available (the third one we saw earlier is not connect for testing purpose). Before doing the steps above i only could see one sink in wpctl status. ## create a wireplumber Policiy Note: i checked for correct media-names and node-name with pactl list sinks and even tryed some variations. 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" }
      }
    }
  }
}
i rebooted after or just restarted wireplumber (and chromium) with systemctl --user restart wireplumber but it doesnt work. (only output on one sink) ## wireplumber error log i cant find relevant logs for my policy. Don't know if the policy gets used or is correct either ... After a wireplumber service restart journalctl shows:
Oct 13 10:38:48 xxx wireplumber: stopped by signal: Terminated
Oct 13 10:38:48 xxx systemd: Stopping wireplumber.service - Multimedia Service Session Manager...
Oct 13 10:38:48 xxx wireplumber: disconnected from pipewire
Oct 13 10:38:48 xxx systemd: Stopped wireplumber.service - Multimedia Service Session Manager.
Oct 13 10:38:48 xxx systemd: Started wireplumber.service - Multimedia Service Session Manager.
Oct 13 10:38:48 xxx wireplumber: SPA handle 'api.libcamera.enum.manager' could not be loaded; is it installed?
Oct 13 10:38:48 xxx wireplumber: PipeWire's libcamera SPA missing or broken. libcamera not supported.
Oct 13 10:38:48 xxx wireplumber: GetManagedObjects() failed: org.freedesktop.DBus.Error.NameHasNoOwner
Oct 13 10:38:48 xxx wireplumber:  Object activation aborted: proxy destroyed
Oct 13 10:38:48 xxx wireplumber:  failed to activate item: Object activation aborted: proxy destroyed
------- ## workaround test 1 using pactl load-module module-combine-sink creates the combined sink. if i manually set my Chromium to this sink in pavucontrol its outputing to all devices. But how to do this with wireplumber directly and automatically. ## workaround test 2 As described here 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 Start qjackctl and under "Graph" link the connections. Couldnt figure out yet how to make this change permanent. ---- This has to be working directly with wireplumber - right?? RIGHT GUYS???? ;)
Asked by Frankstar (131 rep)
Oct 16, 2023, 07:27 AM