Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.97a is out! (02/02/24); New blog post: Simulator Enhancements (03/13/24)

Author Topic: Audio doesn't work after bluetooth disconnect  (Read 1113 times)

Gothars

  • Global Moderator
  • Admiral
  • *****
  • Posts: 4403
  • Eschewing obfuscatory verbosity.
    • View Profile
Audio doesn't work after bluetooth disconnect
« on: November 12, 2020, 02:00:55 PM »

If my bluetooth headphones get disconnected, either manually or by distance, Starsector audio stops working. Other sources still play audio normally, either over reconnected bluetooth or normal speakers. Starsector needs a restart, though.
Logged
The game was completed 8 years ago and we get a free expansion every year.

Arranging holidays in an embrace with the Starsector is priceless.

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23987
    • View Profile
Re: Audio doesn't work after bluetooth disconnect
« Reply #1 on: November 16, 2020, 12:04:22 PM »

Sorry about the delayed response! Got a bit sidetracked.

This is a known issue, unfortunately - the game can't handle the audio output changing after startup. I've tried some of the more obvious things as far as re-initializing its audio (though detecting when it actually needs to do it would be another hurdle), but it hasn't worked, and I haven't had the time to really dig into it. Plus, my familiarity with the underlying sound API is fairly low, so it'd be a significant effort to try to figure out, with no guarantee that it's actually possible using the stuff the game is using (i.e. LWJGL + OpenAL).
Logged

Gothars

  • Global Moderator
  • Admiral
  • *****
  • Posts: 4403
  • Eschewing obfuscatory verbosity.
    • View Profile
Re: Audio doesn't work after bluetooth disconnect
« Reply #2 on: November 16, 2020, 03:37:12 PM »

Ah ok thanks, it's no big deal.
Logged
The game was completed 8 years ago and we get a free expansion every year.

Arranging holidays in an embrace with the Starsector is priceless.

Curator

  • Ensign
  • *
  • Posts: 5
    • View Profile
Re: Audio doesn't work after bluetooth disconnect
« Reply #3 on: March 29, 2021, 07:51:56 AM »

Sorry about the delayed response! Got a bit sidetracked.

This is a known issue, unfortunately - the game can't handle the audio output changing after startup. I've tried some of the more obvious things as far as re-initializing its audio (though detecting when it actually needs to do it would be another hurdle), but it hasn't worked, and I haven't had the time to really dig into it. Plus, my familiarity with the underlying sound API is fairly low, so it'd be a significant effort to try to figure out, with no guarantee that it's actually possible using the stuff the game is using (i.e. LWJGL + OpenAL).

Hey. Just got the same issue when changing my audio output from speakers to bluetooth headphones.
Some googling leads to Minecraft that uses LWJGL + OpenAL too. Here are some steps that Minecraft devs do to solve this ( http://forum.lwjgl.org/index.php?topic=7081.0 ):

What could be done to resolve this? Suggestions:
- Minecraft regularly queries alcGetInteger(device, ALC_CONNECTED), via the ALC_EXT_disconnect extension. If it returns ALC_FALSE, it automatically recreates the audio context.
- Minecraft regularly queries alcGetString(NULL, ALC_DEFAULT_ALL_DEVICES_SPECIFIER). This returns a string that describes the default audio device. If it changes, it automatically recreates the audio context.
- Minecraft queries ALC_ALL_DEVICES_SPECIFIER (also regularly updates it) and displays the list of available audio devices. Instead of changing the default audio device from the OS settings, users can change the audio device used by Minecraft itself. This is the simplest and most robust solution. I don't remember a PC game that doesn't have such an option in its audio settings.
Logged