EnvelopePanel
File: Rhapsodist/Widgets/EnvelopePanel.js · Namespace: EnvelopePanel.
Overview
Builds a Flex AHDSR UI: a floating tile graph plus a row of knobs (Attack/Hold/Decay/Sustain/Release, plus Attack Level and the three curve knobs, hidden by default since they’re normally set by dragging on the graph).
Knobs and graph
Alt-clicking a knob or the floating tile resets every knob to its default value. Dragging on the graph updates the matching knob and vice versa; both stay in sync. Unless options.defaultLayout is false, the knobs are laid out in a row.
Usage
const pnlEnvelope = EnvelopePanel.create("pnlEnvelopeContainer", "ahdsrController", "globalFlexAhdsr", {})
Options
| Option | Description | Default |
|---|---|---|
defaultLayout | Whether the knob row is arranged automatically via Container.createRow(). | true |
index | Suffix appended to the envelope panel’s own component ID (pnlEnvelope<index>), letting multiple EnvelopePanel instances coexist. | - |
knobHeight | Knob height in pixels, only applied if smaller than the default. | 90 |
Look and Feel
| Function | Draws |
|---|---|
drawAhdsrBackground | The floating tile’s background. |
drawFlexAhdsrFullPath | The full envelope shape (the gradient-filled path behind the active segment). |
drawFlexAhdsrSegment | The currently active segment’s highlighted fill. |
drawFlexAhdsrCurvePoint | The small circle shown at a segment’s curve point on hover. |
drawFlexAhdsrDragPoint | The small square shown at a segment’s drag point on hover. |
drawFlexAhdsrPosition | The playback position marker. No default drawing is provided. |
drawFlexAhdsrBall | The playback ball indicator. |
drawFlexAhdsrText | Text drawn on the graph. No default drawing is provided. |
drawAhdsrKnob | Each knob, in place of CoreLookAndFeel.drawKnob(). |
Public API
| Function | Description | Returns |
|---|---|---|
create(panelId, processorId, flexEnvelopeId, options) | Builds the graph and knob row inside panelId. processorId is the AhdsrController.js module the knobs bind to; flexEnvelopeId is the Flex AHDSR modulator the graph connects to. Both must already exist in the module tree. Each knob is bound to processorId’s matching parameter with saveInPreset: true. | ScriptObject |