Adamcake / Bolt

An alternative launcher for your favourite MMO
GNU Affero General Public License v3.0
162 stars 23 forks source link

Audio is played via HDMI Instead of Default Audio Device on Arch Linux #28

Closed Kaelygon closed 7 months ago

Kaelygon commented 7 months ago

bolt-launcer version 0.8.2-1 (from AUR) OS: Arch linux 6.7.5 Motherboard: X570 GPU: GTX 1080 nvidia 545.29.06-4 Audio drivers: alsa pulseaudio pulseaudio-alsa

Audio output works perfectly with official Runelite launcher although I can't login due to Jagex account requirement. But whenever I use the bolt-launcher the audio is played in my monitor speakers via HDMI and the audio output doesn't show anywhere in Pavucontrol. Even when everything is muted the Runelite audio plays on the monitor speakers when launched via bolt-launcher.

I have: -Reinstalled all audio drivers -Reset all audio driver related configurations -In /etc/modprobe.d/blacklist.conf I added lines: blacklist snd_hda_codec_hdmi blacklist snd_hda_codec_nvhdmi -In /etc/pulse/default.pa I added line: set-default-sink alsa_output.pci-0000_0b_00.4.analog-stereo -Set default sink to card 1 "$ pacmd set-default-sink 1" -Tried RuneLite JAR extracted from official appimage but this made no difference

I have 3 monitors: DVI-D, HDMI and one DP. Audio is always played from the HDMI monitor. I have ran out of ideas what to do. Audio works perfectly fine with the official Runelite launcher. I didn't find any audio device settings in bolt-launcher, Runelite or Runescape.

$ pactl info | grep "Default Sink"
Default Sink: alsa_output.pci-0000_0b_00.4.analog-stereo
$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: NVidia [HDA NVidia], device 3: Generic Digital [Generic Digital]
  Subdevices: 0/1

  Subdevice #0: subdevice #0
card 1: Generic [HD-Audio Generic], device 0: ALC1220 Analog [ALC1220 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: Generic [HD-Audio Generic], device 1: ALC1220 Digital [ALC1220 Digital]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

$ aplay -L aplayL.txt

Console log bolt-launcher.log

I appreciate any help and I'm happy to provide more information as needed

Kaelygon commented 7 months ago

I tested various things and I believe this did the trick:

I added this to alsa config /etc/asound.conf

defaults.pcm.card 1
defaults.ctl.card 1

then $sudo systemctl restart alsa-utils

And finally the audio comes from the speakers. Although the audio isn't affected by pavucontrol.

I'm still a bit confused why this matters with bolt-launcher but starting Runelite client directly would work without this workaround. It would be nice to know whether this is an issue with bolt-launcher or on my system.

Kaelygon commented 7 months ago

Nevermind that. /etc/asound.conf didn't have anything to do with it I believe. It appears that the audio is forced to play through HDMI and monitor speakers when there's an other audio source playing. If Runelite launched via bolt-launcher is the first audio source, no other audio can be played until runelite is closed.

journalctl error when trying to playback with Runelite already open Mar 01 17:41:03 kaelygon.net pulseaudio[710]: Error opening PCM device front:1: Device or resource busy This results in no desktop audio but Runelite audio plays through desktop speakers

Errors starting Runelite when an other audio source is playing Mar 01 17:43:20 kaelygon.net kernel: snd_hda_intel 0000:09:00.1: spurious response 0x0:0x0, last cmd=0x1f0500 This results in Desktop audio is played through desktop speakers but Runelite audio is played through HDMI monitor speakers

Kaelygon commented 7 months ago

With few more tests it seems that the issue is with my system. Just the Runelite client without bolt-launcher does the exact same thing, so the issue is definitely with my audio configuration. By chance I didn't have any audio sources playing when I tested audio the official Runelite client

Kaelygon commented 7 months ago

This might be related to https://github.com/Adamcake/Bolt/issues/19 where this "Runelite locks /dev/snd" bug was discussed https://github.com/runelite/runelite/issues/3525

Adamcake commented 7 months ago

This could possibly be an issue with XDG environment variables not being set, or with needing to set PULSE_RUNTIME_PATH as in the issue you linked. Worth a try, but I don't get the impression that it's either of those things. It seems more likely your audio is going directly via ALSA, which can sometimes handle multiple audio sources but can be quite finnicky about it, especially if the game isn't coded correctly. https://www.reddit.com/r/linux4noobs/comments/9wc6yd/alsa_only_allowing_one_audio_source_at_a_time/

I suggest just using Pipewire, personally. It solves all these issues.

Kaelygon commented 7 months ago

I suggest just using Pipewire, personally. It solves all these issues.

That fixed it, thanks! I have had a few alsa/pulse related issues before with other programs such as portaudio or audacity. And there's so many different audio packages which makes things even more confusing for me.

Thankfully simply installing pipewire without any reconfig fixed the issue.

Adamcake commented 7 months ago

Linux audio is a very confusing world. Fortunately, "switch to pipewire" tends to solve almost all problems with it these days.

Glad I could help anyway.