FMLiveSwitchCocoaAudioUnitSource Class Reference

Audio source that captures microphone input through the centralized AudioSessionManager's VPIO. More...

Instance Methods

(NSString *) - label
 Gets the label/name of this audio source implementation. More...
 
(bool) - useVoiceProcessingIO
 Legacy property - gets whether VPIO is in use. More...
 
(void) - setUseVoiceProcessingIO:
 Legacy setter - has no effect (VPIO configuration managed by AudioSessionManager). More...
 
(bool) - bypassVoiceProcessing
 Gets whether voice processing is bypassed. More...
 
(void) - setBypassVoiceProcessing:
 Legacy setter - has no effect (bypass managed by AudioSessionManager). More...
 
(bool) - voiceProcessingEnableAGC
 Gets whether Automatic Gain Control (AGC) is enabled. More...
 
(void) - setVoiceProcessingEnableAGC:
 Legacy setter - has no effect (AGC managed by AudioSessionManager). More...
 
- Instance Methods inherited from FMLiveSwitchAudioSource
(int) - calculateDurationFloatWithDataLength:
 Calculates the duration of an audio chunk given its data length (the number of bytes) and assuming that the clock rate and channel count match the output format. More...
 
(int) - calculateDurationWithDataLength:
 Calculates the duration of an audio chunk given its data length (the number of bytes) and assuming that the clock rate and channel count match the output format. More...
 
(FMLiveSwitchAudioConfig *) - config
 Gets the output configuration. More...
 
(FMLiveSwitchIAudioInputCollection *) - createInputCollectionWithOutput:
 Creates an input collection. More...
 
(bool) - disableTimestampReset
 Gets whether the timestamp should be reset using the wall clock after timestampResetInterval milliseconds elapse between frames. More...
 
(bool) - disableZeroPadding
 Gets whether to disable zero-padding for audio gaps. More...
 
(void) - doDestroy
 Destroys this instance. More...
 
(bool) - forceTimestampReset
 Gets whether the timestamp should be reset before the next frame is processed. More...
 
(int) - frameDuration
 Gets the frame duration in milliseconds. More...
 
(instancetype) - initWithOutputFormat:
 Initializes a new instance of the FMLiveSwitchAudioSource class. More...
 
(instancetype) - initWithOutputFormat:frameDuration:
 Initializes a new instance of the FMLiveSwitchAudioSource class. More...
 
(void) - raiseFrame:
 Raises a frame. More...
 
(void) - setDisableTimestampReset:
 Sets whether the timestamp should be reset using the wall clock after timestampResetInterval milliseconds elapse between frames. More...
 
(void) - setDisableZeroPadding:
 Sets whether to disable zero-padding for audio gaps. More...
 
(void) - setForceTimestampReset:
 Sets whether the timestamp should be reset before the next frame is processed. More...
 
(void) - setTimestampResetInterval:
 Sets the amount of time in milliseconds between audio frames that will trigger a reset of the timestamp to the wall clock. More...
 
(void) - setVolume:
 Sets a value indicating the volume (output resistance) of this source. More...
 
(int) - timestampResetInterval
 Gets the amount of time in milliseconds between audio frames that will trigger a reset of the timestamp to the wall clock. More...
 
(bool) - trySetSystemTimestampWithFrame:
 Tries to set the system timestamp on an audio frame. More...
 
(bool) - trySetTimestampWithFrame:
 Tries to set the timestamp on an audio frame. More...
 
(double) - volume
 Gets a value indicating the volume (output resistance) of this source. More...
 
- Instance Methods inherited from FMLiveSwitchMediaSource
(void) - addOnDisabledChange:
 Adds a handler that is raised when the Disabled property changes state. More...
 
(void) - addOnDisabledChangeWithCaller:
 Adds a handler that is raised when the Disabled property changes state. More...
 
(id- addOnDisabledChangeWithCallerWithBlock
 Adds a handler that is raised when the Disabled property changes state. More...
 
(void) - addOnDisabledChangeWithCallerWithBlock:
 Adds a handler that is raised when the Disabled property changes state. More...
 
(void) - addOnMuted:
 Adds a handler that is raised when the source is muted. More...
 
(void) - addOnPausedChange:
 Adds a handler that is raised when the Paused property changes state. More...
 
(void) - addOnProcessControlFrames:
 Adds a handler that is raised when control frames are processed. More...
 
(NSMutableArray *) - addOnProcessControlFramesWithBlock
 Adds a handler that is raised when control frames are processed. More...
 
(void) - addOnProcessControlFramesWithBlock:
 Adds a handler that is raised when control frames are processed. More...
 
(void) - addOnProcessedControlFrames:
 Adds a handler that is raised when control frames have been processed. More...
 
(NSMutableArray *) - addOnProcessedControlFramesWithBlock
 Adds a handler that is raised when control frames have been processed. More...
 
(void) - addOnProcessedControlFramesWithBlock:
 Adds a handler that is raised when control frames have been processed. More...
 
(void) - addOnRaiseControlFrameResponses:
 Adds a handler that is raised when control frame responses are raised. More...
 
(NSMutableArray *) - addOnRaiseControlFrameResponsesWithBlock
 Adds a handler that is raised when control frame responses are raised. More...
 
(void) - addOnRaiseControlFrameResponsesWithBlock:
 Adds a handler that is raised when control frame responses are raised. More...
 
(void) - addOnRaisedControlFrameResponses:
 Adds a handler that is raised when control frame responses have been raised. More...
 
(NSMutableArray *) - addOnRaisedControlFrameResponsesWithBlock
 Adds a handler that is raised when control frame responses have been raised. More...
 
(void) - addOnRaisedControlFrameResponsesWithBlock:
 Adds a handler that is raised when control frame responses have been raised. More...
 
(void) - addOnRaisedFrame:
 Adds a handler that is raised when a frame has been raised. More...
 
(TFrame) - addOnRaisedFrameWithBlock
 Adds a handler that is raised when a frame has been raised. More...
 
(void) - addOnRaisedFrameWithBlock:
 Adds a handler that is raised when a frame has been raised. More...
 
(void) - addOnRaiseFrame:
 Adds a handler that is raised when a frame is being raised. More...
 
(TFrame) - addOnRaiseFrameWithBlock
 Adds a handler that is raised when a frame is being raised. More...
 
(void) - addOnRaiseFrameWithBlock:
 Adds a handler that is raised when a frame is being raised. More...
 
(void) - addOnStateChange:
 Adds a handler that is raised when the state changes. More...
 
(TSource) - addOnStateChangeWithBlock
 Adds a handler that is raised when the state changes. More...
 
(void) - addOnStateChangeWithBlock:
 Adds a handler that is raised when the state changes. More...
 
(void) - addOnUnmuted:
 Adds a handler that is raised when the source is unmuted. More...
 
(void) - addOutput:
 Adds an output. More...
 
(void) - addOutputs:
 Adds some outputs. More...
 
(bool) - allowDiagnosticTimer
 Gets whether this media pipe is allowed to be timed. More...
 
(bool) - allowOutputRateTimer
 Gets whether this media pipe output rate is allowed to be timed. More...
 
(bool) - canChangeBitrate
 Gets whether this source can change the output bitrate. More...
 
(bool) - canPauseBitrate
 Gets whether this source can pause the output bitrate. More...
 
(FMLiveSwitchFuture< id > *) - changeInput:
 Changes the current input. More...
 
(NSString *) - content
 Gets the content descriptor. More...
 
(TIInputCollection) - createInputCollectionWithOutput:
 Creates an input collection. More...
 
(bool) - deactivated
 Gets a value indicating whether this source is deactivated. More...
 
(bool) - deactivatedByApplication
 Gets whether this source is deactivated because the application has requested it. More...
 
(bool) - deactivatedByServer
 Gets whether this source is deactivated because the server has requested it. More...
 
(NSString *) - description
 Returns a string that represents this instance. More...
 
(bool) - destroy
 Destroys this instance. More...
 
(bool) - disabled
 Gets a value indicating whether this source is disabled. More...
 
(void) - doProcessControlFrames:
 Processes control frames. More...
 
(FMLiveSwitchError *) - doProcessSdpMediaDescription:isOffer:isLocalDescription:
 Processes a local SDP media description. More...
 
(void) - doProcessSourceStatsFromOutputWithSourceStats:
 Processes source stats from an output. More...
 
(void) - doProcessTrackStatsFromOutputWithTrackStats:
 Processes track stats from an output. More...
 
(FMLiveSwitchFuture< id > *) - doStart
 Starts this instance. More...
 
(FMLiveSwitchFuture< id > *) - doStop
 Stops this instance. More...
 
(int) - getCcmSequenceNumber
 Gets the CCM sequence number. More...
 
(FMLiveSwitchFuture< NSMutableArray * > *) - getInputs
 Gets the available inputs. More...
 
(long long) - getPipelineSystemDelayWithOutputFormat:
 Gets the total pipeline system delay in ticks for a given output format. More...
 
(bool) - hasOutput:
 Determines whether this source has the specified output. More...
 
(void) - incrementCcmSequenceNumber
 Increments the CCM sequence number. More...
 
(instancetype) - initWithOutputFormat:
 Initializes a new instance of the FMLiveSwitchMediaSource`8 class. More...
 
(FMLiveSwitchSourceInput *) - input
 Gets the current input. More...
 
(bool) - isDestroyed
 Gets whether the current state is Destroyed. More...
 
(bool) - isStarted
 Gets whether the current state is Started. More...
 
(bool) - isStopped
 Gets whether the current state is Stopped. More...
 
(int) - maxOutputBitrate
 Gets the maximum allowed output bitrate, in kbps. More...
 
(FMLiveSwitchEncodingInfo *) - maxOutputEncoding
 Gets the maximum allowed output encoding. More...
 
(int) - minOutputBitrate
 Gets the minimum allowed output bitrate, in kbps. More...
 
(FMLiveSwitchEncodingInfo *) - minOutputEncoding
 Gets the minimum allowed output encoding. More...
 
(bool) - muted
 Gets whether output is muted. More...
 
(TIInput) - output
 Gets the output. More...
 
(void) - outputAddedWithOutput:
 Called when an output is added. More...
 
(bool) - outputCanProcessFrameWithOutput:
 Determines whether an output can process a frame from this pipe. More...
 
(bool) - outputDeactivated
 Gets whether output is deactivated. More...
 
(TFormat) - outputFormat
 Gets the output format. More...
 
(bool) - outputMuted
 Gets whether output is muted. More...
 
(void) - outputRemovedWithOutput:
 Called when an output is removed. More...
 
(NSString *) - outputRtpStreamId
 Gets the output RTP stream identifier. More...
 
(NSMutableArray *) - outputs
 Gets the outputs. More...
 
(bool) - outputSynchronizable
 Gets whether output is synchronizable. More...
 
(long long) - outputSynchronizationSource
 Gets the output synchronization source. More...
 
(bool) - overConstrained
 Gets whether this source is over-constrained. More...
 
(bool) - overConstrainedBitrate
 Gets whether the source bitrate is over-constrained. More...
 
(bool) - overConstrainedOutput
 Gets whether the output is over-constrained. More...
 
(bool) - overConstrainedOutputBitrate
 Gets whether the minimum allowed output bitrate exceeds the maximum allowed output bitrate. More...
 
(bool) - paused
 Gets a value indicating whether this source is paused. More...
 
(bool) - persistent
 Gets a value indicating whether this instance is persistent. More...
 
(NSString *) - pipelineJson
 Gets the pipeline JSON with this as the central point. More...
 
(NSString *) - pipelineJsonFromOutput
 Gets the pipeline JSON from an output. More...
 
(void) - processControlFrame:
 Processes a control frame. More...
 
(void) - processControlFrames:
 Processes control frames. More...
 
(FMLiveSwitchError *) - processSdpMediaDescriptionFromOutputWithMediaDescription:isOffer:isLocalDescription:
 Processes a local SDP media description from an output. More...
 
(void) - processSourceStatsFromOutputWithSourceStats:
 Processes source stats from an output. More...
 
(void) - processTrackStatsFromOutputWithTrackStats:
 Processes track stats from an output. More...
 
(void) - raiseControlFrameResponse:
 Raises a control frame response. More...
 
(void) - raiseControlFrameResponse:outputs:
 Raises a control frame response. More...
 
(void) - raiseControlFrameResponses:
 Raises control frame responses. More...
 
(void) - raiseControlFrameResponses:outputs:
 Raises control frame responses. More...
 
(void) - raiseDisabledChange
 Raises the OnDisabledChange event. More...
 
(void) - raiseFrame:
 Raises a frame. More...
 
(void) - removeOnDisabledChange:
 Removes a handler that is raised when the Disabled property changes state. More...
 
(void) - removeOnDisabledChangeWithCaller:
 Removes a handler that is raised when the Disabled property changes state. More...
 
(void) - removeOnMuted:
 Removes a handler that is raised when the source is muted. More...
 
(void) - removeOnPausedChange:
 Removes a handler that is raised when the Paused property changes state. More...
 
(void) - removeOnProcessControlFrames:
 Removes a handler that is raised when control frames are processed. More...
 
(void) - removeOnProcessedControlFrames:
 Removes a handler that is raised when control frames have been processed. More...
 
(void) - removeOnRaiseControlFrameResponses:
 Removes a handler that is raised when control frame responses are raised. More...
 
(void) - removeOnRaisedControlFrameResponses:
 Removes a handler that is raised when control frame responses have been raised. More...
 
(void) - removeOnRaisedFrame:
 Removes a handler that is raised when a frame has been raised. More...
 
(void) - removeOnRaiseFrame:
 Removes a handler that is raised when a frame is being raised. More...
 
(void) - removeOnStateChange:
 Removes a handler that is raised when the state changes. More...
 
(void) - removeOnUnmuted:
 Removes a handler that is raised when the source is unmuted. More...
 
(bool) - removeOutput:
 Removes an output. More...
 
(void) - removeOutputs
 Removes all outputs. More...
 
(void) - removeOutputs:
 Removes some outputs. More...
 
(void) - setDeactivated:
 Sets a value indicating whether this source is deactivated. More...
 
(void) - setInput:
 Sets the current input. More...
 
(void) - setMaxOutputBitrate:
 Sets the maximum allowed output bitrate, in kbps. More...
 
(void) - setMaxOutputEncoding:
 Sets the maximum allowed output encoding. More...
 
(void) - setMinOutputBitrate:
 Sets the minimum allowed output bitrate, in kbps. More...
 
(void) - setMinOutputEncoding:
 Sets the minimum allowed output encoding. More...
 
(void) - setMuted:
 Sets whether output is muted. More...
 
(void) - setOutput:
 Sets the output. More...
 
(void) - setOutputDeactivated:
 Sets whether output is deactivated. More...
 
(void) - setOutputMuted:
 Sets whether output is muted. More...
 
(void) - setOutputRtpStreamId:
 Sets the output RTP stream identifier. More...
 
(void) - setOutputs:
 Sets the outputs. More...
 
(void) - setOutputSynchronizable:
 Sets whether output is synchronizable. More...
 
(void) - setOutputSynchronizationSource:
 Sets the output synchronization source. More...
 
(void) - setPersistent:
 Sets a value indicating whether this instance is persistent. More...
 
(void) - setSynchronizationSource:
 Sets the output synchronization source. More...
 
(void) - setSystemDelay:
 Sets the system delay in ticks. More...
 
(void) - setTargetOutputBitrate:
 Sets the target output bitrate, in kbps. More...
 
(void) - setTargetOutputEncoding:
 Sets the target output encoding. More...
 
(FMLiveSwitchFuture< id > *) - start
 Starts this instance. More...
 
(FMLiveSwitchMediaSourceState) - state
 Gets the state. More...
 
(FMLiveSwitchFuture< id > *) - stop
 Stops this instance. More...
 
(long long) - synchronizationSource
 Gets the output synchronization source. More...
 
(long long) - systemDelay
 Gets the system delay in ticks. More...
 
(int) - targetOutputBitrate
 Gets the target output bitrate, in kbps. More...
 
(FMLiveSwitchEncodingInfo *) - targetOutputEncoding
 Gets the target output encoding. More...
 
(bool) - updateDisabled
 Updates the disabled property. More...
 
- Instance Methods inherited from <FMLiveSwitchIMediaOutput>
(void) - addOnDisabledChange:
 Adds a handler that is raised when the Disabled property changes state. More...
 
(void) - addOnDisabledChangeWithCaller:
 Adds a handler that is raised when the Disabled property changes state. More...
 
(id- addOnDisabledChangeWithCallerWithBlock
 Adds a handler that is raised when the Disabled property changes state. More...
 
(void) - addOnDisabledChangeWithCallerWithBlock:
 Adds a handler that is raised when the Disabled property changes state. More...
 
(void) - addOnPausedChange:
 Adds a handler that is raised when the Paused property changes state. More...
 
(void) - addOnProcessControlFrames:
 Adds a handler that is raised when control frames are processed. More...
 
(NSMutableArray *) - addOnProcessControlFramesWithBlock
 Adds a handler that is raised when control frames are processed. More...
 
(void) - addOnProcessControlFramesWithBlock:
 Adds a handler that is raised when control frames are processed. More...
 
(void) - addOnRaiseControlFrameResponses:
 Adds a handler that is raised when a control frame response is raised. More...
 
(NSMutableArray *) - addOnRaiseControlFrameResponsesWithBlock
 Adds a handler that is raised when a control frame response is raised. More...
 
(void) - addOnRaiseControlFrameResponsesWithBlock:
 Adds a handler that is raised when a control frame response is raised. More...
 
(void) - addOnRaiseFrame:
 Adds a handler that is raised when a frame is raised. More...
 
(FMLiveSwitchMediaFrame *) - addOnRaiseFrameWithBlock
 Adds a handler that is raised when a frame is raised. More...
 
(void) - addOnRaiseFrameWithBlock:
 Adds a handler that is raised when a frame is raised. More...
 
(NSString *) - content
 Gets the content descriptor. More...
 
(int) - getCcmSequenceNumber
 Gets the CCM sequence number. More...
 
(long long) - getPipelineSystemDelayWithOutputFormat:
 Gets the total pipeline system delay in ticks for a given media format. More...
 
(void) - incrementCcmSequenceNumber
 Increments the CCM sequence number. More...
 
(int) - maxOutputBitrate
 Gets the maximum allowed output bitrate, in kbps. More...
 
(FMLiveSwitchEncodingInfo *) - maxOutputEncoding
 Gets the maximum allowed output encoding. More...
 
(int) - minOutputBitrate
 Gets the minimum allowed output bitrate, in kbps. More...
 
(FMLiveSwitchEncodingInfo *) - minOutputEncoding
 Gets the minimum allowed output encoding. More...
 
(bool) - outputDeactivated
 Gets whether output is deactivated. More...
 
(bool) - outputMuted
 Gets whether output is muted. More...
 
(NSString *) - outputRtpStreamId
 Gets the output RTP stream identifier. More...
 
(bool) - outputSynchronizable
 Gets whether output is synchronizable. More...
 
(long long) - outputSynchronizationSource
 Gets the output synchronization source. More...
 
(void) - processControlFrames:
 Processes control frames. More...
 
(FMLiveSwitchError *) - processSdpMediaDescriptionFromOutputWithMediaDescription:isOffer:isLocalDescription:
 Processes a local SDP media description from an output. More...
 
(void) - processSourceStatsFromOutputWithSourceStats:
 Processes source stats from an output. More...
 
(void) - processTrackStatsFromOutputWithTrackStats:
 Processes track stats from an output. More...
 
(void) - removeOnDisabledChange:
 Removes a handler that is raised when the Disabled property changes state. More...
 
(void) - removeOnDisabledChangeWithCaller:
 Removes a handler that is raised when the Disabled property changes state. More...
 
(void) - removeOnPausedChange:
 Removes a handler that is raised when the Paused property changes state. More...
 
(void) - removeOnProcessControlFrames:
 Removes a handler that is raised when control frames are processed. More...
 
(void) - removeOnRaiseControlFrameResponses:
 Removes a handler that is raised when a control frame response is raised. More...
 
(void) - removeOnRaiseFrame:
 Removes a handler that is raised when a frame is raised. More...
 
(long long) - systemDelay
 Gets the system delay in ticks. More...
 
(int) - targetOutputBitrate
 Gets the target output bitrate, in kbps. More...
 
(FMLiveSwitchEncodingInfo *) - targetOutputEncoding
 Gets the target output encoding. More...
 
- Instance Methods inherited from <FMLiveSwitchIOutput>
(void) - addOutput:
 Adds an output. More...
 
(void) - addOutputs:
 Adds some outputs. More...
 
(NSObject< FMLiveSwitchIInput > *) - output
 Gets the output. More...
 
(FMLiveSwitchMediaFormat *) - outputFormat
 Gets the output format. More...
 
(NSMutableArray *) - outputs
 Gets the outputs. More...
 
(NSString *) - pipelineJsonFromOutput
 Gets the pipeline JSON from an output. More...
 
(bool) - removeOutput:
 Removes an output. More...
 
(void) - removeOutputs
 Removes all outputs. More...
 
(void) - removeOutputs:
 Removes some outputs. More...
 
- Instance Methods inherited from <FMLiveSwitchIElement>
(NSString *) - externalId
 Gets the external identifier. More...
 
(NSString *) - id
 Gets the identifier. More...
 
(NSString *) - pipelineJson
 Gets the pipeline JSON with this as the central point. More...
 
(void) - setExternalId:
 Sets the external identifier. More...
 
- Instance Methods inherited from <FMLiveSwitchIMediaElement>
(bool) - deactivated
 Gets a value indicating whether this instance is deactivated. More...
 
(bool) - destroy
 Destroys this instance. More...
 
(bool) - disabled
 Gets a value indicating whether this instance is disabled. More...
 
(bool) - muted
 Gets a value indicating whether this instance is muted. More...
 
(bool) - paused
 Gets a value indicating whether this instance is paused. More...
 
(bool) - persistent
 Gets a value indicating whether this instance is persistent. More...
 
(void) - setDeactivated:
 Sets a value indicating whether this instance is deactivated. More...
 
(void) - setMuted:
 Sets a value indicating whether this instance is muted. More...
 

Class Methods

(instancetype) + audioUnitSourceWithConfig:
 Creates an audio source with the specified audio configuration. More...
 
- Class Methods inherited from FMLiveSwitchAudioSource
(FMLiveSwitchAudioSource *) + audioSourceWithOutputFormat:
 Initializes a new instance of the FMLiveSwitchAudioSource class. More...
 
(FMLiveSwitchAudioSource *) + audioSourceWithOutputFormat:frameDuration:
 Initializes a new instance of the FMLiveSwitchAudioSource class. More...
 
(int) + calculateDurationFloatWithDataLength:clockRate:channelCount:
 Calculates the duration of an audio chunk given its data length (the number of bytes), clock rate, and channel count. More...
 
(int) + calculateDurationWithDataLength:clockRate:channelCount:
 Calculates the duration of an audio chunk given its data length (the number of bytes), clock rate, and channel count. More...
 
(int) + calculateDurationWithDataLength:config:
 Calculates the duration of an audio chunk given its data length (the number of bytes), clock rate, and channel count. More...
 
- Class Methods inherited from FMLiveSwitchMediaSource
(FMLiveSwitchMediaSource *) + mediaSourceWithOutputFormat:
 Initializes a new instance of the FMLiveSwitchMediaSource`8 class. More...
 

Additional Inherited Members

- Protected Attributes inherited from FMLiveSwitchMediaSource
 __pad0__: FMLiveSwitchMediaSourceBase<FMLiveSwitchIMediaOutput
 
 FMLiveSwitchIOutput
 
 FMLiveSwitchIMediaElement
 

Detailed Description

Audio source that captures microphone input through the centralized AudioSessionManager's VPIO.

@discussion This source registers a callback with AudioSessionManager to receive microphone audio that has been processed through the shared VPIO AudioUnit. The VPIO provides built-in echo cancellation, noise suppression, and automatic gain control.

Key Architectural Points:

  • Does NOT own an AudioUnit (AudioSessionManager owns the shared VPIO)
  • Does NOT create or configure AudioUnit (AudioSessionManager handles this)
  • Registers a callback with AudioSessionManager to receive mic data
  • Only ONE source can register at a time (microphone is singular)
  • Receives audio AFTER echo cancellation and noise suppression

Lifecycle:

  1. Created when LocalMedia is instantiated
  2. Registers with AudioSessionManager on start (startInternalWithBuffer)
  3. Registers callback to receive microphone data
  4. Callback invoked by AudioSessionManager when mic data available
  5. Unregisters callback and from AudioSessionManager on stop (stopInternal)

Audio Flow:

Microphone → VPIO (AEC/NS/AGC) → AudioSessionManager Input Callback →
AudioUnitSource.captureCallback() → AudioUnitRender() → Process → IceLink

Echo Cancellation:

  • VPIO's AEC sees both microphone input (this source) and speaker output (from sinks)
  • This is why centralized VPIO is crucial - it can cancel echo properly
  • With separate AudioUnits, AEC doesn't have the speaker reference

Thread Safety:

  • start/stop called on arbitrary thread (typically main)
  • Callback runs on real-time audio thread (high priority)
  • Must not block or allocate memory in callback

Comparison to Traditional Approach:

OLD (Per-Source AudioUnit):

  • Source creates its own AudioUnit (VPIO or RemoteIO)
  • VPIO doesn't see speaker output → no echo cancellation
  • Or RemoteIO used → no echo cancellation at all

NEW (Centralized VPIO):

  • Source registers callback with AudioSessionManager
  • Receives mic audio from shared VPIO
  • VPIO sees speaker output → proper echo cancellation

Usage:

// Created automatically by LocalMedia
FMLiveSwitchAudioConfig *config = [FMLiveSwitchAudioConfig audioConfigWithClockRate:48000];
FMLiveSwitchCocoaAudioUnitSource *source = [FMLiveSwitchCocoaAudioUnitSource audioUnitSourceWithConfig:config];
[localMedia setAudioSource:source];

Method Documentation

◆ audioUnitSourceWithConfig:

+ (instancetype) audioUnitSourceWithConfig: (FMLiveSwitchAudioConfig *)  config

Creates an audio source with the specified audio configuration.

Parameters
configThe audio configuration (sample rate, channel count, etc.).
Returns
A new AudioUnitSource instance.

@discussion This creates a source configured for the given audio format. The source will register with AudioSessionManager when started.

Typical configurations:

  • VoIP: 48kHz, 1 channel (mono), 16-bit PCM
  • High-quality: 48kHz, 2 channels (stereo), 16-bit PCM

Note: Mono is recommended for best echo cancellation results.

Example:

FMLiveSwitchAudioConfig *config = [FMLiveSwitchAudioConfig audioConfigWithClockRate:48000];
config.channelCount = 1;
FMLiveSwitchCocoaAudioUnitSource *source = [FMLiveSwitchCocoaAudioUnitSource audioUnitSourceWithConfig:config];

◆ bypassVoiceProcessing

- (bool) bypassVoiceProcessing

Gets whether voice processing is bypassed.

Returns
Current bypass state from AudioSessionManager.

@discussion Returns the current bypass state from AudioSessionManager. When bypassed, VPIO structure is maintained but echo cancellation and noise suppression are disabled.

To modify this setting, use:

[[FMLiveSwitchCocoaAudioSessionManager sharedInstance] setBypassVoiceProcessing:YES];

◆ label

- (NSString *) label

Gets the label/name of this audio source implementation.

Returns
A string identifying this source (e.g., "iOS AudioUnit Source (Centralized VPIO)").

@discussion The label varies by platform:

  • iOS: "iOS AudioUnit Source (Centralized VPIO)"
  • tvOS: "tvOS AudioUnit Source (Centralized VPIO)"
  • macOS: "macOS AudioUnit Source (Centralized VPIO)"

This is primarily used for logging and debugging.

Implements FMLiveSwitchMediaSource.

◆ setBypassVoiceProcessing:

- (void) setBypassVoiceProcessing: (bool)  bypassVoiceProcessing

Legacy setter - has no effect (bypass managed by AudioSessionManager).

Parameters
bypassVoiceProcessingIgnored parameter.

@discussion This setter is maintained for API compatibility but has no effect. To configure bypass, use AudioSessionManager.bypassVoiceProcessing instead.

Deprecated:
Use AudioSessionManager configuration instead.

◆ setUseVoiceProcessingIO:

- (void) setUseVoiceProcessingIO: (bool)  useVoiceProcessingIO

Legacy setter - has no effect (VPIO configuration managed by AudioSessionManager).

Parameters
useVoiceProcessingIOIgnored parameter.

@discussion This setter is maintained for API compatibility but has no effect. To configure VPIO vs RemoteIO, use:

[[FMLiveSwitchCocoaAudioSessionManager sharedInstance] setUseVoiceProcessingIO:YES];
Deprecated:
Use AudioSessionManager configuration instead.

◆ setVoiceProcessingEnableAGC:

- (void) setVoiceProcessingEnableAGC: (bool)  voiceProcessingEnableAGC

Legacy setter - has no effect (AGC managed by AudioSessionManager).

Parameters
voiceProcessingEnableAGCIgnored parameter.

@discussion This setter is maintained for API compatibility but has no effect. To configure AGC, use AudioSessionManager.voiceProcessingEnableAGC instead.

Deprecated:
Use AudioSessionManager configuration instead.

◆ useVoiceProcessingIO

- (bool) useVoiceProcessingIO

Legacy property - gets whether VPIO is in use.

(VPIO always used via AudioSessionManager).

Returns
A value indication whether VPIO is in use by AudioSessionManager.

@discussion This property is maintained for API compatibility but has no effect. The source always uses the shared VPIO from AudioSessionManager. To configure VPIO vs RemoteIO, use AudioSessionManager.useVoiceProcessingIO instead.

Deprecated:
Use AudioSessionManager configuration instead.

◆ voiceProcessingEnableAGC

- (bool) voiceProcessingEnableAGC

Gets whether Automatic Gain Control (AGC) is enabled.

Returns
Current AGC state from AudioSessionManager.

@discussion Returns the current AGC state from AudioSessionManager. AGC automatically adjusts microphone gain for consistent volume.

To modify this setting, use:

[[FMLiveSwitchCocoaAudioSessionManager sharedInstance] setVoiceProcessingEnableAGC:YES];