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.

83 lines
3.0KB

  1. /*
  2. ZynAddSubFX - a software synthesizer
  3. Fl_Osc_Interface.h - Interface To OSC Powered Widgets
  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. #pragma once
  11. #include <stdio.h>
  12. #include <string>
  13. using std::string;
  14. #ifdef NO_UI
  15. class Fl_Osc_Widget
  16. {
  17. public:
  18. //Callback methods
  19. virtual void OSC_value(float){};
  20. virtual void OSC_value(bool){};
  21. virtual void OSC_value(int){};
  22. virtual void OSC_value(char){};
  23. virtual void OSC_value(unsigned,void*){};
  24. virtual void OSC_value(const char *){};
  25. //labeled forwarding methods
  26. virtual void OSC_value(float x, const char *){};
  27. virtual void OSC_value(bool x, const char *){};
  28. virtual void OSC_value(int x, const char *){};
  29. virtual void OSC_value(char x, const char *){};
  30. virtual void OSC_value(unsigned x, void *v, const char *){};
  31. virtual void OSC_value(const char *x, const char *){};
  32. //Raw messages
  33. virtual void OSC_raw(const char *){};
  34. //Widget methods
  35. void oscWrite(std::string path, const char *args, ...){};
  36. void oscWrite(std::string path){};
  37. void oscRegister(const char *path){};
  38. //Forces an update of parameters as they have become stale somehow
  39. virtual void update(void){};
  40. //Smoothly change the base path
  41. virtual void rebase(std::string new_base){};
  42. void oscMove(std::string new_ext){};
  43. //Explict version for weirdly routed controls
  44. void oscMove(std::string old_loc, std::string new_loc){};
  45. };
  46. #endif
  47. class Fl_Osc_Interface
  48. {
  49. public:
  50. virtual ~Fl_Osc_Interface(void){};
  51. //It is assumed that you want to have a registry for all of these
  52. //elements
  53. virtual void createLink(string, class Fl_Osc_Widget *) {};
  54. virtual void renameLink(string,string,class Fl_Osc_Widget*){};
  55. virtual void removeLink(string,class Fl_Osc_Widget*){};
  56. virtual void removeLink(class Fl_Osc_Widget*){};
  57. //and to be able to give them events
  58. virtual void tryLink(const char *){};
  59. //Damage the values of a collection of widgets
  60. virtual void damage(const char*){};
  61. //Communication link
  62. virtual void requestValue(string s) { printf("request: '%s'...\n", s.c_str()); };
  63. virtual void writeValue(string s, float f){printf("%s -> %f\n",s.c_str(), f); };
  64. virtual void writeValue(string s, char c){printf("%s->%d\n", s.c_str(), c);};
  65. virtual void writeValue(string, int){};
  66. virtual void writeValue(string, bool){};
  67. virtual void writeValue(string, string){};
  68. virtual void write(string s) {write(s, "");};//{printf("write: '%s'\n", s.c_str());};
  69. virtual void write(string, const char *, ...) {};//{printf("write: '%s'\n", s.c_str());};
  70. virtual void writeRaw(const char *) {}
  71. };