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

Rhythmic gate effect with programmable step sequencing. More...

#include <gin_gateeffect.h>

Public Member Functions

 GateEffect ()
void setSampleRate (double sr)
void reset ()
void process (juce::AudioSampleBuffer &buffer, int noteOnSample, int noteOffSample)
void setLength (int n)
void setFrequency (float f)
void setStep (int step, bool l, bool r)
void setAttack (float seconds)
void setRelease (float seconds)
void setMix (float m)

Protected Attributes

double sampleRate = 44100.0
AnalogADSR adsrL
AnalogADSR adsrR
juce::Array< bool > stepsL
juce::Array< bool > stepsR
float frequency = 0.0f
float phase = 0.0f
float mix = 1.0f
bool triggered = false
bool lastLOn = false
bool lastROn = false

Detailed Description

Rhythmic gate effect with programmable step sequencing.

GateEffect creates rhythmic gating patterns by turning audio on/off in a programmable sequence. Each step can be independently set for left and right channels, allowing for complex rhythmic patterns and stereo effects.

Key Features:

  • Programmable step sequencer (configurable length)
  • Independent left/right channel patterns
  • Configurable gate frequency (tempo)
  • Attack and release envelope for smooth gating
  • Wet/dry mix control
  • Synced to note on/off events

Usage:

gate.setSampleRate(44100.0);
gate.setLength(16); // 16-step sequence
// Create a pattern (1=on, 0=off)
gate.setStep(0, true, true); // Both channels on
gate.setStep(1, false, false); // Both off
gate.setStep(2, true, false); // Left only
gate.setStep(3, false, true); // Right only
// ... set remaining steps
gate.setFrequency(8.0f); // 8 steps per second
gate.setAttack(0.001f); // 1ms attack
gate.setRelease(0.05f); // 50ms release
gate.setMix(1.0f); // 100% wet
// In audio callback
gate.process(audioBuffer, noteOnSamplePos, noteOffSamplePos);
void setStep(int step, bool l, bool r)
Definition gin_gateeffect.h:144
GateEffect()
Definition gin_gateeffect.h:59
void setFrequency(float f)
Definition gin_gateeffect.h:139
void process(juce::AudioSampleBuffer &buffer, int noteOnSample, int noteOffSample)
Definition gin_gateeffect.h:85
void setMix(float m)
Definition gin_gateeffect.h:162
void setRelease(float seconds)
Definition gin_gateeffect.h:156
void setAttack(float seconds)
Definition gin_gateeffect.h:150
void setSampleRate(double sr)
Definition gin_gateeffect.h:67
void setLength(int n)
Definition gin_gateeffect.h:133
See also
AnalogADSR

Constructor & Destructor Documentation

◆ GateEffect()

GateEffect::GateEffect ( )

References adsrL, and adsrR.

Member Function Documentation

◆ setSampleRate()

void GateEffect::setSampleRate ( double sr)

References adsrL, and sampleRate.

◆ reset()

void GateEffect::reset ( )

References adsrL, adsrR, lastLOn, lastROn, phase, and triggered.

◆ process()

void GateEffect::process ( juce::AudioSampleBuffer & buffer,
int noteOnSample,
int noteOffSample )

◆ setLength()

void GateEffect::setLength ( int n)

References stepsL, and stepsR.

◆ setFrequency()

void GateEffect::setFrequency ( float f)

References frequency.

◆ setStep()

void GateEffect::setStep ( int step,
bool l,
bool r )

References stepsL, and stepsR.

◆ setAttack()

void GateEffect::setAttack ( float seconds)

References adsrL, and adsrR.

◆ setRelease()

void GateEffect::setRelease ( float seconds)

References adsrL, and adsrR.

◆ setMix()

void GateEffect::setMix ( float m)

References mix.

Member Data Documentation

◆ sampleRate

double GateEffect::sampleRate = 44100.0
protected

Referenced by process(), and setSampleRate().

◆ adsrL

AnalogADSR GateEffect::adsrL
protected

◆ adsrR

AnalogADSR GateEffect::adsrR
protected

◆ stepsL

juce::Array<bool> GateEffect::stepsL
protected

Referenced by process(), setLength(), and setStep().

◆ stepsR

juce::Array<bool> GateEffect::stepsR
protected

Referenced by process(), setLength(), and setStep().

◆ frequency

float GateEffect::frequency = 0.0f
protected

Referenced by process(), and setFrequency().

◆ phase

float GateEffect::phase = 0.0f
protected

Referenced by process(), and reset().

◆ mix

float GateEffect::mix = 1.0f
protected

Referenced by process(), and setMix().

◆ triggered

bool GateEffect::triggered = false
protected

Referenced by process(), and reset().

◆ lastLOn

bool GateEffect::lastLOn = false
protected

Referenced by process(), and reset().

◆ lastROn

bool GateEffect::lastROn = false
protected

Referenced by process(), and reset().


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