Class EchoCancellationBlock
- Assembly
- VisioForge.Core.dll
Echo cancellation for calls, on the WebRTC audio processing library (webrtcdsp and
webrtcechoprobe): removes the far end's voice that the speakers play and the microphone picks up
again, and optionally suppresses noise and levels the microphone.
public class EchoCancellationBlock : MediaBlock, IMediaBlock, IDisposable, IMediaBlockInternalsInheritance
Implements
Inherited Members
Extension Methods
Remarks
The block has two paths. The microphone goes through VisioForge.Core.MediaBlocks.AudioProcessing.EchoCancellationBlock.Input and VisioForge.Core.MediaBlocks.AudioProcessing.EchoCancellationBlock.Output (the cleaned signal, to send to the far end). The far end's audio goes through VisioForge.Core.MediaBlocks.AudioProcessing.EchoCancellationBlock.PlaybackInput and VisioForge.Core.MediaBlocks.AudioProcessing.EchoCancellationBlock.PlaybackOutput on its way to the audio renderer: the block listens to it to know what to remove. Connect both; with the playback path left unconnected nothing is cancelled, and VisioForge.Core.MediaBlocks.AudioProcessing.EchoCancellationBlock.PlaybackOutput must be connected whenever VisioForge.Core.MediaBlocks.AudioProcessing.EchoCancellationBlock.PlaybackInput is: the far end's audio fails not-linked otherwise.
Both outputs are 48 kHz, the rate the WebRTC audio processing requires to be the same on the two paths, in S16LE interleaved or F32LE non-interleaved samples (the only formats the elements take); the channel count stays as negotiated. Put a converter after an output whose next element takes neither.
Constructors
EchoCancellationBlock(EchoCancellationSettings)
Initializes a new instance of the VisioForge.Core.MediaBlocks.AudioProcessing.EchoCancellationBlock class.
public EchoCancellationBlock(EchoCancellationSettings settings)Parameters
settingsEchoCancellationSettings-
The settings.
Exceptions
- ArgumentNullException
-
settingsisnull.
Properties
Input
Gets the microphone input.
public override MediaBlockPad Input { get; }Property Value
Inputs
Gets both inputs: the microphone, then the far end's audio.
public override MediaBlockPad[] Inputs { get; }Property Value
Output
Gets the processed microphone output.
public override MediaBlockPad Output { get; }Property Value
Outputs
Gets both outputs: the processed microphone, then the far end's audio.
public override MediaBlockPad[] Outputs { get; }Property Value
PlaybackInput
Gets the far end's audio input, on its way to the audio renderer.
public MediaBlockPad PlaybackInput { get; }Property Value
PlaybackOutput
Gets the far end's audio output, to connect to the audio renderer.
public MediaBlockPad PlaybackOutput { get; }Property Value
Settings
Gets or sets the settings. Read when the block is built.
public EchoCancellationSettings Settings { get; set; }Property Value
Exceptions
- ArgumentNullException
-
The value is
null.
Type
Gets the media block type identifier.
public override MediaBlockType Type { get; }Property Value
Methods
Build()
Builds both paths: audioconvert, audioresample and a 48 kHz capsfilter in front of webrtcdsp and of
webrtcechoprobe.
public override bool Build()Returns
- bool
-
trueif successful; otherwise,false.
CleanUp()
Cleans up resources.
public void CleanUp()Dispose(bool)
Releases resources.
protected override void Dispose(bool disposing)Parameters
disposingbool-
Whether to release managed resources.
GetCore()
Gets the core element wrapper.
public BaseElement GetCore()Returns
- BaseElement
-
Always null for this composite block.
GetElement()
Gets the native element.
public Element GetElement()Returns
- Element
-
Always null for this composite block.
IsAvailable()
Determines whether this media block is available (the webrtcdsp plugin of the SDK redist).
public static bool IsAvailable()Returns
- bool
-
trueif this media block is available; otherwise,false.
IMediaBlockInternals.SetContext(MediaBlocksPipeline)
Sets the pipeline context.
void IMediaBlockInternals.SetContext(MediaBlocksPipeline pipeline)Parameters
pipelineMediaBlocksPipeline-
The owning pipeline.