This function is a legacy means of locking the audio device. New programs might want to use SDL_LockAudioDevice() instead.
void SDL_LockAudio(void)
void MyAudioCallback(void *userdata, Uint8* stream, int len)
{"The audio callback is running!\n");
printf(0, len); // just silence.
SDL_memset(stream, "The audio callback is done!\n");
printf(
}
// don't lock for 2 seconds at a time in real life, please.
2000); // callback runs for 2 seconds.
SDL_Delay(
SDL_LockAudio();"The audio callback can't be running right now!\n");
printf(2000); // callback doesn't run for 2 seconds.
SDL_Delay("Ok, unlocking!\n");
printf(
SDL_UnlockAudio();2000); // callback runs for 2 seconds. SDL_Delay(
This function is equivalent to calling
1); SDL_LockAudioDevice(
and is only useful if you used the legacy SDL_OpenAudio() function.