A very simple ADSR envelope class.
More...
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.
Do not change the parameters during playback. If you change the parameters before the release stage has completed then you must call reset() before the next call to noteOn().
◆ ADSR()
◆ setParameters()
void ADSR::setParameters |
( |
const Parameters & |
newParameters | ) |
|
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.
◆ getParameters()
◆ isActive()
bool ADSR::isActive |
( |
| ) |
const |
|
noexcept |
Returns true if the envelope is in its attack, decay, sustain or release stage.
◆ setSampleRate()
void ADSR::setSampleRate |
( |
double |
newSampleRate | ) |
|
|
noexcept |
◆ reset()
Resets the envelope to an idle state.
◆ noteOn()
Starts the attack phase of the envelope.
◆ noteOff()
Starts the release phase of the envelope.
◆ getNextSample()
float ADSR::getNextSample |
( |
| ) |
|
|
noexcept |
◆ applyEnvelopeToBuffer()
template<typename FloatType >
void ADSR::applyEnvelopeToBuffer |
( |
AudioBuffer< FloatType > & |
buffer, |
|
|
int |
startSample, |
|
|
int |
numSamples |
|
) |
| |
The documentation for this class was generated from the following file: