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_Value.cpp 1.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. ZynAddSubFX - a software synthesizer
  3. Fl_Osc_Value.cpp - OSC Based Fl_Value
  4. Copyright (C) 2016 Mark McCurry
  5. This program is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU General Public License
  7. as published by the Free Software Foundation; either version 2
  8. of the License, or (at your option) any later version.
  9. */
  10. #include "Fl_Osc_Value.H"
  11. static void callback_fn_value(Fl_Widget *w, void *)
  12. {
  13. ((Fl_Osc_Value*)w)->cb();
  14. }
  15. Fl_Osc_Value::Fl_Osc_Value(int X, int Y, int W, int H, const char *label)
  16. :Fl_Value_Input(X,Y,W,H, label), Fl_Osc_Widget(this)
  17. {
  18. Fl_Value_Input::callback(callback_fn_value);
  19. }
  20. Fl_Osc_Value::~Fl_Osc_Value(void)
  21. {}
  22. void Fl_Osc_Value::init(const char *path_)
  23. {
  24. ext = path_;
  25. oscRegister(path_);
  26. }
  27. void Fl_Osc_Value::OSC_value(float v)
  28. {
  29. //static char value[1024];
  30. //snprintf(value, sizeof(value), "%f", v);
  31. this->value(v);
  32. }
  33. void Fl_Osc_Value::cb(void)
  34. {
  35. assert(osc);
  36. oscWrite(ext, "f", (float)(value()));
  37. }