Wiki Page Content

Differences between revisions 13 and 14
Revision 13 as of 2010-10-17 04:33:47
Size: 2522
Editor: SheenaSmith
Comment: update content - filled in with
Revision 14 as of 2011-01-13 05:04:38
Size: 2525
Editor: SheenaSmith
Comment: update content for consistency - non-zero
Deletions are marked like this. Additions are marked like this.
Line 20: Line 20:
||'''iscapture'''||non-0 to specify a device that has recording capability|| ||'''iscapture'''||non-zero to specify a device that has recording capability||

SDL_OpenAudioDevice

Use this function to open a specific audio device.

Syntax

SDL_AudioDeviceID SDL_OpenAudioDevice(const char*          device,
                                      int                  iscapture,
                                      const SDL_AudioSpec* desired,
                                      SDL_AudioSpec*       obtained,
                                      int                  allowed_changes)

Function Parameters

device

a UTF-8 string reported by SDL_GetAudioDeviceName(); see Remarks

iscapture

non-zero to specify a device that has recording capability

desired

the desired audio parameters -or- an SDL_AudioSpec structure representing the desired output format; see SDL_OpenAudio() for more information

obtained

an SDL_AudioSpec structure filled in with the actual output format; see SDL_OpenAudio() for more information

allowed_changes

0, or one or more flags OR'd together; see Remarks for details

Return Value

Returns a valid device ID that is >= 2 on success or 0 on failure; call SDL_GetError() for more information.

<<Color2: execution failed [No argument named "Although it is implied here and in Remarks would it be of value to specify that the ID is >"] (see also the log)>>

Code Examples

You can add your code example here

Remarks

Passing in a device name of NULL requests the most reasonable default (and is equivalent to calling SDL_OpenAudio()). The device name is a UTF-8 string reported by SDL_GetAudioDeviceName(), but some drivers allow arbitrary and driver-specific strings, such as a hostname/IP address for a remote audio server, or a filename in the diskaudio driver.

allowed_changes can have the following flags OR'd together:

SDL_AUDIO_ALLOW_FREQUENCY_CHANGE

SDL_AUDIO_ALLOW_FORMAT_CHANGE

SDL_AUDIO_ALLOW_CHANNELS_CHANGE

SDL_AUDIO_ALLOW_ANY_CHANGE

SDL_OpenAudio(), unlike this function, always acts on device ID 1.


CategoryAPI, CategoryAudio

None: SDL_OpenAudioDevice (last edited 2017-03-30 12:26:07 by ChrisBush)

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