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.

70 lines
1.7KB

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