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.

60 lines
880B

  1. #pragma once
  2. #include "bogaudio.hpp"
  3. extern Model* modelDGate;
  4. namespace bogaudio {
  5. struct DGate : TriggerOnLoadModule {
  6. enum ParamsIds {
  7. DELAY_PARAM,
  8. GATE_PARAM,
  9. LOOP_PARAM,
  10. TRIGGER_PARAM,
  11. NUM_PARAMS
  12. };
  13. enum InputsIds {
  14. TRIGGER_INPUT,
  15. NUM_INPUTS
  16. };
  17. enum OutputsIds {
  18. GATE_OUTPUT,
  19. END_OUTPUT,
  20. NUM_OUTPUTS
  21. };
  22. enum LightsIds {
  23. DELAY_LIGHT,
  24. GATE_LIGHT,
  25. NUM_LIGHTS
  26. };
  27. enum Stage {
  28. STOPPED_STAGE,
  29. DELAY_STAGE,
  30. GATE_STAGE
  31. };
  32. bool _firstStep = true;
  33. Trigger _trigger;
  34. PulseGenerator _triggerOuptutPulseGen;
  35. Stage _stage;
  36. float _stageProgress;
  37. DGate() : TriggerOnLoadModule(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS) {
  38. onReset();
  39. }
  40. void onReset() override;
  41. void step() override;
  42. bool stepStage(Param& knob);
  43. bool shouldTriggerOnNextLoad() override {
  44. return _stage != STOPPED_STAGE;
  45. };
  46. };
  47. } // namespace bogaudio