Table of Contents

Class HistoryGraph

Namespace
PluginUI
Assembly
PluginUI.dll

Rolling graph of a value over time, newest on the right (iPlug2 IVDisplayControl): gain reduction history, envelope follower, LFO output, CPU load… Values come from Push(float) (UI thread), from a lock-free PeakValue published by the audio thread (PeakSource), or from a function polled every frame (ValueSource).

public class HistoryGraph : Control
Inheritance
HistoryGraph
Inherited Members

Examples

// Audio thread: _grPeak.Push(gainReductionDb);   UI:
var history = new HistoryGraph { PeakSource = processor.GainReduction, Minimum = 0, Maximum = 24, FillFromTop = true,
                                 Mode = HistoryGraphMode.Filled, Unit = " dB" };

Constructors

HistoryGraph()

Creates a history graph.

public HistoryGraph()

Properties

Capacity

Number of values kept (and spread across the width).

public int Capacity { get; set; }

Property Value

int

Count

Number of values currently stored.

[Browsable(false)]
public int Count { get; }

Property Value

int

Decimals

Decimals of the displayed value.

public int Decimals { get; set; }

Property Value

int

DefaultSize

Natural size used when no explicit size is given.

protected override Size DefaultSize { get; }

Property Value

Size

FillFromTop

Fills (and draws bars) from the top instead of the bottom, e.g. for gain reduction.

public bool FillFromTop { get; set; }

Property Value

bool

IsFrozen

Stops scrolling (values pushed meanwhile are ignored).

public bool IsFrozen { get; set; }

Property Value

bool

Latest

Most recent value (0 when empty).

[Browsable(false)]
public float Latest { get; }

Property Value

float

LineThickness

Line thickness.

public float LineThickness { get; set; }

Property Value

float

Maximum

Value at the top of the graph.

public float Maximum { get; set; }

Property Value

float

Minimum

Value at the bottom of the graph.

public float Minimum { get; set; }

Property Value

float

Mode

Drawing mode.

public HistoryGraphMode Mode { get; set; }

Property Value

HistoryGraphMode

PeakSource

Lock-free value published by the audio thread; its maximum since the previous frame is plotted.

[Browsable(false)]
public PeakValue? PeakSource { get; set; }

Property Value

PeakValue

SamplesPerSecond

Values plotted per second when polling a source (default 30).

public float SamplesPerSecond { get; set; }

Property Value

float

ShowCurrentValue

Shows the latest value in the top-right corner.

public bool ShowCurrentValue { get; set; }

Property Value

bool

ShowGrid

Draws horizontal grid lines (4 divisions).

public bool ShowGrid { get; set; }

Property Value

bool

TraceColor

Trace color (null = theme accent).

public Color? TraceColor { get; set; }

Property Value

Color?

Unit

Unit appended to the displayed value (e.g. " dB").

public string? Unit { get; set; }

Property Value

string

ValueSource

Function polled once per sample period (UI thread).

[Browsable(false)]
public Func<float>? ValueSource { get; set; }

Property Value

Func<float>

Methods

Advance(double)

Advances the polling clock (called every frame; public for offscreen hosts and tests).

public void Advance(double elapsedSeconds)

Parameters

elapsedSeconds double

Time since the previous call.

Clear()

Removes every value.

public void Clear()

OnAttached()

Called when the element joins a host (subscribe to external events here).

protected override void OnAttached()

OnDetached()

Called when the element leaves its host (unsubscribe here).

protected override void OnDetached()

Push(float)

Appends a value (UI thread).

public void Push(float value)

Parameters

value float

The value (NaN is ignored).

RenderVector(DrawingContext, Rect, VectorStyle)

Vector rendering of the widget area.

protected override void RenderVector(DrawingContext dc, Rect widget, VectorStyle style)

Parameters

dc DrawingContext
widget Rect
style VectorStyle

Snapshot()

Copy of the stored values, oldest first.

public float[] Snapshot()

Returns

float[]

A new array of Count values.