home *** CD-ROM | disk | FTP | other *** search
/ PC Musician 2000 / PC_Musician_2000.iso / PCMUSIC / NOTATION / SILENCE / ADSR.H next >
Encoding:
C/C++ Source or Header  |  1996-07-09  |  1.3 KB  |  47 lines

  1. /*******************************************/
  2. /*  ADSR Subclass of the Envelope Class,   */
  3. /*  by Perry R. Cook, 1995-96              */ 
  4. /*  This is the traditional ADSR (Attack   */
  5. /*  Decay, Sustain, Release) envelope.     */
  6. /*  It responds to simple KeyOn and KeyOff */
  7. /*  messages, keeping track of it's state. */         
  8. /*  There are two tick (update value)      */
  9. /*  methods, one returns the value, and    */
  10. /*  other returns the state (0 = A, 1 = D, */
  11. /*  2 = S, 3 = R)                          */
  12. /*******************************************/
  13.  
  14. #if !defined(__ADSR_h)
  15. #define __ADSR_h
  16.  
  17. #include "Envelope.h"
  18.  
  19. class ADSR : public Envelope
  20. {
  21.   protected:  
  22.     MY_FLOAT attackRate;
  23.     MY_FLOAT decayRate;
  24.     MY_FLOAT sustainLevel;
  25.     MY_FLOAT releaseRate;
  26.   public:
  27.     ADSR();
  28.     ~ADSR();
  29.     void keyOn();
  30.     void keyOff();
  31.     void setAttackRate(MY_FLOAT aRate);
  32.     void setDecayRate(MY_FLOAT aRate);
  33.     void setSustainLevel(MY_FLOAT aLevel);
  34.     void setReleaseRate(MY_FLOAT aRate);
  35.     void setAttackTime(MY_FLOAT aTime);
  36.     void setDecayTime(MY_FLOAT aTime);
  37.     void setReleaseTime(MY_FLOAT aTime);
  38.     void setAllTimes(MY_FLOAT attTime, MY_FLOAT decTime, MY_FLOAT susLevel, MY_FLOAT relTime);
  39.     void setTarget(MY_FLOAT aTarget);
  40.     void setValue(MY_FLOAT aValue);
  41.     MY_FLOAT tick();
  42.     int informTick();  
  43.     MY_FLOAT lastOut();
  44. };
  45.  
  46. #endif
  47.