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.

182 lines
4.4KB

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