Audio file loader operation. More...
#import <AEAudioFileLoaderOperation.h>
Inherits NSOperation.
Instance Methods | |
(id) | - initWithFileURL:targetAudioDescription: |
Initializer. | |
Class Methods | |
(BOOL) | + infoForFileAtURL:audioDescription:lengthInFrames:error: |
Get info for a file. | |
Properties | |
void(^ | audioReceiverBlock )(AudioBufferList *audio, UInt32 lengthInFrames) |
A block to use to receive audio. | |
void(^ | completedBlock )() |
AudioBufferList * | bufferList |
The loaded audio, once operation has completed, unless audioReceiverBlock is set. | |
UInt32 | lengthInFrames |
The length of the audio file. | |
NSError * | error |
The error, if one occurred. | |
Audio file loader operation.
This in an NSOperation object that is used to load an arbitraty audio file into memory. Use it by creating an instance, passing in the file URL to the audio file, the audio description for the format you the loaded audio in, optionally setting a completion block, and adding the operation to an operation queue.
If you wish to load a file synchronously, then you can simply start the operation yourself, like so:
Note that this class is not suitable for use with large audio files, which should be loaded incrementally as playback occurs.
+ (BOOL) infoForFileAtURL: | (NSURL *) | url | |
audioDescription: | (AudioStreamBasicDescription *) | audioDescription | |
lengthInFrames: | (UInt32 *) | lengthInFrames | |
error: | (NSError **) | error | |
Get info for a file.
url | URL to the file |
audioDescription | On output, if not NULL, will be filled with the file's audio description |
lengthInFrames | On output, if not NULL, will indicated the file length in frames |
error | If not NULL, and an error occurs, this contains the error that occurred |
- (id) initWithFileURL: | (NSURL *) | url | |
targetAudioDescription: | (AudioStreamBasicDescription) | audioDescription | |
Initializer.
url | URL to the file to load |
audioDescription | The target audio description |
|
readwritenonatomiccopy |
A block to use to receive audio.
If this is set, then audio will be provided via this block as it is loaded, instead of stored within bufferList.
|
readwritenonatomiccopy |
|
readnonatomicassign |
The loaded audio, once operation has completed, unless audioReceiverBlock is set.
You are responsible for freeing both the memory pointed to by each mData pointer, as well as the buffer list itself. If an error occurred, this will be NULL.
|
readnonatomicassign |
The length of the audio file.
|
readnonatomicstrong |
The error, if one occurred.