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:
常量 描述 audio_mono Mono (single channel) audio. audio_stereo Stereo (dual channel) audio. audio_3D 3D (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:
- "queue_id" - the queue that has finished playing data
- "buffer_id" - the buffer that is no longer being played from
- "queue_shutdown" - this is set to 0 during normal playback and 1 when the event is received because audio_free_play_queue has been called. 如果将其设置为 1，你不希望排队等待任何进一步的数据。重要！该函数在试用版（Trial License）产品中不可用。
audio_create_play_queue(queueFormat, queueRate, queueChannels);
|queueFormat||The format of the buffer data to use (buffer_u8 or buffer_s16).|
|queueRate||The sample rate of the data in the buffer queue.|
|queueChannels||The channels to use from one of the constants listed below.|
audio_queue = audio_create_play_queue(buffer_s16, 11052, audio_mono);
The above code creates a new audio queue and assigns its index to a variable for future reference.