Wiki Page Content

Differences between revisions 7 and 8
Revision 7 as of 2013-08-08 00:19:52
Size: 1284
Editor: RyanGordon
Comment: typo
Revision 8 as of 2015-01-09 23:02:41
Size: 1284
Comment: Changed function name in example for consistency.
Deletions are marked like this. Additions are marked like this.
Line 19: Line 19:
void myAudioCallback(void *userdata, Uint8* stream, int len) void MyAudioCallback(void *userdata, Uint8* stream, int len)

SDL_UnlockAudioDevice

Use this function to unlock the audio callback function for a specified device.

Syntax

void SDL_UnlockAudioDevice(SDL_AudioDeviceID dev)

Function Parameters

dev

the ID of the device to be unlocked

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.
extern SDL_AudioDeviceID devid;
SDL_Delay(2000);  // callback runs for 2 seconds.
SDL_LockAudioDevice(devid);
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_UnlockAudioDevice(devid);
SDL_Delay(2000);  // callback runs for 2 seconds.

Remarks

Unlocks a previous SDL_LockAudioDevice() call. Please see that function's remarks for more details.


CategoryAPI, CategoryAudio

None: SDL_UnlockAudioDevice (last edited 2015-01-09 23:02:41 by PhilippWiesemann)

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