Gin
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
MSEG Class Reference

Multi-Segment Envelope Generator (MSEG) for complex modulation curves. More...

#include <gin_mseg.h>

Classes

struct  Data
 
struct  Parameters
 
struct  Point
 

Public Member Functions

 MSEG (Data &d)
 
int getMaxPoints ()
 
juce::Array< Point > & getPoints ()
 
void setSampleRate (double sr)
 
void setParameters (Parameters p)
 
void reset ()
 
void setPoints (const juce::Array< Point > &p)
 
void noteOn (float phase_=-1.0f)
 
float process (int numSamples)
 
float getOutput ()
 
float getCurrentPhase ()
 
float getValueAt (float atPhase)
 

Detailed Description

Multi-Segment Envelope Generator (MSEG) for complex modulation curves.

MSEG provides a sophisticated LFO/envelope generator with multiple breakpoints and adjustable curves between them. Each segment can have independent curve shaping, allowing for complex modulation patterns beyond simple LFO waveforms.

Key Features:

Each Point has:

Parameters:

Usage:

MSEG mseg(msegData);
mseg.setSampleRate(44100.0);
// Define envelope shape
msegData.points[0] = {0.0f, 0.0f, 0.0f}; // Start at 0
msegData.points[1] = {0.2f, 1.0f, 2.0f}; // Rise with curve
msegData.points[2] = {0.8f, 0.5f, -1.0f}; // Decay with curve
msegData.points[3] = {1.0f, 0.0f, 0.0f}; // Return to 0
msegData.numPoints = 4;
msegData.startIndex = 0;
msegData.endIndex = 3;
params.frequency = 2.0f; // 2 Hz
params.loop = true;
params.depth = 1.0f;
params.offset = 0.0f;
mseg.setParameters(params);
mseg.noteOn();
float modValue = mseg.process(numSamples);
Multi-Segment Envelope Generator (MSEG) for complex modulation curves.
Definition gin_mseg.h:76
A lightweight 2D point class for projects that don't use juce_graphics.
Definition gin_point.h:25
Definition gin_mseg.h:93
Definition gin_mseg.h:80
bool loop
Definition gin_mseg.h:82
float depth
Definition gin_mseg.h:81
float offset
Definition gin_mseg.h:81
float frequency
Definition gin_mseg.h:81
Definition gin_mseg.h:86
See also
StepLFO, LFO, AnalogADSR

Constructor & Destructor Documentation

◆ MSEG()

MSEG::MSEG ( Data d)

Member Function Documentation

◆ getMaxPoints()

int MSEG::getMaxPoints ( )

References MSEG::Data::maxPoints.

◆ getPoints()

juce::Array< Point > & MSEG::getPoints ( )

References MSEG::Data::points.

◆ setSampleRate()

void MSEG::setSampleRate ( double  sr)

◆ setParameters()

void MSEG::setParameters ( Parameters  p)

◆ reset()

void MSEG::reset ( )

◆ setPoints()

void MSEG::setPoints ( const juce::Array< Point > &  p)

◆ noteOn()

void MSEG::noteOn ( float  phase_ = -1.0f)

◆ process()

float MSEG::process ( int  numSamples)

◆ getOutput()

float MSEG::getOutput ( )

◆ getCurrentPhase()

float MSEG::getCurrentPhase ( )

◆ getValueAt()

float MSEG::getValueAt ( float  atPhase)

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