[2.1.9] Linux audio sometimes chooses non-default audio device

Anything that prevents you from playing the game properly. Do you have issues playing for the game, downloading it or successfully running it on your computer? Let us know here.
gridstop
Long Handed Inserter
Long Handed Inserter
Posts: 68
Joined: Sun Jul 17, 2016 1:46 am
Contact:

[2.1.9] Linux audio sometimes chooses non-default audio device

Post by gridstop »

I'm sure this will be an odd/difficult one to track down.

I'm running Arch w/ KDE Plasma, everything updated. Both 2.0.77 and 2.1.x select PulseAudio as the preferred driver. 2.0.77 consistently chooses my system's default sound device (my Razer headphones), I've never had it ever choose a different device. But for some reason 2.1.x will sometimes randomly seem to choose a different device, in this case the HDMI output on my video card, which is connected to nothing. I can just go into the sound settings and select a different device and it switches right back and works.

Any idea what system configuration or call it's making to get the default device that could be going wrong now? I could try to check and see if my system is occasionally returning something weird. Otherwise I'm not sure what to go on. Every other application in my system (other games, Firefox, VLC, etc...) always 100% consistently choose my headphones, and that's the device set as default in the system configuration as far as I can determine.
eugenekay
Smart Inserter
Smart Inserter
Posts: 1211
Joined: Tue May 15, 2018 2:14 am
Contact:

Re: [2.1.9] Linux audio sometimes chooses non-default audio device

Post by eugenekay »

gridstop wrote: Fri Jul 10, 2026 12:01 amAny idea what system configuration or call it's making to get the default device that could be going wrong now? I could try to check and see if my system is occasionally returning something weird. Otherwise I'm not sure what to go on. Every other application in my system (other games, Firefox, VLC, etc...) always 100% consistently choose my headphones, and that's the device set as default in the system configuration as far as I can determine.
Version 2.1 updated from using SDL2 to SDL3. It seems like SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK is now recommended. Previously, a developer would call SDL_OpenAudioDevice with a null device value to get "default" behaviour.

How/where are you setting the "Default Audio Device" for your system? HDMI audio out seems like it may be the first device detected at boot.
gridstop
Long Handed Inserter
Long Handed Inserter
Posts: 68
Joined: Sun Jul 17, 2016 1:46 am
Contact:

Re: [2.1.9] Linux audio sometimes chooses non-default audio device

Post by gridstop »

Just through KDE's System Settings, the Sound window. The device listed at the top and with the checkbox selected is my headphones, and everything else seems to default to it just fine.

I have noticed from the command line if I run something like alsamixer, the 'Card' and 'Chip' are both PipeWire, but if I select sound card (F6), that list puts HDA ATI HDMI above my headphones. No clue if that list is relevant, what drives that list, or how I could re-prioritize it though.

Looking through some logs, it's clear to see sometimes it chooses one or the other:
0.186 [Audio] Driver:pulseaudio, Device:Starship/Matisse HD Audio Controller Digital Stereo (IEC958), Depth:32, Channels:2, Frequency:44100
or
0.178 [Audio] Driver:pulseaudio, Device:Razer BlackShark V2 HS 2.4 Analog Stereo, Depth:32, Channels:2, Frequency:44100

But it doesn't print like a list of what devices it sees or what order. This is one of those things that's not really Factorio's fault, I'm sure it's just asking for the default however SDL wants them to, but there's so many layers or varieties of sound systems these days it's just a pain in the butt sometimes to even know how your distro is configuring things. Kind of like the distros that were by default swallowing the factoriopedia hotkey and it was sometimes quite hard to find the setting to fix. Presumably I can reorder these... somehow.
Donion
Factorio Staff
Factorio Staff
Posts: 506
Joined: Sun Aug 22, 2021 9:18 am
Contact:

Re: [2.1.9] Linux audio sometimes chooses non-default audio device

Post by Donion »

Hello,
as was correctly guessed, when initializing audio we ask SDL for the default playback device. So it will come down to SDL driver calls and what it gets from the system.

You can try changing the preferred driver in Sound settings to pipewire (requires Factorio restart) to see if it behaves any better.

Edit: since this is a driver issue I'm moving this to technical help
Post Reply

Return to “Technical Help”