A very simple ADSR envelope class.
More...
#include <juce_ADSR.h>
A very simple ADSR envelope class.
To use it, call setSampleRate() with the current sample rate and give it some parameters with setParameters() then call getNextSample() to get the envelope value to be applied to each audio sample or applyEnvelopeToBuffer() to apply the envelope to a whole buffer.
@tags{Audio}
◆ State
Enumerator |
---|
idle | |
attack | |
decay | |
sustain | |
release | |
◆ ADSR()
◆ applyEnvelopeToBuffer()
template<typename FloatType >
void juce::ADSR::applyEnvelopeToBuffer |
( |
AudioBuffer< FloatType > & |
buffer, |
|
|
int |
startSample, |
|
|
int |
numSamples |
|
) |
| |
|
inline |
◆ getNextSample()
float juce::ADSR::getNextSample |
( |
| ) |
|
|
inlinenoexcept |
◆ getParameters()
const Parameters& juce::ADSR::getParameters |
( |
| ) |
const |
|
inlinenoexcept |
◆ goToNextState()
void juce::ADSR::goToNextState |
( |
| ) |
|
|
inlineprivatenoexcept |
◆ isActive()
bool juce::ADSR::isActive |
( |
| ) |
const |
|
inlinenoexcept |
Returns true if the envelope is in its attack, decay, sustain or release stage.
◆ noteOff()
void juce::ADSR::noteOff |
( |
| ) |
|
|
inlinenoexcept |
◆ noteOn()
void juce::ADSR::noteOn |
( |
| ) |
|
|
inlinenoexcept |
Starts the attack phase of the envelope.
References juce::gl::f.
◆ recalculateRates()
void juce::ADSR::recalculateRates |
( |
| ) |
|
|
inlineprivatenoexcept |
◆ reset()
void juce::ADSR::reset |
( |
| ) |
|
|
inlinenoexcept |
Resets the envelope to an idle state.
◆ setParameters()
void juce::ADSR::setParameters |
( |
const Parameters & |
newParameters | ) |
|
|
inline |
Sets the parameters that will be used by an ADSR object.
You must have called setSampleRate() with the correct sample rate before this otherwise the values may be incorrect!
- See also
- getParameters
References jassert.
◆ setSampleRate()
void juce::ADSR::setSampleRate |
( |
double |
newSampleRate | ) |
|
|
inlinenoexcept |
◆ attackRate
float juce::ADSR::attackRate = 0.0f |
|
private |
◆ decayRate
float juce::ADSR::decayRate = 0.0f |
|
private |
◆ envelopeVal
float juce::ADSR::envelopeVal = 0.0f |
|
private |
◆ parameters
◆ releaseRate
float juce::ADSR::releaseRate = 0.0f |
|
private |
◆ sampleRate
double juce::ADSR::sampleRate = 44100.0 |
|
private |
◆ state
The documentation for this class was generated from the following file: