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.

244 lines
7.1KB

  1. #include "rack.hpp"
  2. #define FONT_FILE assetPlugin(plugin, "res/bold_led_board-7.ttf")
  3. //#define mFONT_FILE assetPlugin(plugin, "res/DIN Condensed Bold.ttf")
  4. #define mFONT_FILE assetPlugin(plugin, "res/Munro.ttf")
  5. #include <iomanip> // setprecision
  6. #include <sstream> // stringstream
  7. using namespace rack;
  8. RACK_PLUGIN_DECLARE(moDllz);
  9. #ifdef USE_VST2
  10. #define plugin "moDllz"
  11. #endif // USE_VST2
  12. ///////////////////////
  13. // custom components
  14. ///////////////////////
  15. ///knob44
  16. struct moDllzKnobM : SVGKnob {
  17. moDllzKnobM() {
  18. // box.size = Vec(44, 44);
  19. minAngle = -0.83*M_PI;
  20. maxAngle = 0.83*M_PI;
  21. setSVG(SVG::load(assetPlugin(plugin, "res/moDllzKnobM.svg")));
  22. shadow->opacity = 0.f;
  23. }
  24. };
  25. ///knob32
  26. struct moDllzKnob32 : SVGKnob {
  27. moDllzKnob32() {
  28. // box.size = Vec(32, 32);
  29. minAngle = -0.83*M_PI;
  30. maxAngle = 0.83*M_PI;
  31. setSVG(SVG::load(assetPlugin(plugin, "res/moDllzKnob32.svg")));
  32. shadow->opacity = 0.f;
  33. }
  34. };
  35. struct moDllzKnob26 : SVGKnob {
  36. moDllzKnob26() {
  37. // box.size = Vec(32, 32);
  38. minAngle = -0.83*M_PI;
  39. maxAngle = 0.83*M_PI;
  40. setSVG(SVG::load(assetPlugin(plugin, "res/moDllzKnob26.svg")));
  41. shadow->opacity = 0.f;
  42. }
  43. };
  44. ///TinyTrim
  45. struct moDllzTTrim : SVGKnob {
  46. moDllzTTrim() {
  47. minAngle = -0.83*M_PI;
  48. maxAngle = 0.83*M_PI;
  49. setSVG(SVG::load(assetPlugin(plugin, "res/moDllzTTrim.svg")));
  50. shadow->opacity = 0.f;
  51. }
  52. };
  53. struct TTrimSnap : moDllzTTrim{
  54. TTrimSnap(){
  55. snap = true;
  56. }
  57. };
  58. ///SnapSelector32
  59. struct moDllzSelector32 : SVGKnob {
  60. moDllzSelector32() {
  61. // box.size = Vec(32, 32);
  62. minAngle = -0.85*M_PI;
  63. maxAngle = 0.85*M_PI;
  64. snap = true;
  65. setSVG(SVG::load(assetPlugin(plugin, "res/moDllzSnap32.svg")));
  66. shadow->opacity = 0.f;
  67. }
  68. };
  69. struct moDllzSmSelector : SVGKnob{
  70. moDllzSmSelector() {
  71. // box.size = Vec(36, 36);
  72. minAngle = -0.5*M_PI;
  73. maxAngle = 0.5*M_PI;
  74. snap = true;
  75. setSVG(SVG::load(assetPlugin(plugin, "res/moDllzSmSelector.svg")));
  76. shadow->opacity = 0.f;
  77. }
  78. };
  79. //struct moDllzHFader : SVGFader {
  80. // moDllzHFader() {
  81. // // Vec margin = Vec(3.5, 3.5);
  82. // maxHandlePos = Vec(90, 0);//.plus(margin);
  83. // minHandlePos = Vec(0, 0);//.plus(margin);
  84. // background->svg = SVG::load(assetPlugin(plugin, "res/moDllzHFaderBck.svg"));
  85. // background->wrap();
  86. // //background->box.pos = margin;
  87. // box.size = background->box.size;
  88. // handle->svg = SVG::load(assetPlugin(plugin, "res/moDllzHFader.svg"));
  89. // handle->wrap();
  90. // }
  91. //};
  92. ///switch
  93. struct moDllzSwitch : SVGSwitch, ToggleSwitch {
  94. moDllzSwitch() {
  95. // box.size = Vec(10, 20);
  96. addFrame(SVG::load(assetPlugin(plugin, "res/moDllzSwitch_0.svg")));
  97. addFrame(SVG::load(assetPlugin(plugin, "res/moDllzSwitch_1.svg")));
  98. }
  99. };
  100. ///Horizontal switch
  101. struct moDllzSwitchH : SVGSwitch, ToggleSwitch {
  102. moDllzSwitchH() {
  103. // box.size = Vec(20, 10);
  104. addFrame(SVG::load(assetPlugin(plugin, "res/moDllzSwitchH_0.svg")));
  105. addFrame(SVG::load(assetPlugin(plugin, "res/moDllzSwitchH_1.svg")));
  106. }
  107. };
  108. ///Switch with Led
  109. struct moDllzSwitchLed : SVGSwitch, ToggleSwitch {
  110. moDllzSwitchLed() {
  111. // box.size = Vec(10, 18);
  112. addFrame(SVG::load(assetPlugin(plugin, "res/moDllzSwitchLed_0.svg")));
  113. addFrame(SVG::load(assetPlugin(plugin, "res/moDllzSwitchLed_1.svg")));
  114. }
  115. };
  116. ///Horizontal switch with Led
  117. struct moDllzSwitchLedH : SVGSwitch, ToggleSwitch {
  118. moDllzSwitchLedH() {
  119. // box.size = Vec(18, 10);
  120. addFrame(SVG::load(assetPlugin(plugin, "res/moDllzSwitchLedH_0.svg")));
  121. addFrame(SVG::load(assetPlugin(plugin, "res/moDllzSwitchLedH_1.svg")));
  122. }
  123. };
  124. ///Horizontal switch Triple with Led
  125. struct moDllzSwitchLedHT : SVGSwitch, ToggleSwitch {
  126. moDllzSwitchLedHT() {
  127. // box.size = Vec(24, 10);
  128. addFrame(SVG::load(assetPlugin(plugin, "res/moDllzSwitchLedHT_0.svg")));
  129. addFrame(SVG::load(assetPlugin(plugin, "res/moDllzSwitchLedHT_1.svg")));
  130. addFrame(SVG::load(assetPlugin(plugin, "res/moDllzSwitchLedHT_2.svg")));
  131. }
  132. };
  133. ///switch TriState
  134. struct moDllzSwitchT : SVGSwitch, ToggleSwitch {
  135. moDllzSwitchT() {
  136. // box.size = Vec(10, 30);
  137. addFrame(SVG::load(assetPlugin(plugin, "res/moDllzSwitchT_0.svg")));
  138. addFrame(SVG::load(assetPlugin(plugin, "res/moDllzSwitchT_1.svg")));
  139. addFrame(SVG::load(assetPlugin(plugin, "res/moDllzSwitchT_2.svg")));
  140. }
  141. };
  142. ///switch TriState Horizontal
  143. struct moDllzSwitchTH : SVGSwitch, ToggleSwitch {
  144. moDllzSwitchTH() {
  145. // box.size = Vec(30, 10);
  146. addFrame(SVG::load(assetPlugin(plugin, "res/moDllzSwitchTH_0.svg")));
  147. addFrame(SVG::load(assetPlugin(plugin, "res/moDllzSwitchTH_1.svg")));
  148. addFrame(SVG::load(assetPlugin(plugin, "res/moDllzSwitchTH_2.svg")));
  149. }
  150. };
  151. ///Momentary Button
  152. struct moDllzMoButton : SVGSwitch, MomentarySwitch {
  153. moDllzMoButton() {
  154. // box.size = Vec(48, 27);
  155. addFrame(SVG::load(assetPlugin(plugin, "res/moDllzMoButton_0.svg")));
  156. addFrame(SVG::load(assetPlugin(plugin, "res/moDllzMoButton_1.svg")));
  157. }
  158. };
  159. ///Momentary Label Clear Button
  160. struct moDllzClearButton : SVGSwitch, MomentarySwitch {
  161. moDllzClearButton() {
  162. // box.size = Vec(38, 13);
  163. addFrame(SVG::load(assetPlugin(plugin, "res/moDllzClearButton.svg")));
  164. }
  165. };
  166. ///Momentary Round Button
  167. struct moDllzRoundButton : SVGSwitch, MomentarySwitch {
  168. moDllzRoundButton() {
  169. // box.size = Vec(14, 14);
  170. addFrame(SVG::load(assetPlugin(plugin, "res/moDllzRoundButton.svg")));
  171. }
  172. };
  173. ///Momentary PulseUp
  174. struct moDllzPulseUp : SVGSwitch, MomentarySwitch {
  175. moDllzPulseUp() {
  176. // box.size = Vec(12, 12);
  177. addFrame(SVG::load(assetPlugin(plugin, "res/moDllzPulse2Up.svg")));
  178. }
  179. };
  180. ///Momentary PulseDown
  181. struct moDllzPulseDwn : SVGSwitch, MomentarySwitch {
  182. moDllzPulseDwn() {
  183. // box.size = Vec(12, 12);
  184. addFrame(SVG::load(assetPlugin(plugin, "res/moDllzPulse2Dwn.svg")));
  185. }
  186. };
  187. ///MuteGate
  188. struct moDllzMuteG : SVGSwitch, MomentarySwitch {
  189. moDllzMuteG() {
  190. // box.size = Vec(67, 12);
  191. addFrame(SVG::load(assetPlugin(plugin, "res/moDllzMuteG.svg")));
  192. }
  193. };
  194. ///MuteGateP
  195. struct moDllzMuteGP : SVGSwitch, MomentarySwitch {
  196. moDllzMuteGP() {
  197. // box.size = Vec(26, 11);
  198. addFrame(SVG::load(assetPlugin(plugin, "res/moDllzMuteGP.svg")));
  199. }
  200. };
  201. ///MIDIPanic
  202. struct moDllzMidiPanic : SVGSwitch, MomentarySwitch {
  203. moDllzMidiPanic() {
  204. // box.size = Vec(48, 14);
  205. addFrame(SVG::load(assetPlugin(plugin, "res/moDllzMidiPanic.svg")));
  206. }
  207. };
  208. ///Jacks
  209. struct moDllzPort : SVGPort {
  210. moDllzPort() {
  211. background->svg = SVG::load(assetPlugin(plugin, "res/moDllzPort.svg"));
  212. background->wrap();
  213. box.size = background->box.size;
  214. }
  215. };
  216. struct moDllzPortDark : SVGPort {
  217. moDllzPortDark() {
  218. background->svg = SVG::load(assetPlugin(plugin, "res/moDllzPortDark.svg"));
  219. background->wrap();
  220. box.size = background->box.size;
  221. }
  222. };