Wiki Page Content

Differences between revisions 11 and 12
Revision 11 as of 2013-12-26 10:48:19
Size: 1465
Comment: Removed spaces in example and deactivated camel case.
Revision 12 as of 2014-07-04 11:46:00
Size: 1465
Comment: Corrected parameter description (from Feedback).
Deletions are marked like this. Additions are marked like this.
Line 16: Line 16:
||'''index'''||the index of the audio device; the value ranges from 0 to 1 - [[SDL_GetNumAudioDevices]]()|| ||'''index'''||the index of the audio device; the value ranges from 0 to [[SDL_GetNumAudioDevices]]() - 1||

SDL_GetAudioDeviceName

Use this function to get the name of a specific audio device.

Syntax

const char* SDL_GetAudioDeviceName(int index,
                                   int iscapture)

Function Parameters

index

the index of the audio device; the value ranges from 0 to SDL_GetNumAudioDevices() - 1

iscapture

non-zero to specify a device that has recording capability

Return Value

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

Code Examples

int i, count = SDL_GetNumAudioDevices(0);

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

Remarks

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 re-detect 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 is called.


CategoryAPI, CategoryAudio

None: SDL_GetAudioDeviceName (last edited 2016-04-15 22:07:37 by PhilippWiesemann)

(Page Info.)
Feedback
Please include your contact information if you'd like to receive a reply.
Submit