How does one get the device name (const char*) of an active SDL_AudioDeviceID? You might say “Well, it’s the same string passed to SDL_OpenAudioDevice()”, but if I pass NULL as the name, it chooses a device for me. How do I get the device name that it chose, so I can display it as “active” in a dropdown selector of all the device names?
In many cases, we can’t give you a name because it doesn’t map to an actual device. For example: on macOS and Windows WASAPI, you can pick a specific piece of hardware to open, but NULL means “whatever the system default is” and if the user changes hardware mid-game, SDL switches over automatically.
Other platforms, NULL might have SDL ask the OS “pick something for me,” and we never know what it is.
My recommendation: if you show a list of audio devices and highlight the active one, make sure there’s one in there called “[system default]” and assume the user knows what that means vs other choices for his platform and/or the user doesn’t care about specific audio hardware.
(And yeah, “assume” here means “hope.”)
Oh, that’s a good idea. That’s a better workaround than anything I was able to think of.