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.

56 lines
847B

  1. #pragma once
  2. #include "bogaudio.hpp"
  3. #include "dsp/envelope.hpp"
  4. extern Model* modelADSR;
  5. namespace bogaudio {
  6. struct ADSR : Module {
  7. enum ParamsIds {
  8. ATTACK_PARAM,
  9. DECAY_PARAM,
  10. SUSTAIN_PARAM,
  11. RELEASE_PARAM,
  12. LINEAR_PARAM,
  13. NUM_PARAMS
  14. };
  15. enum InputsIds {
  16. GATE_INPUT,
  17. NUM_INPUTS
  18. };
  19. enum OutputsIds {
  20. OUT_OUTPUT,
  21. NUM_OUTPUTS
  22. };
  23. enum LightsIds {
  24. ATTACK_LIGHT,
  25. DECAY_LIGHT,
  26. SUSTAIN_LIGHT,
  27. RELEASE_LIGHT,
  28. LINEAR_LIGHT,
  29. NUM_LIGHTS
  30. };
  31. const int modulationSteps = 100;
  32. int _modulationStep = 0;
  33. bool _linearMode = false;
  34. SchmittTrigger _gateTrigger;
  35. bogaudio::dsp::ADSR _envelope;
  36. ADSR() : Module(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS) {
  37. onReset();
  38. onSampleRateChange();
  39. }
  40. void onReset() override;
  41. void onSampleRateChange() override;
  42. void step() override;
  43. };
  44. } // namespace bogaudio