|
Size: 2182
Comment: edit content
|
Size: 2183
Comment:
|
| Deletions are marked like this. | Additions are marked like this. |
| 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 [[#Remarks|Remarks]] for details|| |
SDL_OpenAudioDevice
Use this function to open a specific audio device.
Contents
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.
