Audio file reader. More...
#import <AEAudioFileReader.h>
Inherits NSObject.
Instance Methods | |
(void) | - cancel |
Cancel a load operation. | |
Class Methods | |
(BOOL) | + infoForFileAtURL:audioDescription:length:error: |
Get info for a file. | |
(instancetype _Nonnull) | + loadFileAtURL:targetAudioDescription:completionBlock: |
Load a file into memory all at once. | |
(instancetype _Nonnull) | + readFileAtURL:targetAudioDescription:readBlock:completionBlock: |
Read file incrementally, with a read block. | |
(instancetype _Nonnull) | + readFileAtURL:targetAudioDescription:readBlock:completionBlock:blockSize: |
Read file incrementally, with a read block and block size. | |
Audio file reader.
This class is used to load an audio file. It can be used to either load an audio file completely into memory in a single operation, or to incrementally read pieces of the file.
Loading is done on a background thread.
Note that for live playback, you should use AEAudioFilePlayerModule.
+ (BOOL) infoForFileAtURL: | (NSURL *_Nonnull) | url | |
audioDescription: | (AudioStreamBasicDescription *_Nullable) | audioDescription | |
length: | (UInt32 *_Nullable) | lengthInFrames | |
error: | (NSError *_Nullable *_Nullable) | 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 |
+ (instancetype _Nonnull) loadFileAtURL: | (NSURL *_Nonnull) | url | |
targetAudioDescription: | (AudioStreamBasicDescription) | targetAudioDescription | |
completionBlock: | (AEAudioFileReaderLoadBlock _Nonnull) | block | |
Load a file into memory all at once.
Will load the entire file into memory in a background thread, then call the completion block on the main thread when finished.
Note that this is not suitable for large audio files, as the entire file will be loaded into memory.
url | URL to the file to load |
targetAudioDescription | The audio description for the loaded audio (e.g. AEAudioDescription) |
block | Block to call when load has finished |
+ (instancetype _Nonnull) readFileAtURL: | (NSURL *_Nonnull) | url | |
targetAudioDescription: | (AudioStreamBasicDescription) | targetAudioDescription | |
readBlock: | (AEAudioFileReaderIncrementalReadBlock _Nullable) | readBlock | |
completionBlock: | (AEAudioFileReaderCompletionBlock _Nonnull) | completionBlock | |
Read file incrementally, with a read block.
Will load the file incrementally, calling the reader block with fixed-size pieces of audio.
url | URL to the file to load |
targetAudioDescription | The audio description for the loaded audio (e.g. AEAudioDescription) |
readBlock | Block to call for each segment of the file; will be called on a background thread |
completionBlock | Block to call on main thread when read operation has completed, or an error occurs |
+ (instancetype _Nonnull) readFileAtURL: | (NSURL *_Nonnull) | url | |
targetAudioDescription: | (AudioStreamBasicDescription) | targetAudioDescription | |
readBlock: | (AEAudioFileReaderIncrementalReadBlock _Nullable) | readBlock | |
completionBlock: | (AEAudioFileReaderCompletionBlock _Nonnull) | completionBlock | |
blockSize: | (UInt32) | blockSize | |
Read file incrementally, with a read block and block size.
Will load the file incrementally, calling the reader block with fixed-size pieces of audio that match the block size.
url | URL to the file to load |
targetAudioDescription | The audio description for the loaded audio (e.g. AEAudioDescription) |
readBlock | Block to call for each segment of the file; will be called on a background thread |
completionBlock | Block to call on main thread when read operation has completed, or an error occurs |
blockSize | The size of blocks to receive |
- (void) cancel |
Cancel a load operation.