AEAudioUnitOutput Class Reference

Audio unit output. More...

#import <AEAudioUnitOutput.h>

Inherits NSObject.

Instance Methods

(instancetype _Nullable) - initWithRenderer:
 Initialize with a renderer.
 
(BOOL) - setup:
 Setup (optional)
 
(BOOL) - start:
 Start the audio unit.
 
(void) - stop
 Stop the audio unit.
 
(AudioUnit _Nullable) - AEAudioUnitOutputGetAudioUnit
 Get access to audio unit.
 
(AESeconds- AEAudioUnitOutputGetOutputLatency
 Get the output latency.
 

Properties

AERenderer *_Nullable renderer
 The renderer. You may change this at any time; assignment is thread-safe.
 
AudioUnit _Nullable audioUnit
 The audio unit.
 
double sampleRate
 The sample rate at which to run, or zero to track the hardware sample rate.
 
double currentSampleRate
 The current sample rate.
 
BOOL running
 Whether unit is currently active.
 
int numberOfOutputChannels
 The current number of output channels.
 
BOOL latencyCompensation
 Whether to automatically perform latency compensation (default YES)
 
AEAudioUnitInputModule *_Nonnull inputModule
 The input module.
 

Detailed Description

Audio unit output.

Renders audio to the system output via an audio unit.

Method Documentation

- (instancetype _Nullable) initWithRenderer: (AERenderer *_Nonnull)  renderer

Initialize with a renderer.

Parameters
rendererRenderer to use to drive processing
- (BOOL) setup: (NSError *__autoreleasing _Nullable *_Nullable)  error

Setup (optional)

You may call this method prior to start: to set up the rendering resources. Once this is called, the audioUnit property will yield a valid audio unit instance. If you do not use this method, it will be called automatically the first time start: is called.

Parameters
errorIf an error occured and this is not nil, it will be set to the error on output
Returns
YES on success, NO on failure
- (BOOL) start: (NSError *__autoreleasing _Nullable *_Nullable)  error

Start the audio unit.

Parameters
errorIf an error occured and this is not nil, it will be set to the error on output
Returns
YES on success, NO on failure
- (void) stop

Stop the audio unit.

- (AudioUnit _Nullable) AEAudioUnitOutputGetAudioUnit (__unsafe_unretained AEAudioUnitOutput *_Nonnull)  output

Get access to audio unit.

Available for realtime thread usage

Parameters
outputThe output instance
Returns
The audio unit
- (AESeconds) AEAudioUnitOutputGetOutputLatency (__unsafe_unretained AEAudioUnitOutput *_Nonnull)  output

Get the output latency.

This function returns the hardware output latency, in seconds. If you have disabled latency compensation, and timing is important in your app, then you should factor this value into your timing calculations.

Parameters
outputThe output instance
Returns
The current output latency

Property Documentation

- (AERenderer* _Nullable) renderer
readwritenonatomicstrong

The renderer. You may change this at any time; assignment is thread-safe.

- (AudioUnit _Nullable) audioUnit
readnonatomicassign

The audio unit.

- (double) sampleRate
readwritenonatomicassign

The sample rate at which to run, or zero to track the hardware sample rate.

- (double) currentSampleRate
readnonatomicassign

The current sample rate.

- (BOOL) running
readnonatomicassign

Whether unit is currently active.

- (int) numberOfOutputChannels
readnonatomicassign

The current number of output channels.

- (BOOL) latencyCompensation
readwritenonatomicassign

Whether to automatically perform latency compensation (default YES)

- (AEAudioUnitInputModule* _Nonnull) inputModule
readnonatomicstrong

The input module.

This is a module that can be used to pull audio input from this unit, instead of using AEAudioUnitInputModule. Use this particularly if you intend to implement an Inter-App Audio or Audiobus effect node.

On the Mac, this returns an instance that uses its own audio unit.

On iOS, this returns an instance that uses the output's audio unit. Note that starting and stopping the returned module will cause the output's audio unit to be uninitialized, reconfigured then reinitialized, temporarily interrupting audio rendering.


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