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.

35 lines
717B

  1. #include "ClockDivider.hpp"
  2. namespace rack_plugin_SynthKit {
  3. ClockDividerModule::ClockDividerModule()
  4. : Module(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS) {
  5. clock = new SynthDevKit::Clock(8, 1.7f);
  6. cv = new SynthDevKit::CV(1.7f);
  7. }
  8. void ClockDividerModule::step() {
  9. float reset_in = inputs[RESET_INPUT].value;
  10. cv->update(reset_in);
  11. if (cv->newTrigger()) {
  12. clock->reset();
  13. }
  14. float in = inputs[TOP_INPUT].value;
  15. bool *states = clock->update(in);
  16. for (int i = 0; i < 8; i++) {
  17. if (states[i] == true) {
  18. outputs[i].value = in;
  19. lights[i].value = 1.0f;
  20. } else {
  21. outputs[i].value = 0;
  22. lights[i].value = 0;
  23. }
  24. }
  25. }
  26. } // namespace rack_plugin_SynthKit