AEAudioFileOutput Class Reference

File output. More...

#import <AEAudioFileOutput.h>

Inherits NSObject.

Instance Methods

(instancetype _Nullable) - initWithRenderer:URL:type:sampleRate:channelCount:error:
 Initializer.
 
(void) - runForDuration:completionBlock:
 Run offline rendering for a specified duration.
 
(void) - runUntilCondition:completionBlock:
 Run offline rendering until a given condition.
 
(void) - finishWriting
 Finish writing the file.
 

Properties

AERenderer *_Nullable renderer
 The renderer. You may change this between runs, but not during a run.
 
double sampleRate
 The sample rate.
 
int numberOfChannels
 The channel count.
 
NSURL *_Nonnull fileURL
 The URL of the output file.
 
UInt64 numberOfFramesRecorded
 The number of frames recorded so far.
 

Detailed Description

File output.

This class implements an offline (i.e. faster-than-realtime) render to file. It can be used in place of AEAudioUnitOutput, for instance, and will write to disk rather than sending audio to the device output.

Note that because this class runs the render loop as fast as it can write to disk, it isn't suitable for render loops that receive live audio.

Method Documentation

- (instancetype _Nullable) initWithRenderer: (AERenderer *_Nonnull)  renderer
URL: (NSURL *_Nonnull)  url
type: (AEAudioFileType)  type
sampleRate: (double)  sampleRate
channelCount: (int)  channelCount
error: (NSError *_Nullable *_Nullable)  error 

Initializer.

Parameters
rendererRenderer to use to drive processing
urlURL to the file to write to
typeThe type of the file to write
sampleRateSample rate to use
channelCountNumber of channels
errorIf not NULL, the error on output
- (void) runForDuration: (AESeconds duration
completionBlock: (AEAudioFileOutputCompletionBlock _Nonnull)  completionBlock 

Run offline rendering for a specified duration.

You may perform multiple runs, prior to calling finishWriting. Rendering will occur on a secondary thread.

Parameters
durationDuration to run for, in seconds
completionBlockBlock to perform on main thread when render has completed
- (void) runUntilCondition: (AEAudioFileOutputConditionBlock _Nonnull)  conditionBlock
completionBlock: (AEAudioFileOutputCompletionBlock _Nonnull)  completionBlock 

Run offline rendering until a given condition.

Rendering will continue, on a secondary thread, until the given block returns YES.

You may perform multiple runs, prior to calling finishWriting.

Parameters
conditionBlockBlock to be called on the secondary rendering thread for each render cycle to determine whether recording should stop. Return YES to stop; NO to continue.
completionBlockBlock to perform on main thread when render has completed
- (void) finishWriting

Finish writing the file.

Property Documentation

- (AERenderer* _Nullable) renderer
readwritenonatomicstrong

The renderer. You may change this between runs, but not during a run.

- (double) sampleRate
readnonatomicassign

The sample rate.

- (int) numberOfChannels
readnonatomicassign

The channel count.

- (NSURL* _Nonnull) fileURL
readnonatomicstrong

The URL of the output file.

- (UInt64) numberOfFramesRecorded
readnonatomicassign

The number of frames recorded so far.


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