Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.7KB

  1. /*
  2. ZynAddSubFX - a software synthesizer
  3. Envelope.h - Envelope implementation
  4. Copyright (C) 2002-2005 Nasca Octavian Paul
  5. Author: Nasca Octavian Paul
  6. This program is free software; you can redistribute it and/or
  7. modify it under the terms of the GNU General Public License
  8. as published by the Free Software Foundation; either version 2
  9. of the License, or (at your option) any later version.
  10. */
  11. #ifndef ENVELOPE_H
  12. #define ENVELOPE_H
  13. #include "../globals.h"
  14. #include "WatchPoint.h"
  15. /**Implementation of a general Envelope*/
  16. class Envelope
  17. {
  18. public:
  19. /**Constructor*/
  20. Envelope(class EnvelopeParams &pars, float basefreq, float dt, WatchManager *m=0,
  21. const char *watch_prefix=0);
  22. /**Destructor*/
  23. ~Envelope(void);
  24. void releasekey(void);
  25. /**Push Envelope to finishing state*/
  26. void forceFinish(void);
  27. float envout(bool doWatch=true);
  28. float envout_dB(void);
  29. /**Determines the status of the Envelope
  30. * @return returns 1 if the envelope is finished*/
  31. bool finished(void) const;
  32. private:
  33. int envpoints;
  34. int envsustain; //"-1" means disabled
  35. float envdt[MAX_ENVELOPE_POINTS]; //millisecons
  36. float envval[MAX_ENVELOPE_POINTS]; // [0.0f .. 1.0f]
  37. float envstretch;
  38. int linearenvelope;
  39. int currentpoint; //current envelope point (starts from 1)
  40. bool forcedrelease;
  41. bool keyreleased; //if the key was released
  42. bool envfinish;
  43. float t; // the time from the last point
  44. float inct; // the time increment
  45. float envoutval; //used to do the forced release
  46. VecWatchPoint watchOut;
  47. };
  48. #endif