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

# AudioQueueFlush(_:)

Resets an audio queue’s decoder state.

```
func AudioQueueFlush(_ inAQ: AudioQueueRef) -> OSStatus
```

## Parameters

`inAQ`

The audio queue to flush.

## Return Value

A result code. See Result Codes.

## Discussion

Call [`AudioQueueFlush(_:)`](/documentation/AudioToolbox/AudioQueueFlush(_:)) after enqueuing the last audio queue buffer to ensure that all buffered data, as well as all audio data in the midst of processing, gets recorded or played. If you do not call this function, stale data in the audio queue’s decoder may interfere with playback or recording of the next set of buffers.

Call this function before calling [`AudioQueueStop(_:_:)`](/documentation/AudioToolbox/AudioQueueStop(_:_:)) if you want to ensure that all enqueued data reaches the destination. If you call [`AudioQueueStop(_:_:)`](/documentation/AudioToolbox/AudioQueueStop(_:_:)) with the `inImmediate` parameter set to `false`, calling this function does nothing; under those conditions, [`AudioQueueStop(_:_:)`](/documentation/AudioToolbox/AudioQueueStop(_:_:)) calls this function.

## See Also

[`AudioQueueDispose(_:_:)`](/documentation/AudioToolbox/AudioQueueDispose(_:_:))

Disposes of an audio queue.



---

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)