Wiki Page Content

Differences between revisions 9 and 10
Revision 9 as of 2009-11-24 21:31:24
Size: 2217
Editor: SheenaSmith
Comment: add categories
Revision 10 as of 2009-12-01 20:10:33
Size: 2255
Editor: SheenaSmith
Comment: insert anchor
Deletions are marked like this. Additions are marked like this.
Line 19: Line 19:
||'''device'''||a UTF-8 string reported by [[SDL_GetAudioDeviceName]](); see [[#Remarks|Remarks]]|| ||'''device'''||a UTF-8 string reported by [[SDL_GetAudioDeviceName]](); see [[#device|Remarks]]||
Line 23: Line 23:
||'''allowed_changes'''||0, or one or more flags OR'd together; see [[#Remarks|Remarks]] for details|| ||'''allowed_changes'''||0, or one or more flags OR'd together; see [[#allowed|Remarks]] for details||
Line 34: Line 34:
Passing in a '''device''' name of NULL requests the most reasonable default (and is equivalent to calling [[SDL_OpenAudio]]()). <<Anchor(device)>> Passing in a '''device''' name of NULL requests the most reasonable default (and is equivalent to calling [[SDL_OpenAudio]]()).
Line 37: Line 37:
'''allowed_changes''' can have the following flags OR'd together: <<Anchor(allowed)>> '''allowed_changes''' can have the following flags OR'd together:

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-0 to specify a device that has recording capability

desired

the desired audio parameters; see SDL_OpenAudio() for more information

obtained

a pointer to an SDL_AudioSpec structure to be filled in; 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.

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