<!--
{
  "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/AudioQueuePrime(_:_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Audio Toolbox"
    ],
    "preciseIdentifier" : "c:@F@AudioQueuePrime"
  },
  "title" : "AudioQueuePrime(_:_:_:)"
}
-->

# AudioQueuePrime(_:_:_:)

Decodes enqueued buffers in preparation for playback.

```
func AudioQueuePrime(_ inAQ: AudioQueueRef, _ inNumberOfFramesToPrepare: UInt32, _ outNumberOfFramesPrepared: UnsafeMutablePointer<UInt32>?) -> OSStatus
```

## Parameters

`inAQ`

The audio queue to be primed.

`inNumberOfFramesToPrepare`

The number of frames to decode before returning. Pass `0` to decode all enqueued buffers.

`outNumberOfFramesPrepared`

On output, the number of frames actually decoded and prepared for playback. Pass `NULL` on input if you you are not interested in this information.

## Return Value

A result code. See Result Codes.

## Discussion

This function decodes enqueued buffers in preparation for playback. It returns when at least the number of audio sample frames specified in `inNumberOfFramesToPrepare` are decoded and ready to play, or (if you pass `0` for the `inNumberOfFramesToPrepare` parameter), when all enqueued buffers are decoded.

To make a buffer of audio data ready to play, use [`AudioQueuePrime(_:_:_:)`](/documentation/AudioToolbox/AudioQueuePrime(_:_:_:)) as follows:

1. Call [`AudioQueueEnqueueBuffer(_:_:_:_:)`](/documentation/AudioToolbox/AudioQueueEnqueueBuffer(_:_:_:_:)).
2. Call [`AudioQueuePrime(_:_:_:)`](/documentation/AudioToolbox/AudioQueuePrime(_:_:_:)).
3. Call [`AudioQueueStart(_:_:)`](/documentation/AudioToolbox/AudioQueueStart(_:_:)).

---

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)