Table of Contents

Class AudioRendererBlock

Namespace
VisioForge.Core.MediaBlocks.AudioRendering
Assembly
VisioForge.Core.dll

Audio renderer block for real-time audio playback through system audio devices. This block provides cross-platform audio output capabilities with support for various audio APIs including DirectSound (Windows), OpenSLES (Android), CoreAudio (macOS/iOS), and ALSA/PulseAudio (Linux). Features real-time volume control, mute functionality, synchronization with video streams, device selection, and low-latency playback. Essential for media players, live streaming applications, audio monitoring systems, and any scenario requiring high-quality audio output with precise timing control. Implements the VisioForge.Core.MediaBlocks.MediaBlock. Implements the VisioForge.Core.MediaBlocks.IMediaBlockInternals. Implements the IDisposable.

public class AudioRendererBlock : MediaBlock, IMediaBlock, IDisposable, IMediaBlockInternals, IMediaBlockRenderer

Inheritance

Implements

Inherited Members

Extension Methods

Constructors

AudioRendererBlock(AudioOutputDeviceInfo)

Initializes a new instance of the VisioForge.Core.MediaBlocks.AudioRendering.AudioRendererBlock class with a specific audio output device.

public AudioRendererBlock(AudioOutputDeviceInfo device)

Parameters

device AudioOutputDeviceInfo

The audio output device information.

AudioRendererBlock(IAudioRendererSettings)

Initializes a new instance of the VisioForge.Core.MediaBlocks.AudioRendering.AudioRendererBlock class with custom audio renderer settings.

public AudioRendererBlock(IAudioRendererSettings settings)

Parameters

settings IAudioRendererSettings

The audio renderer configuration settings.

AudioRendererBlock()

Initializes a new instance of the VisioForge.Core.MediaBlocks.AudioRendering.AudioRendererBlock class with default settings using the system's default audio output device.

public AudioRendererBlock()

Properties

Input

Gets the input.

public override MediaBlockPad Input { get; }

Property Value

MediaBlockPad

Inputs

Gets the inputs.

public override MediaBlockPad[] Inputs { get; }

Property Value

MediaBlockPad[]

IsSync

Gets or sets a value indicating whether to sync a stream/streams, for example audio and video. Usually it should be true for playback and capture applications and false for transcoding. When enabled, maintains proper audio/video synchronization using pipeline clock.

public bool IsSync { get; set; }

Property Value

bool

Mute

Gets or sets a value indicating whether audio output device mute is enabled. Muting preserves the volume setting and can be toggled without affecting it.

public bool Mute { get; set; }

Property Value

bool

Output

Gets the output.

public override MediaBlockPad Output { get; }

Property Value

MediaBlockPad

Outputs

Gets the outputs.

public override MediaBlockPad[] Outputs { get; }

Property Value

MediaBlockPad[]

Settings

Gets the audio renderer settings. Contains device selection, audio API configuration, and output parameters.

public IAudioRendererSettings Settings { get; }

Property Value

IAudioRendererSettings

Type

Gets the type.

public override MediaBlockType Type { get; }

Property Value

MediaBlockType

Volume

Gets or sets the audio output device volume. 1.0 is 100%. Volume changes are applied in real-time without interrupting playback.

public double Volume { get; set; }

Property Value

double

Methods

Build()

Constructs and initializes the audio renderer and its associated elements. This method creates the renderer with the specified device settings, establishes the input pad, and prepares the block for audio playback operations.

public override bool Build()

Returns

bool

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

CleanUp()

Releases all resources and performs cleanup operations for this audio renderer block. This method disposes of the audio renderer element 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 audio renderer element.

public BaseElement GetCore()

Returns

BaseElement

The BaseElement wrapper instance that encapsulates the audio renderer.

GetDevicesAsync(AudioOutputDeviceAPI?)

Gets the available audio output devices asynchronously. Enumerates all audio devices compatible with the specified API.

public static Task<AudioOutputDeviceInfo[]> GetDevicesAsync(AudioOutputDeviceAPI? api = null)

Parameters

api AudioOutputDeviceAPI?

The audio output API to enumerate devices for, or null for all APIs.

Returns

Task<AudioOutputDeviceInfo[]>

A task that returns an array of available audio output devices.

GetElement()

Gets the underlying GStreamer element that performs the audio playback.

public Element GetElement()

Returns

Element

The GStreamer Element instance representing the audio sink.

IsAvailable(AudioOutputDeviceAPI)

Determines whether this media block is available. Correct NuGet SDK redist should be included into your project. Checks if the specified audio API is supported on the current platform.

public static bool IsAvailable(AudioOutputDeviceAPI api)

Parameters

api AudioOutputDeviceAPI

The audio output API to check.

Returns

bool

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

IMediaBlockInternals.SetContext(MediaBlocksPipeline)

Associates this audio renderer 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