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.

606 lines
12KB

  1. #pragma once
  2. #include "app.hpp"
  3. #include "asset.hpp"
  4. namespace rack {
  5. ////////////////////
  6. // Colors
  7. ////////////////////
  8. #define COLOR_BLACK_TRANSPARENT nvgRGBA(0x00, 0x00, 0x00, 0x00)
  9. #define COLOR_BLACK nvgRGB(0x00, 0x00, 0x00)
  10. #define COLOR_WHITE nvgRGB(0xff, 0xff, 0xff)
  11. #define COLOR_RED nvgRGB(0xed, 0x2c, 0x24)
  12. #define COLOR_ORANGE nvgRGB(0xf2, 0xb1, 0x20)
  13. #define COLOR_YELLOW nvgRGB(0xf9, 0xdf, 0x1c)
  14. #define COLOR_GREEN nvgRGB(0x90, 0xc7, 0x3e)
  15. #define COLOR_CYAN nvgRGB(0x22, 0xe6, 0xef)
  16. #define COLOR_BLUE nvgRGB(0x29, 0xb2, 0xef)
  17. #define COLOR_PURPLE nvgRGB(0xd5, 0x2b, 0xed)
  18. ////////////////////
  19. // Knobs
  20. ////////////////////
  21. struct RoundKnob : SVGKnob {
  22. RoundKnob() {
  23. minAngle = -0.83*M_PI;
  24. maxAngle = 0.83*M_PI;
  25. }
  26. };
  27. struct RoundBlackKnob : RoundKnob {
  28. RoundBlackKnob() {
  29. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/RoundBlack.svg")));
  30. box.size = Vec(38, 38);
  31. }
  32. };
  33. struct RoundSmallBlackKnob : RoundBlackKnob {
  34. RoundSmallBlackKnob() {
  35. box.size = Vec(28, 28);
  36. }
  37. };
  38. struct RoundLargeBlackKnob : RoundBlackKnob {
  39. RoundLargeBlackKnob() {
  40. box.size = Vec(46, 46);
  41. }
  42. };
  43. struct RoundHugeBlackKnob : RoundBlackKnob {
  44. RoundHugeBlackKnob() {
  45. box.size = Vec(56, 56);
  46. }
  47. };
  48. struct RoundSmallBlackSnapKnob : RoundSmallBlackKnob {
  49. RoundSmallBlackSnapKnob() {
  50. snap = true;
  51. }
  52. };
  53. struct Davies1900hKnob : SVGKnob {
  54. Davies1900hKnob() {
  55. minAngle = -0.83*M_PI;
  56. maxAngle = 0.83*M_PI;
  57. }
  58. };
  59. struct Davies1900hWhiteKnob : Davies1900hKnob {
  60. Davies1900hWhiteKnob() {
  61. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Davies1900hWhite.svg")));
  62. }
  63. };
  64. struct Davies1900hBlackKnob : Davies1900hKnob {
  65. Davies1900hBlackKnob() {
  66. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Davies1900hBlack.svg")));
  67. }
  68. };
  69. struct Davies1900hRedKnob : Davies1900hKnob {
  70. Davies1900hRedKnob() {
  71. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Davies1900hRed.svg")));
  72. }
  73. };
  74. struct Davies1900hLargeWhiteKnob : Davies1900hKnob {
  75. Davies1900hLargeWhiteKnob() {
  76. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Davies1900hLargeWhite.svg")));
  77. }
  78. };
  79. struct Davies1900hLargeBlackKnob : Davies1900hKnob {
  80. Davies1900hLargeBlackKnob() {
  81. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Davies1900hLargeBlack.svg")));
  82. }
  83. };
  84. struct Davies1900hLargeRedKnob : Davies1900hKnob {
  85. Davies1900hLargeRedKnob() {
  86. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Davies1900hLargeRed.svg")));
  87. }
  88. };
  89. struct Rogan : SVGKnob {
  90. Rogan() {
  91. minAngle = -0.83*M_PI;
  92. maxAngle = 0.83*M_PI;
  93. }
  94. };
  95. struct Rogan6PS : Rogan {
  96. Rogan6PS() {
  97. box.size = Vec(89, 89);
  98. // minAngle = -0.83*M_PI;
  99. // maxAngle = 0.83*M_PI;
  100. }
  101. };
  102. struct Rogan5PS : Rogan {
  103. Rogan5PS() {
  104. box.size = Vec(60, 60);
  105. }
  106. };
  107. struct Rogan3PS : Rogan {
  108. Rogan3PS() {
  109. box.size = Vec(52, 52);
  110. }
  111. };
  112. struct Rogan3P : Rogan {
  113. Rogan3P() {
  114. box.size = Vec(42, 42);
  115. }
  116. };
  117. struct Rogan2S : Rogan {
  118. Rogan2S() {
  119. box.size = Vec(43, 43);
  120. }
  121. };
  122. struct Rogan2PS : Rogan {
  123. Rogan2PS() {
  124. box.size = Vec(43, 43);
  125. }
  126. };
  127. struct Rogan2P : Rogan {
  128. Rogan2P() {
  129. box.size = Vec(34, 34);
  130. }
  131. };
  132. struct Rogan1PS : Rogan {
  133. Rogan1PS() {
  134. box.size = Vec(40, 40);
  135. }
  136. };
  137. struct Rogan1P : Rogan {
  138. Rogan1P() {
  139. box.size = Vec(31, 31);
  140. }
  141. };
  142. struct Rogan6PSWhite : Rogan6PS {
  143. Rogan6PSWhite() {
  144. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan6PSWhite.svg")));
  145. }
  146. };
  147. struct Rogan5PSGray : Rogan5PS {
  148. Rogan5PSGray() {
  149. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan5PSGray.svg")));
  150. }
  151. };
  152. struct Rogan3PSBlue : Rogan3PS {
  153. Rogan3PSBlue() {
  154. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan3PSBlue.svg")));
  155. }
  156. };
  157. struct Rogan3PSRed : Rogan3PS {
  158. Rogan3PSRed() {
  159. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan3PSRed.svg")));
  160. }
  161. };
  162. struct Rogan3PSGreen : Rogan3PS {
  163. Rogan3PSGreen() {
  164. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan3PSGreen.svg")));
  165. }
  166. };
  167. struct Rogan3PSWhite : Rogan3PS {
  168. Rogan3PSWhite() {
  169. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan3PSWhite.svg")));
  170. }
  171. };
  172. struct Rogan3PBlue : Rogan3P {
  173. Rogan3PBlue() {
  174. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan3PBlue.svg")));
  175. }
  176. };
  177. struct Rogan3PRed : Rogan3P {
  178. Rogan3PRed() {
  179. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan3PRed.svg")));
  180. }
  181. };
  182. struct Rogan3PGreen : Rogan3P {
  183. Rogan3PGreen() {
  184. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan3PGreen.svg")));
  185. }
  186. };
  187. struct Rogan3PWhite : Rogan3P {
  188. Rogan3PWhite() {
  189. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan3PWhite.svg")));
  190. }
  191. };
  192. struct Rogan2SGray : Rogan2S {
  193. Rogan2SGray() {
  194. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan2SGray.svg")));
  195. }
  196. };
  197. struct Rogan2PSBlue : Rogan2PS {
  198. Rogan2PSBlue() {
  199. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan2PSBlue.svg")));
  200. }
  201. };
  202. struct Rogan2PSRed : Rogan2PS {
  203. Rogan2PSRed() {
  204. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan2PSRed.svg")));
  205. }
  206. };
  207. struct Rogan2PSGreen : Rogan2PS {
  208. Rogan2PSGreen() {
  209. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan2PSGreen.svg")));
  210. }
  211. };
  212. struct Rogan2PSWhite : Rogan2PS {
  213. Rogan2PSWhite() {
  214. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan2PSWhite.svg")));
  215. }
  216. };
  217. struct Rogan2PBlue : Rogan2P {
  218. Rogan2PBlue() {
  219. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan2PBlue.svg")));
  220. }
  221. };
  222. struct Rogan2PRed : Rogan2P {
  223. Rogan2PRed() {
  224. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan2PRed.svg")));
  225. }
  226. };
  227. struct Rogan2PGreen : Rogan2P {
  228. Rogan2PGreen() {
  229. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan2PGreen.svg")));
  230. }
  231. };
  232. struct Rogan2PWhite : Rogan2P {
  233. Rogan2PWhite() {
  234. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan2PWhite.svg")));
  235. }
  236. };
  237. struct Rogan1PSBlue : Rogan1PS {
  238. Rogan1PSBlue() {
  239. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan1PSBlue.svg")));
  240. }
  241. };
  242. struct Rogan1PSRed : Rogan1PS {
  243. Rogan1PSRed() {
  244. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan1PSRed.svg")));
  245. }
  246. };
  247. struct Rogan1PSGreen : Rogan1PS {
  248. Rogan1PSGreen() {
  249. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan1PSGreen.svg")));
  250. }
  251. };
  252. struct Rogan1PSWhite : Rogan1PS {
  253. Rogan1PSWhite() {
  254. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan1PSWhite.svg")));
  255. }
  256. };
  257. struct Rogan1PBlue : Rogan1P {
  258. Rogan1PBlue() {
  259. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan1PBlue.svg")));
  260. }
  261. };
  262. struct Rogan1PRed : Rogan1P {
  263. Rogan1PRed() {
  264. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan1PRed.svg")));
  265. }
  266. };
  267. struct Rogan1PGreen : Rogan1P {
  268. Rogan1PGreen() {
  269. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan1PGreen.svg")));
  270. }
  271. };
  272. struct Rogan1PWhite : Rogan1P {
  273. Rogan1PWhite() {
  274. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan1PWhite.svg")));
  275. }
  276. };
  277. struct SynthTechAlco : SVGKnob {
  278. SynthTechAlco() {
  279. minAngle = -0.82*M_PI;
  280. maxAngle = 0.82*M_PI;
  281. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/SynthTechAlco.svg")));
  282. }
  283. };
  284. struct Trimpot : SVGKnob {
  285. Trimpot() {
  286. box.size = Vec(17, 17);
  287. minAngle = -0.75*M_PI;
  288. maxAngle = 0.75*M_PI;
  289. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Trimpot.svg")));
  290. }
  291. };
  292. struct BefacoBigKnob : SVGKnob {
  293. BefacoBigKnob() {
  294. box.size = Vec(75, 75);
  295. minAngle = -0.75*M_PI;
  296. maxAngle = 0.75*M_PI;
  297. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/BefacoBigKnob.svg")));
  298. }
  299. };
  300. struct BefacoBigSnapKnob : BefacoBigKnob {
  301. BefacoBigSnapKnob() {
  302. snap = true;
  303. }
  304. };
  305. struct BefacoTinyKnob : SVGKnob {
  306. BefacoTinyKnob() {
  307. box.size = Vec(26, 26);
  308. minAngle = -0.75*M_PI;
  309. maxAngle = 0.75*M_PI;
  310. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/BefacoTinyKnob.svg")));
  311. }
  312. };
  313. struct BefacoSlidePot : SVGSlider {
  314. BefacoSlidePot() {
  315. Vec margin = Vec(3.5, 3.5);
  316. maxHandlePos = Vec(-1, -2).plus(margin);
  317. minHandlePos = Vec(-1, 87).plus(margin);
  318. background->svg = SVG::load(assetGlobal("res/ComponentLibrary/BefacoSlidePot.svg"));
  319. background->wrap();
  320. background->box.pos = margin;
  321. box.size = background->box.size.plus(margin.mult(2));
  322. handle->svg = SVG::load(assetGlobal("res/ComponentLibrary/BefacoSlidePotHandle.svg"));
  323. handle->wrap();
  324. }
  325. };
  326. ////////////////////
  327. // Jacks
  328. ////////////////////
  329. struct PJ301MPort : SVGPort {
  330. PJ301MPort() {
  331. background->svg = SVG::load(assetGlobal("res/ComponentLibrary/PJ301M.svg"));
  332. background->wrap();
  333. box.size = background->box.size;
  334. }
  335. };
  336. struct PJ3410Port : SVGPort {
  337. PJ3410Port() {
  338. background->svg = SVG::load(assetGlobal("res/ComponentLibrary/PJ3410.svg"));
  339. background->wrap();
  340. box.size = background->box.size;
  341. }
  342. };
  343. struct CL1362Port : SVGPort {
  344. CL1362Port() {
  345. background->svg = SVG::load(assetGlobal("res/ComponentLibrary/CL1362.svg"));
  346. background->wrap();
  347. box.size = background->box.size;
  348. }
  349. };
  350. ////////////////////
  351. // Lights
  352. ////////////////////
  353. struct RedLight : ColorLightWidget {
  354. RedLight() {
  355. addColor(COLOR_RED);
  356. }
  357. };
  358. struct GreenLight : ColorLightWidget {
  359. GreenLight() {
  360. addColor(COLOR_GREEN);
  361. }
  362. };
  363. struct YellowLight : ColorLightWidget {
  364. YellowLight() {
  365. addColor(COLOR_YELLOW);
  366. }
  367. };
  368. struct BlueLight : ColorLightWidget {
  369. BlueLight() {
  370. addColor(COLOR_BLUE);
  371. }
  372. };
  373. /** Reads two adjacent lightIds, so `lightId` and `lightId + 1` must be defined */
  374. struct GreenRedLight : ColorLightWidget {
  375. GreenRedLight() {
  376. addColor(COLOR_GREEN);
  377. addColor(COLOR_RED);
  378. }
  379. };
  380. struct RedGreenBlueLight : ColorLightWidget {
  381. RedGreenBlueLight() {
  382. addColor(COLOR_RED);
  383. addColor(COLOR_GREEN);
  384. addColor(COLOR_BLUE);
  385. }
  386. };
  387. template <typename BASE>
  388. struct LargeLight : BASE {
  389. LargeLight() {
  390. this->box.size = Vec(20, 20);
  391. }
  392. };
  393. template <typename BASE>
  394. struct MediumLight : BASE {
  395. MediumLight() {
  396. this->box.size = Vec(12, 12);
  397. }
  398. };
  399. template <typename BASE>
  400. struct SmallLight : BASE {
  401. SmallLight() {
  402. this->box.size = Vec(8, 8);
  403. }
  404. };
  405. template <typename BASE>
  406. struct TinyLight : BASE {
  407. TinyLight() {
  408. this->box.size = Vec(5, 5);
  409. }
  410. };
  411. ////////////////////
  412. // Switches and Buttons
  413. ////////////////////
  414. struct NKK : SVGSwitch, ToggleSwitch {
  415. NKK() {
  416. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/NKK_0.svg")));
  417. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/NKK_1.svg")));
  418. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/NKK_2.svg")));
  419. sw->wrap();
  420. box.size = sw->box.size;
  421. }
  422. };
  423. struct CKSS : SVGSwitch, ToggleSwitch {
  424. CKSS() {
  425. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/CKSS_0.svg")));
  426. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/CKSS_1.svg")));
  427. sw->wrap();
  428. box.size = sw->box.size;
  429. }
  430. };
  431. struct CKD6 : SVGSwitch, MomentarySwitch {
  432. CKD6() {
  433. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/CKD6_0.svg")));
  434. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/CKD6_1.svg")));
  435. sw->wrap();
  436. box.size = sw->box.size;
  437. }
  438. };
  439. struct TL1105 : SVGSwitch, MomentarySwitch {
  440. TL1105() {
  441. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/TL1105_0.svg")));
  442. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/TL1105_1.svg")));
  443. sw->wrap();
  444. box.size = sw->box.size;
  445. }
  446. };
  447. struct LEDButton : SVGSwitch, MomentarySwitch {
  448. LEDButton() {
  449. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/LEDButton.svg")));
  450. sw->wrap();
  451. box.size = sw->box.size;
  452. }
  453. };
  454. struct BefacoSwitch : SVGSwitch, ToggleSwitch {
  455. BefacoSwitch() {
  456. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/BefacoSwitch_0.svg")));
  457. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/BefacoSwitch_1.svg")));
  458. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/BefacoSwitch_2.svg")));
  459. sw->wrap();
  460. box.size = sw->box.size;
  461. }
  462. };
  463. struct BefacoPush : SVGSwitch, MomentarySwitch {
  464. BefacoPush() {
  465. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/BefacoPush_0.svg")));
  466. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/BefacoPush_1.svg")));
  467. sw->wrap();
  468. box.size = sw->box.size;
  469. }
  470. };
  471. struct PB61303 : SVGSwitch, MomentarySwitch {
  472. PB61303() {
  473. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/PB61303_0.svg")));
  474. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/PB61303_1.svg")));
  475. sw->wrap();
  476. box.size = sw->box.size;
  477. }
  478. };
  479. ////////////////////
  480. // Misc
  481. ////////////////////
  482. struct ScrewSilver : SVGScrew {
  483. ScrewSilver() {
  484. sw->svg = SVG::load(assetGlobal("res/ComponentLibrary/ScrewSilver.svg"));
  485. sw->wrap();
  486. box.size = sw->box.size;
  487. }
  488. };
  489. struct ScrewBlack : SVGScrew {
  490. ScrewBlack() {
  491. sw->svg = SVG::load(assetGlobal("res/ComponentLibrary/ScrewBlack.svg"));
  492. sw->wrap();
  493. box.size = sw->box.size;
  494. }
  495. };
  496. struct LightPanel : Panel {
  497. LightPanel() {
  498. backgroundColor = nvgRGB(0xe6, 0xe6, 0xe6);
  499. }
  500. };
  501. struct DarkPanel : Panel {
  502. DarkPanel() {
  503. backgroundColor = nvgRGB(0x17, 0x17, 0x17);
  504. }
  505. };
  506. } // namespace rack