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
948B

  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_BOOL_OP (5) //not, and, or, (the) xor, implication
  9. struct Boole;
  10. struct BooleWidget : ModuleWidget
  11. {
  12. BooleWidget(Boole * module);
  13. private:
  14. float yncscape(float y, float height)
  15. {
  16. return RACK_GRID_HEIGHT - mm2px(y + height);
  17. }
  18. };
  19. struct Boole : Module
  20. {
  21. enum ParamIds
  22. {
  23. INVERT_1,
  24. THRESH_1 = INVERT_1 + NUM_BOOL_OP - 1,
  25. NUM_PARAMS = THRESH_1 + 2* NUM_BOOL_OP-1
  26. };
  27. enum InputIds
  28. {
  29. IN_1,
  30. NUM_INPUTS = IN_1 + 2 * NUM_BOOL_OP-1
  31. };
  32. enum OutputIds
  33. {
  34. OUT_1,
  35. NUM_OUTPUTS = OUT_1 + NUM_BOOL_OP
  36. };
  37. enum LightIds
  38. {
  39. LED_1,
  40. NUM_LIGHTS = LED_1 + 3* NUM_BOOL_OP-1
  41. };
  42. Boole() : Module(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS)
  43. {
  44. }
  45. void step() override;
  46. private:
  47. bool process(int num_op, int index);
  48. };
  49. } // namespace rack_plugin_TheXOR