13
0

OSC: Some surfaces may use float for ssid. Accept this too.

This commit is contained in:
Len Ovens 2017-05-31 08:38:55 -07:00
parent b343108756
commit d35dfa9c93
2 changed files with 26 additions and 10 deletions

View 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;

View 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);