AEAudioFileWriter Class Reference

Audio file writer. More...

#import <AEAudioFileWriter.h>

Inherits <NSObject>.

Instance Methods

(id) - initWithAudioDescription:
 Initialise, with a given audio description to use.
 
(BOOL) - beginWritingToFileAtPath:fileType:error:
 Begin write operation.
 
(BOOL) - beginWritingToFileAtPath:fileType:bitDepth:error:
 
(BOOL) - beginWritingToFileAtPath:fileType:bitDepth:channels:error:
 
(void) - finishWriting
 Complete writing operation.
 
(OSStatus) - AEAudioFileWriterAddAudio
 Add audio to be written.
 
(OSStatus) - AEAudioFileWriterAddAudioSynchronously
 Add audio to be written, synchronously.
 

Class Methods

(BOOL) + AACEncodingAvailable
 

Properties

NSString * path
 The path to the file being written.
 

Detailed Description

Audio file writer.

Provides an easy-to-use interface to the ExtAudioFile API, allowing asynchronous, Core Audio thread-safe writing of arbitrary audio formats.

Method Documentation

+ (BOOL) AACEncodingAvailable
- (id) initWithAudioDescription: (AudioStreamBasicDescription)  audioDescription

Initialise, with a given audio description to use.

Parameters
audioDescriptionThe audio format of audio that will be fed to this class via the AddAudio functions.
- (BOOL) beginWritingToFileAtPath: (NSString *)  path
fileType: (AudioFileTypeID)  fileType
error: (NSError **)  error 

Begin write operation.

This will create the output file and prepare internal structures for writing.

Parameters
pathThe path to the file to create
fileTypeA file type
errorOn output, if not NULL, the error if one occurred
Returns
YES on success; NO on error
- (BOOL) beginWritingToFileAtPath: (NSString *)  path
fileType: (AudioFileTypeID)  fileType
bitDepth: (UInt32)  bits
error: (NSError **)  error 
- (BOOL) beginWritingToFileAtPath: (NSString *)  path
fileType: (AudioFileTypeID)  fileType
bitDepth: (UInt32)  bits
channels: (UInt32)  channels
error: (NSError **)  error 
- (void) finishWriting

Complete writing operation.

Finishes write, closes the file and cleans up internal resources.

- (OSStatus) AEAudioFileWriterAddAudio (AEAudioFileWriter *)  writer
(AudioBufferList *)  bufferList
(UInt32)  lengthInFrames 

Add audio to be written.

This C function, safe to be used in a Core Audio realtime thread context, is used to feed audio to this class to be written to the file.

It runs asynchronously, and will never block.

Parameters
writerA pointer to the writer object
bufferListAn AudioBufferList containing the audio in the format you provided upon initialization
lengthInFramesThe length of the audio in the buffer list, in frames
Returns
A status code; noErr on success
- (OSStatus) AEAudioFileWriterAddAudioSynchronously (AEAudioFileWriter *)  writer
(AudioBufferList *)  bufferList
(UInt32)  lengthInFrames 

Add audio to be written, synchronously.

This C function allows you to synchronously add audio - it will block until the audio is written to the file. Note that due to the fact that it will block, this function is not to be used from a Core Audio realtime thread.

Parameters
writerA pointer to the writer object
bufferListAn AudioBufferList containing the audio in the format you provided upon initialization
lengthInFramesThe length of the audio in the buffer list, in frames
Returns
A status code; noErr on success

Property Documentation

- (NSString*) path
readnonatomicstrong

The path to the file being written.


The documentation for this class was generated from the following file: