Table of Contents

Class AudioResamplerBlock

Namespace
VisioForge.Core.MediaBlocks.AudioProcessing
Assembly
VisioForge.Core.dll

Audio resampler block that converts audio between different sample rates, formats, and channel configurations. This block provides high-quality audio resampling for format compatibility and sample rate conversion within the MediaBlocks pipeline. It can convert between various audio formats (8-bit to 32-bit), sample rates (8kHz to 192kHz), and channel layouts (mono to multi-channel). The resampler uses advanced algorithms to maintain audio quality during conversion and minimize artifacts. Essential for ensuring audio compatibility between sources, effects, and outputs with different requirements. Implements the VisioForge.Core.MediaBlocks.MediaBlock. Implements the VisioForge.Core.MediaBlocks.IMediaBlockInternals. Implements the IDisposable.

public class AudioResamplerBlock : MediaBlock, IMediaBlock, IDisposable, IMediaBlockInternals

Inheritance

Implements

Inherited Members

Extension Methods

Constructors

AudioResamplerBlock(AudioResamplerSettings)

Initializes a new instance of the VisioForge.Core.MediaBlocks.AudioProcessing.AudioResamplerBlock class with the specified resampling settings. Creates an audio resampler block that will convert audio to the target format specified in the settings.

public AudioResamplerBlock(AudioResamplerSettings settings)

Parameters

settings AudioResamplerSettings

The resampler settings defining the target audio format, sample rate, and channel configuration.

Properties

Input

Gets the single input pad for receiving audio to be resampled.

public override MediaBlockPad Input { get; }

Property Value

MediaBlockPad

Inputs

Gets all input pads for this audio resampler block. This block has a single input for audio resampling operations.

public override MediaBlockPad[] Inputs { get; }

Property Value

MediaBlockPad[]

Output

Gets the single output pad providing resampled audio data.

public override MediaBlockPad Output { get; }

Property Value

MediaBlockPad

Outputs

Gets all output pads for this audio resampler block. This block has a single output for resampled audio data.

public override MediaBlockPad[] Outputs { get; }

Property Value

MediaBlockPad[]

Settings

Gets or sets the audio resampler configuration settings. These settings define the target audio format, sample rate, and channel configuration for resampling.

public AudioResamplerSettings Settings { get; set; }

Property Value

AudioResamplerSettings

Type

Gets the block type identifier for audio resampling operations.

public override MediaBlockType Type { get; }

Property Value

MediaBlockType

Methods

Build()

Builds and initializes the audio resampler block by creating the GStreamer audio resampler element. This method configures the resampler with the specified target format settings and establishes the input/output pad connections for audio resampling operations.

public override bool Build()

Returns

bool

true if the audio resampler was successfully built and configured; false if initialization failed.

CleanUp()

Cleans up the audio resampler block by disposing of the GStreamer audio resampler element. This method safely releases the underlying resampling resources and resets the block to an unbuilt state for potential reuse or final disposal.

public void CleanUp()

Dispose(bool)

Releases unmanaged and optionally managed resources used by the audio resampler block. Properly disposes of the GStreamer audio resampler element and associated resources.

protected override void Dispose(bool disposing)

Parameters

disposing bool

true to release both managed and unmanaged resources; false to release only unmanaged resources.

GetCore()

Gets the core GStreamer base element for this audio resampler block. Provides access to the underlying audio resampler element for advanced operations.

public BaseElement GetCore()

Returns

BaseElement

The BaseElement representing the audio resampler component.

GetElement()

Gets the underlying GStreamer element for direct GStreamer API access. Provides low-level access to the audio resampler element for advanced resampling operations.

public Element GetElement()

Returns

Element

The GStreamer Element representing the audio resampler.

IsAvailable()

Determines whether the audio resampler block is available in the current environment. Checks for the presence of required GStreamer audio resampling plugins and dependencies. The correct NuGet SDK redistribution package should be included in your project.

public static bool IsAvailable()

Returns

bool

true if audio resampling is available; otherwise, false.

IMediaBlockInternals.SetContext(MediaBlocksPipeline)

Sets the pipeline context for this audio resampler block. This method is called internally by the MediaBlocks pipeline during block initialization to provide access to pipeline resources and logging context.

void IMediaBlockInternals.SetContext(MediaBlocksPipeline pipeline)

Parameters

pipeline MediaBlocksPipeline

The parent MediaBlocksPipeline that owns this block.

See Also