Fl_Osc_Interface.h (3276B)
1 /* 2 ZynAddSubFX - a software synthesizer 3 4 Fl_Osc_Interface.h - Interface To OSC Powered Widgets 5 Copyright (C) 2016 Mark McCurry 6 7 This program is free software; you can redistribute it and/or 8 modify it under the terms of the GNU General Public License 9 as published by the Free Software Foundation; either version 2 10 of the License, or (at your option) any later version. 11 */ 12 #pragma once 13 #include <stdio.h> 14 #include <string> 15 using std::string; 16 #ifdef NO_UI 17 class Fl_Osc_Widget 18 { 19 public: 20 //Callback methods 21 virtual void OSC_value(float){}; 22 virtual void OSC_value(bool){}; 23 virtual void OSC_value(int){}; 24 virtual void OSC_value(char){}; 25 virtual void OSC_value(unsigned,void*){}; 26 virtual void OSC_value(const char *){}; 27 28 //labeled forwarding methods 29 virtual void OSC_value(float x, const char *){(void)x;}; 30 virtual void OSC_value(bool x, const char *){(void)x;}; 31 virtual void OSC_value(int x, const char *){(void)x;}; 32 virtual void OSC_value(char x, const char *){(void)x;}; 33 virtual void OSC_value(unsigned x, void *, const char *){(void)x;}; 34 virtual void OSC_value(const char *x, const char *){(void)x;}; 35 36 //Raw messages 37 virtual void OSC_raw(const char *){}; 38 39 //Widget methods 40 void oscWrite(std::string path, const char *args, ...){(void)path;(void)args;}; 41 void oscWrite(std::string path){(void)path;}; 42 void oscRegister(const char *path){(void)path;}; 43 44 //Forces an update of parameters as they have become stale somehow 45 virtual void update(void){}; 46 47 //Smoothly change the base path 48 virtual void rebase(std::string new_base){(void)new_base;}; 49 void oscMove(std::string new_ext){(void)new_ext;}; 50 //Explicit version for weirdly routed controls 51 void oscMove(std::string old_loc, std::string new_loc){(void)old_loc;(void)new_loc;}; 52 }; 53 #endif 54 55 class Fl_Osc_Interface 56 { 57 public: 58 virtual ~Fl_Osc_Interface(void){}; 59 //It is assumed that you want to have a registry for all of these 60 //elements 61 virtual void createLink(string, class Fl_Osc_Widget *) {}; 62 virtual void renameLink(string,string,class Fl_Osc_Widget*){}; 63 virtual void removeLink(string,class Fl_Osc_Widget*){}; 64 virtual void removeLink(class Fl_Osc_Widget*){}; 65 66 //and to be able to give them events 67 virtual void tryLink(const char *){}; 68 69 //Damage the values of a collection of widgets 70 virtual void damage(const char*){}; 71 72 //Communication link 73 virtual void requestValue(string s) { printf("request: '%s'...\n", s.c_str()); }; 74 virtual void writeValue(string s, float f){printf("%s -> %f\n",s.c_str(), f); }; 75 virtual void writeValue(string s, char c){printf("%s->%d\n", s.c_str(), c);}; 76 virtual void writeValue(string, int){}; 77 virtual void writeValue(string, bool){}; 78 virtual void writeValue(string, string){}; 79 virtual void write(string s) {write(s, "");};//{printf("write: '%s'\n", s.c_str());}; 80 virtual void write(string, const char *, ...) {};//{printf("write: '%s'\n", s.c_str());}; 81 virtual void writeRaw(const char *) {} 82 };