Fractal Softworks Forum

Please login or register.

Login with username, password and session length

Author Topic: No sound after focus change  (Read 415 times)

xybre

  • Ensign
  • *
  • Posts: 1
    • View Profile
No sound after focus change
« on: August 08, 2023, 07:55:11 AM »

This is kind of niche, but I think I understand the mechanics of the issue, so I wanted to report it.

The Issue

When Starsector loses focus then regains it, sound no longer works.

Steps to Reproduce

- Launch Starsector, open a session
- Click off the game
- Tab back to the game

No audio in game.

The Culprit

1. I have 2 monitors and I'm currently using one of monitor's headphone jack as the main audio output.
2. Because of the way that Starsector reinitializes the monitor system (at least on Linux) it causes the monitor to reset for a second which also disconnects it as an audio device for a moment.
3. Because the audio device is probably missing when Starsector looks for it, it either grabs some other random device that isn't hooked up, or none at all.

Possible Workarounds

- Use a windowed fullscreen mode
- Use a less aggressive screen grabbing mode in general that doesn't reset the monitors (it also makes a mess of my windows)
- Attempt to get back the same audio device a few seconds after getting focus back
- Allow sound device selection from the settings screen

Related

May be released to this old issue:
https://fractalsoftworks.com/forum/index.php?topic=16503.msg262145#msg262145

Specs

Code
OS: Solus x86_64 
Kernel: 6.4.8-247.current
Resolution: 2560x1440, 3840x2160
DE: Budgie 10.7.2
WM: Mutter(Budgie)
CPU: AMD Ryzen 9 5950X (32) @ 3.400GHz
GPU: NVIDIA GeForce RTX 3080 Ti
Memory: 11554MiB / 128736MiB
« Last Edit: August 08, 2023, 07:57:08 AM by xybre »
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24151
    • View Profile
Re: No sound after focus change
« Reply #1 on: August 08, 2023, 08:16:49 AM »

Thank you for the report! Yeah, the larger issue is that the game is unable to pick up sound device changes, and unfortunately solving that appears non-trivial at the moment.

It's odd that the monitor seems to get briefly disconnected when fullscreen is used, though; that doesn't seem right. The game is not doing anything special there. I do wonder if borderless windowed (or even just windowed) would avoid the issue. Or perhaps some config setting on your system? Not familiar enough with desktop linux to even make a suggestion in that direction, though.
Logged

chrysalisx

  • Ensign
  • *
  • Posts: 6
    • View Profile
Re: No sound after focus change
« Reply #2 on: February 08, 2024, 10:12:46 AM »

I wanted to bump this, I believe this issue is impacting steam deck. I've been really enjoying playing starsector on flights, but miss the music!
Logged

sirus

  • Ensign
  • *
  • Posts: 4
    • View Profile
Re: No sound after focus change
« Reply #3 on: March 18, 2024, 11:52:45 PM »

I might have this issue but it's hard to tell because it always picks the wrong audio device (one that doesn't even actually have an output) so I have to alt tab to change it

Logged

Vind

  • Admiral
  • *****
  • Posts: 785
    • View Profile
Re: No sound after focus change
« Reply #4 on: March 21, 2024, 04:56:11 AM »

I believe it is a configuration issue. You must select your primary used audio device as number 0 so the order of audio devices wont change then you plug in or remove other audio devices.
For example this configuration will make GPU audio device always number 1 and dedicated audio card number 0 or default:
in /etc/modprobe.d/alsa-base.conf
options snd_emu10k1 index=0
options snd_hda_intel index=1 enable_msi=1

It is just an exampe you need to find your audio card drivers name and change "snd_emu10k1" and "snd_hda_intel" to correct values. In this case i have:
Multimedia audio controller: Creative Labs CA0108/CA10300 [Sound Blaster Audigy Series]
Audio device: NVIDIA Corporation GA106 High Definition Audio Controller (rev a1)

Starsector java tries to use default audio device unless reconfigured via alsa/pulseaudio configuration.
Logged