SDL_OpenAudioDevice - open wrong device when name is NULL

Hi
In my system I have 6 output devices (audio) “A”,“B”,“C”,D",“E”,“G”, including one indicated as the default in the system - it’s “G”. When I use the SDL_OpenAudio function, everything is fine - the function opens the “G” device - the sound is played. But when I use the equivalent (from documentation) SDL_OpenAudioDevice(NULL, 0, desired, obtained, SDL_AUDIO_ALLOW_ANY_CHANGE);
function, device “B” opens - which is not the default device selected in the system, and I cannot hear any sound. I checked - in the second case the callback function is called. So how to open the default device selected in the system using the function SDL_OpenAudioDevice.
I tried to replace SDL_AUDIO_ALLOW_ANY_CHANGE with 0 - still the same.Of course, the structure desired has the same data in both cases.

Windows 10; SDL 2.0.12

Best regards.

1 Like