---
title: "AudioFileGetUserData(_:_:_:_:_:)"
framework: audiotoolbox
role: symbol
role_heading: Function
path: "audiotoolbox/audiofilegetuserdata(_:_:_:_:_:)"
---

# AudioFileGetUserData(_:_:_:_:_:)

Gets a chunk from an audio file.

## Declaration

```swift
func AudioFileGetUserData(_ inAudioFile: AudioFileID, _ inUserDataID: UInt32, _ inIndex: UInt32, _ ioUserDataSize: UnsafeMutablePointer<UInt32>, _ outUserData: UnsafeMutableRawPointer) -> OSStatus
```

## Parameters

- `inAudioFile`: The audio file whose chunk you want to get.
- `inUserDataID`: The four-character code of the designated chunk.
- `inIndex`: An index that specifies which chunk with the four-character code specified in the inUserDataID parameter you want to query.
- `ioUserDataSize`: On input, a pointer to the size of the buffer that contains the designated chunk. On output, a pointer to the size of bytes that the system copied to the buffer.
- `outUserData`: A pointer to a buffer in which to copy the chunk data.

## Return Value

Return Value A result code if there’s an error (see Result Codes) or noErr if the operation succeeds.

## See Also

### Working with User Data

- [AudioFileCountUserData(_:_:_:)](audiotoolbox/audiofilecountuserdata(_:_:_:).md)
- [AudioFileGetUserDataSize(_:_:_:_:)](audiotoolbox/audiofilegetuserdatasize(_:_:_:_:).md)
- [AudioFileGetUserDataSize64(_:_:_:_:)](audiotoolbox/audiofilegetuserdatasize64(_:_:_:_:).md)
- [AudioFileGetUserDataAtOffset(_:_:_:_:_:_:)](audiotoolbox/audiofilegetuserdataatoffset(_:_:_:_:_:_:).md)
- [AudioFileSetUserData(_:_:_:_:_:)](audiotoolbox/audiofilesetuserdata(_:_:_:_:_:).md)
- [AudioFileRemoveUserData(_:_:_:)](audiotoolbox/audiofileremoveuserdata(_:_:_:).md)
