Table of Contents

Class VolumeMeterLED

Namespace
VisioForge.Core.UI.WPF.VolumeMeterPro
Assembly
VisioForge.Core.dll

Segmented LED-bar VU meter for WPF. Each segment is independently coloured per its dB position on the scale (green / yellow / red zones) and lit only when the current VisioForge.Core.UI.WPF.VolumeMeterPro.VolumeMeterLED.Amplitude reaches its anchor dB.

public class VolumeMeterLED : UserControl, IAnimatable, ISupportInitialize, IFrameworkInputElement, IInputElement, IQueryAmbient, IAddChild

Inheritance

Implements

Inherited Members

Remarks

Designed to be fed from a VU meter event (OnAudioVUMeter) where the application passes the channel's true peak (dBTP) — or sample peak as a fallback — into VisioForge.Core.UI.WPF.VolumeMeterPro.VolumeMeterLED.Amplitude on each tick and calls VisioForge.Core.UI.WPF.VolumeMeterPro.VolumeMeterLED.Update. Optional features (peak hold, scale labels, RMS bar) are gated by individual dependency properties so the control can scale from a compact 90x14 strip to a full mixer-style indicator.

Constructors

VolumeMeterLED()

Initialises a new VisioForge.Core.UI.WPF.VolumeMeterPro.VolumeMeterLED with default sizing and dark background.

public VolumeMeterLED()

Fields

AmplitudeProperty

Identifies the VisioForge.Core.UI.WPF.VolumeMeterPro.VolumeMeterLED.Amplitude dependency property.

public static readonly DependencyProperty AmplitudeProperty

Field Value

DependencyProperty

GreenBrushProperty

Identifies the VisioForge.Core.UI.WPF.VolumeMeterPro.VolumeMeterLED.GreenBrush dependency property.

public static readonly DependencyProperty GreenBrushProperty

Field Value

DependencyProperty

GreenMaxDbProperty

Identifies the VisioForge.Core.UI.WPF.VolumeMeterPro.VolumeMeterLED.GreenMaxDb dependency property.

public static readonly DependencyProperty GreenMaxDbProperty

Field Value

DependencyProperty

MaxDbProperty

Identifies the VisioForge.Core.UI.WPF.VolumeMeterPro.VolumeMeterLED.MaxDb dependency property.

public static readonly DependencyProperty MaxDbProperty

Field Value

DependencyProperty

MinDbProperty

Identifies the VisioForge.Core.UI.WPF.VolumeMeterPro.VolumeMeterLED.MinDb dependency property.

public static readonly DependencyProperty MinDbProperty

Field Value

DependencyProperty

MinimalUpdateIntervalProperty

Identifies the VisioForge.Core.UI.WPF.VolumeMeterPro.VolumeMeterLED.MinimalUpdateInterval dependency property.

public static readonly DependencyProperty MinimalUpdateIntervalProperty

Field Value

DependencyProperty

OffBrushProperty

Identifies the VisioForge.Core.UI.WPF.VolumeMeterPro.VolumeMeterLED.OffBrush dependency property.

public static readonly DependencyProperty OffBrushProperty

Field Value

DependencyProperty

OrientationProperty

Identifies the VisioForge.Core.UI.WPF.VolumeMeterPro.VolumeMeterLED.Orientation dependency property.

public static readonly DependencyProperty OrientationProperty

Field Value

DependencyProperty

PeakHoldFallTimeProperty

Identifies the VisioForge.Core.UI.WPF.VolumeMeterPro.VolumeMeterLED.PeakHoldFallTime dependency property.

public static readonly DependencyProperty PeakHoldFallTimeProperty

Field Value

DependencyProperty

RedBrushProperty

Identifies the VisioForge.Core.UI.WPF.VolumeMeterPro.VolumeMeterLED.RedBrush dependency property.

public static readonly DependencyProperty RedBrushProperty

Field Value

DependencyProperty

RmsProperty

Identifies the VisioForge.Core.UI.WPF.VolumeMeterPro.VolumeMeterLED.Rms dependency property.

public static readonly DependencyProperty RmsProperty

Field Value

DependencyProperty

SegmentCountProperty

Identifies the VisioForge.Core.UI.WPF.VolumeMeterPro.VolumeMeterLED.SegmentCount dependency property.

public static readonly DependencyProperty SegmentCountProperty

Field Value

DependencyProperty

SegmentGapProperty

Identifies the VisioForge.Core.UI.WPF.VolumeMeterPro.VolumeMeterLED.SegmentGap dependency property.

public static readonly DependencyProperty SegmentGapProperty

Field Value

DependencyProperty

ShowPeakHoldProperty

Identifies the VisioForge.Core.UI.WPF.VolumeMeterPro.VolumeMeterLED.ShowPeakHold dependency property.

public static readonly DependencyProperty ShowPeakHoldProperty

Field Value

DependencyProperty

ShowRmsBarProperty

Identifies the VisioForge.Core.UI.WPF.VolumeMeterPro.VolumeMeterLED.ShowRmsBar dependency property.

public static readonly DependencyProperty ShowRmsBarProperty

Field Value

DependencyProperty

ShowScaleLabelsProperty

Identifies the VisioForge.Core.UI.WPF.VolumeMeterPro.VolumeMeterLED.ShowScaleLabels dependency property.

public static readonly DependencyProperty ShowScaleLabelsProperty

Field Value

DependencyProperty

YellowBrushProperty

Identifies the VisioForge.Core.UI.WPF.VolumeMeterPro.VolumeMeterLED.YellowBrush dependency property.

public static readonly DependencyProperty YellowBrushProperty

Field Value

DependencyProperty

YellowMaxDbProperty

Identifies the VisioForge.Core.UI.WPF.VolumeMeterPro.VolumeMeterLED.YellowMaxDb dependency property.

public static readonly DependencyProperty YellowMaxDbProperty

Field Value

DependencyProperty

Properties

Amplitude

Current peak amplitude in dBFS (or dBTP) used to light segments. Typically driven by a VU meter callback.

public double Amplitude { get; set; }

Property Value

double

GreenBrush

Brush used for segments in the green (safe) zone.

public Brush GreenBrush { get; set; }

Property Value

Brush

GreenMaxDb

Upper bound (in dB) of the green zone. Segments at or above this anchor become yellow.

public double GreenMaxDb { get; set; }

Property Value

double

MaxDb

Highest dB value displayed on the scale (typically 0 dBFS). Changing this triggers a redraw.

public double MaxDb { get; set; }

Property Value

double

MinDb

Lowest dB value displayed on the scale. Changing this triggers a redraw.

public double MinDb { get; set; }

Property Value

double

MinimalUpdateInterval

Minimum interval between VisioForge.Core.UI.WPF.VolumeMeterPro.VolumeMeterLED.Update-driven redraws. Bounds UI cost for high-rate VU callbacks.

public TimeSpan MinimalUpdateInterval { get; set; }

Property Value

TimeSpan

OffBrush

Brush used for unlit segments.

public Brush OffBrush { get; set; }

Property Value

Brush

Orientation

Layout orientation of the bar (horizontal or vertical). Changing this rebuilds the layout.

public Orientation Orientation { get; set; }

Property Value

Orientation

PeakHoldFallTime

Time the peak-hold marker takes to fall the full scale (VisioForge.Core.UI.WPF.VolumeMeterPro.VolumeMeterLED.MaxDb - VisioForge.Core.UI.WPF.VolumeMeterPro.VolumeMeterLED.MinDb).

public TimeSpan PeakHoldFallTime { get; set; }

Property Value

TimeSpan

RedBrush

Brush used for segments in the red (overload) zone.

public Brush RedBrush { get; set; }

Property Value

Brush

Rms

RMS (root-mean-square) level in dB. Shown as a darker overlay when VisioForge.Core.UI.WPF.VolumeMeterPro.VolumeMeterLED.ShowRmsBar is enabled.

public double Rms { get; set; }

Property Value

double

SegmentCount

Number of LED segments along the bar. Changing this rebuilds the segment array.

public int SegmentCount { get; set; }

Property Value

int

SegmentGap

Pixel gap between adjacent LED segments.

public double SegmentGap { get; set; }

Property Value

double

ShowPeakHold

When true, draws a small marker at the recent peak that falls back over VisioForge.Core.UI.WPF.VolumeMeterPro.VolumeMeterLED.PeakHoldFallTime.

public bool ShowPeakHold { get; set; }

Property Value

bool

ShowRmsBar

When true, overlays the VisioForge.Core.UI.WPF.VolumeMeterPro.VolumeMeterLED.Rms level in a darker tint under the peak segments.

public bool ShowRmsBar { get; set; }

Property Value

bool

ShowScaleLabels

When true, renders dB-value text labels along the bar.

public bool ShowScaleLabels { get; set; }

Property Value

bool

YellowBrush

Brush used for segments in the yellow (warning) zone.

public Brush YellowBrush { get; set; }

Property Value

Brush

YellowMaxDb

Upper bound (in dB) of the yellow zone. Segments at or above this anchor become red.

public double YellowMaxDb { get; set; }

Property Value

double

Methods

Clear()

Resets the displayed level to VisioForge.Core.UI.WPF.VolumeMeterPro.VolumeMeterLED.MinDb and clears any peak-hold state.

public void Clear()

Start()

Enables updates. VisioForge.Core.UI.WPF.VolumeMeterPro.VolumeMeterLED.Update only redraws while the meter is started.

public void Start()

Stop()

Disables updates. Subsequent VisioForge.Core.UI.WPF.VolumeMeterPro.VolumeMeterLED.Update calls become no-ops until VisioForge.Core.UI.WPF.VolumeMeterPro.VolumeMeterLED.Start is called.

public void Stop()

Update()

Triggers a redraw if the meter is started and at least VisioForge.Core.UI.WPF.VolumeMeterPro.VolumeMeterLED.MinimalUpdateInterval has elapsed since the previous update. Call from your VU-meter event handler after updating VisioForge.Core.UI.WPF.VolumeMeterPro.VolumeMeterLED.Amplitude (and optionally VisioForge.Core.UI.WPF.VolumeMeterPro.VolumeMeterLED.Rms).

public void Update()

Remarks

The peak-hold sample is captured on every call (so a transient peak that lands between rate-limit ticks is not lost), while the visual redraw itself is rate-limited to VisioForge.Core.UI.WPF.VolumeMeterPro.VolumeMeterLED.MinimalUpdateInterval.