Table of Contents

Class VST3AudioBlock

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

Hosts one VST® 3 audio effect plug-in (a .vst3 bundle) in the audio path. Mono and stereo; the input is converted to the plug-in's 32-bit float format and back. The plug-in's latency is compensated, so the output stays in sync with video. No plug-in is bundled: the application points the block at one installed on the machine. Implements the VisioForge.Core.MediaBlocks.MediaBlock. Implements the VisioForge.Core.MediaBlocks.IMediaBlockInternals. Implements the IDisposable.

public class VST3AudioBlock : MediaBlock, IMediaBlock, IDisposable, IMediaBlockInternals

Inheritance

Implements

Inherited Members

Extension Methods

Remarks

The plug-in loads on the first call that needs it (VisioForge.Core.MediaBlocks.AudioProcessing.VST3AudioBlock.GetParameters, VisioForge.Core.MediaBlocks.AudioProcessing.VST3AudioBlock.GetState and the others), or when the pipeline starts, so parameters and presets can be read and set before playback. A bundle that cannot be loaded fails the pipeline start with an error naming the cause. VST is a registered trademark of Steinberg Media Technologies GmbH.

Constructors

VST3AudioBlock(string, int)

Initializes a new instance of the VisioForge.Core.MediaBlocks.AudioProcessing.VST3AudioBlock class.

public VST3AudioBlock(string location, int classIndex = 0)

Parameters

location string

The path of the .vst3 bundle, for example C:\Program Files\Common Files\VST3\Plugin.vst3.

classIndex int

Which audio effect of the bundle to load, from 0.

Exceptions

ArgumentNullException

location is null or empty.

ArgumentOutOfRangeException

classIndex is negative.

Properties

Bypass

Gets or sets a value indicating whether the effect is bypassed. Uses the plug-in's own bypass parameter when it has one, otherwise passes the audio through unchanged. Can be changed while playing.

public bool Bypass { get; set; }

Property Value

bool

ClassIndex

Gets which audio effect of a bundle that holds several is loaded, from 0. See VisioForge.Core.MediaBlocks.AudioProcessing.VST3AudioBlock.GetClassNames.

public int ClassIndex { get; }

Property Value

int

ClassName

Gets the name of the loaded audio effect, or null before the plug-in is loaded.

public string ClassName { get; }

Property Value

string

Input

Gets the audio input pad.

public override MediaBlockPad Input { get; }

Property Value

MediaBlockPad

Inputs

Gets all input pads: the single audio input.

public override MediaBlockPad[] Inputs { get; }

Property Value

MediaBlockPad[]

Latency

Gets the latency the plug-in reports, in samples; the block compensates it. 0 until the plug-in has processed audio.

public int Latency { get; }

Property Value

int

Location

Gets the path of the .vst3 bundle.

public string Location { get; }

Property Value

string

Output

Gets the audio output pad.

public override MediaBlockPad Output { get; }

Property Value

MediaBlockPad

Outputs

Gets all output pads: the single audio output.

public override MediaBlockPad[] Outputs { get; }

Property Value

MediaBlockPad[]

Type

Gets the block type identifier.

public override MediaBlockType Type { get; }

Property Value

MediaBlockType

Methods

Build()

Creates audioconvert ! vfvst3filter ! audioconvert and points the host at the bundle.

public override bool Build()

Returns

bool

true if successful; otherwise, false.

CleanUp()

Releases the converters and resets the build state. The host element stays alive: it holds the plug-in and its settings, which a restart of the pipeline keeps; VisioForge.Core.MediaBlocks.AudioProcessing.VST3AudioBlock.Dispose(System.Boolean) releases it. A stopped pipeline gives it up here, so a rebuild can add it again.

public void CleanUp()

Dispose(bool)

Releases unmanaged and - optionally - managed resources.

protected override void Dispose(bool disposing)

Parameters

disposing bool

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

GetClassNames()

Gets the names of the audio effects in the bundle, in VisioForge.Core.MediaBlocks.AudioProcessing.VST3AudioBlock.ClassIndex order.

public string[] GetClassNames()

Returns

string[]

The names; empty if the bundle does not load.

Exceptions

InvalidOperationException

The VST 3 host is not available (see VisioForge.Core.MediaBlocks.AudioProcessing.VST3AudioBlock.IsAvailable).

ObjectDisposedException

The block is disposed.

GetCore()

Gets the core BaseElement wrapper. This block has none.

public BaseElement GetCore()

Returns

BaseElement

Always null.

GetElement()

Gets the underlying vfvst3filter GStreamer element.

public Element GetElement()

Returns

Element

The element, or null before the plug-in is loaded or the pipeline is built.

GetParameter(uint)

Gets the normalized value of a parameter.

public double GetParameter(uint id)

Parameters

id uint

The parameter ID, VisioForge.Core.Types.X.AudioEffects.VST3ParameterInfo.ID.

Returns

double

The value, 0.0 to 1.0; -1.0 if the plug-in has no parameter with this ID or does not load.

Exceptions

InvalidOperationException

The VST 3 host is not available (see VisioForge.Core.MediaBlocks.AudioProcessing.VST3AudioBlock.IsAvailable).

ObjectDisposedException

The block is disposed.

GetParameters()

Gets the plug-in's parameters with their current values.

public VST3ParameterInfo[] GetParameters()

Returns

VST3ParameterInfo[]

The parameters; empty if the plug-in does not load (an error is logged).

Exceptions

InvalidOperationException

The VST 3 host is not available (see VisioForge.Core.MediaBlocks.AudioProcessing.VST3AudioBlock.IsAvailable).

ObjectDisposedException

The block is disposed.

GetState()

Gets the plug-in's state as a standard .vstpreset file image, which DAWs and other hosts read too.

public byte[] GetState()

Returns

byte[]

The preset bytes, or null if the plug-in does not load.

Exceptions

InvalidOperationException

The VST 3 host is not available (see VisioForge.Core.MediaBlocks.AudioProcessing.VST3AudioBlock.IsAvailable).

ObjectDisposedException

The block is disposed.

IsAvailable()

Determines whether this media block is available. The VST 3 host ships in the VisioForge.CrossPlatform.Core.Windows.Adds.x64, Core.macOS.Adds and Core.Linux.Adds.x64 packages.

public static bool IsAvailable()

Returns

bool

true if this media block is available; otherwise, false.

SetParameter(uint, double)

Sets the normalized value of a parameter. The change reaches the plug-in with the next audio buffer; several changes of one parameter before it collapse into the latest.

public bool SetParameter(uint id, double value)

Parameters

id uint

The parameter ID, VisioForge.Core.Types.X.AudioEffects.VST3ParameterInfo.ID.

value double

The normalized value, 0.0 to 1.0.

Returns

bool

true if the plug-in has a parameter with this ID; false if it has not or does not load.

Exceptions

ArgumentOutOfRangeException

value is outside 0.0 to 1.0 or NaN.

InvalidOperationException

The VST 3 host is not available (see VisioForge.Core.MediaBlocks.AudioProcessing.VST3AudioBlock.IsAvailable).

ObjectDisposedException

The block is disposed.

SetState(byte[])

Restores the plug-in's state from a .vstpreset file image, as VisioForge.Core.MediaBlocks.AudioProcessing.VST3AudioBlock.GetState returns it.

public bool SetState(byte[] preset)

Parameters

preset byte[]

The preset bytes.

Returns

bool

true if the plug-in accepted the preset; otherwise, false.

Exceptions

ArgumentNullException

preset is null.

InvalidOperationException

The VST 3 host is not available (see VisioForge.Core.MediaBlocks.AudioProcessing.VST3AudioBlock.IsAvailable).

ObjectDisposedException

The block is disposed.

IMediaBlockInternals.SetContext(MediaBlocksPipeline)

Associates this MediaBlock with a pipeline and initializes its internal context. This method is called automatically when the block is added to a pipeline, providing access to shared resources and pipeline-wide configuration.

void IMediaBlockInternals.SetContext(MediaBlocksPipeline pipeline)

Parameters

pipeline MediaBlocksPipeline

The MediaBlocksPipeline instance that will manage this block.

See Also