Class StepSequencer
- Namespace
- PluginUI
- Assembly
- PluginUI.dll
Step sequencer: a lane of step values (bars drawn with the mouse) above a lane of gates (on / off), with beat grouping, an active length and a play cursor. Each step can be bound to parameters.
public class StepSequencer : Control
- Inheritance
-
StepSequencer
- Inherited Members
Examples
var seq = new StepSequencer { StepCount = 16, IsBipolar = true };
seq.CurrentStepSource = () => processor.CurrentStep; // −1 when stopped
seq.StepChanged += (s, i) => pattern[i] = s.GetValue(i);
Remarks
Mouse. Drag across the value lane to draw values (fast movements are interpolated so no step is skipped), double-click a bar to reset it to DefaultStepValue; click or drag across the gate lane to switch gates (the first gate clicked decides on or off for the whole drag).
Parameters. When ValueParameters / GateParameters are set (one per step), the steps read and write them; each parameter touched during a drag gets a single gesture that ends with the drag.
Constructors
StepSequencer()
Creates a 16-step sequencer with all gates on.
public StepSequencer()
Properties
CurrentStep
Step being played (−1 = none).
public int CurrentStep { get; set; }
Property Value
CurrentStepSource
Function polled every frame for the playing step (e.g. a volatile field written by the audio thread).
[Browsable(false)]
public Func<int>? CurrentStepSource { get; set; }
Property Value
DefaultSize
Natural size used when no explicit size is given.
protected override Size DefaultSize { get; }
Property Value
DefaultStepValue
Value restored by a double-click.
public double DefaultStepValue { get; set; }
Property Value
GateParameters
One parameter per step for the gates (on above 0.5), or null.
[Browsable(false)]
public IReadOnlyList<IParameter>? GateParameters { get; set; }
Property Value
GroupSize
Steps per beat group (alternate background shading; 0 = none).
public int GroupSize { get; set; }
Property Value
IsBipolar
Draws values from the center line (−1..+1) instead of from the bottom.
public bool IsBipolar { get; set; }
Property Value
Length
Number of active steps (steps beyond are dimmed).
public int Length { get; set; }
Property Value
ShowGates
Shows the gate lane.
public bool ShowGates { get; set; }
Property Value
StepCount
Number of steps (1 … 64).
public int StepCount { get; set; }
Property Value
ValueParameters
One parameter per step for the values, or null.
[Browsable(false)]
public IReadOnlyList<IParameter>? ValueParameters { get; set; }
Property Value
ValueSteps
Number of value steps (0 = continuous; e.g. 24 for semitones over two octaves).
public int ValueSteps { get; set; }
Property Value
Methods
GetGate(int)
Gate of a step.
public bool GetGate(int step)
Parameters
stepintStep index.
Returns
- bool
trueif the step plays.
GetValue(int)
Value of a step (normalized).
public double GetValue(int step)
Parameters
stepintStep index.
Returns
- double
The value in [0, 1].
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
RenderVector(DrawingContext, Rect, VectorStyle)
Vector rendering of the widget area.
protected override void RenderVector(DrawingContext dc, Rect widget, VectorStyle style)
Parameters
dcDrawingContextwidgetRectstyleVectorStyle
SetGate(int, bool)
Sets a gate (programmatic).
public void SetGate(int step, bool on)
Parameters
SetValue(int, double)
Sets a step value (programmatic: bound parameters receive a complete gesture).
public void SetValue(int step, double value)
Parameters
Events
GateChanged
Raised after the user switched a gate (argument: step index).
public event Action<StepSequencer, int>? GateChanged
Event Type
StepChanged
Raised after the user changed a step value (argument: step index).
public event Action<StepSequencer, int>? StepChanged