Audio plugin host https://kx.studio/carla
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.

37 lines
734B

  1. #include "Fl_Osc_Numeric_Input.H"
  2. Fl_Osc_Numeric_Input::Fl_Osc_Numeric_Input(int X, int Y, int W, int H, const char *label)
  3. :Fl_Input(X,Y,W,H, label), Fl_Osc_Widget(this)
  4. {
  5. callback(numeric_callback);
  6. }
  7. Fl_Osc_Numeric_Input::~Fl_Osc_Numeric_Input(void)
  8. {}
  9. void Fl_Osc_Numeric_Input::init(const char *path)
  10. {
  11. ext = path;
  12. oscRegister(path);
  13. }
  14. void Fl_Osc_Numeric_Input::OSC_value(float f)
  15. {
  16. OSC_value((int)f);
  17. }
  18. void Fl_Osc_Numeric_Input::OSC_value(int i)
  19. {
  20. char buf[128];
  21. snprintf(buf, 128, "%d", i);
  22. value(buf);
  23. }
  24. void Fl_Osc_Numeric_Input::numeric_callback(Fl_Widget *w)
  25. {
  26. auto &ww = *(Fl_Osc_Numeric_Input *)w;
  27. int x = atoi(ww.value());
  28. if(x)
  29. ww.oscWrite(ww.ext, "i", x);
  30. }