b3ADSR.h 569 B

12345678910111213141516171819202122232425262728293031323334
  1. #ifndef B3_ADSR_H
  2. #define B3_ADSR_H
  3. class b3ADSR
  4. {
  5. int m_state;
  6. double m_value;
  7. double m_target;
  8. double m_attackRate;
  9. double m_decayRate;
  10. double m_releaseRate;
  11. double m_releaseTime;
  12. double m_sustainLevel;
  13. bool m_autoKeyOff;
  14. public:
  15. b3ADSR();
  16. virtual ~b3ADSR();
  17. double tick();
  18. bool isIdle() const;
  19. void keyOn(bool autoKeyOff);
  20. void keyOff();
  21. void setValues(double attack, double decay, double sustain, double release)
  22. {
  23. m_attackRate = attack;
  24. m_decayRate = decay;
  25. m_sustainLevel = sustain;
  26. m_releaseRate = release;
  27. }
  28. };
  29. #endif //B3_ADSR_H