Wiki Page Content

Differences between revisions 2 and 3
Revision 2 as of 2009-11-15 01:46:10
Size: 594
Editor: SheenaSmith
Comment: content added
Revision 3 as of 2009-11-15 02:27:05
Size: 1241
Editor: SheenaSmith
Comment:
Deletions are marked like this. Additions are marked like this.
Line 4: Line 4:
= SDL_GetNumAudioDrivers =
Use this function to return the number of built in audio drivers.
= SDL_GetNumAudioDevices =
Use this function to return the number of built in audio devices.
Line 11: Line 11:
int SDL_GetNumAudioDrivers(void) int SDL_GetNumAudioDevices (int iscapture)
Line 13: Line 13:

== Function Parameters ==
||'''iscapture'''||non-0 to specify a device that has recording capability||
Line 19: Line 22:
int i; int i, count = SDL_GetNumAudioDevices(0);
Line 21: Line 24:
for ( i = 0; i < SDL_GetNumAudioDrivers(); ++i ) {
    printf("Audio driver %d: %s\n", i, SDL_GetAudioDriver(i);
for ( i = 0; i < count; ++i ) {
    printf("Audio device %d: %s\n", i, SDL_GetAudioDeviceName(i, 0);
Line 27: Line 30:
You can add useful comments here 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]]().

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]]()).

SDL_GetNumAudioDevices

Use this function to return the number of built in audio devices.

Syntax

int SDL_GetNumAudioDevices (int iscapture)

Function Parameters

iscapture

non-0 to specify a device that has recording capability

Return Value

The number of built in audio drivers.

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. 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().

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()).

None: SDL_GetNumAudioDrivers (last edited 2016-05-14 22:18:35 by PhilippWiesemann)

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