---
title: "AudioQueueFlush(_:)"
framework: audiotoolbox
role: symbol
role_heading: Function
path: "audiotoolbox/audioqueueflush(_:)"
---

# AudioQueueFlush(_:)

Resets an audio queue’s decoder state.

## Declaration

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

## Parameters

- `inAQ`: The audio queue to flush.

## Return Value

Return Value A result code. See Result Codes.

## Discussion

Discussion Call 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(_:_:) if you want to ensure that all enqueued data reaches the destination. If you call AudioQueueStop(_:_:) with the inImmediate parameter set to false, calling this function does nothing; under those conditions, AudioQueueStop(_:_:) calls this function.

## See Also

### Related Documentation

- [AudioQueueDispose(_:_:)](audiotoolbox/audioqueuedispose(_:_:).md)

### Controlling Audio Queues

- [AudioQueueStart(_:_:)](audiotoolbox/audioqueuestart(_:_:).md)
- [AudioQueuePrime(_:_:_:)](audiotoolbox/audioqueueprime(_:_:_:).md)
- [AudioQueueStop(_:_:)](audiotoolbox/audioqueuestop(_:_:).md)
- [AudioQueuePause(_:)](audiotoolbox/audioqueuepause(_:).md)
- [AudioQueueReset(_:)](audiotoolbox/audioqueuereset(_:).md)
