From d35dfa9c93b1d2234aff5fe64d44f8b83da1fb57 Mon Sep 17 00:00:00 2001 From: Len Ovens Date: Wed, 31 May 2017 08:38:55 -0700 Subject: [PATCH] OSC: Some surfaces may use float for ssid. Accept this too. --- libs/surfaces/osc/osc.cc | 28 ++++++++++++++++++++-------- libs/surfaces/osc/osc.h | 8 ++++++-- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/libs/surfaces/osc/osc.cc b/libs/surfaces/osc/osc.cc index c480512b88..4818f9340c 100644 --- a/libs/surfaces/osc/osc.cc +++ b/libs/surfaces/osc/osc.cc @@ -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 strp = boost::shared_ptr(); 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 strp = boost::shared_ptr(); 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; diff --git a/libs/surfaces/osc/osc.h b/libs/surfaces/osc/osc.h index 1e50caa2e6..fb8a5e5365 100644 --- a/libs/surfaces/osc/osc.h +++ b/libs/surfaces/osc/osc.h @@ -121,6 +121,10 @@ class OSC : public ARDOUR::ControlProtocol, public AbstractUI 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 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 ctrl); int route_get_sends (lo_message msg);