Gin
Loading...
Searching...
No Matches
ADSRComponent Class Reference

Interactive visual editor for ADSR envelope parameters. More...

#include <gin_adsrcomponent.h>

Inheritance diagram for ADSRComponent:

Public Member Functions

 ADSRComponent ()
 ~ADSRComponent () override=default
void setParams (Parameter::Ptr attack, Parameter::Ptr decay, Parameter::Ptr sustain, Parameter::Ptr release)
Public Member Functions inherited from MultiParamComponent
 MultiParamComponent ()
 ~MultiParamComponent () override
juce::Colour dimIfNeeded (const juce::Colour &c)
Public Member Functions inherited from Parameter::ParameterListener
virtual ~ParameterListener ()

Public Attributes

std::function< std::vector< std::pair< int, float > >()> phaseCallback

Additional Inherited Members

Protected Member Functions inherited from MultiParamComponent
void showBubble (const juce::String &text, const juce::Rectangle< int > &rc)
void hideBubble ()
void watchParam (Parameter *p)
void unwatchParam (Parameter *p)
void unwatchParams ()
virtual void paramChanged ()
void enablementChanged () override
void valueUpdated (Parameter *) override
void handleAsyncUpdate () override
Protected Attributes inherited from MultiParamComponent
juce::Array< Parameter * > params
std::unique_ptr< juce::BubbleMessageComponent > bubble

Detailed Description

Interactive visual editor for ADSR envelope parameters.

ADSRComponent provides an intuitive graphical interface for editing ADSR (Attack, Decay, Sustain, Release) envelope parameters. Users can drag handles to adjust the envelope shape, with real-time visual feedback and optional phase indication showing the current envelope position.

Key Features:

  • Visual envelope curve display
  • Draggable handles for Attack, Decay/Sustain, and Release
  • Real-time parameter updates while dragging
  • Optional phase indicators for showing active voices
  • Mouse cursor changes to indicate draggable areas
  • Bubble tooltips showing parameter values

The component requires four parameters (attack, decay, sustain, release) and optionally accepts a callback to display current envelope phases for visual feedback during playback.

Usage:

ADSRComponent adsrEditor;
adsrEditor.setParams(attackParam, decayParam, sustainParam, releaseParam);
adsrEditor.setBounds(0, 0, 300, 150);
// Optional: Show current envelope phases
adsrEditor.phaseCallback = [this]() {
std::vector<std::pair<int, float>> phases;
for (auto* voice : activeVoices)
phases.push_back(voice->getEnvelopePhase());
return phases;
};
void setParams(Parameter::Ptr attack, Parameter::Ptr decay, Parameter::Ptr sustain, Parameter::Ptr release)
std::function< std::vector< std::pair< int, float > >()> phaseCallback
Definition gin_adsrcomponent.h:55
See also
Parameter, MultiParamComponent, AnalogADSR

Constructor & Destructor Documentation

◆ ADSRComponent()

ADSRComponent::ADSRComponent ( )

◆ ~ADSRComponent()

ADSRComponent::~ADSRComponent ( )
overridedefault

Member Function Documentation

◆ setParams()

void ADSRComponent::setParams ( Parameter::Ptr attack,
Parameter::Ptr decay,
Parameter::Ptr sustain,
Parameter::Ptr release )

Member Data Documentation

◆ phaseCallback

std::function<std::vector<std::pair<int,float> >()> ADSRComponent::phaseCallback

The documentation for this class was generated from the following file: