Wiki Page Content



Use this function to drop any queued audio data waiting to be sent to the hardware.


void SDL_ClearQueuedAudio(SDL_AudioDeviceID dev)

Function Parameters


the device ID of which to clear the audio queue

Code Examples

You can add your code example here


Immediately after this call, SDL_GetQueuedAudioSize() will return 0 and the hardware will start playing silence if more audio isn't queued.

This will not prevent playback of queued audio that's already been sent to the hardware, as we can not undo that, so expect there to be some fraction of a second of audio that might still be heard. This can be useful if you want to, say, drop any pending music during a level change in your game.

You may not queue audio on a device that is using an application-supplied callback; calling this function on such a device is always a no-op. You have to use the audio callback or queue audio with SDL_QueueAudio(), but not both.

You should not call SDL_LockAudio() on the device before clearing the queue; SDL handles locking internally for this function.

This function always succeeds and thus returns void.


This function is available since SDL 2.0.4.

CategoryAPI, CategoryAudio

None: SDL_ClearQueuedAudio (last edited 2014-07-28 17:50:37 by PhilippWiesemann)

Please include your contact information if you'd like to receive a reply.