AudioQueueEnqueueBuffer(_:_:_:_:)
Adds a buffer to the buffer queue of a recording or playback audio queue.
Declaration
func AudioQueueEnqueueBuffer(_ inAQ: AudioQueueRef, _ inBuffer: AudioQueueBufferRef, _ inNumPacketDescs: UInt32, _ inPacketDescs: UnsafePointer<AudioStreamPacketDescription>?) -> OSStatusParameters
- inAQ:
The audio queue that owns the audio queue buffer.
- inBuffer:
The audio queue buffer to add to the buffer queue.
- inNumPacketDescs:
The number of packets of audio data in the
inBufferparameter. Use a value of0for any of the following situations:When playing a constant bit rate (CBR) format.
When the audio queue is a recording (input) audio queue.
When the buffer you are reenqueuing was allocated with the Audioqueueallocatebufferwithpacketdescriptions(_:_:_:_:) function. In this case, your callback should describe the buffer’s packets in the buffer’s
mPacketDescriptionsandmPacketDescriptionCountfields.
- inPacketDescs:
An array of packet descriptions. Use a value of
NULLfor any of the following situations:When playing a constant bit rate (CBR) format.
When the audio queue is an input (recording) audio queue.
When the buffer you are reenqueuing was allocated with the Audioqueueallocatebufferwithpacketdescriptions(_:_:_:_:) function. In this case, your callback should describe the buffer’s packets in the buffer’s
mPacketDescriptionsandmPacketDescriptionCountfields.
Return Value
A result code. See Result Codes.
Discussion
Audio queue callbacks use this function to reenqueue buffers—placing them “last in line” in a buffer queue. A playback (or output) callback reenqueues a buffer after the buffer is filled with fresh audio data (typically from a file). A recording (or input) callback reenqueues a buffer after the buffer’s contents were written (typically to a file).