Home Information Classes Download Usage Mail List Requirements Links FAQ Tutorial

# stk::ADSR Class Reference

STK ADSR envelope class. More...

`#include <ADSR.h>`

Inheritance diagram for stk::ADSR:

List of all members.

## Public Types
enum | { ATTACK, DECAY, SUSTAIN, RELEASE, DONE }
| ADSR envelope states. More...
## Public Member Functions
| ADSR (void)
| Default constructor.
| ~ADSR (void)
| Class destructor.
void | keyOn (void)
| Set target = 1, state = ADSR::ATTACK.
void | keyOff (void)
| Set target = 0, state = ADSR::RELEASE.
void | setAttackRate (StkFloat rate)
| Set the attack rate.
void | setDecayRate (StkFloat rate)
| Set the decay rate.
void | setSustainLevel (StkFloat level)
| Set the sustain level.
void | setReleaseRate (StkFloat rate)
| Set the release rate.
void | setAttackTime (StkFloat time)
| Set the attack rate based on a time duration.
void | setDecayTime (StkFloat time)
| Set the decay rate based on a time duration.
void | setReleaseTime (StkFloat time)
| Set the release rate based on a time duration.
void | setAllTimes (StkFloat aTime, StkFloat dTime, StkFloat sLevel, StkFloat rTime)
| Set sustain level and attack, decay, and release time durations.
void | setTarget (StkFloat target)
| Set the target value.
int | getState (void) const
| Return the current envelope state (ATTACK, DECAY, SUSTAIN, RELEASE, DONE).
void | setValue (StkFloat value)
| Set to state = ADSR::SUSTAIN with current and target values of value.
StkFloat | lastOut (void) const
| Return the last computed output value.
StkFloat | tick (void)
| Compute and return one output sample.
StkFrames & | tick (StkFrames &frames, unsigned int channel=0)
| Fill a channel of the StkFrames object with computed outputs.

## Detailed Description

STK ADSR envelope class.

This class implements a traditional ADSR (Attack, Decay, Sustain, Release) envelope. It responds to simple keyOn and keyOff messages, keeping track of its state. The state = ADSR::DONE after the envelope value reaches 0.0 in the ADSR::RELEASE state.

by Perry R. Cook and Gary P. Scavone, 1995 - 2010.

## Member Enumeration Documentation

anonymous enum

ADSR envelope states.

Enumerator:

  ATTACK | Attack
  DECAY | Decay
  SUSTAIN | Sustain
  RELEASE | Release
  DONE | End of release

## Member Function Documentation

StkFrames & stk::ADSR::tick | ( | StkFrames & | frames,
|  | unsigned int | channel = `0` |
| ) |  |  | `[inline, virtual]`

Fill a channel of the StkFrames object with computed outputs.

The `channel` argument must be less than the number of channels in the StkFrames argument (the first channel is specified by 0). However, range checking is only performed if _STK_DEBUG_ is defined during compilation, in which case an out-of-range value will trigger an StkError exception.

Implements stk::Generator.

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

- ADSR.h

The Synthesis ToolKit in C++ (STK)
©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.