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.

65 lines
1.7KB

  1. #include "Bidoo.hpp"
  2. #include "BidooComponents.hpp"
  3. #include "dsp/digital.hpp"
  4. using namespace std;
  5. namespace rack_plugin_Bidoo {
  6. struct SIGMA : Module {
  7. enum ParamIds {
  8. NUM_PARAMS
  9. };
  10. enum InputIds {
  11. IN_INPUT,
  12. NUM_INPUTS = IN_INPUT + 18
  13. };
  14. enum OutputIds {
  15. OUT_OUTPUT,
  16. NUM_OUTPUTS = OUT_OUTPUT + 6
  17. };
  18. enum LightIds {
  19. NUM_LIGHTS
  20. };
  21. SIGMA() : Module(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS) {
  22. }
  23. void step() override;
  24. };
  25. void SIGMA::step() {
  26. for (int i = 0; i < NUM_OUTPUTS; i++) {
  27. outputs[i].value = inputs[3*i].value + inputs[3*i+1].value + inputs[3*i+2].value;
  28. }
  29. }
  30. struct SIGMAWidget : ModuleWidget {
  31. SIGMAWidget(SIGMA *module) : ModuleWidget(module) {
  32. setPanel(SVG::load(assetPlugin(plugin, "res/SIGMA.svg")));
  33. addChild(Widget::create<ScrewSilver>(Vec(RACK_GRID_WIDTH, 0)));
  34. addChild(Widget::create<ScrewSilver>(Vec(box.size.x - 2 * RACK_GRID_WIDTH, 0)));
  35. addChild(Widget::create<ScrewSilver>(Vec(RACK_GRID_WIDTH, RACK_GRID_HEIGHT - RACK_GRID_WIDTH)));
  36. addChild(Widget::create<ScrewSilver>(Vec(box.size.x - 2 * RACK_GRID_WIDTH, RACK_GRID_HEIGHT - RACK_GRID_WIDTH)));
  37. for (int i = 0; i < SIGMA::NUM_OUTPUTS; i++) {
  38. addOutput(Port::create<TinyPJ301MPort>(Vec(15.0f+round(i/3)*30.0f, 120.0f+(i%3)*100.0f),Port::OUTPUT, module, i));
  39. }
  40. for (int i = 0; i < SIGMA::NUM_INPUTS; i++) {
  41. addInput(Port::create<TinyPJ301MPort>(Vec(15.0f+round(i/9)*30.0f, 50.0f+(i%9)*20.0f+round((i%9)/3)*40.0f),Port::INPUT, module, i));
  42. }
  43. }
  44. };
  45. } // namespace rack_plugin_Bidoo
  46. using namespace rack_plugin_Bidoo;
  47. RACK_PLUGIN_MODEL_INIT(Bidoo, SIGMA) {
  48. Model *modelSIGMA= Model::create<SIGMA, SIGMAWidget>("Bidoo", "Σ", "Σ multiprise :)", MULTIPLE_TAG);
  49. return modelSIGMA;
  50. }