Home   Information   Classes   Download   Usage   Mail List   Requirements   Links   Tutorial


ADSR Class Reference

#include <ADSR.h>

Inheritance diagram for ADSR:

Envelope Generator Stk List of all members.

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 - 2004.

Definition at line 23 of file ADSR.h.

Public Types

enum  
 Envelope states.


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 attach, 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 aValue.

StkFloat tick (void)
 Return one envelope output value.

StkFloat * tick (StkFloat *vector, unsigned int vectorSize)
 Compute vectorSize outputs and return them in vector.

StkFramestick (StkFrames &frames, unsigned int channel=1)
 Fill a channel of the StkFrames object with computed outputs.


Member Function Documentation

StkFrames& ADSR::tick StkFrames frames,
unsigned int  channel = 1
[virtual]
 

Fill a channel of the StkFrames object with computed outputs.

The channel argument should be one or greater (the first channel is specified by 1). An StkError will be thrown if the channel argument is zero or it is greater than the number of channels in the StkFrames object.

Reimplemented from Envelope.


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