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

Default audio sink not respect by gamescope session #1195

Open
Kidswiss opened this issue Jun 1, 2024 · 16 comments
Open

Default audio sink not respect by gamescope session #1195

Kidswiss opened this issue Jun 1, 2024 · 16 comments

Comments

@Kidswiss
Copy link

Kidswiss commented Jun 1, 2024

Describe the bug

When I change my default audio sink via:

pactl set-default-sink alsa_output.pci-0000_0b_00.1.hdmi-surround-extra3

and then start a gamescope-session, it will reset it to another sink.

What did you expect to happen?

That the default sink set by pactl is not changed.

Output of rpm-ostree status

Deployments:
● ostree-image-signed:docker://ghcr.io/ublue-os/bazzite-deck-gnome:stable
                   Digest: sha256:2fe1600a06aa6827efcdb9854b5349d50c685629655125732ccb42c6758925bd
                  Version: 40.20240427.0 (2024-04-27T22:40:11Z)
          LayeredPackages: eza gparted htop kitty ncdu zsh
            LocalPackages: lact-libadwaita-0.5.4-0.x86_64

Hardware

AMD Ryzen 7 5800X, AMD 6800

Extra information or context

No response

@KyleGospo
Copy link
Member

Default audio is set by Wireplumber. This matches how SteamOS handles this. You'll need to configure that.

@Kidswiss
Copy link
Author

Kidswiss commented Jun 2, 2024

Thanks for the answer.

Unfortunately with wpctl it doesn't work either. As soon as the gamescope session starts, the default gets reset.

it happens either when rebooting or switching to desktop and back to gamescope session.

@ChaosBlades
Copy link

Wireplumber is the most convoluted thing that a normal user would need to use I have ran across in my time using linux. It is like needing to change cam timing in order to turn on your windshield wipers. Spent a week trying to get it to work with no success.

For whatever reason wpctl status does not list inactive sinks. Need to go old school in order to avoid further convoluted nonsense.

You don't need to use sudo for any of this.

pactl list

You are looking for the name and output you want to use. Change yours to whatever you need them to be. I will just list what I need to use.

Name: alsa_card.pci-0000_09_00.1
output:hdmi-surround-extra3

nano ~/.config/systemd/user/set-surround.service

[Unit]
Description=Set Sink in PipeWire (user session)

[Service]
Type=oneshot
ExecStart=sh -c "sleep 30; /usr/bin/pactl set-card-profile alsa_card.pci-0000_09_00.1 output:hdmi-surround-extra3"

[Install]
WantedBy=default.target

systemctl --user daemon-reload
systemctl --user enable set-surround.service
systemctl --user start set-surround.service

On boot it will wait 30 seconds and switch the audio sink.

@WeslyG
Copy link

WeslyG commented Jun 26, 2024

@ChaosBlades Thank you so much for this detailed guide, I managed to do it a little differently.

For some reason, the output option didn't work for me, I tried different options, but it worked strangely.
i use this command

pactl list sinks short

46      alsa_output.pci-0000_03_00.1.hdmi-stereo-extra3 PipeWire        s32le 2-channel 4800  SUSPENDED
47      alsa_output.pci-0000_00_1f.3.iec958-stereo      PipeWire        s32le 2-channel 4800  SUSPENDED

my systemd unit looks like this

[Unit]
Description=Set Sink in PipeWire (user session)

[Service]
Type=oneshot
ExecStart=sh -c "sleep 30; /usr/bin/pactl set-default-sink alsa_output.pci-0000_03_00.1.hdmi-stereo-extra3"

[Install]
WantedBy=default.target

Of course, you need to make sure that everything works

systemctl --user daemon-reload
systemctl --user enable set-surround.service
systemctl --user start set-surround.service

and now the sound appears steadily after turning on the system after 30 seconds. It's much better than switching it every time)

@RayBa82
Copy link

RayBa82 commented Aug 14, 2024

There are so many audio issues since the update to Fedora 40, this cant be the solution.
There is defintely an issue, witch breaks anything. I cant't get to manage 5.1 audio to work since the update to Fedora 40.

And this worked before the update perfectly without telling all the users to fiddle around with any configuration files. Absolutley annoying...

Telling your users to handle some configuration files for a feature which worked before without that shit is not acceptable.

@KyleGospo
Copy link
Member

Telling your users to handle some configuration files for a feature which worked before without that shit is not acceptable.

PRs are open

@RayBa82
Copy link

RayBa82 commented Aug 14, 2024

Sorry my language, but I am struggling with this issue since a long time. Found a first workaround after the update to Fedora 40, but this is not working anymore. And now I can`t use my nice sound setup anymore :-(

But I really appreciate your response, and I will definetly give you feedback if my issues are resolved.
Try to identify the PRs now ;-)

@RayBa82
Copy link

RayBa82 commented Aug 20, 2024

@KyleGospo I could not find any PRs related to this issue, could you tell me which they are?
Because I am really eager to test them.

This issue is for me related to #912 where I am struggling to get my sound setup working

@GloriousEggroll
Copy link

GloriousEggroll commented Sep 21, 2024

@KyleGospo I could not find any PRs related to this issue, could you tell me which they are? Because I am really eager to test them.

This issue is for me related to #912 where I am struggling to get my sound setup working

He was stating that PRs are open as in -- if you think something can be done better, you're welcome to create a PR to try to fix it.

This is an open project. The devs do not owe you anything. Being disrespectful will get you nowhere.

@Kidswiss
Copy link
Author

This feels somewhat related:

40.20240922.0 completely breaks surround for me in gamescope session. Usually it works when setting it to surround in desktop mode and then switching back to gamescope. I can still set surround in desktop mode, but switching to gamescope will only produce stereo sound. I tried some solutions from #912, but they don't seem to work.

Rolling back to any version prior to seems to fix it again. Checking the commits, I see that gamescope got bumped, maybe that broke it?

@RayBa82
Copy link

RayBa82 commented Nov 4, 2024

This is for me the case since the update to Fedora 40.

No surround sound solution since more than a half year :-)
Bazzite always switches back to stereo in gamemode, and the games sometimes don't even show the surround sound "in game option", because bazzite does not recognize the sound set up correctly.

What a flaw for a "gaming" distribution...

And there is absolute no help for this topic and no interest by the ublue devs to solve it.

If it wasn't for MESA 24 i would switch back to a Fedora 39 build

@RayBa82
Copy link

RayBa82 commented Jan 6, 2025

Now this issue is magically solved in the testing branch, I can not pin point it to any specific build, but now I do have 5.1 sound just from boot without flaws. 2 weeks ago it was still stereo after reboot.

I am hearing the startup sound in 5.1, the first time since 9 months :-)

Can anybody with that problem confirm that?

@prestonsmartuk
Copy link

Now this issue is magically solved in the testing branch, I can not pin point it to any specific build, but now I do have 5.1 sound just from boot without flaws. 2 weeks ago it was still stereo after reboot.

I am hearing the startup sound in 5.1, the first time since 9 months :-)

Can anybody with that problem confirm that?

I've just tried the testing branch and no, this has not resolved the problem for me. Bazzite is still outputting Stereo mode, even if I trick my tv/sound system settings into showing 5.1 multi pcm, it's actually only stereo through Bazzite.

@ChaosBlades
Copy link

ChaosBlades commented Jan 12, 2025

My solution is still working. Have not needed to mess with it since I set up the service. Getting real 5.1 surround.

This very likely won't be fixed until Valve adds surround sound options to the Deck GUI when SteamOS is ready to be used beyond handhelds officially.

Really this is the only thing I am waiting on other than real HDMI 2.1 on AMD cards or I guess Nvidia to not be terrible on Linux.

Edit: Ublue could add a ujust script that assists with surround sound service creation. Only thing I can think of to make things easier until an official solution is added.

@prestonsmartuk
Copy link

prestonsmartuk commented Jan 12, 2025

Wireplumber is the most convoluted thing that a normal user would need to use I have ran across in my time using linux. It is like needing to change cam timing in order to turn on your windshield wipers. Spent a week trying to get it to work with no success.

For whatever reason wpctl status does not list inactive sinks. Need to go old school in order to avoid further convoluted nonsense.

You don't need to use sudo for any of this.

pactl list

You are looking for the name and output you want to use. Change yours to whatever you need them to be. I will just list what I need to use.

Name: alsa_card.pci-0000_09_00.1
output:hdmi-surround-extra3

nano ~/.config/systemd/user/set-surround.service

[Unit]
Description=Set Sink in PipeWire (user session)

[Service]
Type=oneshot
ExecStart=sh -c "sleep 30; /usr/bin/pactl set-card-profile alsa_card.pci-0000_09_00.1 output:hdmi-surround-extra3"

[Install]
WantedBy=default.target

systemctl --user daemon-reload systemctl --user enable set-surround.service systemctl --user start set-surround.service

On boot it will wait 30 seconds and switch the audio sink.

Can you give a bit more step by step on what to do! I'm newish to linux.
I found my name and output.

In terminal I have done nano ~/.config/systemd/user/set-surround.service

Now what do I do?

It has brought up gnu nano 8.1 and at the bottom in a red box it states Directory /home/bazzite/.config/systemmd/user does not exist

EDIT: Can't even write this command in GBU Nano 8.1. Once I do a write out it states:
Error Writing /home/bazzite/.config/systemd/user/set-surround.service: No such file or directory

EDIT 2: So I had to create a folder called systemd/user/ within bazzite/.config

Now within terminal when I do your last command systemctl --user start set-surround.service I get the following error message:

Job for set-surround.service failed because the control process exited with error code.
See "systemtcl --user status set-surround.service" and "journalctl --user -xeu set-surround.service" for details

@prestonsmartuk
Copy link

prestonsmartuk commented Jan 13, 2025

Hi all

I got surround sound working on Bazzite Gamemode on a Mini PC (with AMD iGPU [7840u CPU]- will likely work with external GPUs too).

I picked solution parts from this post #1195 but specifically this section #1195 (comment)

A lot simpler than all the methods been mentioned around the web and on Bazzite Discord. Here were my steps from memory, it may seem really long but it's actually super quick (10 minutes work max), I'm just breaking down all the steps bit by bit to assist people who aren't Linux gurus (I'm not a guru at all!)

  1. Go to desktop mode
  2. Under Settings > Sound > Ensure your HDMI sound device is set to 5.1 or 7.1 depending on your surround sound setup.
  3. Remember the name of this Surround Sound device.
  4. Open Terminal
  5. In Terminal type in pactl list and press enter on your keyboard
  6. This will bring up all your audio devices (it's a long list fyi)
  7. Now look for two key parts which you will need a little later. Yours will be called something a little different to mine due to different model of devices, but it will be somewhat similar so now please see the next two steps for the two similar parts you will be looking for:
  8. alsa_card.pci-0000_09_00.1 (the one that that references your surround sound device as noted in Step 3)
  9. hdmi-surround-extra3 (the one that references surround sound device as noted in Step 3)
  10. Make a note of these two you found in your pactl list (again, yours may be a slightly different string of text, but ensure you note the ones down that reference your surround sound)
  11. Using your bazzite desktop file explorer, go to bazzite/.config/ (you may need to show hidden files within the file explorer for the folder .config to show)
  12. Create a folder called systemd
  13. Within systemd folder, create another folder called user
  14. Go back to your Terminal window
  15. Within Terminal, type in nano ~/.config/systemd/user/set-surround.service and press enter on your keyboard
  16. This will now bring up GNU Nano 8.1.
  17. Type in (but read step 18 first to understand what parts you need to replace)
[Unit]
Description=Set Sink in PipeWire (user session)

[Service]
Type=oneshot
ExecStart=sh -c "sleep 30; /usr/bin/pactl set-default-sink [YOUR STEP 8 REFERENCE].[YOUR STEP 9 REFERENCE]"

[Install]
WantedBy=default.target
  1. So where I filled in [YOUR STEP REFERENCE] in step 17, you need to replace these with what you found in your list after your terminal command in Step 6. So if you picked your Surround Devices references correctly, the command you would type in should look something like this:
[Unit]
Description=Set Sink in PipeWire (user session)

[Service]
Type=oneshot
ExecStart=sh -c "sleep 30; /usr/bin/pactl set-default-sink alsa_output.pci-0000_03_00.1.hdmi-stereo-extra3"

[Install]
WantedBy=default.target
  1. Now DON'T press enter on your keyboard, instead press on your keyboard together CTRL + O to write this command (that is an O not a zero btw)
  2. Now press on your keyboard together CTRL + X to exit
  3. You should now be back into Terminal
  4. In Terminal type in systemctl --user daemon-reload and press enter on your keyboard
  5. In Terminal type in systemctl --user enable set-surround.service and press enter on your keyboard
  6. In Terminal type in systemctl --user start set-surround.service and press enter on your keyboard
  7. NOW WAIT - this might look like it's doing nothing but wait until it's done (no more than approx 5 minutes)
  8. If no errors are showing after STEP 24 and Terminal returns back to give you a prompt to allow you to type again you're good to go.
  9. If you have an error message, you have not followed these steps correctly - please go back and re-read.
  10. If no errors, you may now reboot your device and enjoy marvelous surround sound again in Game mode via Bazzite.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants