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.

187 lines
2.9KB

  1. #include "rack.hpp"
  2. #pragma once
  3. using namespace rack;
  4. RACK_PLUGIN_DECLARE(ML_modules);
  5. #ifdef USE_VST2
  6. #define plugin "ML_modules"
  7. #endif // USE_VST2
  8. struct MLSVGSwitch : virtual ParamWidget, FramebufferWidget {
  9. CircularShadow *shadow;
  10. std::vector<std::shared_ptr<SVG>> frames;
  11. SVGWidget *sw;
  12. MLSVGSwitch();
  13. /** Adds an SVG file to represent the next switch position */
  14. void addFrame(std::shared_ptr<SVG> svg);
  15. void onChange(EventChange &e) override;
  16. };
  17. template <typename BASE>
  18. struct MLLargeLight : BASE {
  19. MLLargeLight() {
  20. this->box.size = Vec(16.0, 16.0);
  21. }
  22. };
  23. template <typename BASE>
  24. struct MLMediumLight : BASE {
  25. MLMediumLight() {
  26. this->box.size = Vec(12.0, 12.0);
  27. }
  28. };
  29. template <typename BASE>
  30. struct MLSmallLight : BASE {
  31. MLSmallLight() {
  32. this->box.size = Vec(8.0, 8.0);
  33. }
  34. };
  35. struct WhiteLight : ModuleLightWidget {
  36. WhiteLight();
  37. };
  38. struct BlueMLKnob : RoundKnob {
  39. BlueMLKnob();
  40. };
  41. struct SmallBlueMLKnob : RoundKnob {
  42. SmallBlueMLKnob();
  43. };
  44. struct BlueSnapMLKnob : RoundKnob {
  45. BlueSnapMLKnob();
  46. };
  47. struct SmallBlueSnapMLKnob : RoundKnob {
  48. SmallBlueSnapMLKnob();
  49. };
  50. struct RedMLKnob : RoundKnob {
  51. RedMLKnob();
  52. };
  53. struct SmallRedMLKnob : RoundKnob {
  54. SmallRedMLKnob();
  55. };
  56. struct RedSnapMLKnob : RoundKnob {
  57. RedSnapMLKnob();
  58. };
  59. struct SmallRedSnapMLKnob : RoundKnob {
  60. SmallRedSnapMLKnob();
  61. };
  62. struct GreyMLKnob : RoundKnob {
  63. GreyMLKnob();
  64. };
  65. struct SmallGreyMLKnob : RoundKnob {
  66. SmallGreyMLKnob();
  67. };
  68. struct GreySnapMLKnob : RoundKnob {
  69. GreySnapMLKnob();
  70. };
  71. struct SmallGreySnapMLKnob : RoundKnob {
  72. SmallGreySnapMLKnob();
  73. };
  74. struct MLPort : SVGPort {
  75. MLPort();
  76. };
  77. struct MLButton : MLSVGSwitch, MomentarySwitch {
  78. MLButton();
  79. };
  80. struct MLSmallButton : MLSVGSwitch, MomentarySwitch {
  81. MLSmallButton();
  82. };
  83. struct ML_ResetButton : MLSVGSwitch, MomentarySwitch {
  84. ML_ResetButton();
  85. };
  86. struct ML_LEDButton : MLSVGSwitch, MomentarySwitch {
  87. ML_LEDButton();
  88. };
  89. struct ML_MediumLEDButton : MLSVGSwitch, MomentarySwitch {
  90. ML_MediumLEDButton();
  91. };
  92. struct ML_SmallLEDButton : MLSVGSwitch, MomentarySwitch {
  93. ML_SmallLEDButton();
  94. };
  95. struct MLSwitch : MLSVGSwitch, ToggleSwitch {
  96. MLSwitch();
  97. };
  98. struct MLSwitch2 : MLSVGSwitch, ToggleSwitch {
  99. MLSwitch2();
  100. };
  101. struct BlueMLSwitch : MLSVGSwitch, ToggleSwitch {
  102. BlueMLSwitch();
  103. };
  104. struct MLScrew : FramebufferWidget {
  105. SVGWidget *sw;
  106. TransformWidget *tw;
  107. MLScrew() {
  108. tw = new TransformWidget();
  109. addChild(tw);
  110. sw = new SVGWidget();
  111. tw->addChild(sw);
  112. sw->setSVG(SVG::load(assetPlugin(plugin, "res/MLScrew.svg")));
  113. tw->box.size = sw->box.size;
  114. float angle = 1.71f * (rand() / (static_cast<double>(RAND_MAX) + 1.0));
  115. Vec transl = tw->box.getCenter();
  116. tw->translate( transl );
  117. tw->rotate(angle);
  118. tw->translate( transl.neg() );
  119. }
  120. };