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.

208 lines
5.1KB

  1. #include "rack.hpp"
  2. using namespace rack;
  3. extern Plugin *plugin;
  4. ////////////////////
  5. // module widgets
  6. ////////////////////
  7. extern Model *modelSineOsc;
  8. extern Model *modelSawOsc;
  9. extern Model *modelADSR;
  10. extern Model *modelVCA;
  11. extern Model *modelQuadVCA;
  12. extern Model *modelTriLFO;
  13. extern Model *modelBPMClock;
  14. extern Model *modelSEQ16;
  15. extern Model *modelMixer8ch;
  16. extern Model *modelMonoVUmeter;
  17. extern Model *modelStereoVUmeter;
  18. extern Model *modelMultiple2_5;
  19. extern Model *modelMerge2_5;
  20. extern Model *modelSteps;
  21. extern Model *modelTriggersMKI;
  22. extern Model *modelTriggersMKII;
  23. extern Model *modelLaunchGate;
  24. extern Model *modelKillGate;
  25. extern Model *modelFlow;
  26. extern Model *modelSignalDelay;
  27. extern Model *modelDelayPlusFx;
  28. extern Model *modelPhaserFx;
  29. extern Model *modelReverbFx;
  30. extern Model *modelSuperDriveFx;
  31. extern Model *modelTremoloFx;
  32. extern Model *modelWaveShaper;
  33. extern Model *modelBlankPanel4;
  34. extern Model *modelBlankPanel6;
  35. extern Model *modelBlankPanel8;
  36. //////////////////////////////////////
  37. //MODULE COMPONENTS
  38. /////////////////////////////////////
  39. struct as_HexScrew : SVGScrew {
  40. as_HexScrew() {
  41. sw->svg = SVG::load(assetPlugin(plugin, "res/as-hexscrew.svg"));
  42. sw->wrap();
  43. box.size = sw->box.size;
  44. }
  45. };
  46. struct as_Knob : SVGKnob {
  47. as_Knob() {
  48. minAngle = -0.83 * M_PI;
  49. maxAngle = 0.83 * M_PI;
  50. sw->svg = SVG::load(assetPlugin(plugin, "res/as-knob.svg"));
  51. sw->wrap();
  52. box.size = sw->box.size;
  53. }
  54. };
  55. struct as_KnobBlack : SVGKnob {
  56. as_KnobBlack() {
  57. minAngle = -0.83 * M_PI;
  58. maxAngle = 0.83 * M_PI;
  59. sw->svg = SVG::load(assetPlugin(plugin, "res/as-knobBlack.svg"));
  60. sw->wrap();
  61. box.size = sw->box.size;
  62. }
  63. };
  64. struct as_FxKnobWhite : SVGKnob {
  65. as_FxKnobWhite() {
  66. minAngle = -0.83 * M_PI;
  67. maxAngle = 0.83 * M_PI;
  68. sw->svg = SVG::load(assetPlugin(plugin, "res/as-FxKnobWhite.svg"));
  69. sw->wrap();
  70. box.size = sw->box.size;
  71. }
  72. };
  73. struct as_FxKnobBlack : SVGKnob {
  74. as_FxKnobBlack() {
  75. minAngle = -0.83 * M_PI;
  76. maxAngle = 0.83 * M_PI;
  77. sw->svg = SVG::load(assetPlugin(plugin, "res/as-FxKnobBlack.svg"));
  78. sw->wrap();
  79. box.size = sw->box.size;
  80. }
  81. };
  82. struct BigLEDBezel : SVGSwitch, MomentarySwitch {
  83. BigLEDBezel() {
  84. addFrame(SVG::load(assetPlugin(plugin, "res/as_bigLEDBezel.svg")));
  85. }
  86. };
  87. struct as_CKSS : SVGSwitch, ToggleSwitch {
  88. as_CKSS() {
  89. addFrame(SVG::load(assetPlugin(plugin,"res/as_CKSS_0.svg")));
  90. addFrame(SVG::load(assetPlugin(plugin,"res/as_CKSS_1.svg")));
  91. }
  92. };
  93. struct as_CKSSH : SVGSwitch, ToggleSwitch {
  94. as_CKSSH() {
  95. addFrame(SVG::load(assetPlugin(plugin, "res/as_CKSSH_0.svg")));
  96. addFrame(SVG::load(assetPlugin(plugin, "res/as_CKSSH_1.svg")));
  97. sw->wrap();
  98. box.size = sw->box.size;
  99. }
  100. };
  101. struct as_CKSSThree : SVGSwitch, ToggleSwitch {
  102. as_CKSSThree() {
  103. addFrame(SVG::load(assetPlugin(plugin,"res/as_CKSSThree_2.svg")));
  104. addFrame(SVG::load(assetPlugin(plugin,"res/as_CKSSThree_1.svg")));
  105. addFrame(SVG::load(assetPlugin(plugin,"res/as_CKSSThree_0.svg")));
  106. }
  107. };
  108. struct as_MuteBtn : SVGSwitch, ToggleSwitch {
  109. as_MuteBtn() {
  110. addFrame(SVG::load(assetPlugin(plugin,"res/as_mute-off.svg")));
  111. addFrame(SVG::load(assetPlugin(plugin,"res/as_mute-on.svg")));
  112. }
  113. };
  114. struct as_SoloBtn : SVGSwitch, ToggleSwitch {
  115. as_SoloBtn() {
  116. addFrame(SVG::load(assetPlugin(plugin,"res/as_solo-off.svg")));
  117. addFrame(SVG::load(assetPlugin(plugin,"res/as_solo-on.svg")));
  118. }
  119. };
  120. template <typename BASE>
  121. struct GiantLight : BASE {
  122. GiantLight() {
  123. this->box.size = mm2px(Vec(18.0, 18.0));
  124. }
  125. };
  126. template <typename BASE>
  127. struct MeterLight : BASE {
  128. MeterLight() {
  129. this->box.size = Vec(8, 8);
  130. }
  131. };
  132. struct OrangeLight : GrayModuleLightWidget {
  133. OrangeLight() {
  134. addBaseColor(COLOR_ORANGE);
  135. }
  136. };
  137. template <typename BASE>
  138. struct LedLight : BASE {
  139. LedLight() {
  140. //this->box.size = Vec(20.0, 20.0);
  141. this->box.size = mm2px(Vec(6.0, 6.0));
  142. }
  143. };
  144. /** Reads two adjacent lightIds, so `lightId` and `lightId + 1` must be defined */
  145. struct YellowRedLight : GrayModuleLightWidget {
  146. YellowRedLight() {
  147. addBaseColor(COLOR_YELLOW);
  148. addBaseColor(COLOR_RED);
  149. }
  150. };
  151. struct as_PJ301MPort : SVGPort {
  152. as_PJ301MPort() {
  153. background->svg = SVG::load(assetPlugin(plugin,"res/as-PJ301M.svg"));
  154. background->wrap();
  155. box.size = background->box.size;
  156. }
  157. };
  158. struct as_SlidePot : SVGFader {
  159. as_SlidePot() {
  160. Vec margin = Vec(4, 4);
  161. maxHandlePos = Vec(-1.5, -8).plus(margin);
  162. minHandlePos = Vec(-1.5, 87).plus(margin);
  163. background->svg = SVG::load(assetPlugin(plugin,"res/as-SlidePot.svg"));
  164. background->wrap();
  165. background->box.pos = margin;
  166. box.size = background->box.size.plus(margin.mult(2));
  167. handle->svg = SVG::load(assetPlugin(plugin,"res/as-SlidePotHandle.svg"));
  168. handle->wrap();
  169. }
  170. };
  171. struct as_FaderPot : SVGFader {
  172. as_FaderPot() {
  173. Vec margin = Vec(4, 4);
  174. maxHandlePos = Vec(-1.5, -8).plus(margin);
  175. minHandlePos = Vec(-1.5, 57).plus(margin);
  176. background->svg = SVG::load(assetPlugin(plugin,"res/as-FaderPot.svg"));
  177. background->wrap();
  178. background->box.pos = margin;
  179. box.size = background->box.size.plus(margin.mult(2));
  180. handle->svg = SVG::load(assetPlugin(plugin,"res/as-SlidePotHandle.svg"));
  181. handle->wrap();
  182. }
  183. };