<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.3.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AudioToolbox",
  "identifier" : "/documentation/AudioToolbox/AudioFileInitializeWithCallbacks(_:_:_:_:_:_:_:_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Audio Toolbox"
    ],
    "preciseIdentifier" : "c:@F@AudioFileInitializeWithCallbacks"
  },
  "title" : "AudioFileInitializeWithCallbacks(_:_:_:_:_:_:_:_:_:)"
}
-->

# AudioFileInitializeWithCallbacks(_:_:_:_:_:_:_:_:_:)

Deletes the content of an existing file and assigns callbacks to the audio file object.

```
func AudioFileInitializeWithCallbacks(_ inClientData: UnsafeMutableRawPointer, _ inReadFunc: AudioFile_ReadProc, _ inWriteFunc: AudioFile_WriteProc, _ inGetSizeFunc: AudioFile_GetSizeProc, _ inSetSizeFunc: AudioFile_SetSizeProc, _ inFileType: AudioFileTypeID, _ inFormat: UnsafePointer<AudioStreamBasicDescription>, _ inFlags: AudioFileFlags, _ outAudioFile: UnsafeMutablePointer<AudioFileID?>) -> OSStatus
```

## Parameters

`inClientData`

A pointer to a constant passed to your callbacks. Th constant should contain any information you use to manage the state for reading data from the file.

`inReadFunc`

A callback function invoked when the audio file object wants to read data.

`inWriteFunc`

A callback function invoked when the audio file object wants to write data.

`inGetSizeFunc`

A callback function invoked when the audio file object wants to know the size of the file.

`inSetSizeFunc`

A callback function invoked when the audio file object wants to set the size of the file.

`inFileType`

The type of audio file to initialize

`inFormat`

The format for the audio data in the file.

`inFlags`

Flags for creating or opening the file. Set to `0`.

`outAudioFile`

On output, a pointer to the newly initialized audio file.

## Return Value

A result code. See Result Codes.

## See Also

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

Opens an existing file with callbacks you provide.



---

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)