---
title: "AudioQueueStop(_:_:)"
framework: audiotoolbox
role: symbol
role_heading: Function
path: "audiotoolbox/audioqueuestop(_:_:)"
---

# AudioQueueStop(_:_:)

Stops playing or recording audio.

## Declaration

```swift
func AudioQueueStop(_ inAQ: AudioQueueRef, _ inImmediate: Bool) -> OSStatus
```

## Parameters

- `inAQ`: The audio queue to stop.
- `inImmediate`: If you pass true, stopping occurs immediately (that is, synchronously). If you pass false, the function returns immediately, but the audio queue does not stop until its queued buffers are played or recorded (that is, the stop occurs asynchronously). Audio queue callbacks are invoked as necessary until the queue actually stops.

## Return Value

Return Value A result code. See Result Codes.

## Discussion

Discussion This function resets an audio queue, stops the audio hardware associated with the queue if it is not in use by other audio services, and stops the audio queue. When recording, this function is typically invoked by a user. When playing back, a playback audio queue callback should call this function when there is no more audio to play.

## See Also

### Controlling Audio Queues

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