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.

64 lines
1.0KB

  1. #pragma once
  2. #include "bogaudio.hpp"
  3. #include "dsp/signal.hpp"
  4. using namespace bogaudio::dsp;
  5. extern Model* modelLmtr;
  6. namespace bogaudio {
  7. struct Lmtr : Module {
  8. enum ParamsIds {
  9. THRESHOLD_PARAM,
  10. OUTPUT_GAIN_PARAM,
  11. KNEE_PARAM,
  12. NUM_PARAMS
  13. };
  14. enum InputsIds {
  15. LEFT_INPUT,
  16. RIGHT_INPUT,
  17. THRESHOLD_INPUT,
  18. OUTPUT_GAIN_INPUT,
  19. NUM_INPUTS
  20. };
  21. enum OutputsIds {
  22. LEFT_OUTPUT,
  23. RIGHT_OUTPUT,
  24. NUM_OUTPUTS
  25. };
  26. enum LightsIds {
  27. NUM_LIGHTS
  28. };
  29. const int modulationSteps = 100;
  30. int _modulationStep = 0;
  31. float _thresholdDb = 0.0f;
  32. float _outGain = -1.0f;
  33. float _outLevel = 0.0f;
  34. bool _softKnee = true;
  35. float _lastEnv = 0.0f;
  36. SlewLimiter _attackSL;
  37. SlewLimiter _releaseSL;
  38. RootMeanSquare _detector;
  39. Compressor _compressor;
  40. Amplifier _amplifier;
  41. Saturator _saturator;
  42. Lmtr() : Module(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS) {
  43. onReset();
  44. onSampleRateChange();
  45. }
  46. void onReset() override;
  47. void onSampleRateChange() override;
  48. void step() override;
  49. };
  50. } // namespace bogaudio