Home   Information   Classes   Download   Usage   Mail List   Requirements   Tutorial


ADSR Class Reference

STK ADSR envelope class. More...

#include <ADSR.h>

Inheritance diagram for ADSR::

Envelope Stk List of all members.

Public Types

enum  {
  ATTACK, DECAY, SUSTAIN, RELEASE,
  DONE
}
 Envelope states.


Public Methods

 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 (MY_FLOAT aRate)
 Set the attack rate.

void setDecayRate (MY_FLOAT aRate)
 Set the decay rate.

void setSustainLevel (MY_FLOAT aLevel)
 Set the sustain level.

void setReleaseRate (MY_FLOAT aRate)
 Set the release rate.

void setAttackTime (MY_FLOAT aTime)
 Set the attack rate based on a time duration.

void setDecayTime (MY_FLOAT aTime)
 Set the decay rate based on a time duration.

void setReleaseTime (MY_FLOAT aTime)
 Set the release rate based on a time duration.

void setAllTimes (MY_FLOAT aTime, MY_FLOAT dTime, MY_FLOAT sLevel, MY_FLOAT rTime)
 Set sustain level and attack, decay, and release state rates based on time durations.

void setTarget (MY_FLOAT aTarget)
 Set the target value.

int getState (void) const
 Return the current envelope state (ATTACK, DECAY, SUSTAIN, RELEASE, DONE).

void setValue (MY_FLOAT aValue)
 Set to state = ADSR::SUSTAIN with current and target values of aValue.

MY_FLOAT tick (void)
 Return one envelope output value.

MY_FLOAT* tick (MY_FLOAT *vector, unsigned int vectorSize)
 Return vectorSize envelope outputs in vector.


Detailed Description

STK ADSR envelope class.

This Envelope subclass 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 - 2002.


The documentation for this class was generated from the following file:
The Synthesis ToolKit in C++ (STK)
©1995-2002 Perry R. Cook and Gary P. Scavone. All Rights Reserved.