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
Start minecraft with no headphones in headphone jack*
Plug headphones into headphone jack* (title screen or in-game)
*Headphones can be typical audio jack or USB
No audio through speakers
Start minecraft with headphones in headphone jack*
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 theALC_EXT_disconnect
extension. If it returnsALC_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
@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.
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 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.