Function

AudioFileWritePackets

Writes packets of audio data to an audio data file.

Declaration

OSStatus AudioFileWritePackets(AudioFileID inAudioFile, Boolean inUseCache, UInt32 inNumBytes, const AudioStreamPacketDescription *inPacketDescriptions, SInt64 inStartingPacket, UInt32 *ioNumPackets, const void *inBuffer);

Parameters

inAudioFile

The audio file to write to.

inUseCache

Set to true if you want to cache the data. Otherwise, set to false.

inNumBytes

The number of bytes of audio data being written.

inPacketDescriptions

A pointer to an array of packet descriptions for the audio data. Not all formats require packet descriptions. If no packet descriptions are required, for instance, if you are writing CBR data, pass NULL.

inStartingPacket

The packet index for the placement of the first provided packet.

ioNumPackets

On input, a pointer to the number of packets to write. On output, a pointer to the number of packets actually written.

inBuffer

A pointer to user-allocated memory containing the new audio data to write to the audio data file.

Return Value

A result code. See Result Codes.

Discussion

For all uncompressed formats, this function equates packets with frames.

See Also

Reading and Writing Audio Files

AudioFileReadBytes

Reads bytes of audio data from an audio file.

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