<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.5.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AudioToolbox",
  "identifier" : "/documentation/AudioToolbox/AudioQueueEnqueueBuffer(_:_:_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Audio Toolbox"
    ],
    "preciseIdentifier" : "c:@F@AudioQueueEnqueueBuffer"
  },
  "title" : "AudioQueueEnqueueBuffer(_:_:_:_:)"
}
-->

# AudioQueueEnqueueBuffer(_:_:_:_:)

Adds a buffer to the buffer queue of a recording or playback audio queue.

```
func AudioQueueEnqueueBuffer(_ inAQ: AudioQueueRef, _ inBuffer: AudioQueueBufferRef, _ inNumPacketDescs: UInt32, _ inPacketDescs: UnsafePointer<AudioStreamPacketDescription>?) -> OSStatus
```

## Parameters

`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 `inBuffer` parameter. Use a value of `0` for 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(_:_:_:_:)`](/documentation/AudioToolbox/AudioQueueAllocateBufferWithPacketDescriptions(_:_:_:_:)) function. In this case, your callback should describe the buffer’s packets in the buffer’s `mPacketDescriptions` and `mPacketDescriptionCount` fields.

`inPacketDescs`

An array of packet descriptions. Use a value of `NULL` for 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(_:_:_:_:)`](/documentation/AudioToolbox/AudioQueueAllocateBufferWithPacketDescriptions(_:_:_:_:)) function. In this case, your callback should describe the buffer’s packets in the buffer’s `mPacketDescriptions` and `mPacketDescriptionCount` fields.

## 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).

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)