OSC: Some surfaces may use float for ssid. Accept this too.
authorLen Ovens <len@ovenwerks.net>
Wed, 31 May 2017 15:38:55 +0000 (08:38 -0700)
committerLen Ovens <len@ovenwerks.net>
Wed, 31 May 2017 15:39:55 +0000 (08:39 -0700)
libs/surfaces/osc/osc.cc
libs/surfaces/osc/osc.h

index c480512b8837ee1e956cd96ee41f78ef26bee4fb..4818f9340c9a47c23a4e8a0aba9282c41aa337c1 100644 (file)
@@ -866,11 +866,11 @@ OSC::catchall (const char *path, const char* types, lo_arg **argv, int argc, lo_
        len = strlen (path);
 
        if (strstr (path, "/automation")) {
-               ret = set_automation (path, argv, argc, msg);
+               ret = set_automation (path, types, argv, argc, msg);
 
        } else
        if (strstr (path, "/touch")) {
-               ret = touch_detect (path, argv, argc, msg);
+               ret = touch_detect (path, types, argv, argc, msg);
 
        } else
        if (len >= 17 && !strcmp (&path[len-15], "/#current_value")) {
@@ -2207,7 +2207,7 @@ OSC::route_get_receives(lo_message msg) {
 // strip calls
 
 int
-OSC::set_automation (const char *path, lo_arg **argv, int argc, lo_message msg)
+OSC::set_automation (const char *path, const char* types, lo_arg **argv, int argc, lo_message msg)
 {
        if (!session) return -1;
 
@@ -2216,6 +2216,7 @@ OSC::set_automation (const char *path, lo_arg **argv, int argc, lo_message msg)
        boost::shared_ptr<Stripable> strp = boost::shared_ptr<Stripable>();
        uint32_t ctr = 0;
        uint32_t aut = 0;
+       uint32_t ssid;
 
        if (argc) {
                if (argv[argc - 1]->f) {
@@ -2229,9 +2230,14 @@ OSC::set_automation (const char *path, lo_arg **argv, int argc, lo_message msg)
        if (!strncmp (path, "/strip/", 7)) {
                // find ssid and stripable
                if (argc > 1) {
-                       strp = get_strip (argv[0]->i, get_address (msg));
+                       if (types[1] == 'f') {
+                               ssid = (uint32_t)argv[0]->f;
+                       } else {
+                               ssid = argv[0]->i;
+                       }
+                       strp = get_strip (ssid, get_address (msg));
                } else {
-                       uint32_t ssid = atoi (&(strrchr (path, '/' ))[1]);
+                       ssid = atoi (&(strrchr (path, '/' ))[1]);
                        strp = get_strip (ssid, get_address (msg));
                }
                ctr = 7;
@@ -2287,7 +2293,7 @@ OSC::set_automation (const char *path, lo_arg **argv, int argc, lo_message msg)
 }
 
 int
-OSC::touch_detect (const char *path, lo_arg **argv, int argc, lo_message msg)
+OSC::touch_detect (const char *path, const char* types, lo_arg **argv, int argc, lo_message msg)
 {
        if (!session) return -1;
 
@@ -2296,6 +2302,7 @@ OSC::touch_detect (const char *path, lo_arg **argv, int argc, lo_message msg)
        boost::shared_ptr<Stripable> strp = boost::shared_ptr<Stripable>();
        uint32_t ctr = 0;
        uint32_t touch = 0;
+       uint32_t ssid;
 
        if (argc) {
                if (argv[argc - 1]->f) {
@@ -2309,9 +2316,14 @@ OSC::touch_detect (const char *path, lo_arg **argv, int argc, lo_message msg)
        if (!strncmp (path, "/strip/", 7)) {
                // find ssid and stripable
                if (argc > 1) {
-                       strp = get_strip (argv[0]->i, get_address (msg));
+                       if (types[1] == 'f') {
+                               ssid = (uint32_t)argv[0]->f;
+                       } else {
+                               ssid = argv[0]->i;
+                       }
+                       strp = get_strip (ssid, get_address (msg));
                } else {
-                       uint32_t ssid = atoi (&(strrchr (path, '/' ))[1]);
+                       ssid = atoi (&(strrchr (path, '/' ))[1]);
                        strp = get_strip (ssid, get_address (msg));
                }
                ctr = 7;
index 1e50caa2e61f1dd6391774acd9441f91d7250505..fb8a5e5365dc972789f65047db06abace1617bcf 100644 (file)
@@ -121,6 +121,10 @@ class OSC : public ARDOUR::ControlProtocol, public AbstractUI<OSCUIRequest>
                JogMode jogmode;                        // current jogmode
                uint32_t bank;                          // current bank
                uint32_t bank_size;                     // size of banks for this surface
+               uint32_t plug_page;                     // current plugin page
+               uint32_t plug_page_size;        // plugin page size (number of controls)
+               uint32_t send_page;                     // current send page
+               uint32_t send_page_size;        // send page size in channels
                std::bitset<32> strip_types;// what strip types are a part of this bank
                uint32_t nstrips;                       // how many strips are there for strip_types
                std::bitset<32> feedback;       // What is fed back? strips/meters/timecode/bar_beat/global
@@ -232,8 +236,8 @@ class OSC : public ARDOUR::ControlProtocol, public AbstractUI<OSCUIRequest>
        int catchall (const char *path, const char *types, lo_arg **argv, int argc, void *data);
        static int _catchall (const char *path, const char *types, lo_arg **argv, int argc, void *data, void *user_data);
 
-       int set_automation (const char *path, lo_arg **argv, int argc, lo_message msg);
-       int touch_detect (const char *path, lo_arg **argv, int argc, lo_message msg);
+       int set_automation (const char *path, const char* types, lo_arg **argv, int argc, lo_message msg);
+       int touch_detect (const char *path, const char* types, lo_arg **argv, int argc, lo_message msg);
        int fake_touch (boost::shared_ptr<ARDOUR::AutomationControl> ctrl);
 
        int route_get_sends (lo_message msg);