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.

LFO.h 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. ZynAddSubFX - a software synthesizer
  3. LFO.h - LFO 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 LFO_H
  18. #define LFO_H
  19. #include "../globals.h"
  20. #include "../Misc/Time.h"
  21. /**Class for creating Low Frequency Oscillators*/
  22. class LFO
  23. {
  24. public:
  25. /**Constructor
  26. *
  27. * @param lfopars pointer to a LFOParams object
  28. * @param basefreq base frequency of LFO
  29. */
  30. LFO(const LFOParams &lfopars, float basefreq, const AbsTime &t);
  31. ~LFO();
  32. float lfoout();
  33. float amplfoout();
  34. private:
  35. float baseOut(const char waveShape, const float phase) const;
  36. //Phase of Oscillator
  37. float phase;
  38. //Phase Increment Per Frame
  39. float phaseInc;
  40. //Frequency Randomness
  41. float incrnd, nextincrnd;
  42. //Amplitude Randomness
  43. float amp1, amp2;
  44. //Intensity of the wave
  45. float lfointensity;
  46. //Amount Randomness
  47. float lfornd, lfofreqrnd;
  48. //Delay before starting
  49. RelTime delayTime;
  50. char waveShape;
  51. //If After initialization there are no calls to random number gen.
  52. bool deterministic;
  53. void computeNextFreqRnd(void);
  54. };
  55. #endif