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:
- Set BandsCount and LEDCount for desired resolution
- Configure color scheme and ranges
- Call Start() to begin metering
- Update levels using SetData() method
- 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, IDisposableInheritance
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
ColorHigh
Gets or sets high color.
public Color ColorHigh { get; set; }Property Value
ColorHighBack
Gets or sets high back color.
public Color ColorHighBack { get; set; }Property Value
ColorMedium
Gets or sets medium color.
public Color ColorMedium { get; set; }Property Value
ColorMediumBack
Gets or sets medium back color.
public Color ColorMediumBack { get; set; }Property Value
ColorNormal
Gets or sets normal color.
public Color ColorNormal { get; set; }Property Value
ColorNormalBack
Gets or sets normal back color.
public Color ColorNormalBack { get; set; }Property Value
ColoredGrid
Gets or sets a value indicating whether grid is colored.
public bool ColoredGrid { get; set; }Property Value
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
FalloffColor
Gets or sets falloff color.
public Color FalloffColor { get; set; }Property Value
FalloffEffect
Gets or sets a value indicating whether falloff effect is enabled.
public bool FalloffEffect { get; set; }Property Value
FalloffSpeed
Gets or sets falloff speed.
public int FalloffSpeed { get; set; }Property Value
GridColor
Gets or sets grid color.
public Color GridColor { get; set; }Property Value
IsActive
Gets a value indicating whether peakmeter is active.
[Browsable(false)]
public bool IsActive { get; }Property Value
LEDCount
Gets or sets LED count.
public int LEDCount { get; set; }Property Value
MeterStyle
Gets or sets meter style.
public PeakMeterStyle MeterStyle { get; set; }Property Value
ShowGrid
Gets or sets a value indicating whether grid is enabled.
public bool ShowGrid { get; set; }Property Value
Methods
Clear()
Clears values.
public void Clear()DarkenColor(Color, byte)
Make a color darker.
protected virtual Color DarkenColor(Color color, byte darkenBy)Parameters
Returns
Dispose(bool)
Clean up any resources being used.
protected override void Dispose(bool disposing)Parameters
disposingbool-
true if managed resources should be disposed; otherwise, false.
DrawHorzBand(Graphics, Rectangle)
Draws horizon bands.
protected void DrawHorzBand(Graphics g, Rectangle rect)Parameters
DrawVertBand(Graphics, Rectangle)
Draws vertical band.
protected void DrawVertBand(Graphics g, Rectangle rect)Parameters
InRange(int, int, int)
Checks is in range.
protected static bool InRange(int value, int rangeMin, int rangeMax)Parameters
Returns
LightenColor(Color, byte)
Make a color lighter.
protected virtual Color LightenColor(Color color, byte lightenBy)Parameters
Returns
OnBackColorChanged(EventArgs)
On backcolor changed event.
protected override void OnBackColorChanged(EventArgs e)Parameters
eEventArgs-
Event args.
OnHandleDestroyed(EventArgs)
On handle destroyed event.
protected override void OnHandleDestroyed(EventArgs e)Parameters
eEventArgs-
Event args.
OnPaint(PaintEventArgs)
On paint event.
protected override void OnPaint(PaintEventArgs e)Parameters
ePaintEventArgs-
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
arrayValueint[]-
Array value for the bands.
offsetint-
Starting offset position.
sizeint-
Number of values to set.
Returns
SetMeterBands(int, int)
Set number of LED bands.
public void SetMeterBands(int bandsCount, int ledCount)Parameters
SetRange(int, int, int)
Set range info.
public void SetRange(int minRangeVal, int medRangeVal, int maxRangeVal)Parameters
Start(int)
Start animation.
public bool Start(int delay)Parameters
delayint-
Delay.
Returns
StartAnimation(int)
Starts animation.
protected bool StartAnimation(int period)Parameters
periodint-
Period.
Returns
Stop()
Stop animation.
public bool Stop()Returns
StopAnimation()
Stops animation.
protected bool StopAnimation()Returns
TimerCallback(object)
Timer callback.
protected void TimerCallback(object thisObject)Parameters
thisObjectobject-
Self.