Class AmplifyBlock
- Assembly
- VisioForge.Core.dll
Audio amplification block that adjusts the volume level of audio streams. This block provides configurable gain control with multiple clipping methods to prevent distortion when amplifying audio signals. Useful for normalizing audio levels or boosting quiet audio sources. Implements the VisioForge.Core.MediaBlocks.MediaBlock. Implements the VisioForge.Core.MediaBlocks.IMediaBlockInternals. Implements the IDisposable.
public class AmplifyBlock : MediaBlock, IMediaBlock, IDisposable, IMediaBlockInternalsInheritance
Implements
Inherited Members
Extension Methods
Constructors
AmplifyBlock(AmplifyClippingMethod, double)
Initializes a new instance of the VisioForge.Core.MediaBlocks.AudioProcessing.AmplifyBlock class with specified settings.
public AmplifyBlock(AmplifyClippingMethod method = AmplifyClippingMethod.Normal, double level = 1)Parameters
methodAmplifyClippingMethod-
The clipping method to use when audio exceeds valid range. Default is Normal.
leveldouble-
The initial amplification level multiplier. Default is 1.0 (no change).
Properties
Input
Gets the single audio input pad for this block.
public override MediaBlockPad Input { get; }Property Value
Inputs
Gets all input pads. This block has a single audio input.
public override MediaBlockPad[] Inputs { get; }Property Value
Level
Gets or sets the amplification level multiplier. Values greater than 1.0 increase volume, values less than 1.0 decrease volume. For example: 2.0 doubles the volume, 0.5 halves it. Default value is 1.0 (no change).
public double Level { get; set; }Property Value
Method
Gets or sets the clipping method used when amplified audio exceeds the valid range. Different methods provide various ways to handle over-amplification to prevent distortion. Default value is Normal.
public AmplifyClippingMethod Method { get; set; }Property Value
Output
Gets the single audio output pad for this block.
public override MediaBlockPad Output { get; }Property Value
Outputs
Gets all output pads. This block has a single audio output.
public override MediaBlockPad[] Outputs { get; }Property Value
Type
Gets the block type identifier for this amplify block.
public override MediaBlockType Type { get; }Property Value
Methods
Build()
Builds and initializes the amplify filter element with configured settings. Creates the GStreamer element and sets up input/output pads for audio processing.
public override bool Build()Returns
- bool
-
True if the block was successfully built; false if initialization failed.
CleanUp()
Releases all internal resources and disposes of the amplify filter element. Called during disposal to ensure proper cleanup of native resources.
public void CleanUp()Dispose(bool)
Releases unmanaged and - optionally - managed resources.
protected override void Dispose(bool disposing)Parameters
disposingbool-
trueto release both managed and unmanaged resources;falseto release only unmanaged resources.
GetCore()
Gets the core BaseElement wrapper for the amplify filter.
public BaseElement GetCore()Returns
- BaseElement
-
The AmplifyFilter element that performs the audio processing.
GetElement()
Gets the underlying GStreamer element for this amplify block.
public Element GetElement()Returns
- Element
-
The GStreamer element that performs the amplification.
IsAvailable()
Determines whether this media block is available. Correct NuGet SDK redist should be included into your project.
public static bool IsAvailable()Returns
- bool
-
trueif this media block is available; otherwise,false.
IMediaBlockInternals.SetContext(MediaBlocksPipeline)
Sets the pipeline context for this block, providing access to shared resources.
void IMediaBlockInternals.SetContext(MediaBlocksPipeline pipeline)Parameters
pipelineMediaBlocksPipeline-
The MediaBlocksPipeline that owns this block.