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.

568 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 Rogan6PSWhite : Rogan {
  96. Rogan6PSWhite() {
  97. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan6PSWhite.svg")));
  98. }
  99. };
  100. struct Rogan5PSGray : Rogan {
  101. Rogan5PSGray() {
  102. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan5PSGray.svg")));
  103. }
  104. };
  105. struct Rogan3PSBlue : Rogan {
  106. Rogan3PSBlue() {
  107. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan3PSBlue.svg")));
  108. }
  109. };
  110. struct Rogan3PSRed : Rogan {
  111. Rogan3PSRed() {
  112. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan3PSRed.svg")));
  113. }
  114. };
  115. struct Rogan3PSGreen : Rogan {
  116. Rogan3PSGreen() {
  117. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan3PSGreen.svg")));
  118. }
  119. };
  120. struct Rogan3PSWhite : Rogan {
  121. Rogan3PSWhite() {
  122. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan3PSWhite.svg")));
  123. }
  124. };
  125. struct Rogan3PBlue : Rogan {
  126. Rogan3PBlue() {
  127. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan3PBlue.svg")));
  128. }
  129. };
  130. struct Rogan3PRed : Rogan {
  131. Rogan3PRed() {
  132. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan3PRed.svg")));
  133. }
  134. };
  135. struct Rogan3PGreen : Rogan {
  136. Rogan3PGreen() {
  137. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan3PGreen.svg")));
  138. }
  139. };
  140. struct Rogan3PWhite : Rogan {
  141. Rogan3PWhite() {
  142. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan3PWhite.svg")));
  143. }
  144. };
  145. struct Rogan2SGray : Rogan {
  146. Rogan2SGray() {
  147. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan2SGray.svg")));
  148. }
  149. };
  150. struct Rogan2PSBlue : Rogan {
  151. Rogan2PSBlue() {
  152. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan2PSBlue.svg")));
  153. }
  154. };
  155. struct Rogan2PSRed : Rogan {
  156. Rogan2PSRed() {
  157. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan2PSRed.svg")));
  158. }
  159. };
  160. struct Rogan2PSGreen : Rogan {
  161. Rogan2PSGreen() {
  162. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan2PSGreen.svg")));
  163. }
  164. };
  165. struct Rogan2PSWhite : Rogan {
  166. Rogan2PSWhite() {
  167. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan2PSWhite.svg")));
  168. }
  169. };
  170. struct Rogan2PBlue : Rogan {
  171. Rogan2PBlue() {
  172. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan2PBlue.svg")));
  173. }
  174. };
  175. struct Rogan2PRed : Rogan {
  176. Rogan2PRed() {
  177. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan2PRed.svg")));
  178. }
  179. };
  180. struct Rogan2PGreen : Rogan {
  181. Rogan2PGreen() {
  182. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan2PGreen.svg")));
  183. }
  184. };
  185. struct Rogan2PWhite : Rogan {
  186. Rogan2PWhite() {
  187. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan2PWhite.svg")));
  188. }
  189. };
  190. struct Rogan1PSBlue : Rogan {
  191. Rogan1PSBlue() {
  192. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan1PSBlue.svg")));
  193. }
  194. };
  195. struct Rogan1PSRed : Rogan {
  196. Rogan1PSRed() {
  197. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan1PSRed.svg")));
  198. }
  199. };
  200. struct Rogan1PSGreen : Rogan {
  201. Rogan1PSGreen() {
  202. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan1PSGreen.svg")));
  203. }
  204. };
  205. struct Rogan1PSWhite : Rogan {
  206. Rogan1PSWhite() {
  207. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan1PSWhite.svg")));
  208. }
  209. };
  210. struct Rogan1PBlue : Rogan {
  211. Rogan1PBlue() {
  212. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan1PBlue.svg")));
  213. }
  214. };
  215. struct Rogan1PRed : Rogan {
  216. Rogan1PRed() {
  217. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan1PRed.svg")));
  218. }
  219. };
  220. struct Rogan1PGreen : Rogan {
  221. Rogan1PGreen() {
  222. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan1PGreen.svg")));
  223. }
  224. };
  225. struct Rogan1PWhite : Rogan {
  226. Rogan1PWhite() {
  227. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan1PWhite.svg")));
  228. }
  229. };
  230. struct SynthTechAlco : SVGKnob {
  231. SynthTechAlco() {
  232. minAngle = -0.82*M_PI;
  233. maxAngle = 0.82*M_PI;
  234. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/SynthTechAlco.svg")));
  235. SVGWidget *cap = new SVGWidget();
  236. cap->setSVG(SVG::load(assetGlobal("res/ComponentLibrary/SynthTechAlco_cap.svg")));
  237. addChild(cap);
  238. }
  239. };
  240. struct Trimpot : SVGKnob {
  241. Trimpot() {
  242. box.size = Vec(17, 17);
  243. minAngle = -0.75*M_PI;
  244. maxAngle = 0.75*M_PI;
  245. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Trimpot.svg")));
  246. }
  247. };
  248. struct BefacoBigKnob : SVGKnob {
  249. BefacoBigKnob() {
  250. box.size = Vec(75, 75);
  251. minAngle = -0.75*M_PI;
  252. maxAngle = 0.75*M_PI;
  253. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/BefacoBigKnob.svg")));
  254. }
  255. };
  256. struct BefacoBigSnapKnob : BefacoBigKnob {
  257. BefacoBigSnapKnob() {
  258. snap = true;
  259. }
  260. };
  261. struct BefacoTinyKnob : SVGKnob {
  262. BefacoTinyKnob() {
  263. box.size = Vec(26, 26);
  264. minAngle = -0.75*M_PI;
  265. maxAngle = 0.75*M_PI;
  266. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/BefacoTinyKnob.svg")));
  267. }
  268. };
  269. struct BefacoSlidePot : SVGFader {
  270. BefacoSlidePot() {
  271. Vec margin = Vec(3.5, 3.5);
  272. maxHandlePos = Vec(-1, -2).plus(margin);
  273. minHandlePos = Vec(-1, 87).plus(margin);
  274. background->svg = SVG::load(assetGlobal("res/ComponentLibrary/BefacoSlidePot.svg"));
  275. background->wrap();
  276. background->box.pos = margin;
  277. box.size = background->box.size.plus(margin.mult(2));
  278. handle->svg = SVG::load(assetGlobal("res/ComponentLibrary/BefacoSlidePotHandle.svg"));
  279. handle->wrap();
  280. }
  281. };
  282. ////////////////////
  283. // IO widgets
  284. ////////////////////
  285. struct USB_B_AudioWidget : AudioWidget, SVGWidget {
  286. USB_B_AudioWidget() {
  287. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/USB-B.svg")));
  288. }
  289. };
  290. struct MIDI_DIN_MidiWidget : MidiWidget, SVGWidget {
  291. MIDI_DIN_MidiWidget() {
  292. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/MIDI_DIN.svg")));
  293. }
  294. };
  295. ////////////////////
  296. // Jacks
  297. ////////////////////
  298. struct PJ301MPort : SVGPort {
  299. PJ301MPort() {
  300. background->svg = SVG::load(assetGlobal("res/ComponentLibrary/PJ301M.svg"));
  301. background->wrap();
  302. box.size = background->box.size;
  303. }
  304. };
  305. struct PJ3410Port : SVGPort {
  306. PJ3410Port() {
  307. background->svg = SVG::load(assetGlobal("res/ComponentLibrary/PJ3410.svg"));
  308. background->wrap();
  309. box.size = background->box.size;
  310. }
  311. };
  312. struct CL1362Port : SVGPort {
  313. CL1362Port() {
  314. background->svg = SVG::load(assetGlobal("res/ComponentLibrary/CL1362.svg"));
  315. background->wrap();
  316. box.size = background->box.size;
  317. }
  318. };
  319. ////////////////////
  320. // Lights
  321. ////////////////////
  322. struct RedLight : ModuleLightWidget {
  323. RedLight() {
  324. addBaseColor(COLOR_RED);
  325. }
  326. };
  327. struct GreenLight : ModuleLightWidget {
  328. GreenLight() {
  329. addBaseColor(COLOR_GREEN);
  330. }
  331. };
  332. struct YellowLight : ModuleLightWidget {
  333. YellowLight() {
  334. addBaseColor(COLOR_YELLOW);
  335. }
  336. };
  337. struct BlueLight : ModuleLightWidget {
  338. BlueLight() {
  339. addBaseColor(COLOR_BLUE);
  340. }
  341. };
  342. /** Reads two adjacent lightIds, so `lightId` and `lightId + 1` must be defined */
  343. struct GreenRedLight : ModuleLightWidget {
  344. GreenRedLight() {
  345. addBaseColor(COLOR_GREEN);
  346. addBaseColor(COLOR_RED);
  347. }
  348. };
  349. struct RedGreenBlueLight : ModuleLightWidget {
  350. RedGreenBlueLight() {
  351. addBaseColor(COLOR_RED);
  352. addBaseColor(COLOR_GREEN);
  353. addBaseColor(COLOR_BLUE);
  354. }
  355. };
  356. /** Based on the size of 5mm LEDs */
  357. template <typename BASE>
  358. struct LargeLight : BASE {
  359. LargeLight() {
  360. this->box.size = mm2px(Vec(5.179, 5.179));
  361. }
  362. };
  363. /** Based on the size of 3mm LEDs */
  364. template <typename BASE>
  365. struct MediumLight : BASE {
  366. MediumLight() {
  367. this->box.size = mm2px(Vec(3.176, 3.176));
  368. }
  369. };
  370. /** Based on the size of 2mm LEDs */
  371. template <typename BASE>
  372. struct SmallLight : BASE {
  373. SmallLight() {
  374. this->box.size = mm2px(Vec(2.176, 2.176));
  375. }
  376. };
  377. /** Based on the size of 1mm LEDs */
  378. template <typename BASE>
  379. struct TinyLight : BASE {
  380. TinyLight() {
  381. this->box.size = mm2px(Vec(1.088, 1.088));
  382. }
  383. };
  384. ////////////////////
  385. // Switches and Buttons
  386. ////////////////////
  387. struct NKK : SVGSwitch, ToggleSwitch {
  388. NKK() {
  389. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/NKK_0.svg")));
  390. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/NKK_1.svg")));
  391. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/NKK_2.svg")));
  392. }
  393. };
  394. struct CKSS : SVGSwitch, ToggleSwitch {
  395. CKSS() {
  396. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/CKSS_0.svg")));
  397. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/CKSS_1.svg")));
  398. }
  399. };
  400. struct CKSSThree : SVGSwitch, ToggleSwitch {
  401. CKSSThree() {
  402. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/CKSSThree_0.svg")));
  403. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/CKSSThree_1.svg")));
  404. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/CKSSThree_2.svg")));
  405. }
  406. };
  407. struct CKD6 : SVGSwitch, MomentarySwitch {
  408. CKD6() {
  409. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/CKD6_0.svg")));
  410. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/CKD6_1.svg")));
  411. }
  412. };
  413. struct TL1105 : SVGSwitch, MomentarySwitch {
  414. TL1105() {
  415. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/TL1105_0.svg")));
  416. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/TL1105_1.svg")));
  417. }
  418. };
  419. struct LEDButton : SVGSwitch, MomentarySwitch {
  420. LEDButton() {
  421. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/LEDButton.svg")));
  422. }
  423. };
  424. struct BefacoSwitch : SVGSwitch, ToggleSwitch {
  425. BefacoSwitch() {
  426. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/BefacoSwitch_0.svg")));
  427. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/BefacoSwitch_1.svg")));
  428. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/BefacoSwitch_2.svg")));
  429. }
  430. };
  431. struct BefacoPush : SVGSwitch, MomentarySwitch {
  432. BefacoPush() {
  433. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/BefacoPush_0.svg")));
  434. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/BefacoPush_1.svg")));
  435. }
  436. };
  437. struct PB61303 : SVGSwitch, MomentarySwitch {
  438. PB61303() {
  439. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/PB61303.svg")));
  440. }
  441. };
  442. struct LEDBezel : SVGSwitch, MomentarySwitch {
  443. LEDBezel() {
  444. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/LEDBezel.svg")));
  445. }
  446. };
  447. ////////////////////
  448. // Misc
  449. ////////////////////
  450. struct ScrewSilver : SVGScrew {
  451. ScrewSilver() {
  452. sw->setSVG(SVG::load(assetGlobal("res/ComponentLibrary/ScrewSilver.svg")));
  453. box.size = sw->box.size;
  454. }
  455. };
  456. struct ScrewBlack : SVGScrew {
  457. ScrewBlack() {
  458. sw->setSVG(SVG::load(assetGlobal("res/ComponentLibrary/ScrewBlack.svg")));
  459. box.size = sw->box.size;
  460. }
  461. };
  462. struct LightPanel : Panel {
  463. LightPanel() {
  464. backgroundColor = nvgRGB(0xe6, 0xe6, 0xe6);
  465. }
  466. };
  467. struct DarkPanel : Panel {
  468. DarkPanel() {
  469. backgroundColor = nvgRGB(0x17, 0x17, 0x17);
  470. }
  471. };
  472. } // namespace rack