Wiki Page Content

Differences between revisions 9 and 10
Revision 9 as of 2013-08-07 23:18:58
Size: 1240
Editor: RyanGordon
Comment: Updated
Revision 10 as of 2013-08-07 23:21:15
Size: 1244
Editor: RyanGordon
Comment: typo
Deletions are marked like this. Additions are marked like this.
Line 5: Line 5:
This function is a legacy means of locking the audio device. New programs might want to use SDL_LockAudioDevice() instead. This function is a legacy means of locking the audio device. New programs might want to use [[SDL_LockAudioDevice]]() instead.

SDL_LockAudio

This function is a legacy means of locking the audio device. New programs might want to use SDL_LockAudioDevice() instead.

Syntax

void SDL_LockAudio(void)

Code Examples

void myAudioCallback(void *userdata, Uint8* stream, int len)
{
    printf("The audio callback is running!\n");
    SDL_memset(stream, 0, len);  // just silence.
    printf("The audio callback is done!\n");
}

// don't lock for 2 seconds at a time in real life, please.
SDL_Delay(2000);  // callback runs for 2 seconds.
SDL_LockAudio();
printf("The audio callback can't be running right now!\n");
SDL_Delay(2000);  // callback doesn't run for 2 seconds.
printf("Ok, unlocking!\n");
SDL_UnlockAudio();
SDL_Delay(2000);  // callback runs for 2 seconds.

Remarks

This function is equivalent to calling

SDL_LockAudioDevice(1);

and is only useful if you used the legacy SDL_OpenAudio() function.


CategoryAPI, CategoryAudio

None: SDL_LockAudio (last edited 2015-01-09 23:01:38 by PhilippWiesemann)

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