<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: -",
    "macOS: 27.0.0 -",
    "tvOS: 27.0.0 -",
    "visionOS: 27.0.0 -",
    "watchOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AVFAudio",
  "identifier" : "/documentation/AVFAudio/AVReadOnlyAudioPCMBuffer/withUnsafeAudioBufferList(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AVFAudio"
    ],
    "preciseIdentifier" : "s:8AVFAudio24AVReadOnlyAudioPCMBufferV010withUnsafeD10BufferListyxxSPySo0dhI0VGKXEKlF"
  },
  "title" : "withUnsafeAudioBufferList(_:)"
}
-->

# withUnsafeAudioBufferList(_:)

Provides scoped read-only access to the audio buffer list.

```
func withUnsafeAudioBufferList<R>(_ body: (UnsafePointer<AudioBufferList>) throws -> R) rethrows -> R
```

## Parameters

`body`

A closure that receives a pointer to the audio buffer list.

## Return Value

The value returned by the closure.

## Discussion> Warning: Although the `AudioBufferList` pointer is const, each `AudioBuffer` within
> the list exposes `mData` as `UnsafeMutableRawPointer`. You must not modify the buffer
> data through these pointers. Doing so results in undefined behavior and violates the
> read-only contract of this type.

---

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)