ABAudioUnitFader Class Reference

Audio Unit Fader. More...

#import <ABAudioUnitFader.h>

Inherits NSObject.

Class Methods

(void) + fadeOutAndStopAudioUnit:
 Fade out, then stop audio unit.
 
(void) + fadeOutAudioUnit:completionBlock:
 Fade out audio unit, then call completion block.
 
(void) + startAndFadeInAudioUnit:
 Start, then fade in audio unit.
 
(void) + fadeInAudioUnit:beginBlock:completionBlock:
 Fade in audio unit, then call completion block.
 
(BOOL) + transitionsRunning
 Determine if there are any running transitions.
 
(void) + cancel
 Cancel any current transitions.
 

Detailed Description

Audio Unit Fader.

This class provides an easy-to-use facility for starting a Remote IO audio unit, then fading in, or fading out then stopping a Remote IO audio unit. This allows your app to transition smoothly between running and stopped states without any unpleasant clicks.

Use this class in place of calling AudioOutputUnitStart or AudioOutputUnitStop, and it will perform a smooth fade in or out, and either call the appropriate start/stop routines itself, or invoke a completion block you provide, to perform your own shutdown or setup.

Method Documentation

+ (void) fadeOutAndStopAudioUnit: (AudioUnit)  audioUnit

Fade out, then stop audio unit.

This method will apply a fade-out ramp on the provided Remote IO audio unit, then call AudioOutputUnitStop, to halt the audio unit's render pipeline.

Calling this method cancels any other transitions.

Parameters
audioUnitA reference to a Remote IO audio unit (kAudioUnitSubType_RemoteIO)
+ (void) fadeOutAudioUnit: (AudioUnit)  audioUnit

Fade out audio unit, then call completion block.

This method will apply a fade-out ramp on the provided Remote IO audio unit, then call the provided completion block. You should stop your audio output's render pipeline from within this completion block, by either calling AudioOutputUnitStop, or if you're using an AudioGraph, AUGraphStop.

Calling this method cancels any other transitions.

Parameters
audioUnitA reference to a Remote IO audio unit (kAudioUnitSubType_RemoteIO)
blockBlock to call on completion of fade-out
+ (void) startAndFadeInAudioUnit: (AudioUnit)  audioUnit

Start, then fade in audio unit.

This method will call AudioOutputUnitStart on the provided audio unit, then apply a fade-in ramp on the provided Remote IO audio unit.

Calling this method cancels any other transitions.

Parameters
audioUnitA reference to a Remote IO audio unit (kAudioUnitSubType_RemoteIO)
+ (void) fadeInAudioUnit: (AudioUnit)  audioUnit

Fade in audio unit, then call completion block.

This method will apply a fade-in ramp on the provided Remote IO audio unit, initialising then calling the provided beginBlock, which should start the audio unit by either calling AudioOutputUnitStart, or if you're using an AudioGraph, AUGraphStart. Upon completion, the provided optional completion block will be called.

If you do not need to be notified on completion of the fade-in transition, pass nil for the 'completionBlock' parameter.

Calling this method cancels any other transitions.

Parameters
audioUnitA reference to a Remote IO audio unit (kAudioUnitSubType_RemoteIO)
beginBlockBlock to call at beginning of process, after initialisation
completionBlockBlock to call on completion of fade-in
+ (BOOL) transitionsRunning

Determine if there are any running transitions.

+ (void) cancel

Cancel any current transitions.


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