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.

534 lines
10KB

  1. #pragma once
  2. #include "app.hpp"
  3. namespace rack {
  4. ////////////////////
  5. // Knobs
  6. ////////////////////
  7. struct Rogan : SVGKnob {
  8. Rogan() {
  9. minAngle = -0.75*M_PI;
  10. maxAngle = 0.75*M_PI;
  11. }
  12. };
  13. struct Rogan6PS : Rogan {
  14. Rogan6PS() {
  15. box.size = Vec(89, 89);
  16. minAngle = -0.83*M_PI;
  17. maxAngle = 0.83*M_PI;
  18. }
  19. };
  20. struct Rogan5PS : Rogan {
  21. Rogan5PS() {
  22. box.size = Vec(60, 60);
  23. }
  24. };
  25. struct Rogan3PS : Rogan {
  26. Rogan3PS() {
  27. box.size = Vec(52, 52);
  28. }
  29. };
  30. struct Rogan3P : Rogan {
  31. Rogan3P() {
  32. box.size = Vec(42, 42);
  33. }
  34. };
  35. struct Rogan2S : Rogan {
  36. Rogan2S() {
  37. box.size = Vec(43, 43);
  38. }
  39. };
  40. struct Rogan2PS : Rogan {
  41. Rogan2PS() {
  42. box.size = Vec(43, 43);
  43. }
  44. };
  45. struct Rogan2P : Rogan {
  46. Rogan2P() {
  47. box.size = Vec(34, 34);
  48. }
  49. };
  50. struct Rogan1PS : Rogan {
  51. Rogan1PS() {
  52. box.size = Vec(40, 40);
  53. }
  54. };
  55. struct Rogan1P : Rogan {
  56. Rogan1P() {
  57. box.size = Vec(31, 31);
  58. }
  59. };
  60. struct Rogan6PSWhite : Rogan6PS {
  61. Rogan6PSWhite() {
  62. setSVG(SVG::load("res/ComponentLibrary/Rogan6PSWhite.svg"));
  63. }
  64. };
  65. struct Rogan5PSGray : Rogan5PS {
  66. Rogan5PSGray() {
  67. setSVG(SVG::load("res/ComponentLibrary/Rogan5PSGray.svg"));
  68. }
  69. };
  70. struct Rogan3PSBlue : Rogan3PS {
  71. Rogan3PSBlue() {
  72. setSVG(SVG::load("res/ComponentLibrary/Rogan3PSBlue.svg"));
  73. }
  74. };
  75. struct Rogan3PSRed : Rogan3PS {
  76. Rogan3PSRed() {
  77. setSVG(SVG::load("res/ComponentLibrary/Rogan3PSRed.svg"));
  78. }
  79. };
  80. struct Rogan3PSGreen : Rogan3PS {
  81. Rogan3PSGreen() {
  82. setSVG(SVG::load("res/ComponentLibrary/Rogan3PSGreen.svg"));
  83. }
  84. };
  85. struct Rogan3PSWhite : Rogan3PS {
  86. Rogan3PSWhite() {
  87. setSVG(SVG::load("res/ComponentLibrary/Rogan3PSWhite.svg"));
  88. }
  89. };
  90. struct Rogan3PBlue : Rogan3P {
  91. Rogan3PBlue() {
  92. setSVG(SVG::load("res/ComponentLibrary/Rogan3PBlue.svg"));
  93. }
  94. };
  95. struct Rogan3PRed : Rogan3P {
  96. Rogan3PRed() {
  97. setSVG(SVG::load("res/ComponentLibrary/Rogan3PRed.svg"));
  98. }
  99. };
  100. struct Rogan3PGreen : Rogan3P {
  101. Rogan3PGreen() {
  102. setSVG(SVG::load("res/ComponentLibrary/Rogan3PGreen.svg"));
  103. }
  104. };
  105. struct Rogan3PWhite : Rogan3P {
  106. Rogan3PWhite() {
  107. setSVG(SVG::load("res/ComponentLibrary/Rogan3PWhite.svg"));
  108. }
  109. };
  110. struct Rogan2SGray : Rogan2S {
  111. Rogan2SGray() {
  112. setSVG(SVG::load("res/ComponentLibrary/Rogan2SGray.svg"));
  113. }
  114. };
  115. struct Rogan2PSBlue : Rogan2PS {
  116. Rogan2PSBlue() {
  117. setSVG(SVG::load("res/ComponentLibrary/Rogan2PSBlue.svg"));
  118. }
  119. };
  120. struct Rogan2PSRed : Rogan2PS {
  121. Rogan2PSRed() {
  122. setSVG(SVG::load("res/ComponentLibrary/Rogan2PSRed.svg"));
  123. }
  124. };
  125. struct Rogan2PSGreen : Rogan2PS {
  126. Rogan2PSGreen() {
  127. setSVG(SVG::load("res/ComponentLibrary/Rogan2PSGreen.svg"));
  128. }
  129. };
  130. struct Rogan2PSWhite : Rogan2PS {
  131. Rogan2PSWhite() {
  132. setSVG(SVG::load("res/ComponentLibrary/Rogan2PSWhite.svg"));
  133. }
  134. };
  135. struct Rogan2PBlue : Rogan2P {
  136. Rogan2PBlue() {
  137. setSVG(SVG::load("res/ComponentLibrary/Rogan2PBlue.svg"));
  138. }
  139. };
  140. struct Rogan2PRed : Rogan2P {
  141. Rogan2PRed() {
  142. setSVG(SVG::load("res/ComponentLibrary/Rogan2PRed.svg"));
  143. }
  144. };
  145. struct Rogan2PGreen : Rogan2P {
  146. Rogan2PGreen() {
  147. setSVG(SVG::load("res/ComponentLibrary/Rogan2PGreen.svg"));
  148. }
  149. };
  150. struct Rogan2PWhite : Rogan2P {
  151. Rogan2PWhite() {
  152. setSVG(SVG::load("res/ComponentLibrary/Rogan2PWhite.svg"));
  153. }
  154. };
  155. struct Rogan1PSBlue : Rogan1PS {
  156. Rogan1PSBlue() {
  157. setSVG(SVG::load("res/ComponentLibrary/Rogan1PSBlue.svg"));
  158. }
  159. };
  160. struct Rogan1PSRed : Rogan1PS {
  161. Rogan1PSRed() {
  162. setSVG(SVG::load("res/ComponentLibrary/Rogan1PSRed.svg"));
  163. }
  164. };
  165. struct Rogan1PSGreen : Rogan1PS {
  166. Rogan1PSGreen() {
  167. setSVG(SVG::load("res/ComponentLibrary/Rogan1PSGreen.svg"));
  168. }
  169. };
  170. struct Rogan1PSWhite : Rogan1PS {
  171. Rogan1PSWhite() {
  172. setSVG(SVG::load("res/ComponentLibrary/Rogan1PSWhite.svg"));
  173. }
  174. };
  175. struct Rogan1PBlue : Rogan1P {
  176. Rogan1PBlue() {
  177. setSVG(SVG::load("res/ComponentLibrary/Rogan1PBlue.svg"));
  178. }
  179. };
  180. struct Rogan1PRed : Rogan1P {
  181. Rogan1PRed() {
  182. setSVG(SVG::load("res/ComponentLibrary/Rogan1PRed.svg"));
  183. }
  184. };
  185. struct Rogan1PGreen : Rogan1P {
  186. Rogan1PGreen() {
  187. setSVG(SVG::load("res/ComponentLibrary/Rogan1PGreen.svg"));
  188. }
  189. };
  190. struct Rogan1PWhite : Rogan1P {
  191. Rogan1PWhite() {
  192. setSVG(SVG::load("res/ComponentLibrary/Rogan1PWhite.svg"));
  193. }
  194. };
  195. struct SynthTechAlco : SVGKnob {
  196. SynthTechAlco() {
  197. box.size = Vec(45, 45);
  198. minAngle = -0.82*M_PI;
  199. maxAngle = 0.82*M_PI;
  200. setSVG(SVG::load("res/ComponentLibrary/SynthTechAlco.svg"));
  201. }
  202. };
  203. struct Davies1900hKnob : SVGKnob {
  204. Davies1900hKnob() {
  205. box.size = Vec(36, 36);
  206. minAngle = -0.75*M_PI;
  207. maxAngle = 0.75*M_PI;
  208. }
  209. };
  210. struct Davies1900hWhiteKnob : Davies1900hKnob {
  211. Davies1900hWhiteKnob() {
  212. setSVG(SVG::load("res/ComponentLibrary/Davies1900hWhite.svg"));
  213. }
  214. };
  215. struct Davies1900hBlackKnob : Davies1900hKnob {
  216. Davies1900hBlackKnob() {
  217. setSVG(SVG::load("res/ComponentLibrary/Davies1900hBlack.svg"));
  218. }
  219. };
  220. struct Davies1900hRedKnob : Davies1900hKnob {
  221. Davies1900hRedKnob() {
  222. setSVG(SVG::load("res/ComponentLibrary/Davies1900hRed.svg"));
  223. }
  224. };
  225. struct Davies1900hLargeWhiteKnob : Davies1900hKnob {
  226. Davies1900hLargeWhiteKnob() {
  227. setSVG(SVG::load("res/ComponentLibrary/Davies1900hLargeWhite.svg"));
  228. }
  229. };
  230. struct Davies1900hLargeBlackKnob : Davies1900hKnob {
  231. Davies1900hLargeBlackKnob() {
  232. setSVG(SVG::load("res/ComponentLibrary/Davies1900hLargeBlack.svg"));
  233. }
  234. };
  235. struct Davies1900hLargeRedKnob : Davies1900hKnob {
  236. Davies1900hLargeRedKnob() {
  237. setSVG(SVG::load("res/ComponentLibrary/Davies1900hLargeRed.svg"));
  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("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("res/ComponentLibrary/BefacoBigKnob.svg"));
  254. }
  255. };
  256. struct BefacoTinyKnob : SVGKnob {
  257. BefacoTinyKnob() {
  258. box.size = Vec(26, 26);
  259. minAngle = -0.75*M_PI;
  260. maxAngle = 0.75*M_PI;
  261. setSVG(SVG::load("res/ComponentLibrary/BefacoTinyKnob.svg"));
  262. }
  263. };
  264. struct BefacoSlidePot : SVGSlider {
  265. BefacoSlidePot() {
  266. Vec margin = Vec(3.5, 3.5);
  267. maxHandlePos = Vec(-1, -2).plus(margin);
  268. minHandlePos = Vec(-1, 87).plus(margin);
  269. background->svg = SVG::load("res/ComponentLibrary/BefacoSlidePot.svg");
  270. background->wrap();
  271. background->box.pos = margin;
  272. box.size = background->box.size.plus(margin.mult(2));
  273. handle->svg = SVG::load("res/ComponentLibrary/BefacoSlidePotHandle.svg");
  274. handle->wrap();
  275. }
  276. };
  277. ////////////////////
  278. // Jacks
  279. ////////////////////
  280. struct PJ301MPort : SVGPort {
  281. PJ301MPort() {
  282. padding = Vec(1, 1);
  283. background->svg = SVG::load("res/ComponentLibrary/PJ301M.svg");
  284. background->wrap();
  285. box.size = background->box.size;
  286. }
  287. };
  288. struct PJ3410Port : SVGPort {
  289. PJ3410Port() {
  290. padding = Vec(1, 1);
  291. background->svg = SVG::load("res/ComponentLibrary/PJ3410.svg");
  292. background->wrap();
  293. box.size = background->box.size;
  294. }
  295. };
  296. struct CL1362Port : SVGPort {
  297. CL1362Port() {
  298. padding = Vec(1, 1);
  299. background->svg = SVG::load("res/ComponentLibrary/CL1362.svg");
  300. background->wrap();
  301. box.size = background->box.size;
  302. }
  303. };
  304. ////////////////////
  305. // LEDs
  306. ////////////////////
  307. struct ValueLight : Light {
  308. float *value;
  309. };
  310. struct ColorValueLight : ValueLight {
  311. NVGcolor baseColor;
  312. void step() {
  313. float v = sqrtBipolar(getf(value));
  314. color = baseColor;
  315. color.a = clampf(v, 0.0, 1.0);
  316. }
  317. };
  318. struct RedValueLight : ColorValueLight {
  319. RedValueLight() {
  320. baseColor = nvgRGB(0xed, 0x2c, 0x24);
  321. }
  322. };
  323. struct YellowValueLight : ColorValueLight {
  324. YellowValueLight() {
  325. baseColor = nvgRGB(0xf9, 0xdf, 0x1c);
  326. }
  327. };
  328. struct GreenValueLight : ColorValueLight {
  329. GreenValueLight() {
  330. baseColor = nvgRGB(0x90, 0xc7, 0x3e);
  331. }
  332. };
  333. struct PolarityLight : ValueLight {
  334. NVGcolor posColor;
  335. NVGcolor negColor;
  336. void step() {
  337. float v = sqrtBipolar(getf(value));
  338. color = (v >= 0.0) ? posColor : negColor;
  339. color.a = clampf(fabsf(v), 0.0, 1.0);
  340. }
  341. };
  342. struct GreenRedPolarityLight : PolarityLight {
  343. GreenRedPolarityLight() {
  344. posColor = nvgRGB(0x90, 0xc7, 0x3e);
  345. negColor = nvgRGB(0xed, 0x2c, 0x24);
  346. }
  347. };
  348. template <typename BASE>
  349. struct LargeLight : BASE {
  350. LargeLight() {
  351. this->box.size = Vec(20, 20);
  352. }
  353. };
  354. template <typename BASE>
  355. struct MediumLight : BASE {
  356. MediumLight() {
  357. this->box.size = Vec(12, 12);
  358. }
  359. };
  360. template <typename BASE>
  361. struct SmallLight : BASE {
  362. SmallLight() {
  363. this->box.size = Vec(8, 8);
  364. }
  365. };
  366. ////////////////////
  367. // Switches and Buttons
  368. ////////////////////
  369. struct NKK : SVGSwitch, ToggleSwitch {
  370. NKK() {
  371. addFrame(SVG::load("res/ComponentLibrary/NKK_0.svg"));
  372. addFrame(SVG::load("res/ComponentLibrary/NKK_1.svg"));
  373. addFrame(SVG::load("res/ComponentLibrary/NKK_2.svg"));
  374. sw->wrap();
  375. box.size = sw->box.size;
  376. }
  377. };
  378. struct CKSS : SVGSwitch, ToggleSwitch {
  379. CKSS() {
  380. addFrame(SVG::load("res/ComponentLibrary/CKSS_0.svg"));
  381. addFrame(SVG::load("res/ComponentLibrary/CKSS_1.svg"));
  382. sw->wrap();
  383. box.size = sw->box.size;
  384. }
  385. };
  386. struct CKD6 : SVGSwitch, MomentarySwitch {
  387. CKD6() {
  388. addFrame(SVG::load("res/ComponentLibrary/CKD6_0.svg"));
  389. addFrame(SVG::load("res/ComponentLibrary/CKD6_1.svg"));
  390. sw->wrap();
  391. box.size = sw->box.size;
  392. }
  393. };
  394. struct TL1105 : SVGSwitch, MomentarySwitch {
  395. TL1105() {
  396. addFrame(SVG::load("res/ComponentLibrary/TL1105_0.svg"));
  397. addFrame(SVG::load("res/ComponentLibrary/TL1105_1.svg"));
  398. sw->wrap();
  399. box.size = sw->box.size;
  400. }
  401. };
  402. struct BefacoSwitch : SVGSwitch, ToggleSwitch {
  403. BefacoSwitch() {
  404. addFrame(SVG::load("res/ComponentLibrary/BefacoSwitch_0.svg"));
  405. addFrame(SVG::load("res/ComponentLibrary/BefacoSwitch_1.svg"));
  406. addFrame(SVG::load("res/ComponentLibrary/BefacoSwitch_2.svg"));
  407. sw->wrap();
  408. box.size = sw->box.size;
  409. }
  410. };
  411. struct BefacoPush : SVGSwitch, MomentarySwitch {
  412. BefacoPush() {
  413. addFrame(SVG::load("res/ComponentLibrary/BefacoPush_0.svg"));
  414. addFrame(SVG::load("res/ComponentLibrary/BefacoPush_1.svg"));
  415. sw->wrap();
  416. box.size = sw->box.size;
  417. }
  418. };
  419. ////////////////////
  420. // Misc
  421. ////////////////////
  422. struct ScrewSilver : SVGScrew {
  423. ScrewSilver() {
  424. sw->svg = SVG::load("res/ComponentLibrary/ScrewSilver.svg");
  425. sw->wrap();
  426. box.size = sw->box.size;
  427. }
  428. };
  429. struct ScrewBlack : SVGScrew {
  430. ScrewBlack() {
  431. sw->svg = SVG::load("res/ComponentLibrary/ScrewBlack.svg");
  432. sw->wrap();
  433. box.size = sw->box.size;
  434. }
  435. };
  436. struct LightPanel : Panel {
  437. LightPanel() {
  438. backgroundColor = nvgRGB(0xe8, 0xe8, 0xe8);
  439. borderColor = nvgRGB(0xac, 0xac, 0xac);
  440. }
  441. };
  442. struct DarkPanel : Panel {
  443. DarkPanel() {
  444. backgroundColor = nvgRGB(0x17, 0x17, 0x17);
  445. borderColor = nvgRGB(0x5e, 0x5e, 0x5e);
  446. }
  447. };
  448. } // namespace rack