AEAudioFilePlayerModule Class Reference

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.
 

Detailed Description

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.

Method Documentation

- (instancetype _Nullable) initWithRenderer: (AERenderer *_Nullable)  renderer
URL: (NSURL *_Nonnull)  url
error: (NSError *_Nullable *_Nullable)  error 

Default initialiser.

Parameters
rendererThe renderer
urlURL to the file to load
errorIf 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.

Parameters
timeThe 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.

Parameters
timeThe timestamp at which to begin playback
blockBlock 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.

Parameters
filePlayerThe player
timeTime to look up playhead position for
Returns
Current playhead position, in seconds, relative to the start of the file
- (BOOL) AEAudioFilePlayerModuleGetPlaying (__unsafe_unretained AEAudioFilePlayerModule *_Nonnull)  filePlayer

Determine if playing.

Parameters
filePlayerThe player
Returns
Whether currently playing

Property Documentation

- (NSURL* _Nullable) url
readnonatomicstrong

Original media URL.

- (AESeconds) duration
readnonatomicassign

Length of audio file, in seconds.

- (AESeconds) regionStartTime
readwritenonatomicassign

Time offset within file to begin playback.

- (AESeconds) regionDuration
readwritenonatomicassign

Duration of playback within the file.

- (AESeconds) currentTime
readwritenonatomicassign

Current playback position relative to the beginning of the file.

- (BOOL) playing
readnonatomicassign

Whether playing (not KVO observable)

- (BOOL) loop
readwritenonatomicassign

Whether to loop this track.

- (UInt32) microfadeFrames
readwritenonatomicassign

Number of frames to microfade at start and end (0 by default; increase to smooth out discontinuities - clicks - at start and end)

- (AEAudioFilePlayerModuleBlock _Nullable) completionBlock
readwritenonatomiccopy

A block to be called when non-looped playback finishes.


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