Function

AudioFileCreateWithURL

Creates a new audio file, or initializes an existing file, specified by a URL.

Declaration

OSStatus AudioFileCreateWithURL(CFURLRef inFileRef, AudioFileTypeID inFileType, const AudioStreamBasicDescription *inFormat, AudioFileFlags inFlags, AudioFileID  _Nullable *outAudioFile);

Parameters

inFileRef

The fully specified path of the file to create or initialize.

inFileType

The type of audio file to create. See AudioFileTypeID for constants that can be used.

inFormat

A pointer to the structure that describes the format of the data.

inFlags

Relevant flags for creating or opening the file. If kAudioFileFlags_EraseFile is set, it erases an existing file. If the flag is not set, the function fails fails if the URL is an existing file.

outAudioFile

On output, a pointer to a newly created or initialized file.

Return Value

A result code. See Result Codes.

Discussion

This function uses a CFURLRef type rather than the FSRef type used by the deprecated AudioFileCreate function.

See Also

Creating and Initializing Audio Files

AudioFileInitializeWithCallbacks

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