Table of Contents

Class CsoundFilterBlock

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

Csound audio filter block that provides advanced audio synthesis and processing capabilities. This block integrates the powerful Csound audio programming language and DSP engine to enable complex audio transformations, synthesis, and effects processing. Supports both CSD text content and external CSD files for flexible audio programming. Features include real-time parameter control, score looping, and offset configuration for sophisticated audio manipulation in multimedia pipelines. Implements the VisioForge.Core.MediaBlocks.MediaBlock. Implements the VisioForge.Core.MediaBlocks.IMediaBlockInternals. Implements the IDisposable.

public class CsoundFilterBlock : MediaBlock, IMediaBlock, IDisposable, IMediaBlockInternals

Inheritance

Implements

Inherited Members

Extension Methods

Constructors

CsoundFilterBlock()

Initializes a new instance of the VisioForge.Core.MediaBlocks.AudioProcessing.CsoundFilterBlock class with default Csound settings for general-purpose use.

public CsoundFilterBlock()

CsoundFilterBlock(string)

Initializes a new instance of the VisioForge.Core.MediaBlocks.AudioProcessing.CsoundFilterBlock class with specified CSD text content.

public CsoundFilterBlock(string csdText)

Parameters

csdText string

The CSD text content.

CsoundFilterBlock(string, bool, double)

Initializes a new instance of the VisioForge.Core.MediaBlocks.AudioProcessing.CsoundFilterBlock class with full parameter configuration.

public CsoundFilterBlock(string csdText, bool loop, double scoreOffset)

Parameters

csdText string

The CSD text content.

loop bool

If set to true [loop].

scoreOffset double

The score offset.

Properties

CsdText

Gets or sets the CSD text content defining the Csound instruments and score. This property allows inline specification of Csound code for real-time audio processing. Changes take effect on the next pipeline start or restart.

public string CsdText { get; set; }

Property Value

string

Input

Gets the single audio input pad for this block.

public override MediaBlockPad Input { get; }

Property Value

MediaBlockPad

Inputs

Gets all input pads. This block has a single audio input.

public override MediaBlockPad[] Inputs { get; }

Property Value

MediaBlockPad[]

Location

Gets or sets the CSD file location for external Csound score files. Use either CsdText or Location but not both simultaneously to avoid conflicts. Changes take effect on the next pipeline start or restart.

public string Location { get; set; }

Property Value

string

Loop

Gets or sets a value indicating whether the Csound score should loop continuously. When enabled, the score will restart automatically upon completion. Can be changed during playback in PLAYING or PAUSED states.

public bool Loop { get; set; }

Property Value

bool

Output

Gets the single audio output pad for this block.

public override MediaBlockPad Output { get; }

Property Value

MediaBlockPad

Outputs

Gets all output pads. This block has a single audio output.

public override MediaBlockPad[] Outputs { get; }

Property Value

MediaBlockPad[]

ScoreOffset

Gets or sets the score offset in seconds for starting playback at a specific time. This allows skipping to any position within the Csound score for flexible playback control. Changes take effect on the next pipeline start or restart.

public double ScoreOffset { get; set; }

Property Value

double

Type

Gets the block type identifier for this Csound filter block.

public override MediaBlockType Type { get; }

Property Value

MediaBlockType

Methods

Build()

Constructs and initializes the Csound filter and its associated GStreamer elements. This method creates the filter with the specified Csound parameters, establishes input and output pads, and prepares the block for advanced audio synthesis and processing using the Csound DSP engine.

public override bool Build()

Returns

bool

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

CleanUp()

Releases all resources and performs cleanup operations for this Csound filter block. This method disposes of the GStreamer elements and resets the build state.

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.

GetCore()

Gets the core BaseElement wrapper that provides additional functionality around the GStreamer Csound filter element.

public BaseElement GetCore()

Returns

BaseElement

The BaseElement wrapper instance that encapsulates the GStreamer Csound filter.

GetElement()

Gets the underlying GStreamer element that performs the Csound audio processing.

public Element GetElement()

Returns

Element

The GStreamer Element instance representing the Csound filter.

IsAvailable()

Determines whether this media block is available. Correct NuGet SDK redist should be included into your project.

public static bool IsAvailable()

Returns

bool

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

IMediaBlockInternals.SetContext(MediaBlocksPipeline)

Associates this Csound filter block with a pipeline and initializes its internal context. This method is called internally when the block is added to a pipeline.

void IMediaBlockInternals.SetContext(MediaBlocksPipeline pipeline)

Parameters

pipeline MediaBlocksPipeline

The MediaBlocksPipeline instance that will manage this block.

See Also