Table of Contents

Class PeakMeterCtrl

Namespace
VisioForge.Core.UI.WinForms
Assembly
VisioForge.Core.dll

Professional multi-band audio peak meter control for real-time audio level visualization in WinForms applications.

This highly customizable control provides broadcast-quality audio metering with support for multiple bands, LED-style visualization, and professional color-coded level indication. It implements smooth falloff effects, peak hold functionality, and flexible styling options suitable for audio recording, mixing, and monitoring applications.

Key features:

  • Multi-band metering support (1-1000 bands configurable)
  • LED-style segmented display (1-1000 LEDs per band)
  • Three-zone color coding: Normal (green), Medium (yellow), High (red)
  • Smooth level falloff with configurable speed
  • Peak hold indicators with optional decay
  • Grid visualization for reference levels
  • Horizontal and vertical orientation support
  • Optimized double-buffered rendering
  • Customizable colors and appearance

Technical specifications:

  • Default ranges: Normal (0-60%), Medium (60-80%), High (80-100%)
  • Configurable falloff speed with smooth animation
  • Efficient GDI+ rendering with minimal CPU usage
  • Automatic scaling based on control dimensions
  • Thread-safe level update mechanism

Performance characteristics:

  • Double-buffered rendering to prevent flicker
  • Optimized paint routines for multiple bands
  • Timer-based falloff animation
  • Minimal memory allocation during operation

Common use cases:

  • Audio recording and playback level monitoring
  • Multi-track mixing console interfaces
  • Broadcast audio monitoring systems
  • Live sound reinforcement applications
  • Audio analysis and measurement tools
  • Multi-channel audio processing visualization

Usage pattern:

  1. Set BandsCount and LEDCount for desired resolution
  2. Configure color scheme and ranges
  3. Call Start() to begin metering
  4. Update levels using SetData() method
  5. Call Stop() to pause metering

Thread safety: SetData() and related methods can be called from any thread. Visual updates are automatically marshaled to the UI thread.

[ToolboxBitmap(typeof(MyResourceNamespace), "PeakMeterCtrl.pmicon.bmp")]
public class PeakMeterCtrl : Control, IDropTarget, ISynchronizeInvoke, IWin32Window, IBindableComponent, IComponent, IDisposable

Inheritance

Implements

Inherited Members

Constructors

PeakMeterCtrl()

Initializes a new instance of the VisioForge.Core.UI.WinForms.PeakMeterCtrl class.

public PeakMeterCtrl()

Properties

BandsCount

Gets or sets bands count.

public int BandsCount { get; set; }

Property Value

int

ColorHigh

Gets or sets high color.

public Color ColorHigh { get; set; }

Property Value

Color

ColorHighBack

Gets or sets high back color.

public Color ColorHighBack { get; set; }

Property Value

Color

ColorMedium

Gets or sets medium color.

public Color ColorMedium { get; set; }

Property Value

Color

ColorMediumBack

Gets or sets medium back color.

public Color ColorMediumBack { get; set; }

Property Value

Color

ColorNormal

Gets or sets normal color.

public Color ColorNormal { get; set; }

Property Value

Color

ColorNormalBack

Gets or sets normal back color.

public Color ColorNormalBack { get; set; }

Property Value

Color

ColoredGrid

Gets or sets a value indicating whether grid is colored.

public bool ColoredGrid { get; set; }

Property Value

bool

Context

SDK logging context. Set by the engine via ContextPropagator when this control is attached. Routes errors through the SDK's Serilog sink. Falls back to Trace when null.

[Browsable(false)]
public BaseContext Context { get; set; }

Property Value

BaseContext

FalloffColor

Gets or sets falloff color.

public Color FalloffColor { get; set; }

Property Value

Color

FalloffEffect

Gets or sets a value indicating whether falloff effect is enabled.

public bool FalloffEffect { get; set; }

Property Value

bool

FalloffSpeed

Gets or sets falloff speed.

public int FalloffSpeed { get; set; }

Property Value

int

GridColor

Gets or sets grid color.

public Color GridColor { get; set; }

Property Value

Color

IsActive

Gets a value indicating whether peakmeter is active.

[Browsable(false)]
public bool IsActive { get; }

Property Value

bool

LEDCount

Gets or sets LED count.

public int LEDCount { get; set; }

Property Value

int

MeterStyle

Gets or sets meter style.

public PeakMeterStyle MeterStyle { get; set; }

Property Value

PeakMeterStyle

ShowGrid

Gets or sets a value indicating whether grid is enabled.

public bool ShowGrid { get; set; }

Property Value

bool

Methods

Clear()

Clears values.

public void Clear()

DarkenColor(Color, byte)

Make a color darker.

protected virtual Color DarkenColor(Color color, byte darkenBy)

Parameters

color Color

Color to darken.

darkenBy byte

Value to decrease by.

Returns

Color

Returns Color.

Dispose(bool)

Clean up any resources being used.

protected override void Dispose(bool disposing)

Parameters

disposing bool

true if managed resources should be disposed; otherwise, false.

DrawHorzBand(Graphics, Rectangle)

Draws horizon bands.

protected void DrawHorzBand(Graphics g, Rectangle rect)

Parameters

g Graphics

Graphics.

rect Rectangle

Rectangle.

DrawVertBand(Graphics, Rectangle)

Draws vertical band.

protected void DrawVertBand(Graphics g, Rectangle rect)

Parameters

g Graphics

Graphics.

rect Rectangle

Rectangle.

InRange(int, int, int)

Checks is in range.

protected static bool InRange(int value, int rangeMin, int rangeMax)

Parameters

value int

Value.

rangeMin int

Min range.

rangeMax int

Max range.

Returns

bool

Returns Boolean.

LightenColor(Color, byte)

Make a color lighter.

protected virtual Color LightenColor(Color color, byte lightenBy)

Parameters

color Color

Color.

lightenBy byte

Lighten by.

Returns

Color

Returns Color.

OnBackColorChanged(EventArgs)

On backcolor changed event.

protected override void OnBackColorChanged(EventArgs e)

Parameters

e EventArgs

Event args.

OnHandleDestroyed(EventArgs)

On handle destroyed event.

protected override void OnHandleDestroyed(EventArgs e)

Parameters

e EventArgs

Event args.

OnPaint(PaintEventArgs)

On paint event.

protected override void OnPaint(PaintEventArgs e)

Parameters

e PaintEventArgs

Event args.

ResetControl()

Resets control.

protected void ResetControl()

SetData(int[], int, int)

Set meter band value.

public bool SetData(int[] arrayValue, int offset, int size)

Parameters

arrayValue int[]

Array value for the bands.

offset int

Starting offset position.

size int

Number of values to set.

Returns

bool

Returns Boolean.

SetMeterBands(int, int)

Set number of LED bands.

public void SetMeterBands(int bandsCount, int ledCount)

Parameters

bandsCount int

Number of bands.

ledCount int

Number of LED per bands.

SetRange(int, int, int)

Set range info.

public void SetRange(int minRangeVal, int medRangeVal, int maxRangeVal)

Parameters

minRangeVal int

Min Range.

medRangeVal int

Medium Range.

maxRangeVal int

High Range.

Start(int)

Start animation.

public bool Start(int delay)

Parameters

delay int

Delay.

Returns

bool

Returns Boolean.

StartAnimation(int)

Starts animation.

protected bool StartAnimation(int period)

Parameters

period int

Period.

Returns

bool

Returns Boolean.

Stop()

Stop animation.

public bool Stop()

Returns

bool

Returns Boolean.

StopAnimation()

Stops animation.

protected bool StopAnimation()

Returns

bool

Returns Boolean.

TimerCallback(object)

Timer callback.

protected void TimerCallback(object thisObject)

Parameters

thisObject object

Self.