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.

98 lines
3.3KB

  1. #include "XF.hpp"
  2. namespace rack_plugin_SubmarineFree {
  3. struct XF_201 : XF {
  4. static const int deviceCount = 1;
  5. enum ParamIds {
  6. PARAM_CV_1,
  7. PARAM_MODE_1,
  8. PARAM_FADE_1,
  9. NUM_PARAMS
  10. };
  11. enum InputIds {
  12. INPUT_A_1,
  13. INPUT_AR_1,
  14. INPUT_B_1,
  15. INPUT_BR_1,
  16. INPUT_CV_1,
  17. NUM_INPUTS
  18. };
  19. enum OutputIds {
  20. OUTPUT_1,
  21. OUTPUTR_1,
  22. NUM_OUTPUTS
  23. };
  24. enum LightIds {
  25. LIGHT_LIN_1,
  26. LIGHT_LOG_1,
  27. LIGHT_AUTO_1, LIGHT_INV_1,
  28. NUM_LIGHTS
  29. };
  30. XF_Correlator correlators[deviceCount];
  31. XF_Controls controls[deviceCount];
  32. XF_201() : XF(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS) {
  33. for (int i = 0; i < deviceCount; i++) {
  34. controls[i].a = INPUT_A_1 + i;
  35. controls[i].ar = INPUT_AR_1 + i;
  36. controls[i].b = INPUT_B_1 + i;
  37. controls[i].br = INPUT_BR_1 + i;
  38. controls[i].fader = PARAM_FADE_1 + i;
  39. controls[i].cv = INPUT_CV_1 + i;
  40. controls[i].out = OUTPUT_1 + i;
  41. controls[i].outr = OUTPUTR_1 + i;
  42. controls[i].polar = PARAM_CV_1 + i;
  43. controls[i].mode = PARAM_MODE_1 + i;
  44. controls[i].light1 = LIGHT_LIN_1 + i;
  45. controls[i].light2 = LIGHT_LOG_1 + i;
  46. controls[i].light3 = LIGHT_AUTO_1 + i * 2;
  47. controls[i].correlator = &correlators[i];
  48. }
  49. }
  50. void step() override;
  51. };
  52. void XF_201::step() {
  53. crossFade(&controls[0]);
  54. }
  55. struct XF201 : ModuleWidget {
  56. XF201(XF_201 *module) : ModuleWidget(module) {
  57. XF_LightKnob *fader;
  58. setPanel(SVG::load(assetPlugin(plugin, "res/XF-201.svg")));
  59. for (int i = 0; i < XF_201::deviceCount; i++) {
  60. int offset = 176 * i;
  61. addInput(Port::create<sub_port>(Vec(3,18 + offset), Port::INPUT, module, XF_201::INPUT_A_1 + i));
  62. addInput(Port::create<sub_port_red>(Vec(3,45 + offset), Port::INPUT, module, XF_201::INPUT_AR_1 + i));
  63. addInput(Port::create<sub_port>(Vec(92,18 + offset), Port::INPUT, module, XF_201::INPUT_B_1 + i));
  64. addInput(Port::create<sub_port_red>(Vec(92,45 + offset), Port::INPUT, module, XF_201::INPUT_BR_1 + i));
  65. addInput(Port::create<sub_port>(Vec(3,120 + offset), Port::INPUT, module, XF_201::INPUT_CV_1 + i));
  66. addOutput(Port::create<sub_port>(Vec(92,93 + offset), Port::OUTPUT, module, XF_201::OUTPUT_1 + i));
  67. addOutput(Port::create<sub_port_red>(Vec(92,120 + offset), Port::OUTPUT, module, XF_201::OUTPUTR_1 + i));
  68. addParam(ParamWidget::create<sub_sw_2>(Vec(28, 154.5 + offset), module, XF_201::PARAM_CV_1 + i, 0.0f, 1.0f, 0.0f));
  69. addParam(ParamWidget::create<sub_sw_3>(Vec(65, 152 + offset), module, XF_201::PARAM_MODE_1 + i, 0.0f, 2.0f, 0.0f));
  70. fader = ParamWidget::create<XF_LightKnob>(Vec(33, 51 + offset), module, XF_201::PARAM_FADE_1 + i, 0.0f, 10.0f, 5.0f);
  71. fader->cv = XF_201::INPUT_CV_1 + i;
  72. fader->link = 0;
  73. addParam(fader);
  74. addChild(ModuleLightWidget::create<TinyLight<BlueLight>>(Vec(81, 156 + offset), module, XF_201::LIGHT_LIN_1 + i));
  75. addChild(ModuleLightWidget::create<TinyLight<BlueLight>>(Vec(81, 166 + offset), module, XF_201::LIGHT_LOG_1 + i));
  76. addChild(ModuleLightWidget::create<TinyLight<BlueRedLight>>(Vec(81, 176 + offset), module, XF_201::LIGHT_AUTO_1 + i * 2));
  77. }
  78. }
  79. };
  80. } // namespace rack_plugin_SubmarineFree
  81. using namespace rack_plugin_SubmarineFree;
  82. RACK_PLUGIN_MODEL_INIT(SubmarineFree, XF201) {
  83. Model *modelXF201 = Model::create<XF_201, XF201>("SubmarineFree", "XF-201", "XF-201 Single Stereo Cross Fader", MIXER_TAG);
  84. return modelXF201;
  85. }