AEMemoryBufferPlayer Class Reference

Memory buffer player. More...

#import <AEMemoryBufferPlayer.h>

Inherits <NSObject>, and <AEAudioPlayable>.

Instance Methods

(instancetype) - initWithBuffer:audioDescription:freeWhenDone:
 Initialise with a memory buffer.
 
(void) - playAtTime:
 Schedule playback for a particular time.
 
- Instance Methods inherited from <AEAudioPlayable>
(void) - setupWithAudioController:
 Perform setup, to prepare for playback.
 
(void) - teardown
 Clean up resources.
 

Class Methods

(void) + beginLoadingAudioFileAtURL:audioDescription:completionBlock:
 Initialise with audio loaded from a file.
 

Properties

AudioBufferList * buffer
 The audio buffer.
 
NSTimeInterval duration
 Length of audio, in seconds.
 
NSTimeInterval currentTime
 Current playback position, in seconds.
 
AudioStreamBasicDescription audioDescription
 The client audio format.
 
BOOL loop
 Whether to loop this track.
 
float volume
 Track volume.
 
float pan
 Track pan.
 
BOOL channelIsPlaying
 Whether the track is playing.
 
BOOL channelIsMuted
 Whether the track is muted.
 
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.
 
void(^ startLoopBlock )()
 A block to be called when the loop restarts in loop mode.
 
- 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

Memory buffer player.

This class allows you to play a buffer containing audio, either as one-off samples, or looped. It can load any audio file format supported by iOS.

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

Method Documentation

+ (void) beginLoadingAudioFileAtURL: (NSURL *)  url
audioDescription: (AudioStreamBasicDescription)  audioDescription
completionBlock: (AEMemoryBufferPlayer *) 
(NSError *)  completionBlock 

Initialise with audio loaded from a file.

This method will asynchronously load the given audio file into memory, and create an AEMemoryBufferPlayer instance when it is finished.

Parameters
urlURL to the file to load into memory
audioDescriptionThe target audio description to use (usually the same as AEAudioController's)
completionBlockBlock to call when the load operation has finished
- (instancetype) initWithBuffer: (AudioBufferList *)  buffer
audioDescription: (AudioStreamBasicDescription)  audioDescription
freeWhenDone: (BOOL)  freeWhenDone 

Initialise with a memory buffer.

Parameters
bufferAudio buffer
audioDescriptionThe description of the audio provided
freeWhenDoneWhether to free the audio buffer when this class is deallocated
- (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

Property Documentation

- (AudioBufferList*) buffer
readnonatomicassign

The audio buffer.

- (NSTimeInterval) duration
readnonatomicassign

Length of audio, in seconds.

- (NSTimeInterval) currentTime
readwritenonatomicassign

Current playback position, in seconds.

- (AudioStreamBasicDescription) audioDescription
readnonatomicassign

The client audio format.

- (BOOL) loop
readwritenonatomicassign

Whether to loop this track.

- (float) volume
readwritenonatomicassign

Track volume.

- (float) pan
readwritenonatomicassign

Track pan.

- (BOOL) channelIsPlaying
readwritenonatomicassign

Whether the track is playing.

- (BOOL) channelIsMuted
readwritenonatomicassign

Whether the track is muted.

- (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.

- (void(^ startLoopBlock)())
readwritenonatomiccopy

A block to be called when the loop restarts in loop mode.


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