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.

62 lines
928B

  1. #pragma once
  2. #include "bogaudio.hpp"
  3. #include "dsp/signal.hpp"
  4. using namespace bogaudio::dsp;
  5. extern Model* modelFlipFlop;
  6. namespace bogaudio {
  7. struct FlipFlop : Module {
  8. enum ParamsIds {
  9. NUM_PARAMS
  10. };
  11. enum InputsIds {
  12. IN1_INPUT,
  13. RESET1_INPUT,
  14. IN2_INPUT,
  15. RESET2_INPUT,
  16. NUM_INPUTS
  17. };
  18. enum OutputsIds {
  19. A1_OUTPUT,
  20. B1_OUTPUT,
  21. A2_OUTPUT,
  22. B2_OUTPUT,
  23. NUM_OUTPUTS
  24. };
  25. enum LightsIds {
  26. NUM_LIGHTS
  27. };
  28. bool _flipped1;
  29. bool _flipped2;
  30. PositiveZeroCrossing _trigger1;
  31. Trigger _resetTrigger1;
  32. PositiveZeroCrossing _trigger2;
  33. Trigger _resetTrigger2;
  34. FlipFlop() : Module(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS) {
  35. onReset();
  36. }
  37. void onReset() override;
  38. void step() override;
  39. void channelStep(
  40. Input& triggerInput,
  41. Input& resetInput,
  42. Output& aOutput,
  43. Output& bOutput,
  44. PositiveZeroCrossing& trigger,
  45. Trigger& resetTrigger,
  46. bool& flipped
  47. );
  48. };
  49. } // namespace bogaudio