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.

Fl_Osc_Numeric_Input.cpp 754B

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