mojira.dev
MC-44055

Game fails to switch the audio output from one device to another after the game has started (from title screen)

Moderator Note

This ticket includes switching between all types of audio devices, not just headphones.

To work around the issue, you can manually reload sounds (and all other resources) with F3+T.

The game fails to switch audio outputs, meaning that headphones cannot start or stop being used after game start.

After the game start, plugging in the headphones should have audio going through the headphones. Unplugging them should have audio going through the speakers (Unless, the default speakers say otherwise).

After plugging (or unplugging) headphones, no sound can be heard because the sound is still going to the jack. (or still not going to the jack. The Computer OS detects the headphones muting the speakers, which is normal operation)

Reproduction steps

No audio through headphones

  1. Start minecraft with no headphones in headphone jack*

  2. Plug headphones into headphone jack* (title screen or in-game)

*Headphones can be typical audio jack or USB

No audio through speakers

  1. Start minecraft with headphones in headphone jack*

  2. Unplug headphones from headphone jack* (title screen or in-game)

*Headphones can be typical audio jack or USB

I'm unaware if this problem can be caused from the launcher.

Workaround

See LWJGL forum post:

In the meantime, you could try fixing this with a virtual audio device. I'm not sure what's available on Linux/PulseAudio, but it's certainly possible on Windows. You create a virtual audio device and configure it as the default. It's what Minecraft/OpenAL Soft will use to output audio. Then you configure the virtual device to forward any audio to the real audio device of your choice. You should then be able to change the downstream device, on the fly, without breaking Minecraft/OpenAL Soft.

Suggested fix

See LWJGL forum post:

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.

Linked issues

Comments 29

I don't think this is a Minecraft problem, as this is something that either the OS, the Drivers, or the sound library the game is using (paulscode?) should handle. I'm leaning towards the sound library, myself.

@Carl I think you are right about the sound library. The way MC is written I believe due to supporting so many OSes that MC does not support audio switching within Windows. I think it grabs control of the audio device at startup.

I suspect this may working as intended but the ability to switch without restarting would be nice.

Matthew Messinger

Pressing F3+S should reset the sound system.

SOLUTION: CHANGE RESOURCE PACK. MINECRAFT CHANGES DEFAULT SOUNDCARD AS WELL WHEN DOING IT.

are they never going to fix this?

19 more comments
Matt Martineau

Bit of a problem with Windows, as well.  for even Windows sounds, you have to switch back to proper output after sleepmode.
So, yah, still a problem in 2021 ;P (Not only a minecraft problem... but, hopefully a solution is on it's way)

 

It's also (still) present on Linux unfortunately :/ Realoding with F3+T works as a workaround... but that's not something I'd like to do. Is there a corresponding ticket for Linux?

I am not expecting this issue on Linux. What audio backend are you using? (PulseAudio/Pipewire iirc)

I'm running PulseAudio (default on Ubuntu 20.04). 

I don't have sound in minecraft

Sennheizer hd560s + behringer 204hd

Johnathan Dunker

(Unassigned)

Confirmed

Normal

libraries, sound

Minecraft 1.7.4, Minecraft 14w08a, 1.15.2, 20w17a, 1.16.3, ..., 21w17a, 21w20a, 1.17 Pre-release 2, 1.17, 1.17.1

21w38a

Retrieved