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.

542 lines
9.4KB

  1. #include "rack.hpp"
  2. using namespace rack;
  3. RACK_PLUGIN_DECLARE(dBiz);
  4. // // #ifdef USE_VST2
  5. // // #define plugin "dBiz"
  6. // // #endif // USE_VST2
  7. namespace rack_plugin_dBiz {
  8. ////////////////////
  9. // Colors
  10. ///// ///////////////
  11. #define COLOR_BLACK_TRANSPARENT nvgRGBA(0x00, 0x00, 0x00, 0x00)
  12. #define COLOR_BLACK nvgRGB(0x00, 0x00, 0x00)
  13. #define COLOR_WHITE nvgRGB(0xff, 0xff, 0xff)
  14. #define COLOR_RED nvgRGB(0xed, 0x2c, 0x24)
  15. #define COLOR_ORANGE nvgRGB(0xf2, 0xb1, 0x20)
  16. #define COLOR_YELLOW nvgRGB(0xf9, 0xdf, 0x1c)
  17. #define COLOR_GREEN nvgRGB(0x90, 0xc7, 0x3e)
  18. #define COLOR_CYAN nvgRGB(0x22, 0xe6, 0xef)
  19. #define COLOR_BLUE nvgRGB(0x29, 0xb2, 0xef)
  20. #define COLOR_PURPLE nvgRGB(0xd5, 0x2b, 0xed)
  21. ////////////////////
  22. // Knobs
  23. ////////////////////
  24. struct DKnob : SVGKnob
  25. {
  26. DKnob()
  27. {
  28. minAngle = -0.83 * M_PI;
  29. maxAngle = 0.83 * M_PI;
  30. setSVG(SVG::load(assetPlugin(plugin, "res/component/DKnob.svg")));
  31. box.size = Vec(50, 50);
  32. }
  33. };
  34. struct SDKnob : SVGKnob
  35. {
  36. SDKnob()
  37. {
  38. minAngle = -0.83 * M_PI;
  39. maxAngle = 0.83 * M_PI;
  40. setSVG(SVG::load(assetPlugin(plugin, "res/component/SDKnob.svg")));
  41. box.size = Vec(30, 30);
  42. }
  43. };
  44. struct VerboL : SVGKnob
  45. {
  46. VerboL()
  47. {
  48. minAngle = -0.83 * M_PI;
  49. maxAngle = 0.83 * M_PI;
  50. setSVG(SVG::load(assetPlugin(plugin, "res/component/VerboL.svg")));
  51. box.size = Vec(80, 80);
  52. }
  53. };
  54. struct VerboS : SVGKnob
  55. {
  56. VerboS()
  57. {
  58. minAngle = -0.83 * M_PI;
  59. maxAngle = 0.83 * M_PI;
  60. setSVG(SVG::load(assetPlugin(plugin, "res/component/VerboS.svg")));
  61. box.size = Vec(35, 35);
  62. }
  63. };
  64. struct VerboDL : SVGKnob
  65. {
  66. VerboDL()
  67. {
  68. minAngle = -0.83 * M_PI;
  69. maxAngle = 0.83 * M_PI;
  70. setSVG(SVG::load(assetPlugin(plugin, "res/component/VerboDL.svg")));
  71. box.size = Vec(80, 80);
  72. }
  73. };
  74. struct VerboDS : SVGKnob
  75. {
  76. VerboDS()
  77. {
  78. minAngle = -0.83 * M_PI;
  79. maxAngle = 0.83 * M_PI;
  80. setSVG(SVG::load(assetPlugin(plugin, "res/component/VerboDS.svg")));
  81. box.size = Vec(35, 35);
  82. }
  83. };
  84. struct SmallKnob : SVGKnob
  85. {
  86. SmallKnob()
  87. {
  88. minAngle = -0.83 * M_PI;
  89. maxAngle = 0.83 * M_PI;
  90. }
  91. };
  92. struct SmallBlu : SmallKnob
  93. {
  94. SmallBlu()
  95. {
  96. setSVG(SVG::load(assetPlugin(plugin, "res/component/SmallBlu.svg")));
  97. }
  98. };
  99. struct MicroBlu : SmallBlu
  100. {
  101. MicroBlu()
  102. {
  103. box.size = Vec(25, 25);
  104. }
  105. };
  106. struct LargeBlu : SmallBlu
  107. {
  108. LargeBlu()
  109. {
  110. box.size = Vec(45, 45);
  111. }
  112. };
  113. struct SmallCre : SmallKnob
  114. {
  115. SmallCre()
  116. {
  117. setSVG(SVG::load(assetPlugin(plugin, "res/component/SmallCre.svg")));
  118. }
  119. };
  120. struct SmallBla : SmallKnob
  121. {
  122. SmallBla()
  123. {
  124. setSVG(SVG::load(assetPlugin(plugin, "res/component/SmallBla.svg")));
  125. }
  126. };
  127. struct LargeBla : SmallBla
  128. {
  129. LargeBla()
  130. {
  131. box.size = Vec(45, 45);
  132. }
  133. };
  134. struct DaviesKnob : SVGKnob
  135. {
  136. DaviesKnob()
  137. {
  138. minAngle = -0.83 * M_PI;
  139. maxAngle = 0.83 * M_PI;
  140. box.size = Vec(15, 15);
  141. }
  142. };
  143. struct DaviesPur : DaviesKnob
  144. {
  145. DaviesPur()
  146. {
  147. setSVG(SVG::load(assetPlugin(plugin, "res/component/DaviesPur.svg")));
  148. }
  149. };
  150. struct LDaviesPur : DaviesPur
  151. {
  152. LDaviesPur()
  153. {
  154. box.size = Vec(45, 45);
  155. }
  156. };
  157. struct DaviesBlu : DaviesKnob
  158. {
  159. DaviesBlu()
  160. {
  161. setSVG(SVG::load(assetPlugin(plugin, "res/component/DaviesBlu.svg")));
  162. }
  163. };
  164. struct LDaviesBlu : DaviesBlu
  165. {
  166. LDaviesBlu()
  167. {
  168. box.size = Vec(45, 45);
  169. }
  170. };
  171. struct DaviesRed : DaviesKnob
  172. {
  173. DaviesRed()
  174. {
  175. setSVG(SVG::load(assetPlugin(plugin, "res/component/DaviesRed.svg")));
  176. }
  177. };
  178. struct LDaviesRed : DaviesRed
  179. {
  180. LDaviesRed()
  181. {
  182. box.size = Vec(45, 45);
  183. }
  184. };
  185. struct RoundAzz : DaviesKnob
  186. {
  187. RoundAzz()
  188. {
  189. box.size = Vec(30, 30);
  190. setSVG(SVG::load(assetPlugin(plugin, "res/component/RoundAzz.svg")));
  191. }
  192. };
  193. struct RoundRed : DaviesKnob
  194. {
  195. RoundRed()
  196. {
  197. box.size = Vec(30, 30);
  198. setSVG(SVG::load(assetPlugin(plugin, "res/component/RoundRed.svg")));
  199. }
  200. };
  201. struct RoundWhy : DaviesKnob
  202. {
  203. RoundWhy()
  204. {
  205. setSVG(SVG::load(assetPlugin(plugin, "res/component/RoundWhy.svg")));
  206. }
  207. };
  208. struct RoundWhySnapKnob : RoundWhy
  209. {
  210. RoundWhySnapKnob()
  211. {
  212. snap = true;
  213. };
  214. };
  215. struct LRoundWhy : RoundWhy
  216. {
  217. LRoundWhy()
  218. {
  219. setSVG(SVG::load(assetPlugin(plugin, "res/component/LRoundWhy.svg")));
  220. }
  221. };
  222. struct RoundBlu : DaviesKnob
  223. {
  224. RoundBlu()
  225. {
  226. setSVG(SVG::load(assetPlugin(plugin, "res/component/RoundBlu.svg")));
  227. }
  228. };
  229. struct LRoundBlu : RoundBlu
  230. {
  231. LRoundBlu()
  232. {
  233. setSVG(SVG::load(assetPlugin(plugin, "res/component/LRoundBlu.svg")));
  234. }
  235. };
  236. struct FlatA : DaviesKnob
  237. {
  238. FlatA()
  239. {
  240. setSVG(SVG::load(assetPlugin(plugin, "res/component/FlatA.svg")));
  241. box.size = Vec(30, 30);
  242. }
  243. };
  244. struct FlatASnap : FlatA
  245. {
  246. FlatASnap()
  247. {
  248. snap = true;
  249. }
  250. };
  251. struct FlatR : DaviesKnob
  252. {
  253. FlatR()
  254. {
  255. setSVG(SVG::load(assetPlugin(plugin, "res/component/FlatR.svg")));
  256. box.size = Vec(30, 30);
  257. }
  258. };
  259. struct FlatS : DaviesKnob
  260. {
  261. FlatS()
  262. {
  263. setSVG(SVG::load(assetPlugin(plugin, "res/component/FlatS.svg")));
  264. box.size = Vec(30, 30);
  265. }
  266. };
  267. struct FlatG : DaviesKnob
  268. {
  269. FlatG()
  270. {
  271. setSVG(SVG::load(assetPlugin(plugin, "res/component/FlatG.svg")));
  272. box.size = Vec(30, 30);
  273. }
  274. };
  275. // struct DaviesKnobSnapKnob : DaviesKnob, SnapKnob {};
  276. //////////////////////
  277. //slider
  278. ///////////////////
  279. struct SlidePot : SVGFader
  280. {
  281. SlidePot()
  282. {
  283. Vec margin = Vec(3.5, 3.5);
  284. maxHandlePos = Vec(-1, -2).plus(margin);
  285. minHandlePos = Vec(-1, 87).plus(margin);
  286. background->svg = SVG::load(assetPlugin(plugin, "res/component/SlidePot.svg"));
  287. background->wrap();
  288. background->box.pos = margin;
  289. box.size = background->box.size.plus(margin.mult(2));
  290. handle->svg = SVG::load(assetPlugin(plugin, "res/component/SlidePotHandle.svg"));
  291. handle->wrap();
  292. }
  293. };
  294. struct SlidePot2 : SVGFader
  295. {
  296. SlidePot2()
  297. {
  298. Vec margin = Vec(3.5, 3.5);
  299. maxHandlePos = Vec(-10, -2).plus(margin);
  300. minHandlePos = Vec(-10, 87).plus(margin);
  301. background->svg = SVG::load(assetPlugin(plugin, "res/component/SlidePot.svg"));
  302. background->wrap();
  303. background->box.pos = margin;
  304. box.size = background->box.size.plus(margin.mult(2));
  305. handle->svg = SVG::load(assetPlugin(plugin, "res/component/SlidePotHandle2.svg"));
  306. handle->wrap();
  307. }
  308. };
  309. ////////////////////
  310. // Lights
  311. ////////////////////
  312. struct OrangeLight : GrayModuleLightWidget
  313. {
  314. OrangeLight()
  315. {
  316. addBaseColor(COLOR_ORANGE);
  317. }
  318. };
  319. struct CyanLight : GrayModuleLightWidget
  320. {
  321. CyanLight()
  322. {
  323. addBaseColor(COLOR_CYAN);
  324. }
  325. };
  326. struct WhiteLight : GrayModuleLightWidget
  327. {
  328. WhiteLight()
  329. {
  330. addBaseColor(COLOR_WHITE);
  331. }
  332. };
  333. template <typename BASE>
  334. struct BigLight : BASE
  335. {
  336. BigLight()
  337. {
  338. this->box.size = Vec(20, 20);
  339. }
  340. };
  341. template <typename BASE>
  342. struct HugeLight : BASE
  343. {
  344. HugeLight()
  345. {
  346. this->box.size = Vec(24, 24);
  347. }
  348. };
  349. struct OBPLight : GrayModuleLightWidget
  350. {
  351. OBPLight()
  352. {
  353. addBaseColor(COLOR_ORANGE);
  354. addBaseColor(COLOR_BLUE);
  355. addBaseColor(COLOR_PURPLE);
  356. }
  357. };
  358. ////////////////////
  359. // Jacks
  360. ////////////////////
  361. struct PJ301MRPort : SVGPort
  362. {
  363. PJ301MRPort()
  364. {
  365. background->svg = SVG::load(assetPlugin(plugin, "res/component/PJ301MR.svg"));
  366. background->wrap();
  367. box.size = background->box.size;
  368. }
  369. };
  370. struct PJ301MLPort : SVGPort
  371. {
  372. PJ301MLPort()
  373. {
  374. background->svg = SVG::load(assetPlugin(plugin, "res/component/PJ301ML.svg"));
  375. background->wrap();
  376. box.size = background->box.size;
  377. }
  378. };
  379. struct PJ301MIPort : SVGPort
  380. {
  381. PJ301MIPort()
  382. {
  383. background->svg = SVG::load(assetPlugin(plugin, "res/component/PJ301MA.svg"));
  384. background->wrap();
  385. box.size = background->box.size;
  386. }
  387. };
  388. struct PJ301MVAPort : SVGPort
  389. {
  390. PJ301MVAPort()
  391. {
  392. background->svg = SVG::load(assetPlugin(plugin, "res/component/PJ301MVA.svg"));
  393. background->wrap();
  394. box.size = background->box.size;
  395. }
  396. };
  397. struct PJ301MOrPort : SVGPort
  398. {
  399. PJ301MOrPort()
  400. {
  401. background->svg = SVG::load(assetPlugin(plugin, "res/component/PJ301MO.svg"));
  402. background->wrap();
  403. box.size = background->box.size;
  404. }
  405. };
  406. struct PJ301MOPort : SVGPort
  407. {
  408. PJ301MOPort()
  409. {
  410. background->svg = SVG::load(assetPlugin(plugin, "res/component/PJ301MB.svg"));
  411. background->wrap();
  412. box.size = background->box.size;
  413. }
  414. };
  415. struct PJ301MCPort : SVGPort
  416. {
  417. PJ301MCPort()
  418. {
  419. background->svg = SVG::load(assetPlugin(plugin, "res/component/PJ301MW.svg"));
  420. background->wrap();
  421. box.size = background->box.size;
  422. }
  423. };
  424. //
  425. ////////////////////////
  426. // SWITCHES
  427. ////////////////////////////////////////////////
  428. struct SilverSwitch : SVGSwitch, ToggleSwitch
  429. {
  430. SilverSwitch()
  431. {
  432. addFrame(SVG::load(assetPlugin(plugin,"res/component/SilverSwitch_0.svg")));
  433. addFrame(SVG::load(assetPlugin(plugin,"res/component/SilverSwitch_2.svg")));
  434. }
  435. };
  436. struct SilverSwitch3 : SVGSwitch, ToggleSwitch
  437. {
  438. SilverSwitch3()
  439. {
  440. addFrame(SVG::load(assetPlugin(plugin, "res/component/SilverSwitch_0.svg")));
  441. addFrame(SVG::load(assetPlugin(plugin, "res/component/SilverSwitch_1.svg")));
  442. addFrame(SVG::load(assetPlugin(plugin, "res/component/SilverSwitch_2.svg")));
  443. }
  444. };
  445. struct CKSSS : SVGSwitch, ToggleSwitch
  446. {
  447. CKSSS()
  448. {
  449. addFrame(SVG::load(assetPlugin(plugin, "res/component/CKSS_0.svg")));
  450. addFrame(SVG::load(assetPlugin(plugin, "res/component/CKSS_1.svg")));
  451. }
  452. };
  453. struct LEDB : SVGSwitch, ToggleSwitch
  454. {
  455. LEDB()
  456. {
  457. addFrame(SVG::load(assetPlugin(plugin, "res/component/LEDB_0.svg")));
  458. addFrame(SVG::load(assetPlugin(plugin, "res/component/LEDB_1.svg")));
  459. }
  460. };
  461. struct MCKSSS : SVGSwitch, ToggleSwitch
  462. {
  463. MCKSSS()
  464. {
  465. addFrame(SVG::load(assetPlugin(plugin, "res/component/MCKSSS_0.svg")));
  466. addFrame(SVG::load(assetPlugin(plugin, "res/component/MCKSSS_1.svg")));
  467. addFrame(SVG::load(assetPlugin(plugin, "res/component/MCKSSS_2.svg")));
  468. }
  469. };
  470. struct BPush : SVGSwitch, MomentarySwitch
  471. {
  472. BPush()
  473. {
  474. addFrame(SVG::load(assetPlugin(plugin, "res/component/BPush_0.svg")));
  475. addFrame(SVG::load(assetPlugin(plugin, "res/component/BPush_1.svg")));
  476. }
  477. };
  478. } // namespace rack_plugin_dBiz