Home   Information   Classes   Download   Usage   Mail List   Requirements   Links   FAQ   Tutorial


ADSR.h

00001 /***************************************************/
00016 /***************************************************/
00017 
00018 #ifndef STK_ADSR_H
00019 #define STK_ADSR_H
00020 
00021 #include "Envelope.h"
00022 
00023 class ADSR : public Envelope
00024 {
00025  public:
00026 
00028   enum { ATTACK, DECAY, SUSTAIN, RELEASE, DONE };
00029 
00031   ADSR(void);
00032 
00034   ~ADSR(void);
00035 
00037   void keyOn(void);
00038 
00040   void keyOff(void);
00041 
00043   void setAttackRate(StkFloat rate);
00044 
00046   void setDecayRate(StkFloat rate);
00047 
00049   void setSustainLevel(StkFloat level);
00050 
00052   void setReleaseRate(StkFloat rate);
00053 
00055   void setAttackTime(StkFloat time);
00056 
00058   void setDecayTime(StkFloat time);
00059 
00061   void setReleaseTime(StkFloat time);
00062 
00064   void setAllTimes(StkFloat aTime, StkFloat dTime, StkFloat sLevel, StkFloat rTime);
00065 
00067   void setTarget(StkFloat target);
00068 
00070   int getState(void) const;
00071 
00073   void setValue(StkFloat value);
00074 
00075  protected:  
00076 
00077   StkFloat computeSample( void );
00078   void sampleRateChanged( StkFloat newRate, StkFloat oldRate );
00079 
00080   StkFloat attackRate_;
00081   StkFloat decayRate_;
00082   StkFloat sustainLevel_;
00083   StkFloat releaseRate_;
00084 };
00085 
00086 #endif

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