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.

Envelope.h 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. namespace zyncarla {
  16. /**Implementation of a general Envelope*/
  17. class Envelope
  18. {
  19. public:
  20. /**Constructor*/
  21. Envelope(class EnvelopeParams &pars, float basefreq, float dt, WatchManager *m=0,
  22. const char *watch_prefix=0);
  23. /**Destructor*/
  24. ~Envelope(void);
  25. void releasekey(void);
  26. /**Push Envelope to finishing state*/
  27. void forceFinish(void);
  28. float envout(bool doWatch=true);
  29. float envout_dB(void);
  30. /**Determines the status of the Envelope
  31. * @return returns 1 if the envelope is finished*/
  32. bool finished(void) const;
  33. private:
  34. int envpoints;
  35. int envsustain; //"-1" means disabled
  36. float envdt[MAX_ENVELOPE_POINTS]; //millisecons
  37. float envval[MAX_ENVELOPE_POINTS]; // [0.0f .. 1.0f]
  38. float envstretch;
  39. int linearenvelope;
  40. int currentpoint; //current envelope point (starts from 1)
  41. bool forcedrelease;
  42. bool keyreleased; //if the key was released
  43. bool envfinish;
  44. float t; // the time from the last point
  45. float inct; // the time increment
  46. float envoutval; //used to do the forced release
  47. VecWatchPoint watchOut;
  48. };
  49. }
  50. #endif