AEAudioUnitInputModule Class Reference

Audio input module. More...

#import <AEAudioUnitInputModule.h>

Inherits AEModule.

Instance Methods

(BOOL) - setup:
 Setup (optional)
 
(BOOL) - start:
 Start the audio unit.
 
(void) - stop
 Stop the audio unit.
 
(AudioUnit _Nullable) - AEAudioUnitInputModuleGetAudioUnit
 Get access to audio unit.
 
(AudioTimeStamp) - AEAudioUnitInputModuleGetInputTimestamp
 Get the last received input timestamp.
 
(AESeconds- AEAudioUnitInputModuleGetInputLatency
 Get the input latency.
 
- 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

AudioUnit _Nullable audioUnit
 The audio unit.
 
BOOL running
 Whether unit is currently active.
 
int numberOfInputChannels
 The current number of input channels (key-value observable)
 
double inputGain
 The input gain level (as power ratio)
 
BOOL latencyCompensation
 Whether to automatically perform latency compensation (default YES)
 
- Properties inherited from AEModule
AEModuleProcessFunc _Nonnull processFunction
 Process function.
 
AEModuleIsActiveFunc _Nullable isActiveFunction
 Active test function.
 
AERenderer *_Nullable renderer
 The renderer.
 

Detailed Description

Audio input module.

This module receives audio input from the system audio hardware, and pushes a buffer onto the stack containing the received audio. The pushed buffer has the same channel count as the currently-attached audio hardware, accessible via the "numberOfInputChannels" property.

It's recommended that you do not create an instance of this class directly; instead, use the instance returned from AEAudioUnitOutput's inputModule property, which uses the same underlying audio unit instance as the output.

Method Documentation

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

Note that if this module was retrieved from AEAudioUnitOutput, this will do nothing.

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.

You need to start the audio unit to be able to begin getting audio input.

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) AEAudioUnitInputModuleGetAudioUnit (__unsafe_unretained AEAudioUnitInputModule *_Nonnull)  module

Get access to audio unit.

Available for realtime thread usage

Parameters
moduleThe module instance
Returns
The audio
- (AudioTimeStamp) AEAudioUnitInputModuleGetInputTimestamp (__unsafe_unretained AEAudioUnitInputModule *_Nonnull)  module

Get the last received input timestamp.

This gives access to the most recent AudioTimeStamp associated with input audio. Use this to perform synchronization.

Parameters
moduleThe module instance
Returns
The most recent audio timestamp
- (AESeconds) AEAudioUnitInputModuleGetInputLatency (__unsafe_unretained AEAudioUnitInputModule *_Nonnull)  module

Get the input latency.

This function returns the hardware input 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
moduleThe module instance
Returns
The current input latency

Property Documentation

- (AudioUnit _Nullable) audioUnit
readnonatomicassign

The audio unit.

- (BOOL) running
readnonatomicassign

Whether unit is currently active.

- (int) numberOfInputChannels
readnonatomicassign

The current number of input channels (key-value observable)

- (double) inputGain
readwritenonatomicassign

The input gain level (as power ratio)

- (BOOL) latencyCompensation
readwritenonatomicassign

Whether to automatically perform latency compensation (default YES)


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