Class VolumeMeterLED
- 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, IAddChildInheritance
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 AmplitudePropertyField Value
GreenBrushProperty
Identifies the VisioForge.Core.UI.WPF.VolumeMeterPro.VolumeMeterLED.GreenBrush dependency property.
public static readonly DependencyProperty GreenBrushPropertyField Value
GreenMaxDbProperty
Identifies the VisioForge.Core.UI.WPF.VolumeMeterPro.VolumeMeterLED.GreenMaxDb dependency property.
public static readonly DependencyProperty GreenMaxDbPropertyField Value
MaxDbProperty
Identifies the VisioForge.Core.UI.WPF.VolumeMeterPro.VolumeMeterLED.MaxDb dependency property.
public static readonly DependencyProperty MaxDbPropertyField Value
MinDbProperty
Identifies the VisioForge.Core.UI.WPF.VolumeMeterPro.VolumeMeterLED.MinDb dependency property.
public static readonly DependencyProperty MinDbPropertyField Value
MinimalUpdateIntervalProperty
Identifies the VisioForge.Core.UI.WPF.VolumeMeterPro.VolumeMeterLED.MinimalUpdateInterval dependency property.
public static readonly DependencyProperty MinimalUpdateIntervalPropertyField Value
OffBrushProperty
Identifies the VisioForge.Core.UI.WPF.VolumeMeterPro.VolumeMeterLED.OffBrush dependency property.
public static readonly DependencyProperty OffBrushPropertyField Value
OrientationProperty
Identifies the VisioForge.Core.UI.WPF.VolumeMeterPro.VolumeMeterLED.Orientation dependency property.
public static readonly DependencyProperty OrientationPropertyField Value
PeakHoldFallTimeProperty
Identifies the VisioForge.Core.UI.WPF.VolumeMeterPro.VolumeMeterLED.PeakHoldFallTime dependency property.
public static readonly DependencyProperty PeakHoldFallTimePropertyField Value
RedBrushProperty
Identifies the VisioForge.Core.UI.WPF.VolumeMeterPro.VolumeMeterLED.RedBrush dependency property.
public static readonly DependencyProperty RedBrushPropertyField Value
RmsProperty
Identifies the VisioForge.Core.UI.WPF.VolumeMeterPro.VolumeMeterLED.Rms dependency property.
public static readonly DependencyProperty RmsPropertyField Value
SegmentCountProperty
Identifies the VisioForge.Core.UI.WPF.VolumeMeterPro.VolumeMeterLED.SegmentCount dependency property.
public static readonly DependencyProperty SegmentCountPropertyField Value
SegmentGapProperty
Identifies the VisioForge.Core.UI.WPF.VolumeMeterPro.VolumeMeterLED.SegmentGap dependency property.
public static readonly DependencyProperty SegmentGapPropertyField Value
ShowPeakHoldProperty
Identifies the VisioForge.Core.UI.WPF.VolumeMeterPro.VolumeMeterLED.ShowPeakHold dependency property.
public static readonly DependencyProperty ShowPeakHoldPropertyField Value
ShowRmsBarProperty
Identifies the VisioForge.Core.UI.WPF.VolumeMeterPro.VolumeMeterLED.ShowRmsBar dependency property.
public static readonly DependencyProperty ShowRmsBarPropertyField Value
ShowScaleLabelsProperty
Identifies the VisioForge.Core.UI.WPF.VolumeMeterPro.VolumeMeterLED.ShowScaleLabels dependency property.
public static readonly DependencyProperty ShowScaleLabelsPropertyField Value
YellowBrushProperty
Identifies the VisioForge.Core.UI.WPF.VolumeMeterPro.VolumeMeterLED.YellowBrush dependency property.
public static readonly DependencyProperty YellowBrushPropertyField Value
YellowMaxDbProperty
Identifies the VisioForge.Core.UI.WPF.VolumeMeterPro.VolumeMeterLED.YellowMaxDb dependency property.
public static readonly DependencyProperty YellowMaxDbPropertyField Value
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
GreenBrush
Brush used for segments in the green (safe) zone.
public Brush GreenBrush { get; set; }Property Value
GreenMaxDb
Upper bound (in dB) of the green zone. Segments at or above this anchor become yellow.
public double GreenMaxDb { get; set; }Property Value
MaxDb
Highest dB value displayed on the scale (typically 0 dBFS). Changing this triggers a redraw.
public double MaxDb { get; set; }Property Value
MinDb
Lowest dB value displayed on the scale. Changing this triggers a redraw.
public double MinDb { get; set; }Property Value
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
OffBrush
Brush used for unlit segments.
public Brush OffBrush { get; set; }Property Value
Orientation
Layout orientation of the bar (horizontal or vertical). Changing this rebuilds the layout.
public Orientation Orientation { get; set; }Property Value
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
RedBrush
Brush used for segments in the red (overload) zone.
public Brush RedBrush { get; set; }Property Value
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
SegmentCount
Number of LED segments along the bar. Changing this rebuilds the segment array.
public int SegmentCount { get; set; }Property Value
SegmentGap
Pixel gap between adjacent LED segments.
public double SegmentGap { get; set; }Property Value
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
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
ShowScaleLabels
When true, renders dB-value text labels along the bar.
public bool ShowScaleLabels { get; set; }Property Value
YellowBrush
Brush used for segments in the yellow (warning) zone.
public Brush YellowBrush { get; set; }Property Value
YellowMaxDb
Upper bound (in dB) of the yellow zone. Segments at or above this anchor become red.
public double YellowMaxDb { get; set; }Property Value
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.