AEAudioFilePlayer Class Reference

Audio file player. More...

#import <AEAudioFilePlayer.h>

Inherits AEAudioUnitChannel.

Instance Methods

(instancetype) - initWithURL:error:
 Default initialiser.
 
(void) - playAtTime:
 Schedule playback for a particular time.
 
(UInt32) - AEAudioFilePlayerGetPlayhead
 Get playhead position, in frames.
 
- Instance Methods inherited from AEAudioUnitChannel
(id) - initWithComponentDescription:
 Create a new Audio Unit channel.
 
(id) - initWithComponentDescription:preInitializeBlock:
 Create a new Audio Unit channel, with a block to run before initialization of the unit.
 
(AudioUnit) - AEAudioUnitChannelGetAudioUnit
 Retrieve audio unit reference.
 
(double) - getParameterValueForId:
 Get an audio unit parameter.
 
(void) - setParameterValue:forId:
 Set an audio unit parameter.
 
- Instance Methods inherited from <AEAudioPlayable>
(void) - setupWithAudioController:
 Perform setup, to prepare for playback.
 
(void) - teardown
 Clean up resources.
 

Class Methods

(instancetype) + audioFilePlayerWithURL:error:
 Create a new player instance.
 

Properties

NSURL * url
 Original media URL.
 
NSTimeInterval duration
 Length of audio file, in seconds.
 
NSTimeInterval regionStartTime
 Time offset within file to begin playback.
 
NSTimeInterval regionDuration
 Duration of playback within the file.
 
NSTimeInterval currentTime
 Current playback position relative to the beginning of the file, in seconds.
 
BOOL loop
 Whether to loop this track.
 
BOOL removeUponFinish
 Whether the track automatically removes itself from the audio controller after playback completes.
 
void(^ completionBlock )()
 A block to be called when playback finishes.
 
- Properties inherited from AEAudioUnitChannel
float volume
 Track volume.
 
float pan
 Track pan.
 
BOOL channelIsPlaying
 
BOOL channelIsMuted
 
AudioUnit audioUnit
 The audio unit.
 
AUNode audioGraphNode
 The audio graph node.
 
- Properties inherited from <AEAudioPlayable>
AEAudioRenderCallback renderCallback
 Reference to the render callback.
 
float volume
 Track volume.
 
float pan
 Track pan.
 
BOOL channelIsPlaying
 
BOOL channelIsMuted
 
AudioStreamBasicDescription audioDescription
 

Detailed Description

Audio file player.

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.

To use, create an instance, then add it to the audio controller.

Method Documentation

+ (instancetype) audioFilePlayerWithURL: (NSURL *)  url
error: (NSError **)  error 

Create a new player instance.

Parameters
urlURL to the file to load
errorIf not NULL, the error on output
Returns
The audio player, ready to be added to the audio controller.
- (instancetype) initWithURL: (NSURL *)  url
error: (NSError **)  error 

Default initialiser.

Parameters
urlURL to the file to load
errorIf not NULL, the error on output
- (void) playAtTime: (uint64_t)  time

Schedule playback for a particular time.

This causes the player to emit silence up until the given timestamp is reached. Use this method to synchronize playback with other audio generators.

Note: When you call this method, the property channelIsPlaying will be set to YES, to enable playback when the start time is reached.

Parameters
timeThe time, in host ticks, at which to begin playback
- (UInt32) AEAudioFilePlayerGetPlayhead (__unsafe_unretained AEAudioFilePlayer *)  filePlayer

Get playhead position, in frames.

For use on the realtime thread.

Parameters
filePlayerThe player

Property Documentation

- (NSURL*) url
readnonatomicstrong

Original media URL.

- (NSTimeInterval) duration
readnonatomicassign

Length of audio file, in seconds.

- (NSTimeInterval) regionStartTime
readwritenonatomicassign

Time offset within file to begin playback.

- (NSTimeInterval) regionDuration
readwritenonatomicassign

Duration of playback within the file.

- (NSTimeInterval) currentTime
readwritenonatomicassign

Current playback position relative to the beginning of the file, in seconds.

- (BOOL) loop
readwritenonatomicassign

Whether to loop this track.

- (BOOL) removeUponFinish
readwritenonatomicassign

Whether the track automatically removes itself from the audio controller after playback completes.

- (void(^ completionBlock)())
readwritenonatomiccopy

A block to be called when playback finishes.


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