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. | |
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.
- (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.
renderer | Renderer to use to drive processing |
url | URL to the file to write to |
type | The type of the file to write |
sampleRate | Sample rate to use |
channelCount | Number of channels |
error | If 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.
duration | Duration to run for, in seconds |
completionBlock | Block 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.
conditionBlock | Block 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. |
completionBlock | Block to perform on main thread when render has completed |
- (void) finishWriting |
Finish writing the file.
|
readwritenonatomicstrong |
The renderer. You may change this between runs, but not during a run.
|
readnonatomicassign |
The sample rate.
|
readnonatomicassign |
The channel count.
|
readnonatomicstrong |
The URL of the output file.
|
readnonatomicassign |
The number of frames recorded so far.