OSC Accept int in first parameter in path commands as well as float.
authorLen Ovens <len@ovenwerks.net>
Mon, 24 Oct 2016 01:45:25 +0000 (18:45 -0700)
committerLen Ovens <len@ovenwerks.net>
Mon, 24 Oct 2016 01:45:25 +0000 (18:45 -0700)
libs/surfaces/osc/osc.cc

index 1ce3568a443a4536e6c58f76e0faa67225be5d1c..9d09c97d8d1b6308455b9bdcf565f53a6e67f91a 100644 (file)
@@ -886,108 +886,109 @@ OSC::catchall (const char *path, const char* types, lo_arg **argv, int argc, lo_
                }
 
                ret = 0;
-       } else if (argc == 1 && types[0] == 'f') { // single float -- probably TouchOSC
-               if (!strncmp (path, "/strip/gain/", 12) && strlen (path) > 12) {
-                       // in dB
-                       int ssid = atoi (&path[12]);
-                       route_set_gain_dB (ssid, argv[0]->f, msg);
-                       ret = 0;
-               }
-               else if (!strncmp (path, "/strip/fader/", 13) && strlen (path) > 13) {
-                       // in fader position
-                       int ssid = atoi (&path[13]);
-                       route_set_gain_fader (ssid, argv[0]->f, msg);
-                       ret = 0;
-               }
-               else if (!strncmp (path, "/strip/trimdB/", 14) && strlen (path) > 14) {
-                       int ssid = atoi (&path[14]);
-                       route_set_trim_dB (ssid, argv[0]->f, msg);
-                       ret = 0;
-               }
-               else if (!strncmp (path, "/strip/pan_stereo_position/", 27) && strlen (path) > 27) {
-                       int ssid = atoi (&path[27]);
-                       route_set_pan_stereo_position (ssid, argv[0]->f, msg);
-                       ret = 0;
-               }
-               else if (!strncmp (path, "/strip/mute/", 12) && strlen (path) > 12) {
-                       int ssid = atoi (&path[12]);
-                       route_mute (ssid, argv[0]->f == 1.0, msg);
-                       ret = 0;
-               }
-               else if (!strncmp (path, "/strip/solo/", 12) && strlen (path) > 12) {
-                       int ssid = atoi (&path[12]);
-                       route_solo (ssid, argv[0]->f == 1.0, msg);
-                       ret = 0;
-               }
-               else if (!strncmp (path, "/strip/monitor_input/", 21) && strlen (path) > 21) {
-                       int ssid = atoi (&path[21]);
-                       route_monitor_input (ssid, argv[0]->f == 1.0, msg);
-                       ret = 0;
-               }
-               else if (!strncmp (path, "/strip/monitor_disk/", 20) && strlen (path) > 20) {
-                       int ssid = atoi (&path[20]);
-                       route_monitor_disk (ssid, argv[0]->f == 1.0, msg);
-                       ret = 0;
-               }
-               else if (!strncmp (path, "/strip/recenable/", 17) && strlen (path) > 17) {
-                       int ssid = atoi (&path[17]);
-                       route_recenable (ssid, argv[0]->f == 1.0, msg);
-                       ret = 0;
-               }
-               else if (!strncmp (path, "/strip/record_safe/", 19) && strlen (path) > 19) {
-                       int ssid = atoi (&path[19]);
-                       route_recsafe (ssid, argv[0]->f == 1.0, msg);
-                       ret = 0;
-               }
-               else if (!strncmp (path, "/strip/expand/", 14) && strlen (path) > 14) {
-                       int ssid = atoi (&path[14]);
-                       strip_expand (ssid, argv[0]->f == 1.0, msg);
-                       ret = 0;
-               }
-               else if (!strncmp (path, "/strip/select/", 14) && strlen (path) > 14) {
-                       int ssid = atoi (&path[14]);
-                       strip_gui_select (ssid, argv[0]->f == 1.0, msg);
-                       ret = 0;
-               }
-               else if (!strncmp (path, "/select/send_gain/", 18) && strlen (path) > 18) {
-                       int ssid = atoi (&path[18]);
-                       sel_sendgain (ssid, argv[0]->f, msg);
-                       ret = 0;
-               }
-               else if (!strncmp (path, "/select/send_fader/", 19) && strlen (path) > 19) {
-                       int ssid = atoi (&path[19]);
-                       sel_sendfader (ssid, argv[0]->f, msg);
-                       ret = 0;
-               }
-               else if (!strncmp (path, "/select/send_enable/", 20) && strlen (path) > 20) {
-                       int ssid = atoi (&path[20]);
-                       sel_sendenable (ssid, argv[0]->f, msg);
-                       ret = 0;
-               }
-               else if (!strncmp (path, "/select/eq_gain/", 16) && strlen (path) > 16) {
-                       int ssid = atoi (&path[16]);
-                       sel_eq_gain (ssid, argv[0]->f, msg);
-                       ret = 0;
-               }
-               else if (!strncmp (path, "/select/eq_freq/", 16) && strlen (path) > 16) {
-                       int ssid = atoi (&path[16]);
-                       sel_eq_freq (ssid, argv[0]->f , msg);
-                       ret = 0;
-               }
-               else if (!strncmp (path, "/select/eq_q/", 13) && strlen (path) > 13) {
-                       int ssid = atoi (&path[13]);
-                       sel_eq_q (ssid, argv[0]->f, msg);
-                       ret = 0;
-               }
-               else if (!strncmp (path, "/select/eq_shape/", 17) && strlen (path) > 17) {
-                       int ssid = atoi (&path[17]);
-                       sel_eq_shape (ssid, argv[0]->f, msg);
-                       ret = 0;
-               }
+       } else
+       if (!strncmp (path, "/strip/gain/", 12) && strlen (path) > 12) {
+               // in dB
+               int ssid = atoi (&path[12]);
+               route_set_gain_dB (ssid, argv[0]->f, msg);
+               ret = 0;
+       }
+       else if (!strncmp (path, "/strip/fader/", 13) && strlen (path) > 13) {
+               // in fader position
+               int ssid = atoi (&path[13]);
+               route_set_gain_fader (ssid, argv[0]->f, msg);
+               ret = 0;
+       }
+       else if (!strncmp (path, "/strip/trimdB/", 14) && strlen (path) > 14) {
+               int ssid = atoi (&path[14]);
+               route_set_trim_dB (ssid, argv[0]->f, msg);
+               ret = 0;
+       }
+       else if (!strncmp (path, "/strip/pan_stereo_position/", 27) && strlen (path) > 27) {
+               int ssid = atoi (&path[27]);
+               route_set_pan_stereo_position (ssid, argv[0]->f, msg);
+               ret = 0;
+       }
+       else if (!strncmp (path, "/strip/mute/", 12) && strlen (path) > 12) {
+               int ssid = atoi (&path[12]);
+               route_mute (ssid, argv[0]->i, msg);
+               ret = 0;
+       }
+       else if (!strncmp (path, "/strip/solo/", 12) && strlen (path) > 12) {
+               int ssid = atoi (&path[12]);
+               route_solo (ssid, argv[0]->i, msg);
+               ret = 0;
+       }
+       else if (!strncmp (path, "/strip/monitor_input/", 21) && strlen (path) > 21) {
+               int ssid = atoi (&path[21]);
+               route_monitor_input (ssid, argv[0]->i, msg);
+               ret = 0;
+       }
+       else if (!strncmp (path, "/strip/monitor_disk/", 20) && strlen (path) > 20) {
+               int ssid = atoi (&path[20]);
+               route_monitor_disk (ssid, argv[0]->i, msg);
+               ret = 0;
+       }
+       else if (!strncmp (path, "/strip/recenable/", 17) && strlen (path) > 17) {
+               int ssid = atoi (&path[17]);
+               route_recenable (ssid, argv[0]->i, msg);
+               ret = 0;
+       }
+       else if (!strncmp (path, "/strip/record_safe/", 19) && strlen (path) > 19) {
+               int ssid = atoi (&path[19]);
+               route_recsafe (ssid, argv[0]->i, msg);
+               ret = 0;
+       }
+       else if (!strncmp (path, "/strip/expand/", 14) && strlen (path) > 14) {
+               int ssid = atoi (&path[14]);
+               strip_expand (ssid, argv[0]->i, msg);
+               ret = 0;
+       }
+       else if (!strncmp (path, "/strip/select/", 14) && strlen (path) > 14) {
+               int ssid = atoi (&path[14]);
+               strip_gui_select (ssid, argv[0]->i, msg);
+               ret = 0;
+       }
+       else if (!strncmp (path, "/select/send_gain/", 18) && strlen (path) > 18) {
+               int ssid = atoi (&path[18]);
+               sel_sendgain (ssid, argv[0]->f, msg);
+               ret = 0;
+       }
+       else if (!strncmp (path, "/select/send_fader/", 19) && strlen (path) > 19) {
+               int ssid = atoi (&path[19]);
+               sel_sendfader (ssid, argv[0]->f, msg);
+               ret = 0;
+       }
+       else if (!strncmp (path, "/select/send_enable/", 20) && strlen (path) > 20) {
+               int ssid = atoi (&path[20]);
+               sel_sendenable (ssid, argv[0]->f, msg);
+               ret = 0;
+       }
+       else if (!strncmp (path, "/select/eq_gain/", 16) && strlen (path) > 16) {
+               int ssid = atoi (&path[16]);
+               sel_eq_gain (ssid, argv[0]->f, msg);
+               ret = 0;
+       }
+       else if (!strncmp (path, "/select/eq_freq/", 16) && strlen (path) > 16) {
+               int ssid = atoi (&path[16]);
+               sel_eq_freq (ssid, argv[0]->f , msg);
+               ret = 0;
+       }
+       else if (!strncmp (path, "/select/eq_q/", 13) && strlen (path) > 13) {
+               int ssid = atoi (&path[13]);
+               sel_eq_q (ssid, argv[0]->f, msg);
+               ret = 0;
+       }
+       else if (!strncmp (path, "/select/eq_shape/", 17) && strlen (path) > 17) {
+               int ssid = atoi (&path[17]);
+               sel_eq_shape (ssid, argv[0]->f, msg);
+               ret = 0;
        }
 
        if ((ret && _debugmode == Unhandled)) {
                debugmsg (_("Unhandled OSC message"), path, types, argv, argc);
+       } else if ((!ret && _debugmode != Unhandled)) {
+               debugmsg (_("OSC"), path, types, argv, argc);
        }
 
        return ret;