This is new wiki software and old wiki content. It's a work in progress!
Here's the explanation.
Be gentle, report bugs, leave feedback on pages, or just edit them yourself! Thanks!

SDL Wiki


Get the human-readable name of a specific audio device.


const char* SDL_GetAudioDeviceName(int index,
                                   int iscapture);

Function Parameters


the index of the audio device; valid values range from 0 to SDL_GetNumAudioDevices() - 1


non-zero to query the list of recording devices, zero to query the list of output devices.

Return Value

Returns the name of the audio device at the requested index, or NULL on error.


This function is only valid after successfully initializing the audio subsystem. The values returned by this function reflect the latest call to SDL_GetNumAudioDevices(); re-call that function to redetect available hardware.

The string returned by this function is UTF-8 encoded, read-only, and managed internally. You are not to free it. If you need to keep the string for any length of time, you should make your own copy of it, as it will be invalid next time any of several other SDL functions are called.

Code Examples

int i, count = SDL_GetNumAudioDevices(0);

for (i = 0; i < count; ++i) {
    SDL_Log("Audio device %d: %s", i, SDL_GetAudioDeviceName(i, 0));

CategoryAPI, CategoryAudio

[ edit | delete | history | feedback | raw ]

[ front page | index | search | recent changes | git repo | offline html ]

All wiki content is licensed under Creative Commons Attribution 4.0 International (CC BY 4.0).
Wiki powered by ghwikipp.