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.

49 lines
1.6KB

  1. #include "oscTestModule.hpp"
  2. #ifdef OSCTEST_MODULE
  3. void OscTest::step()
  4. {
  5. drv->ProcessOSC();
  6. connected = drv->Connected() ? 1.0 : 0.0;
  7. if(clock() - lasttime > 1000)
  8. {
  9. lasttime = clock();
  10. lights[LED1].value = lights[LED1].value > 0 ? 0 : 10;
  11. }
  12. outputs[OUT_1].value = params[BTN1].value > 0 ? LVL_ON : LVL_OFF;
  13. }
  14. OscTestWidget::OscTestWidget(OscTest *module) : ModuleWidget(module)
  15. {
  16. box.size = Vec(8 * RACK_GRID_WIDTH, RACK_GRID_HEIGHT);
  17. {
  18. LightPanel *panel = new LightPanel();
  19. panel->box.size = box.size;
  20. addChild(panel);
  21. }
  22. addChild(Widget::create<ScrewSilver>(Vec(RACK_GRID_WIDTH, 0)));
  23. addChild(Widget::create<ScrewSilver>(Vec(box.size.x - 2 * RACK_GRID_WIDTH, 0)));
  24. addChild(Widget::create<ScrewSilver>(Vec(RACK_GRID_WIDTH, RACK_GRID_HEIGHT - RACK_GRID_WIDTH)));
  25. addChild(Widget::create<ScrewSilver>(Vec(box.size.x - 2 * RACK_GRID_WIDTH, RACK_GRID_HEIGHT - RACK_GRID_WIDTH)));
  26. addChild(new DigitalLed(60, 20, &module->connected));
  27. ParamWidget *pctrl = ParamWidget::create<Davies1900hBlackKnob>(Vec(20, 70), module, OscTest::POT1, 0.0, 1.0, 0.0);
  28. oscControl *oc = new oscControl("/Knob1");
  29. module->drv->Add(oc, pctrl);
  30. addParam(pctrl); // rnd threshold
  31. ModuleLightWidget *plight = ModuleLightWidget::create<MediumLight<RedLight>>(Vec(60, 70), module, OscTest::LED1);
  32. oc = new oscControl("/Led1");
  33. module->drv->Add(oc, plight);
  34. addChild(plight);
  35. addOutput(Port::create<PJ301MPort>(Vec(50, 100), Port::OUTPUT, module, OscTest::OUT_1 ));
  36. pctrl = ParamWidget::create<CKSS>(Vec(20, 20), module, OscTest::BTN1, 0.0, 1.0, 0.0);
  37. oc = new oscControl("/Switch1");
  38. module->drv->Add(oc, pctrl);
  39. addParam(pctrl);
  40. }
  41. #endif