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.

563 lines
9.1KB

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