Table of Contents

Class CompressorCurve

Namespace
PluginUI
Assembly
PluginUI.dll

Static transfer curve of a compressor / limiter (input level → output level, in dB) with threshold, ratio and soft knee, the unity line, and a moving dot showing the current input level on the curve. The threshold and the ratio can be edited by dragging, optionally bound to parameters.

public class CompressorCurve : Control
Inheritance
CompressorCurve
Inherited Members

Remarks

Editing. Drag the threshold handle (on the curve at the threshold) to move the threshold; drag anywhere above the threshold vertically to change the ratio (up = gentler, down = harder; Shift = fine). Double-click resets both to their defaults. Bound parameters receive complete begin / perform / end gestures.

Parameters. ThresholdParameter, RatioParameter and KneeParameter are read through ToPlain(double): their plain values must be in dB, ratio (e.g. 4 for 4:1) and dB. Unbound, the ThresholdDb, Ratio and KneeDb properties are used and CurveChanged is raised on user edits.

The curve is computed by OutputDb(double, double, double, double) (quadratic soft knee).

Constructors

CompressorCurve()

Creates a compressor curve.

public CompressorCurve()

Properties

CurveColor

Curve color (null = theme accent).

public Color? CurveColor { get; set; }

Property Value

Color?

DefaultSize

Natural size used when no explicit size is given.

protected override Size DefaultSize { get; }

Property Value

Size

InputLevelSource

Input peak level (linear) published by the audio thread, shown as a dot on the curve.

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

Property Value

PeakValue

IsEditable

Allows editing threshold and ratio with the mouse.

public bool IsEditable { get; set; }

Property Value

bool

KneeDb

Knee width in dB (used when KneeParameter is null).

public float KneeDb { get; set; }

Property Value

float

KneeParameter

Knee parameter (plain value in dB), or null.

public IParameter? KneeParameter { get; set; }

Property Value

IParameter

MakeupDb

Make-up gain in dB added to the drawn output.

public float MakeupDb { get; set; }

Property Value

float

MaxDb

Highest level of both axes in dB.

public float MaxDb { get; set; }

Property Value

float

MaxRatio

Highest ratio reachable by dragging (unbound).

public float MaxRatio { get; set; }

Property Value

float

MinDb

Lowest level of both axes in dB.

public float MinDb { get; set; }

Property Value

float

MinThresholdDb

Lowest threshold reachable by dragging (unbound).

public float MinThresholdDb { get; set; }

Property Value

float

Ratio

Ratio, ≥ 1 (used when RatioParameter is null); use a large value (e.g. 100) for a limiter.

public float Ratio { get; set; }

Property Value

float

RatioParameter

Ratio parameter (plain value = ratio), or null.

public IParameter? RatioParameter { get; set; }

Property Value

IParameter

ThresholdDb

Threshold in dB (used when ThresholdParameter is null).

public float ThresholdDb { get; set; }

Property Value

float

ThresholdParameter

Threshold parameter (plain value in dB), or null.

public IParameter? ThresholdParameter { get; set; }

Property Value

IParameter

Methods

OnAttached()

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

protected override void OnAttached()

OnCaptureLost()

The mouse capture was lost without a button release.

protected override void OnCaptureLost()

OnDetached()

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

protected override void OnDetached()

OnMouseDown(MouseEventArgs)

Mouse button pressed over the element (or captured).

protected override void OnMouseDown(MouseEventArgs e)

Parameters

e MouseEventArgs

OnMouseMove(MouseEventArgs)

Mouse moved over the element (or captured).

protected override void OnMouseMove(MouseEventArgs e)

Parameters

e MouseEventArgs

OnMouseUp(MouseEventArgs)

Mouse button released.

protected override void OnMouseUp(MouseEventArgs e)

Parameters

e MouseEventArgs

OutputDb(double)

Output level in dB for an input level, with the current settings and make-up gain.

public double OutputDb(double inputDb)

Parameters

inputDb double

Input level in dB.

Returns

double

Output level in dB.

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

Events

CurveChanged

Raised after the user changed the threshold or the ratio of an unbound curve.

public event Action<CompressorCurve>? CurveChanged

Event Type

Action<CompressorCurve>