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_Roller.cpp 918B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #include "Fl_Osc_Roller.H"
  2. #include <cstdlib>
  3. #include <cstring>
  4. #include <cmath>
  5. #include <cassert>
  6. #include <sstream>
  7. static void callback_fn_roller(Fl_Widget *w, void *)
  8. {
  9. ((Fl_Osc_Roller*)w)->cb();
  10. }
  11. Fl_Osc_Roller::Fl_Osc_Roller(int X, int Y, int W, int H, const char *label)
  12. :Fl_Roller(X,Y,W,H, label), Fl_Osc_Widget(this)
  13. {
  14. Fl_Roller::callback(callback_fn_roller);
  15. bounds(0.0, 127.0f);
  16. }
  17. void Fl_Osc_Roller::init(const char *path)
  18. {
  19. name = path;
  20. oscRegister(path);
  21. };
  22. Fl_Osc_Roller::~Fl_Osc_Roller(void)
  23. {}
  24. void Fl_Osc_Roller::callback(Fl_Callback *cb, void *p)
  25. {
  26. cb_data.first = cb;
  27. cb_data.second = p;
  28. }
  29. void Fl_Osc_Roller::OSC_value(char v)
  30. {
  31. value(v);
  32. }
  33. void Fl_Osc_Roller::update(void)
  34. {
  35. oscWrite(name);
  36. }
  37. void Fl_Osc_Roller::cb(void)
  38. {
  39. oscWrite(name, "i", (int)value());
  40. if(cb_data.first)
  41. cb_data.first(this, cb_data.second);
  42. }