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.

147 lines
2.9KB

  1. #include "rack.hpp"
  2. using namespace rack;
  3. RACK_PLUGIN_DECLARE(mental);
  4. #ifdef USE_VST2
  5. #define plugin "mental"
  6. #endif // USE_VST2
  7. namespace rack_plugin_mental {
  8. ////////////////////
  9. // module widgets
  10. ////////////////////
  11. /////////////////////////////////////////////
  12. // ports
  13. struct OutPort : SVGPort {
  14. OutPort() {
  15. background->svg = SVG::load(assetPlugin(plugin, "res/components/OutPort.svg"));
  16. background->wrap();
  17. box.size = background->box.size;
  18. }
  19. };
  20. struct InPort : SVGPort {
  21. InPort() {
  22. background->svg = SVG::load(assetPlugin(plugin, "res/components/InPort.svg"));
  23. background->wrap();
  24. box.size = background->box.size;
  25. }
  26. };
  27. struct CVInPort : SVGPort {
  28. CVInPort() {
  29. background->svg = SVG::load(assetPlugin(plugin, "res/components/CVInPort.svg"));
  30. background->wrap();
  31. box.size = background->box.size;
  32. }
  33. };
  34. struct CVOutPort : SVGPort {
  35. CVOutPort() {
  36. background->svg = SVG::load(assetPlugin(plugin, "res/components/CVOutPort.svg"));
  37. background->wrap();
  38. box.size = background->box.size;
  39. }
  40. };
  41. struct GateInPort : SVGPort {
  42. GateInPort() {
  43. background->svg = SVG::load(assetPlugin(plugin, "res/components/GateInPort.svg"));
  44. background->wrap();
  45. box.size = background->box.size;
  46. }
  47. };
  48. struct GateOutPort : SVGPort {
  49. GateOutPort() {
  50. background->svg = SVG::load(assetPlugin(plugin, "res/components/GateOutPort.svg"));
  51. background->wrap();
  52. box.size = background->box.size;
  53. }
  54. };
  55. // Knobs
  56. struct LrgKnob : RoundKnob {
  57. LrgKnob() {
  58. setSVG(SVG::load(assetPlugin(plugin, "res/components/LrgKnob.svg")));
  59. box.size = Vec(42,42);
  60. }
  61. };
  62. struct MedKnob : RoundKnob {
  63. MedKnob() {
  64. setSVG(SVG::load(assetPlugin(plugin, "res/components/MedKnob.svg")));
  65. box.size = Vec(24,24);
  66. }
  67. };
  68. struct SmlKnob : RoundKnob {
  69. SmlKnob() {
  70. setSVG(SVG::load(assetPlugin(plugin, "res/components/SmlKnob.svg")));
  71. box.size = Vec(20,20);
  72. }
  73. };
  74. // switches
  75. struct ThreeWaySwitch : SVGSwitch, ToggleSwitch {
  76. ThreeWaySwitch() {
  77. addFrame(SVG::load(assetPlugin(plugin,"res/components/Three_2.svg")));
  78. addFrame(SVG::load(assetPlugin(plugin,"res/components/Three_1.svg")));
  79. addFrame(SVG::load(assetPlugin(plugin,"res/components/Three_0.svg")));
  80. }
  81. };
  82. // lights
  83. /// lights
  84. struct MentalLight : GrayModuleLightWidget{
  85. MentalLight() { bgColor = nvgRGB(0x40, 0x40, 0x40); }
  86. };
  87. struct RedLED : MentalLight {
  88. RedLED() {
  89. addBaseColor(nvgRGB(0xff, 0x00, 0x00)); }
  90. };
  91. struct BlueLED : MentalLight {
  92. BlueLED() {
  93. addBaseColor(nvgRGB(0x00, 0x47, 0x7e)); }
  94. };
  95. struct OrangeLED : MentalLight {
  96. OrangeLED() {
  97. addBaseColor(COLOR_ORANGE); }
  98. };
  99. template <typename BASE>
  100. struct TinyLight : BASE {
  101. TinyLight() {
  102. this->box.size = Vec(4, 4);
  103. }
  104. };
  105. template <typename BASE>
  106. struct SmlLight : BASE {
  107. SmlLight() {
  108. this->box.size = Vec(8, 8);
  109. }
  110. };
  111. template <typename BASE>
  112. struct MedLight : BASE {
  113. MedLight() {
  114. this->box.size = Vec(10, 10);
  115. }
  116. };
  117. } // namespace rack_plugin_mental