Windows music bug when switching audio sources

This was reported to me about the Windows build of our game.

The game loads up and plays audio fine. Switching between regular speaker output on my laptop and the audio through the headphone jack works as intended.

But if you use the volume controls to switch audio sources, for example to Bluetooth earphones, the music doesn’t switch to that source. It will still play through the old source. The same is true in reverse: if I start the game with my Bluetooth earphones already connected to my computer, I can hear the music in the earphones, but I don’t hear any music anymore once I unpair the earphones from the system.

Anyone run into this issue before or have any idea what the problem may be?

I believe we open the audio device at the beginning and never try to change to a new audio device if it changes. I have seen this in Windows before a lot, so I am not sure if it is more about how we are using OpenAL or if this is a common thing in Windows where you expect to close and re-open any application you were using before the default audio device changed

I see. Is this something that could be solved by adding some kind of device change listener and calling suspend() + resume() or even shutdown() + init() in lime.media.AudioManager?

It appears that alcOpenDevice will return the default device and I see no way of being notified if the device has changed. I do not know how expensive it would be… the only solution I see is to call alcOpenDevice periodically, and to change to a new OpenAL context if the device returned has changed