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.

200 lines
4.7KB

  1. #include "rack.hpp"
  2. #pragma once
  3. using namespace rack;
  4. namespace rack_plugin_AS {
  5. }
  6. RACK_PLUGIN_DECLARE(AS);
  7. #ifdef USE_VST2
  8. #define plugin "AS"
  9. #endif // USE_VST2
  10. //////////////////////////////////////
  11. //MODULE COMPONENTS
  12. /////////////////////////////////////
  13. struct as_HexScrew : SVGScrew {
  14. as_HexScrew() {
  15. sw->svg = SVG::load(assetPlugin(plugin, "res/as-hexscrew.svg"));
  16. sw->wrap();
  17. box.size = sw->box.size;
  18. }
  19. };
  20. struct as_Knob : SVGKnob {
  21. as_Knob() {
  22. minAngle = float(-0.83 * M_PI);
  23. maxAngle = float(0.83 * M_PI);
  24. setSVG( SVG::load(assetPlugin(plugin, "res/as-knob.svg")) );
  25. }
  26. };
  27. struct as_KnobBlack : SVGKnob {
  28. as_KnobBlack() {
  29. minAngle = float(-0.83 * M_PI);
  30. maxAngle = float(0.83 * M_PI);
  31. setSVG( SVG::load(assetPlugin(plugin, "res/as-knobBlack.svg")) );
  32. }
  33. };
  34. struct as_KnobBlackSnap : as_KnobBlack {
  35. as_KnobBlackSnap() {
  36. snap = true;
  37. }
  38. };
  39. struct as_KnobBlackSnap4 : as_KnobBlack {
  40. as_KnobBlackSnap4() {
  41. minAngle = float(-0.30 * M_PI);
  42. maxAngle = float(0.30 * M_PI);
  43. snap = true;
  44. }
  45. };
  46. struct as_FxKnobWhite : SVGKnob {
  47. as_FxKnobWhite() {
  48. minAngle = float(-0.83 * M_PI);
  49. maxAngle = float(0.83 * M_PI);
  50. setSVG( SVG::load(assetPlugin(plugin, "res/as-FxKnobWhite.svg")) );
  51. }
  52. };
  53. struct as_FxKnobBlack : SVGKnob {
  54. as_FxKnobBlack() {
  55. minAngle = float(-0.83 * M_PI);
  56. maxAngle = float(0.83 * M_PI);
  57. setSVG( SVG::load(assetPlugin(plugin, "res/as-FxKnobBlack.svg")) );
  58. }
  59. };
  60. struct BigLEDBezel : SVGSwitch, MomentarySwitch {
  61. BigLEDBezel() {
  62. addFrame(SVG::load(assetPlugin(plugin, "res/as_bigLEDBezel.svg")));
  63. }
  64. };
  65. struct as_CKSS : SVGSwitch, ToggleSwitch {
  66. as_CKSS() {
  67. addFrame(SVG::load(assetPlugin(plugin,"res/as_CKSS_0.svg")));
  68. addFrame(SVG::load(assetPlugin(plugin,"res/as_CKSS_1.svg")));
  69. }
  70. };
  71. struct as_CKSSH : SVGSwitch, ToggleSwitch {
  72. as_CKSSH() {
  73. addFrame(SVG::load(assetPlugin(plugin, "res/as_CKSSH_0.svg")));
  74. addFrame(SVG::load(assetPlugin(plugin, "res/as_CKSSH_1.svg")));
  75. sw->wrap();
  76. box.size = sw->box.size;
  77. }
  78. };
  79. struct as_CKSSThree : SVGSwitch, ToggleSwitch {
  80. as_CKSSThree() {
  81. addFrame(SVG::load(assetPlugin(plugin,"res/as_CKSSThree_2.svg")));
  82. addFrame(SVG::load(assetPlugin(plugin,"res/as_CKSSThree_1.svg")));
  83. addFrame(SVG::load(assetPlugin(plugin,"res/as_CKSSThree_0.svg")));
  84. }
  85. };
  86. struct as_MuteBtn : SVGSwitch, ToggleSwitch {
  87. as_MuteBtn() {
  88. addFrame(SVG::load(assetPlugin(plugin,"res/as_mute-off.svg")));
  89. addFrame(SVG::load(assetPlugin(plugin,"res/as_mute-on.svg")));
  90. }
  91. };
  92. struct as_SoloBtn : SVGSwitch, ToggleSwitch {
  93. as_SoloBtn() {
  94. addFrame(SVG::load(assetPlugin(plugin,"res/as_solo-off.svg")));
  95. addFrame(SVG::load(assetPlugin(plugin,"res/as_solo-on.svg")));
  96. }
  97. };
  98. template <typename BASE>
  99. struct GiantLight : BASE {
  100. GiantLight() {
  101. this->box.size = mm2px(Vec(18.0, 18.0));
  102. }
  103. };
  104. template <typename BASE>
  105. struct MeterLight : BASE {
  106. MeterLight() {
  107. this->box.size = Vec(8, 8);
  108. this->bgColor = nvgRGB(0x14, 0x14, 0x14);
  109. }
  110. };
  111. template <typename BASE>
  112. struct DisplayLedLight : BASE {
  113. DisplayLedLight() {
  114. this->box.size = mm2px(Vec(2.0, 2.0));
  115. this->bgColor = nvgRGB(0x14, 0x14, 0x14);
  116. }
  117. };
  118. struct OrangeLight : GrayModuleLightWidget {
  119. OrangeLight() {
  120. addBaseColor(COLOR_ORANGE);
  121. }
  122. };
  123. template <typename BASE>
  124. struct LedLight : BASE {
  125. LedLight() {
  126. //this->box.size = Vec(20.0, 20.0);
  127. this->box.size = mm2px(Vec(6.0, 6.0));
  128. }
  129. };
  130. /** Reads two adjacent lightIds, so `lightId` and `lightId + 1` must be defined */
  131. struct YellowRedLight : GrayModuleLightWidget {
  132. YellowRedLight() {
  133. addBaseColor(COLOR_YELLOW);
  134. addBaseColor(COLOR_RED);
  135. }
  136. };
  137. struct as_PJ301MPort : SVGPort {
  138. as_PJ301MPort() {
  139. setSVG(SVG::load(assetPlugin(plugin,"res/as-PJ301M.svg")));
  140. //background->svg = SVG::load(assetPlugin(plugin,"res/as-PJ301M.svg"));
  141. //background->wrap();
  142. //box.size = background->box.size;
  143. }
  144. };
  145. struct as_SlidePot : SVGFader {
  146. as_SlidePot() {
  147. Vec margin = Vec(4, 4);
  148. maxHandlePos = Vec(-1.5, -8).plus(margin);
  149. minHandlePos = Vec(-1.5, 87).plus(margin);
  150. background->svg = SVG::load(assetPlugin(plugin,"res/as-SlidePot.svg"));
  151. background->wrap();
  152. background->box.pos = margin;
  153. box.size = background->box.size.plus(margin.mult(2));
  154. handle->svg = SVG::load(assetPlugin(plugin,"res/as-SlidePotHandle.svg"));
  155. handle->wrap();
  156. }
  157. };
  158. struct as_FaderPot : SVGFader {
  159. as_FaderPot() {
  160. Vec margin = Vec(4, 4);
  161. maxHandlePos = Vec(-1.5, -8).plus(margin);
  162. minHandlePos = Vec(-1.5, 57).plus(margin);
  163. background->svg = SVG::load(assetPlugin(plugin,"res/as-FaderPot.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. };