---
title: "AudioFileInitializeWithCallbacks(_:_:_:_:_:_:_:_:_:)"
framework: audiotoolbox
role: symbol
role_heading: Function
path: "audiotoolbox/audiofileinitializewithcallbacks(_:_:_:_:_:_:_:_:_:)"
---

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

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

## Declaration

```swift
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

Return Value A result code. See Result Codes.

## See Also

### Related Documentation

- [AudioFileOpenWithCallbacks(_:_:_:_:_:_:_:)](audiotoolbox/audiofileopenwithcallbacks(_:_:_:_:_:_:_:).md)

### Creating and Initializing Audio Files

- [AudioFileCreateWithURL(_:_:_:_:_:)](audiotoolbox/audiofilecreatewithurl(_:_:_:_:_:).md)
