Wiki Page Content

Differences between revisions 5 and 6
Revision 5 as of 2010-10-12 00:40:56
Size: 763
Editor: SheenaSmith
Comment: update content - pointers, structs
Revision 6 as of 2013-08-08 04:39:39
Size: 1243
Editor: RyanGordon
Comment: Rewritten
Deletions are marked like this. Additions are marked like this.
Line 17: Line 17:
<<Color2(green,Should SDL_Audio``DeviceID be specifically mentioned like a struct would be although it is a typedef? It has no page.)>>
Line 21: Line 19:
You can add your code example here extern SDL_AudioSpec want;
SDL_AudioDeviceID devid = SDL_OpenAudioDevice(NULL, 0, &want, NULL, 0);
if (devid > 0) {
    SDL_PauseAudioDevice(devid, 0);
    SDL_Delay(5000); // let audio callback run for 5 seconds.
    SDL_CloseAudioDevice(devid);
}
Line 25: Line 29:
''You can add useful comments here'' The application should close open audio devices once they are no longer needed. Calling this function will wait until the device's audio callback is not running, release the audio hardware and then clean up internal state. No further audio will play from this device once this function returns.

The device ID is invalid as soon as the device is closed, and is eligible for reuse in a new [[SDL_OpenAudioDevice]]() call immediately.

SDL_CloseAudioDevice

Use this function to shut down audio processing and close the audio device.

Syntax

void SDL_CloseAudioDevice(SDL_AudioDeviceID dev)

Function Parameters

dev

an audio device previously opened with SDL_OpenAudioDevice()

Code Examples

extern SDL_AudioSpec want;
SDL_AudioDeviceID devid = SDL_OpenAudioDevice(NULL, 0, &want, NULL, 0);
if (devid > 0) {
    SDL_PauseAudioDevice(devid, 0);
    SDL_Delay(5000);  // let audio callback run for 5 seconds.
    SDL_CloseAudioDevice(devid);
}

Remarks

The application should close open audio devices once they are no longer needed. Calling this function will wait until the device's audio callback is not running, release the audio hardware and then clean up internal state. No further audio will play from this device once this function returns.

The device ID is invalid as soon as the device is closed, and is eligible for reuse in a new SDL_OpenAudioDevice() call immediately.


CategoryAPI, CategoryAudio

None: SDL_CloseAudioDevice (last edited 2013-08-08 04:39:39 by RyanGordon)

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