While I know how to use MIX_OpenAudio.... I wanted to know the use of MIX_OpenAudioDevice function
It takes several arguments... Device name is one of them
So, I want to know that how can we know what the device name is
It says we can use a function i.e. SDL_GetAudioDeviceName()
But how would we know which audio device to choose on every system....
Or is this function only for working with specific audio systems such as realtek or something?
So from how I understand it,
MIX_OpenAudio()is already usingMIX_OpenAudioDevice(), just using aNULLvalue for thedeviceparameter (which then defaults to whatever the system uses for sound). The only reason you would need to specify an actualdevicein that function is if you are expecting your audio data to be in a specific format. Therefore you should already know what it is.From the docs: (link)
As the doc says there,
SDL_GetNumAudioDevices()will allow you to loop throughSDL_GetAudioDeviceName()to see if it exists on the machine.This would allow you more control over your audio and can save CPU time from converting the data to the exact device. You also must have that device already opened as well.
Also a link to the SDL2 docs.
Hope this helps explain that function.