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.

63 lines
1.9KB

  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 modify
  7. it under the terms of version 2 of the GNU General Public License
  8. as published by the Free Software Foundation.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License (version 2 or later) for more details.
  13. You should have received a copy of the GNU General Public License (version 2)
  14. along with this program; if not, write to the Free Software Foundation,
  15. Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  16. */
  17. #ifndef ENVELOPE_H
  18. #define ENVELOPE_H
  19. #include "../globals.h"
  20. #include "../Params/EnvelopeParams.h"
  21. /**Implementation of a general Envelope*/
  22. class Envelope
  23. {
  24. public:
  25. /**Constructor*/
  26. Envelope(class EnvelopeParams *envpars, float basefreq);
  27. /**Destructor*/
  28. ~Envelope();
  29. void relasekey();
  30. float envout();
  31. float envout_dB();
  32. /**Determines the status of the Envelope
  33. * @return returns 1 if the envelope is finished*/
  34. bool finished() const;
  35. private:
  36. int envpoints;
  37. int envsustain; //"-1" means disabled
  38. float envdt[MAX_ENVELOPE_POINTS]; //millisecons
  39. float envval[MAX_ENVELOPE_POINTS]; // [0.0f .. 1.0f]
  40. float envstretch;
  41. int linearenvelope;
  42. int currentpoint; //current envelope point (starts from 1)
  43. int forcedrelase;
  44. bool keyreleased; //if the key was released
  45. bool envfinish;
  46. float t; // the time from the last point
  47. float inct; // the time increment
  48. float envoutval; //used to do the forced release
  49. };
  50. #endif