Audio file player module. More...
#import <AEAudioFilePlayerModule.h>
Inherits AEAudioUnitModule.
Instance Methods | |
(instancetype _Nullable) | - initWithRenderer:URL:error: |
Default initialiser. | |
(void) | - playAtTime: |
Begin playback. | |
(void) | - playAtTime:beginBlock: |
Begin playback. | |
(void) | - stop |
Stop playback. | |
(AESeconds) | - AEAudioFilePlayerModuleGetPlayhead |
Get playhead position, in frames, for a given time. | |
(BOOL) | - AEAudioFilePlayerModuleGetPlaying |
Determine if playing. | |
Instance Methods inherited from AEAudioUnitModule | |
(instancetype _Nullable) | - initWithRenderer:componentDescription: |
Default initializer. | |
(instancetype _Nullable) | - initWithRenderer:componentDescription:subrenderer: |
Sub-renderer initializer. | |
(double) | - getParameterValueForId: |
Get an audio unit parameter. | |
(void) | - setParameterValue:forId: |
Set an audio unit parameter. | |
(BOOL) | - setup |
Setup audio unit. | |
(void) | - initialize |
Initialize audio unit. | |
(void) | - teardown |
Cleanup audio unit. | |
(AudioUnit _Nonnull) | - AEAudioUnitModuleGetAudioUnit |
Get access to audio unit. | |
Instance Methods inherited from AEModule | |
(instancetype _Nullable) | - initWithRenderer: |
Initializer. | |
(instancetype _Nonnull) | - NS_UNAVAILABLE |
(void) | - rendererDidChangeSampleRate |
Notifies the module that the renderer's sample rate has changed. | |
(void) | - rendererDidChangeNumberOfChannels |
Notifies the module that the renderer's channel count has changed. | |
Properties | |
NSURL *_Nullable | url |
Original media URL. | |
AESeconds | duration |
Length of audio file, in seconds. | |
AESeconds | regionStartTime |
Time offset within file to begin playback. | |
AESeconds | regionDuration |
Duration of playback within the file. | |
AESeconds | currentTime |
Current playback position relative to the beginning of the file. | |
BOOL | playing |
Whether playing (not KVO observable) | |
BOOL | loop |
Whether to loop this track. | |
UInt32 | microfadeFrames |
AEAudioFilePlayerModuleBlock _Nullable | completionBlock |
A block to be called when non-looped playback finishes. | |
Properties inherited from AEAudioUnitModule | |
AudioComponentDescription | componentDescription |
The component description. | |
AudioUnit _Nonnull | audioUnit |
The audio unit. | |
BOOL | hasInput |
Whether the audio unit processes input (and thus will process buffers in place, rather than pushing new buffers) | |
double | wetDry |
Wet/dry amount, for use with effect audio unit types. 0.0-1.0; 0.0 bypasses the effect entirely. | |
AERenderer *_Nullable | subrenderer |
Sub-renderer, for use with format converter audio unit types, such as the varispeed and time/pitch units. | |
Properties inherited from AEModule | |
AEModuleProcessFunc _Nonnull | processFunction |
Process function. | |
AEModuleIsActiveFunc _Nullable | isActiveFunction |
Active test function. | |
AERenderer *_Nullable | renderer |
The renderer. | |
Audio file player module.
This class allows you to play audio files, either as one-off samples, or looped. It will play any audio file format supported by iOS.
When processing, it will push a buffer onto the stack containing audio from the playing file, or silence if not playing. The number of channels in the pushed buffer matches the channels from the audio file.
- (instancetype _Nullable) initWithRenderer: | (AERenderer *_Nullable) | renderer | |
URL: | (NSURL *_Nonnull) | url | |
error: | (NSError *_Nullable *_Nullable) | error | |
Default initialiser.
renderer | The renderer |
url | URL to the file to load |
error | If not NULL, the error on output |
- (void) playAtTime: | (AudioTimeStamp) | time |
Begin playback.
This causes the player to emit silence up until the given timestamp is reached. Use this method to synchronize playback with other audio generators.
If you pass AETimeStampNone as the time, the module will immediately begin outputting audio.
time | The timestamp at which to begin playback |
- (void) playAtTime: | (AudioTimeStamp) | time | |
beginBlock: | (AEAudioFilePlayerModuleBlock _Nullable) | block | |
Begin playback.
Begins playback at the given time; this version allows you to provide a block which will be called on the main thread shortly after playback starts.
time | The timestamp at which to begin playback |
block | Block to call on main thread when the time is reached and playback starts |
- (void) stop |
Stop playback.
- (AESeconds) AEAudioFilePlayerModuleGetPlayhead | (__unsafe_unretained AEAudioFilePlayerModule *_Nonnull) | filePlayer | |
(AEHostTicks) | time | ||
Get playhead position, in frames, for a given time.
For use on the realtime thread.
filePlayer | The player |
time | Time to look up playhead position for |
- (BOOL) AEAudioFilePlayerModuleGetPlaying | (__unsafe_unretained AEAudioFilePlayerModule *_Nonnull) | filePlayer |
Determine if playing.
filePlayer | The player |
|
readnonatomicstrong |
Original media URL.
|
readnonatomicassign |
Length of audio file, in seconds.
|
readwritenonatomicassign |
Time offset within file to begin playback.
|
readwritenonatomicassign |
Duration of playback within the file.
|
readwritenonatomicassign |
Current playback position relative to the beginning of the file.
|
readnonatomicassign |
Whether playing (not KVO observable)
|
readwritenonatomicassign |
Whether to loop this track.
|
readwritenonatomicassign |
Number of frames to microfade at start and end (0 by default; increase to smooth out discontinuities - clicks - at start and end)
|
readwritenonatomiccopy |
A block to be called when non-looped playback finishes.