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
DefaultSize
Natural size used when no explicit size is given.
protected override Size DefaultSize { get; }
Property Value
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
IsEditable
Allows editing threshold and ratio with the mouse.
public bool IsEditable { get; set; }
Property Value
KneeDb
Knee width in dB (used when KneeParameter is null).
public float KneeDb { get; set; }
Property Value
KneeParameter
Knee parameter (plain value in dB), or null.
public IParameter? KneeParameter { get; set; }
Property Value
MakeupDb
Make-up gain in dB added to the drawn output.
public float MakeupDb { get; set; }
Property Value
MaxDb
Highest level of both axes in dB.
public float MaxDb { get; set; }
Property Value
MaxRatio
Highest ratio reachable by dragging (unbound).
public float MaxRatio { get; set; }
Property Value
MinDb
Lowest level of both axes in dB.
public float MinDb { get; set; }
Property Value
MinThresholdDb
Lowest threshold reachable by dragging (unbound).
public float MinThresholdDb { get; set; }
Property Value
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
RatioParameter
Ratio parameter (plain value = ratio), or null.
public IParameter? RatioParameter { get; set; }
Property Value
ThresholdDb
Threshold in dB (used when ThresholdParameter is null).
public float ThresholdDb { get; set; }
Property Value
ThresholdParameter
Threshold parameter (plain value in dB), or null.
public IParameter? ThresholdParameter { get; set; }
Property Value
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
OnMouseMove(MouseEventArgs)
Mouse moved over the element (or captured).
protected override void OnMouseMove(MouseEventArgs e)
Parameters
OnMouseUp(MouseEventArgs)
Mouse button released.
protected override void OnMouseUp(MouseEventArgs e)
Parameters
OutputDb(double)
Output level in dB for an input level, with the current settings and make-up gain.
public double OutputDb(double inputDb)
Parameters
inputDbdoubleInput 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
dcDrawingContextwidgetRectstyleVectorStyle
Events
CurveChanged
Raised after the user changed the threshold or the ratio of an unbound curve.
public event Action<CompressorCurve>? CurveChanged