Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Remember sound output between Desktop & Gamescope #912

Open
JaCh0o opened this issue Mar 25, 2024 · 28 comments
Open

Feature Request: Remember sound output between Desktop & Gamescope #912

JaCh0o opened this issue Mar 25, 2024 · 28 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@JaCh0o
Copy link

JaCh0o commented Mar 25, 2024

Describe the bug

Hello,
Every time I restart/turn off/update BazziteOS I have to change sound output settings from mini Jack to sound thru HDMi to my TV. Is there any chance to correct this ?

What did you expect to happen?

I would expect to just set it once and I won't change to any other or this one will disappear it will be set permanently.

Output of rpm-ostree status

No response

Hardware

No response

Extra information or context

No response

@nicknamenamenick
Copy link
Contributor

This is because Valve doesn't set defaults for audio in Game Mode. They rely on Wireplumber to set the default. You can try going into desktop mode and changing the sound output in the system settings by going into Audio --> Devices --> and fiddling with audio profiles. I assume you're using KDE Plasma because you didn't give any information on that.

@E5ants
Copy link

E5ants commented Mar 28, 2024

Você precisa desativar o fone de ouvido como fonte de áudio no modo desktop, deixe apenas o HDMI como opção disponível

@BigNerv
Copy link

BigNerv commented Mar 30, 2024

I have the same problem.
Set the default audio device to Navi 21/23 HDMI/DP in desktop mode.
After switching to game mode the default audio device is set to Default (Auto) and it uses the Audio Adapter (Unitek Y-247A).

System: Minisforum HX99G
Bazzite 39 (latest)

@JaCh0o
Copy link
Author

JaCh0o commented Mar 30, 2024 via email

@E5ants
Copy link

E5ants commented Mar 30, 2024

You have to go to the audio settings in desktop mode and disable headphones as an output. then only HDMI will remain, which will remain as default. In my case it worked.

@nicknamenamenick
Copy link
Contributor

nicknamenamenick commented Apr 2, 2024

Actually I really don't understand why bizzite os can't correct something which is clearly it's problem. Steam deck as console just don't have any other similar outputs as pc based steam consoles with bazzite os. sob., 30 mar 2024, 08:20 użytkownik BigNerv @.***> napisał:

I have the same problem. Set the default audio device to HDMI in desktop mode. After switching to game mode the default audio device is set to speaker out.

It's a Steam Gaming Mode "issue" and because it's proprietary software, we cannot have a universal fix for all hardware.

@KyleGospo
Copy link
Member

Steam game mode defaults to whatever Wireplumber's configured default is. You will need to adjust your configs to correct this.

@Cm4nXD
Copy link

Cm4nXD commented Jun 7, 2024

How do I modify the WirePlumber config if it’s in /usr/share? Isn’t that directory not able to be modified on ublue?

@KyleGospo
Copy link
Member

KyleGospo commented Jun 7, 2024

How do I modify the WirePlumber config if it’s in /usr/share? Isn’t that directory not able to be modified on ublue?

It can be modified with configuration files in your home directory, and in /etc

@ThiagoLuiz2001
Copy link

ThiagoLuiz2001 commented Jun 15, 2024

Steam game mode defaults to whatever Wireplumber's configured default is. You will need to adjust your configs to correct this.

how can we adjust this? i'm new on linux

@kennethso168
Copy link

kennethso168 commented Jul 1, 2024

Here is an example I have posted in the forums. Reposting as below

I'm only posting this in the perspective of non-deck version of Bazzite (i.e. no game/deck mode). I have a problem that Bazzite switches the default audio device to the onboard sound card when I starts a sunshine stream. I found that the order of audio device is determined by wireplumber. I have successfully set my desktop to use my HDMI monitor (actually connected via DisplayPort) as the default audio device without disabling the onboard sound card.

First, open a terminal, run wpctl status and note the ID next to each sink under Audio

k7so@bazzite:~$ wpctl status
...
Audio
 ├─ Devices:
 │      50. Renoir Radeon High Definition Audio Controller [alsa]
 │      51. Family 17h/19h HD Audio Controller  [alsa]
 │  
 ├─ Sinks:
 │      53. Family 17h/19h HD Audio Controller Digital Stereo (IEC958) [vol: 1.00]
 │  *   62. Renoir Radeon High Definition Audio Controller Digital Stereo (HDMI 2) [vol: 0.64]
 │  
 ├─ Sources:
 │      54. Family 17h/19h HD Audio Controller Analog Stereo [vol: 1.00]
 │  
 ├─ Filters:
 │  
 └─ Streams:
...

Note that the ID for "Family 17h..." (my onboard sound card) is 53 and that for HDMI is 62.

Then, run wpctl inspect <id>, where <id> is the ID I mentioned above. Note the value for priority.driver and priority.session.

k7so@bazzite:~$ wpctl inspect 53
id 53, type PipeWire:Interface:Node
...
  * node.description = "Family 17h/19h HD Audio Controller Digital Stereo (IEC958)"
    node.driver = "true"
  * node.name = "alsa_output.pci-0000_06_00.6.iec958-stereo"
...
  * priority.driver = "736"
  * priority.session = "736"
k7so@bazzite:~$ wpctl inspect 62
id 62, type PipeWire:Interface:Node
...
  * node.description = "Renoir Radeon High Definition Audio Controller Digital Stereo (HDMI 2)"
    node.driver = "true"
  * node.name = "alsa_output.pci-0000_06_00.1.hdmi-stereo-extra1"
...
  * priority.driver = "632"
  * priority.session = "632"

You can see that the priority for the onboard card is 736, while that for the HDMI is 632. As the onboard sound card has higher priority it will be preferred.

To fix this, we can add a config file to override the priority value for the onboard card.

Open Kate (the text editor), open a new file and paste the following contents:

monitor.alsa.rules = [
  {
    matches = [
      {
        node.name = "alsa_output.pci-0000_06_00.6.iec958-stereo"
      }
    ]
    actions = {
      update-props = {
         priority.driver = 500
         priority.session = 500
      }
    }
  }
]

In the config the part after node.name should match the node.name as shown in the wpctl inspect output. I change the priority from 736 to 500 so that it will be lower than that for my HDMI.

Save this file as /home/<your username>/.config/wireplumber/wireplumber.conf.d/51-deprio-onboard.conf. In other words, we put this file into the /home/<your username>/.config/wireplumber/wireplumber.conf.d/ directory (you need to create the intermediate directories yourself). And the name for the file is 51-deprio-onboard.conf (actually only the beginning 51- and file extension .conf matter, you can name the middle part to anything as you wish).

After placing that config file, run the command systemctl --user restart wireplumber to restart the wireplumber service.

Double check the priorities using wpctl status and wpctl inspect <id> (note that the ID will change after restarting wireplumber). You can see that the priority has been changed as desired.

Adapt this to your needs. Just remember that the priority should not be set to higher than 1500.

Reference: https://blog.zenlinux.com/2022/08/how-to-configure-audio-device-priorities-in-pipewire-wireplumber/ (However the configuration part is outdated)

Edit: I played around the sound setting a little more and found that the "Default Configured Devices" shown in wpctl status also matters. If there is the device that matches the default configured device, then that device should be chosen as the output. If not the device with highest priority will be chosen. It can be changed by wpctl set-default <id> or just by selecting that device in KDE.

@RayBa82
Copy link

RayBa82 commented Jul 5, 2024

For me this does not work because it is not the wrong device, it is the wrong output selected.

Always output:hdmi-stereo-extra1 instead of output:hdmi-surround-extra1.

So since the update to Fedora 40 i have only stereo sound, before that update everything was fine. Now bazzite can't even play 5.1 sound for me anymore in gamemode.

@RayBa82
Copy link

RayBa82 commented Jul 7, 2024

I made a wireplumber config, that always the 5.1 profile is selected for the device and put it in "/home//.config/wireplumber/wireplumber.conf.d/51-deprio-onboard.conf", but this does not help.

After a reboot always stereo is selected until i ssh into bazzite and do "systemctl --user restart wireplumber". Restarting wireplumber sets the audio to 5.1 as configured in my config.

So How can I make this annoying process as ist was before? Obviously my wireplumber config is ignored on boot....

@kennethso168
Copy link

Please post your config file and the complete output of wpctl status

@RayBa82
Copy link

RayBa82 commented Aug 10, 2024

Sorry I deleted my config file and wiped everything, did a fresh clean install of bazzite deck image and it is still not working....

This is so damn annoying.
I will try to recreate my config, since this is obviously the only way to get surround sound running with bazzite...

@GalaticStryder
Copy link

@JaCh0o I was having the same issue, managed to fix it by setting the onboard audio card to Inactive state on Desktop Mode. After reboot the audio was kept on HDMI.

@RayBa82
Copy link

RayBa82 commented Aug 19, 2024

This is my config file, I don't have problems with selecting the right card, for me the stereo profile is always selected after every boot or when switching between desktop and gamemode.

This file is located in "/home/bazzite/.config/wireplumber/wireplumber.conf.d/51-surround.conf"

When I ssh into bazzite after gamemode is started and doing "systemctl --user restart wireplumber" 5.1 sound is working.

Please provide me a way to have it working like before, without ever touching any config files or ssh into bazzite everytime you want to play...

monitor.alsa.rules = [
  {
    matches = [
      {
         alsa.name = "HDMI 1"
      }
    ]
    actions = {
      update-props = {
         device.profile = "hdmi-surround-extra1"
      }
    }
  }
]

"wpctl status" output after boot

wpctl status
PipeWire 'pipewire-0' [1.0.7, bazzite@bazzite, cookie:918612595]
 └─ Clients:
        31. uresourced                          [1.0.7, bazzite@bazzite, pid:5874]
        32. WirePlumber                         [1.0.7, bazzite@bazzite, pid:5897]
        40. WirePlumber [export]                [1.0.7, bazzite@bazzite, pid:5897]
        51. Chromium input                      [1.0.7, bazzite@bazzite, pid:7198]
        53. wpctl                               [1.0.7, bazzite@bazzite, pid:7978]
        64. gamescope                           [1.0.7, bazzite@bazzite, pid:6060]
        67. pipewire                            [1.0.7, bazzite@bazzite, pid:6412]
        68. Steam Voice Settings                [1.0.7, bazzite@bazzite, pid:6274]
        69. Steam                               [1.0.7, bazzite@bazzite, pid:6274]

Audio
 ├─ Devices:
 │      41. Navi 31 HDMI/DP Audio               [alsa]
 │      42. Rembrandt Radeon High Definition Audio Controller [alsa]
 │      43. Family 17h/19h HD Audio Controller  [alsa]
 │
 ├─ Sinks:
 │  *   47. Navi 31 HDMI/DP Audio Digital Stereo (HDMI 2) [vol: 1.00]
 │
 ├─ Sources:
 │
 ├─ Filters:
 │
 └─ Streams:

Video
 ├─ Devices:
 │      58. OBS Virtual Camera                  [v4l2]
 │
 ├─ Sinks:
 │
 ├─ Sources:
 │  *   65. (null)
 │
 ├─ Filters:
 │
 └─ Streams:

Settings
 └─ Default Configured Devices:

"wpctl status" after connecting via ssh into bazzite and executing "systemctl --user restart wireplumber"

wpctl status
PipeWire 'pipewire-0' [1.0.7, bazzite@bazzite, cookie:918612595]
 └─ Clients:
        31. uresourced                          [1.0.7, bazzite@bazzite, pid:5874]
        43. WirePlumber [export]                [1.0.7, bazzite@bazzite, pid:8060]
        51. Chromium input                      [1.0.7, bazzite@bazzite, pid:7198]
        58. WirePlumber                         [1.0.7, bazzite@bazzite, pid:8060]
        64. gamescope                           [1.0.7, bazzite@bazzite, pid:6060]
        67. pipewire                            [1.0.7, bazzite@bazzite, pid:6412]
        68. Steam Voice Settings                [1.0.7, bazzite@bazzite, pid:6274]
        69. Steam                               [1.0.7, bazzite@bazzite, pid:6274]
        71. wpctl                               [1.0.7, bazzite@bazzite, pid:8072]

Audio
 ├─ Devices:
 │      32. Family 17h/19h HD Audio Controller  [alsa]
 │      41. Rembrandt Radeon High Definition Audio Controller [alsa]
 │      42. Navi 31 HDMI/DP Audio               [alsa]
 │
 ├─ Sinks:
 │  *   39. Navi 31 HDMI/DP Audio Digital Surround 5.1 (HDMI 2) [vol: 1.00]
 │
 ├─ Sources:
 │
 ├─ Filters:
 │
 └─ Streams:

Video
 ├─ Devices:
 │      60. OBS Virtual Camera                  [v4l2]
 │
 ├─ Sinks:
 │
 ├─ Sources:
 │  *   65. (null)
 │
 ├─ Filters:
 │
 └─ Streams:

Settings
 └─ Default Configured Devices:

"wpctl status" does not show inactive devices, I don't think this is very useful.

The main problem for me is, where can I configure it persistently? Even if that would mean I need to fiddle around with this config shit, I really need a solution.

@RayBa82
Copy link

RayBa82 commented Aug 20, 2024

I have multiple versions of a working wireplumper system.d configs which work all after doing a manual "systemctl --user restart wireplumber" after a reboot. Played around with priorities, default sink and all that stuff. I am out of options.
Nothing works! The wireplumber rules are just not applied after reboot or have other timing issues.

Last try is now to setup a service which just executes this command 30s after a reboot, maybe that helps me at least to avoid to do this manually after every reboot....

I am fighting this issue now for months, it is getting ridiculous that there is no solution for that...

@RayBa82
Copy link

RayBa82 commented Aug 20, 2024

Ok my "final" solution which seems to work is the following:

  • create a working wireplumber.conf as in any examples explained before this post (just verify "wpctl status" after doing "systemctl --user restart wireplumber", output depends on your hardware)
  • create a service file which will be executed by a timer after boot: vi ~/.config/systemd/user/set-surround.service
  • paste the following content into that file:
[Unit]
Description=Set Sink in PipeWire (user session)

[Service]
Type=oneshot
ExecStart=systemctl --user restart wireplumber

[Install]
WantedBy=default.target
  • create a timer which is executed on boot: vi ~/.config/systemd/user/set-surround.timer
  • paste the follwowing content into that file:
[Unit]
Description=Wait some second before run set-surround.service

[Timer]
OnActiveSec=60sec
AccuracySec=1s

[Install]
WantedBy=timers.target
  • execute "systemctl --user daemon-reload"
  • execute "systemctl --user enable set-surround.timer"
  • reboot the system

Tadaaaaa:

60 seconds after boot I have 5.1 sound working.
Wow, that was easy and user friendly. Months of not having surround sound in bazzite after boot is now finally solved for me (Until I need to setup a clean install and I will probably not remember this anymore).

Before I just selected in desktop mode the sound setup and the settings were also valid in game mode.

Tell that any Windows user and they will never ever even consider to use this OS :-D

Copy link

dosubot bot commented Nov 19, 2024

Hi, @JaCh0o. I'm Dosu, and I'm helping the bazzite team manage their backlog. I'm marking this issue as stale.

Issue Summary:

  • BazziteOS does not retain sound output settings, requiring manual switching from mini Jack to HDMI after restarts or updates.
  • Users, including nicknamenamenick and E5ants, suggest adjusting audio settings and modifying Wireplumber configurations.
  • RayBa82 provides a workaround using a systemd service to restart Wireplumber for maintaining 5.1 surround sound settings.
  • The issue remains unresolved, highlighting the complexity of audio configuration in BazziteOS.

Next Steps:

  • Please confirm if this issue is still relevant to the latest version of the bazzite repository by commenting here.
  • If no further input is provided, the issue will be automatically closed in 14 days.

Thank you for your understanding and contribution!

@dosubot dosubot bot added the stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed label Nov 19, 2024
@Cm4nXD
Copy link

Cm4nXD commented Nov 19, 2024

This issue still happens on the latest version of bazzite. It happens when switching between desktop mode and gamemode as well as restarting / updating.

@KyleGospo
Copy link
Member

KyleGospo commented Nov 19, 2024

This issue still happens on the latest version of bazzite. It happens when switching between desktop mode and gamemode as well as restarting / updating.

That's because this is working as intended, SteamOS does the exact same thing. This is not an issue, it is a feature request and nobody's working on it.

@dosubot dosubot bot removed the stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed label Nov 19, 2024
@RayBa82
Copy link

RayBa82 commented Nov 19, 2024

But we are not using SteamOS, we are using bazzite, which claims to be a full linux gaming solution, but is is obviously not.
As a bazzite Desktop user I don't care how SteamOS's beaviour on handheld is intended.

Just remove the desktop variant and I can agree to a "new feature", otherwise just make basic requirements to work.

As a HTPC/Desktop User bazzite is getting worse, not better

@KyleGospo
Copy link
Member

KyleGospo commented Nov 19, 2024

PRs are open, you are welcome to create this feature. We might even accept it if it doesn't break another use case.

@KyleGospo KyleGospo added the enhancement New feature or request label Nov 19, 2024
@KyleGospo KyleGospo changed the title Bazzite HTPC Edition is not remembering last sound output Feature Request: Remember sound output between Desktop & Gamescope Nov 19, 2024
@KyleGospo KyleGospo added the help wanted Extra attention is needed label Nov 19, 2024
@RayBa82
Copy link

RayBa82 commented Nov 19, 2024

If I would have any knowledge about that, I would have done that. I guess anyone with this problem would love to do that.

Such a poor and sad answer makes me realize, I have to start looking for alternatives and install another OS and losing all my mods...

The saddest thing is, when I started using bazzite that all worked like a charm, then it broke and no one cares...

@KyleGospo
Copy link
Member

If this was solved elsewhere it'd be fixed everywhere. This has worked this way since launch and works this way on every alternative.

@Cm4nXD
Copy link

Cm4nXD commented Nov 19, 2024

If I would have any knowledge about that, I would have done that. I guess anyone with this problem would love to do that.

Such a poor and sad answer makes me realize, I have to start looking for alternatives and install another OS and losing all my mods...

The saddest thing is, when I started using bazzite that all worked like a charm, then it broke and no one cares...

I disregard the notion that this is more of a feature request and not a bug. If the vast majority of people expect something to work a certain way, and it doesn’t, then it is a bug. Even if it’s not explicitly the result of unintended behavior, and more of a lack of foresight (on valves part, as they made the source software). However, this is an open source project developed for free in people’s own personal time. Threatening to switch platforms doesn’t change the fact that extra work has to go into altering the default behavior from the source software that this project is based upon. Besides this is Linux. There are ALWAYS steps needed to tinker things the way you like.

@ublue-os ublue-os locked and limited conversation to collaborators Nov 19, 2024
@KyleGospo
Copy link
Member

KyleGospo commented Nov 19, 2024

I will leave this feature request locked to contributors until a PR is opened and further discussion is required.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

10 participants