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.

30 lines
652B

  1. #include "turing-volts-module.hh"
  2. namespace rack_plugin_Skylights {
  3. void turing_volts_module::step() {
  4. uint16_t seq = (uint16_t)ceil((inputs[I_EXPANDER].value / 10.0) * 65535.0);
  5. double signal = 0;
  6. for (size_t i = 0;
  7. i < 5;
  8. i++)
  9. {
  10. double here = (((seq & (1 << i)) > 0.0) ? 1.0 : 0.0)
  11. * params[P_VOL1 + i].value;
  12. lights[L_LIGHT1 + i].value = fabs(here);
  13. signal += here;
  14. }
  15. outputs[O_VOLTAGE].value = signal * 2.0;
  16. }
  17. turing_volts_module::turing_volts_module() : Module(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS) {
  18. }
  19. turing_volts_module::~turing_volts_module() {
  20. }
  21. } // namespace rack_plugin_Skylights