|
⇤ ← Revision 1 as of 2009-11-15 02:29:25
Size: 1241
Comment:
|
Size: 1276
Comment: edit content
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 18: | Line 18: |
| The number of built in audio drivers. | The number of available devices exposed by the current driver or -1 if an explicit list of devices can't be determined. |
| Line 30: | Line 30: |
| This function is only valid after successfully initializing the audio subsystem. Returns -1 if an explicit list of devices can't be determined; this is not an error. For example, if SDL is set up to talk to a remote audio server, it can't list every one available on the Internet, but it will still allow a specific host to be specified to [[SDL_OpenAudioDevice]](). | This function is only valid after successfully initializing the audio subsystem. Returning -1 is not an error. For example, if SDL is set up to talk to a remote audio server, it can't list every one available on the Internet, but it will still allow a specific host to be specified to [[SDL_OpenAudioDevice]](). |
| Line 35: | Line 37: |
| .[[SDL_GetAudioDriver]] | .[[SDL_GetAudioDeviceName]] |
SDL_GetNumAudioDevices
Use this function to return the number of built in audio devices.
Contents
Syntax
int SDL_GetNumAudioDevices (int iscapture)
Function Parameters
iscapture |
non-0 to specify a device that has recording capability |
Return Value
The number of available devices exposed by the current driver or -1 if an explicit list of devices can't be determined.
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.
Returning -1 is not an error. For example, if SDL is set up to talk to a remote audio server, it can't list every one available on the Internet, but it will still allow a specific host to be specified to SDL_OpenAudioDevice().
In many common cases, when this function returns a value <= 0, it can still successfully open the default device (NULL for first argument of SDL_OpenAudioDevice()).
