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.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. #include "WatchPoint.h"
  16. namespace zyncarla {
  17. /**Class for creating Low Frequency Oscillators*/
  18. class LFO
  19. {
  20. public:
  21. /**Constructor
  22. *
  23. * @param lfopars pointer to a LFOParams object
  24. * @param basefreq base frequency of LFO
  25. */
  26. LFO(const LFOParams &lfopars, float basefreq, const AbsTime &t, WatchManager *m=0,
  27. const char *watch_prefix=0);
  28. ~LFO();
  29. float lfoout();
  30. float amplfoout();
  31. private:
  32. float baseOut(const char waveShape, const float phase);
  33. //Phase of Oscillator
  34. float phase;
  35. //Phase Increment Per Frame
  36. float phaseInc;
  37. //Frequency Randomness
  38. float incrnd, nextincrnd;
  39. //Amplitude Randomness
  40. float amp1, amp2;
  41. // RND mode
  42. int first_half;
  43. float last_random;
  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. const float dt_;
  54. const LFOParams &lfopars_;
  55. const float basefreq_;
  56. VecWatchPoint watchOut;
  57. void computeNextFreqRnd(void);
  58. };
  59. }
  60. #endif