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.

89 lines
1.3KB

  1. #pragma once
  2. #include "bogaudio.hpp"
  3. #include "dsp/oscillator.hpp"
  4. #include "dsp/signal.hpp"
  5. using namespace bogaudio::dsp;
  6. extern Model* modelLLFO;
  7. namespace bogaudio {
  8. struct LLFO : Module {
  9. enum ParamsIds {
  10. FREQUENCY_PARAM,
  11. SLOW_PARAM,
  12. WAVE_PARAM,
  13. OFFSET_PARAM,
  14. SCALE_PARAM,
  15. NUM_PARAMS
  16. };
  17. enum InputsIds {
  18. PITCH_INPUT,
  19. RESET_INPUT,
  20. NUM_INPUTS
  21. };
  22. enum OutputsIds {
  23. OUT_OUTPUT,
  24. NUM_OUTPUTS
  25. };
  26. enum LightsIds {
  27. SLOW_LIGHT,
  28. SINE_LIGHT,
  29. RAMP_UP_LIGHT,
  30. SQUARE_LIGHT,
  31. TRIANGLE_LIGHT,
  32. RAMP_DOWN_LIGHT,
  33. PULSE_LIGHT,
  34. NUM_LIGHTS
  35. };
  36. enum Wave {
  37. SINE_WAVE,
  38. TRIANGLE_WAVE,
  39. RAMP_UP_WAVE,
  40. RAMP_DOWN_WAVE,
  41. SQUARE_WAVE,
  42. PULSE_WAVE
  43. };
  44. const int modulationSteps = 100;
  45. const float amplitude = 5.0f;
  46. int _modulationStep = 0;
  47. bool _slowMode = false;
  48. float _offset = 0.0f;
  49. float _scale = 0.0f;
  50. PositiveZeroCrossing _resetTrigger;
  51. Phasor _phasor;
  52. SineTableOscillator _sine;
  53. TriangleOscillator _triangle;
  54. SawOscillator _ramp;
  55. SquareOscillator _square;
  56. Wave _wave;
  57. bool _invert;
  58. Phasor* _oscillator;
  59. LLFO()
  60. : Module(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS)
  61. , _wave(SINE_WAVE)
  62. , _invert(false)
  63. , _oscillator(&_sine)
  64. {
  65. onReset();
  66. onSampleRateChange();
  67. }
  68. void onReset() override;
  69. void onSampleRateChange() override;
  70. void step() override;
  71. };
  72. } // namespace bogaudio