Function

AudioFileReadBytes

Reads bytes of audio data from an audio file.

Declaration

OSStatus AudioFileReadBytes(AudioFileID inAudioFile, Boolean inUseCache, SInt64 inStartingByte, UInt32 *ioNumBytes, void *outBuffer);

Parameters

inAudioFile

The audio file whose bytes of audio data you want to read.

inUseCache

Set to true if you want to cache the data. You should cache reads and writes if you read or write the same portion of a file multiple times. To request that the data not be cached, if possible, set to false. You should not cache reads and writes if you read or write data from a file only once.

inStartingByte

The byte offset of the audio data you want to be returned.

ioNumBytes

On input, a pointer to the number of bytes to read. On output, a pointer to the number of bytes actually read.

outBuffer

A pointer to user-allocated memory large enough for the requested bytes.

Return Value

A result code. See Result Codes.

Discussion

In most cases, you should use AudioFileReadPackets instead of this function.

This function returns eofErr when the read operation encounters the end of the file. Note that Audio File Services only reads one 32-bit chunk of a file at a time.

See Also

Reading and Writing Audio Files

AudioFileWriteBytes

Writes bytes of audio data to an audio file.

AudioFileReadPacketData

Reads packets of audio data from an audio file.

AudioFileReadPackets

Reads a fixed duration of audio data from an audio file.

Deprecated
AudioFileWritePackets

Writes packets of audio data to an audio data file.