audio_free_play_queue

This function is used to free up the memory associated with the given audio queue. The queue index is the value returned when you created the queue using the function audio_create_play_queue(), and this function should be called when the queue is no longer required to prevent memory leaks. Freeing the queue will stop any sound that is be playing, and you cannot delete the buffer that a sound is being streamed from until the queue it is assigned to has been freed.

This function will trigger an Audio Playback Asynchronous Event, and in this event a special DS map will be created in the variable async_load with the following key/value pairs:

 

Syntax:

audio_free_play_queue(queueIndex);

Argument Type Description
queueIndex Audio Queue ID The index of the queue to free.

 

Returns:

N/A

 

Example:

var q_id = async_load[? "queue_id"];
if (q_id == audio_queue)
{
    audio_free_play_queue(audio_queue);
    buffer_delete(audio_buffer);
}

The above code would go in the asynchronous Audio Playback event and checks to see if the audio that has finished playing is from the "audio_queue" and if it is it frees the queue and the buffer associated with it.