audio_create_play_queue

This function prepares a buffer queue for audio. You pass data format (only buffer_u8 or buffer_s16 are currently supported), the sample rate (which can be between 1000hz and 48000hz), and the channels that the audio requires from one of the constants listed below:

ConstantDescription
audio_monoMono (single channel) audio.
audio_stereoStereo (dual channel) audio.
audio_3D3D (5.1) audio.

Note that you should free up any audio queues created with this function when no longer required to prevent memory leaks using the function audio_free_play_queue().

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

 

Syntax:

audio_create_play_queue(queueFormat, queueRate, queueChannels);

ArgumentTypeDescription
queueFormatBuffer Data Type ConstantThe format of the buffer data to use (buffer_u8 or buffer_s16).
queueRateRealThe sample rate of the data in the buffer queue.
queueChannelsAudio Channel ConstantThe channels to use from one of the constants listed above.

 

Returns:

Audio Queue ID

 

Example:

audio_queue = audio_create_play_queue(buffer_s16, 11052, audio_mono);

The above code creates a new audio queue and assigns its ID to a variable for future reference.