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.

163 lines
3.7KB

  1. //***********************************************************************************************
  2. //Geodesics: A modular collection for VCV Rack by Pierre Collard and Marc Boulé
  3. //
  4. //Based on code from the Fundamental plugins by Andrew Belt
  5. // and graphics from the Component Library by Wes Milholen
  6. //See ./LICENSE.txt for all licenses
  7. //See ./res/fonts/ for font licenses
  8. //
  9. //***********************************************************************************************
  10. #ifndef GEODESICS_HPP
  11. #define GEODESICS_HPP
  12. #include "rack.hpp"
  13. #include "GeoWidgets.hpp"
  14. #include "dsp/digital.hpp"
  15. using namespace rack;
  16. RACK_PLUGIN_DECLARE(Geodesics);
  17. #ifdef USE_VST2
  18. #define plugin "Geodesics"
  19. #endif // USE_VST2
  20. namespace rack_plugin_Geodesics {
  21. // General constants
  22. static const float lightLambda = 0.075f;
  23. static const std::string lightPanelID = "White light";
  24. static const std::string darkPanelID = "Dark copper";
  25. // Variations on existing knobs, lights, etc
  26. // Ports
  27. struct GeoPort : DynamicSVGPort {
  28. GeoPort() {
  29. shadow->blurRadius = 10.0;
  30. shadow->opacity = 0.8;
  31. addFrame(SVG::load(assetPlugin(plugin, "res/light/comp/Jack.svg")));
  32. //addFrame(SVG::load(assetPlugin(plugin, "res/dark/comp/Jack.svg")));// no dark ports in Geodesics for now
  33. }
  34. };
  35. struct BlankPort : SVGPort {
  36. BlankPort() {
  37. shadow->opacity = 0.0;
  38. setSVG(SVG::load(assetPlugin(plugin, "res/comp/Otrsp-01.svg")));
  39. }
  40. };
  41. // Buttons and switches
  42. struct GeoPushButton : DynamicSVGSwitch, MomentarySwitch {
  43. GeoPushButton() {// only one skin for now
  44. addFrameAll(SVG::load(assetPlugin(plugin, "res/light/comp/PushButton1_0.svg")));
  45. addFrameAll(SVG::load(assetPlugin(plugin, "res/light/comp/PushButton1_1.svg")));
  46. //addFrameAll(SVG::load(assetPlugin(plugin, "res/dark/comp/CKD6b_0.svg"))); // no dark buttons in Geodesics for now
  47. //addFrameAll(SVG::load(assetPlugin(plugin, "res/dark/comp/CKD6b_1.svg"))); // no dark buttons in Geodesics for now
  48. }
  49. };
  50. // Knobs
  51. struct GeoKnob : DynamicSVGKnob {
  52. GeoKnob() {
  53. minAngle = -0.73*M_PI;
  54. maxAngle = 0.73*M_PI;
  55. shadow->blurRadius = 10.0;
  56. shadow->opacity = 0.8;
  57. //shadow->box.pos = Vec(0.0, box.size.y * 0.15); may need this if know is small (taken from IMSmallKnob)
  58. addFrameAll(SVG::load(assetPlugin(plugin, "res/light/comp/Knob.svg")));
  59. //addFrameAll(SVG::load(assetPlugin(plugin, "res/dark/comp/Knob.svg")));// no dark knobs in Geodesics for now
  60. }
  61. };
  62. struct GeoKnobRight : GeoKnob {
  63. GeoKnobRight() {
  64. orientationAngle = M_PI / 2.0f;
  65. }
  66. };
  67. struct GeoKnobLeft : GeoKnob {
  68. GeoKnobLeft() {
  69. orientationAngle = M_PI / -2.0f;
  70. }
  71. };
  72. struct GeoKnobBottom : GeoKnob {
  73. GeoKnobBottom() {
  74. orientationAngle = M_PI;
  75. }
  76. };
  77. struct BlankCKnob : SVGKnob {
  78. BlankCKnob() {
  79. minAngle = -0.73*M_PI;
  80. maxAngle = 0.73*M_PI;
  81. shadow->opacity = 0.0;
  82. setSVG(SVG::load(assetPlugin(plugin, "res/comp/C-01.svg")));
  83. }
  84. };
  85. // Lights
  86. struct GeoGrayModuleLight : ModuleLightWidget {
  87. GeoGrayModuleLight() {
  88. bgColor = nvgRGB(0x8e, 0x8e, 0x8e);
  89. borderColor = nvgRGBA(0, 0, 0, 0x60);
  90. }
  91. };
  92. struct GeoWhiteLight : GeoGrayModuleLight {
  93. GeoWhiteLight() {
  94. addBaseColor(COLOR_WHITE);
  95. }
  96. };
  97. struct GeoBlueLight : GeoGrayModuleLight {
  98. GeoBlueLight() {
  99. addBaseColor(COLOR_BLUE);
  100. }
  101. };
  102. struct GeoRedLight : GeoGrayModuleLight {
  103. GeoRedLight() {
  104. addBaseColor(COLOR_RED);
  105. }
  106. };
  107. struct GeoYellowLight : GeoGrayModuleLight {
  108. GeoYellowLight() {
  109. addBaseColor(COLOR_YELLOW);
  110. }
  111. };
  112. struct GeoWhiteRedLight : GeoGrayModuleLight {
  113. GeoWhiteRedLight() {
  114. addBaseColor(COLOR_WHITE);
  115. addBaseColor(COLOR_RED);
  116. }
  117. };struct GeoBlueYellowWhiteLight : GeoGrayModuleLight {
  118. GeoBlueYellowWhiteLight() {
  119. addBaseColor(COLOR_BLUE);
  120. addBaseColor(COLOR_YELLOW);
  121. addBaseColor(COLOR_WHITE);
  122. }
  123. };
  124. // Other
  125. } // namespace rack_plugin_Geodesics
  126. using namespace rack_plugin_Geodesics;
  127. #endif