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.

189 lines
4.0KB

  1. #include "rack.hpp"
  2. using namespace rack;
  3. RACK_PLUGIN_DECLARE(PvC);
  4. #ifdef USE_VST2
  5. #define plugin "PvC"
  6. #endif // USE_VST2
  7. //////////////////////////////////////////////////////////////////////////////
  8. namespace rack_plugin_PvC {
  9. struct OutPortBin : SVGPort {
  10. OutPortBin() {
  11. background->svg = SVG::load(assetPlugin(plugin, "res/components/OutPortBin.svg"));
  12. background->wrap();
  13. box.size = background->box.size;
  14. }
  15. };
  16. struct OutPortVal : SVGPort {
  17. OutPortVal() {
  18. background->svg = SVG::load(assetPlugin(plugin, "res/components/OutPortVal.svg"));
  19. background->wrap();
  20. box.size = background->box.size;
  21. }
  22. };
  23. struct InPortBin : SVGPort {
  24. InPortBin() {
  25. background->svg = SVG::load(assetPlugin(plugin, "res/components/InPortBin.svg"));
  26. background->wrap();
  27. box.size = background->box.size;
  28. }
  29. };
  30. struct InPortAud : SVGPort {
  31. InPortAud() {
  32. background->svg = SVG::load(assetPlugin(plugin, "res/components/InPortAud.svg"));
  33. background->wrap();
  34. box.size = background->box.size;
  35. }
  36. };
  37. struct InPortCtrl : SVGPort {
  38. InPortCtrl() {
  39. background->svg = SVG::load(assetPlugin(plugin, "res/components/InPortCtrl.svg"));
  40. background->wrap();
  41. box.size = background->box.size;
  42. }
  43. };
  44. /// knobs & buttons
  45. struct PvCKnob : RoundKnob {
  46. PvCKnob() {
  47. setSVG(SVG::load(assetPlugin(plugin, "res/components/PvCKnob.svg")));
  48. box.size = Vec(22,22);
  49. }
  50. };
  51. struct PvCLEDKnob : PvCKnob {
  52. PvCLEDKnob() {
  53. setSVG(SVG::load(assetPlugin(plugin, "res/components/PvCKnobT.svg")));
  54. }
  55. };
  56. struct PvCSnapKnob : PvCKnob {
  57. PvCSnapKnob() {
  58. snap = true;
  59. }
  60. };
  61. struct LabelButtonL : SVGSwitch, MomentarySwitch {
  62. LabelButtonL() {
  63. addFrame(SVG::load(assetPlugin(plugin, "res/components/LabelButtonL_0.svg")));
  64. addFrame(SVG::load(assetPlugin(plugin, "res/components/LabelButtonL_1.svg")));
  65. box.size = Vec(36,12);
  66. }
  67. };
  68. struct LabelButtonS : SVGSwitch, MomentarySwitch {
  69. LabelButtonS() {
  70. addFrame(SVG::load(assetPlugin(plugin, "res/components/LabelButtonS_0.svg")));
  71. addFrame(SVG::load(assetPlugin(plugin, "res/components/LabelButtonS_1.svg")));
  72. box.size = Vec(24,12);
  73. }
  74. };
  75. /// lights
  76. struct PvCLight : GrayModuleLightWidget{
  77. PvCLight() { bgColor = nvgRGB(0x00, 0x00, 0x00); }
  78. };
  79. struct RedLED : PvCLight {
  80. RedLED() {
  81. addBaseColor(COLOR_RED); }
  82. };
  83. struct GreenLED : PvCLight {
  84. GreenLED() {
  85. addBaseColor(COLOR_GREEN); }
  86. };
  87. struct BlueLED : PvCLight {
  88. BlueLED() {
  89. addBaseColor(COLOR_BLUE); }
  90. };
  91. struct WhiteLED : PvCLight {
  92. WhiteLED() {
  93. addBaseColor(COLOR_WHITE); }
  94. };
  95. struct OrangeLED : PvCLight {
  96. OrangeLED() {
  97. addBaseColor(COLOR_ORANGE); }
  98. };
  99. struct YellowLED : PvCLight {
  100. YellowLED() {
  101. addBaseColor(COLOR_YELLOW); }
  102. };
  103. struct PurpleLED : PvCLight {
  104. PurpleLED() {
  105. addBaseColor(COLOR_PURPLE); }
  106. };
  107. struct CyanLED : PvCLight {
  108. CyanLED() {
  109. addBaseColor(COLOR_CYAN); }
  110. };
  111. struct GreenRedLED : PvCLight {
  112. GreenRedLED() {
  113. addBaseColor(COLOR_GREEN);
  114. addBaseColor(COLOR_RED); }
  115. };
  116. struct WhiteRedLED : PvCLight {
  117. WhiteRedLED() {
  118. addBaseColor(COLOR_WHITE);
  119. addBaseColor(COLOR_RED);
  120. }
  121. };
  122. template <typename BASE>
  123. struct PvCBigLED : BASE {
  124. PvCBigLED() {
  125. this->box.size = Vec(22, 22);
  126. }
  127. };
  128. template <typename BASE>
  129. struct FourPixLight : BASE {
  130. FourPixLight() {
  131. this->box.size = Vec(4, 4);
  132. }
  133. };
  134. template <typename BASE>
  135. struct EightPixLight : BASE {
  136. EightPixLight() {
  137. this->box.size = Vec(8, 8);
  138. }
  139. };
  140. /// screws
  141. struct ScrewHead1 : SVGScrew {
  142. ScrewHead1() {
  143. sw->svg = SVG::load(assetPlugin(plugin, "res/components/ScrewHead1.svg"));
  144. sw->wrap();
  145. box.size = sw->box.size;
  146. }
  147. };
  148. struct ScrewHead2 : SVGScrew {
  149. ScrewHead2() {
  150. sw->svg = SVG::load(assetPlugin(plugin, "res/components/ScrewHead2.svg"));
  151. sw->wrap();
  152. box.size = sw->box.size;
  153. }
  154. };
  155. struct ScrewHead3 : SVGScrew {
  156. ScrewHead3() {
  157. sw->svg = SVG::load(assetPlugin(plugin, "res/components/ScrewHead3.svg"));
  158. sw->wrap();
  159. box.size = sw->box.size;
  160. }
  161. };
  162. struct ScrewHead4 : SVGScrew {
  163. ScrewHead4() {
  164. sw->svg = SVG::load(assetPlugin(plugin, "res/components/ScrewHead4.svg"));
  165. sw->wrap();
  166. box.size = sw->box.size;
  167. }
  168. };
  169. } // namespace rack_plugin_PvC
  170. using namespace rack_plugin_PvC;