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.

57 lines
936B

  1. #include "common.hpp"
  2. ////////////////////
  3. // module widgets
  4. ////////////////////
  5. using namespace rack;
  6. #define plugin "TheXOR"
  7. namespace rack_plugin_TheXOR {
  8. #define NUM_QUANTIZERS (6)
  9. struct Quantizer;
  10. struct QuantizerWidget : ModuleWidget
  11. {
  12. QuantizerWidget(Quantizer * module);
  13. private:
  14. float yncscape(float y, float height)
  15. {
  16. return RACK_GRID_HEIGHT - mm2px(y + height);
  17. }
  18. };
  19. struct Quantizer : Module
  20. {
  21. enum ParamIds
  22. {
  23. TRANSP_1,
  24. NUM_PARAMS = TRANSP_1 + NUM_QUANTIZERS
  25. };
  26. enum InputIds
  27. {
  28. IN_1,
  29. TRNSPIN_1 = IN_1 + NUM_QUANTIZERS,
  30. NUM_INPUTS = TRNSPIN_1 + NUM_QUANTIZERS
  31. };
  32. enum OutputIds
  33. {
  34. OUT_1,
  35. NUM_OUTPUTS = OUT_1 + NUM_QUANTIZERS
  36. };
  37. enum LightIds
  38. {
  39. NUM_LIGHTS
  40. };
  41. Quantizer() : Module(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS)
  42. {
  43. }
  44. void step() override;
  45. private:
  46. float quantize_out(Input &in, float transpose);
  47. float getQuantize(int n);
  48. };
  49. } // namespace rack_plugin_TheXOR