# AudioBufferList Utility Functions

These functions make working with AudioBufferLists easier.

## Function Types

- Creating and Disposing
  - MTAudioBufferListNew ( )
  - MTAudioBufferListDispose ( )
- Working with attributes
  - MTAudioBufferListChannelCount ( )
  - MTAudioBufferListFrameCount ( )
- Working with data
  - MTAudioBufferListClear ( )
  - MTAudioBufferListCopy ( )

## Function Reference

### MTAudioBufferListChannelCount ( )

`unsigned MTAudioBufferListChannelCount ( const AudioBufferList * buf )`
Returns the sum of the number of channels in each buffer/stream in buf.

### MTAudioBufferListClear ( )

`unsigned MTAudioBufferListClear ( AudioBufferList * aList, unsigned offset, unsigned count )`
Sets audio frames in theList, starting at offset frames from the beginning, to silence. The number of frames cleared is the smallest of:

- The frame count of aList minus offset
- Parameter count

Returns the number of frames cleared.

### MTAudioBufferListCopy ( )

`unsigned MTAudioBufferListCopy ( const AudioBufferList * src, unsigned srcOffset, AudioBufferList * dst, unsigned dstOffset, unsigned count )`
Copies audio frames from src, starting at srcOffset frames from the beginning, to dst, starting at dstOffset frames from the beginning. The number frames copied is the smallest of:

- The frame count of src minus srcOffset
- The frame count of dst minus dstOffset
- Parameter count

If src has more channels than dst, then the excess channels of src are discarded. If src has fewer channels than dst, then the excess channels of dst are filled with silence.
This function can work with source and destination AudioBufferLists having different numbers of streams and different numbers of channels per stream. However, it is most efficient when all of the corresponding streams in src and dst have the same number of channels.
Returns the number of frames copied.

### MTAudioBufferListDispose ( )

`void MTAudioBufferListDispose ( AudioBufferList * aList )`
Frees all of the resources of AudioBufferList aList.

### MTAudioBufferListFrameCount ( )

`unsigned MTAudioBufferListFrameCount ( const AudioBufferList * buf )`
Returns the number of audio frames that buf can hold.

### MTAudioBufferListNew ( )

`AudioBufferList * MTAudioBufferListNew ( unsigned channels, unsigned frames, Boolean interleaved )`
Returns a new AudioBufferList large enough to hold frames frames of channels-channel Float32 audio samples. If interleaved is `YES`, then the AudioBufferList will have one AudioBuffer with channels interleaved channels. If interleaved is `NO`, then the AudioBufferList will have channels AudioBuffers each one channel wide.

Mike > Mac OS X > MTCoreAudio.framework > MTCoreAudio AudioBufferList Utility Functions