diff --git a/libs/surfaces/osc/osc.cc b/libs/surfaces/osc/osc.cc index c2e19c0507..14547886a4 100644 --- a/libs/surfaces/osc/osc.cc +++ b/libs/surfaces/osc/osc.cc @@ -571,7 +571,6 @@ OSC::register_callbacks() REGISTER_CALLBACK (serv, X_("/select/record_safe"), "i", sel_recsafe); REGISTER_CALLBACK (serv, X_("/select/name"), "s", sel_rename); REGISTER_CALLBACK (serv, X_("/select/comment"), "s", sel_comment); - REGISTER_CALLBACK (serv, X_("/select/group"), "s", sel_group); REGISTER_CALLBACK (serv, X_("/select/mute"), "i", sel_mute); REGISTER_CALLBACK (serv, X_("/select/solo"), "i", sel_solo); REGISTER_CALLBACK (serv, X_("/select/solo_iso"), "i", sel_solo_iso); @@ -815,6 +814,7 @@ OSC::catchall (const char *path, const char* types, lo_arg **argv, int argc, lo_ set = &(link_sets[ls]); sur->custom_mode = set->custom_mode; sur->custom_strips = set->custom_strips; + sur->temp_strips = set->temp_strips; } if (strstr (path, X_("/automation"))) { @@ -979,8 +979,11 @@ OSC::catchall (const char *path, const char* types, lo_arg **argv, int argc, lo_ else if (!strncmp (path, X_("/strip/select/"), 14) && strlen (path) > 14) { int ssid = atoi (&path[14]); ret = strip_gui_select (ssid, argv[0]->i, msg); - } else - if (strstr (path, X_("/select")) && (argc != 1)) { + } + else if (strstr (path, X_("/select/group"))) { + ret = parse_sel_group (path, types, argv, argc, msg); + } + else if (strstr (path, X_("/select")) && (argc != 1)) { // All of the select commands below require 1 parameter PBD::warning << "OSC: Wrong number of parameters." << endmsg; } @@ -2209,11 +2212,13 @@ OSC::strip_feedback (OSCSurface* sur, bool new_bank_size) } sur->custom_mode = set->custom_mode; sur->custom_strips = set->custom_strips; + sur->temp_strips = set->temp_strips; } - if (sur->custom_strips.size () == 0) { - sur->custom_mode = 0; + if (sur->custom_mode < 7) { + sur->strips = get_sorted_stripables(sur->strip_types, sur->cue, sur->custom_mode, sur->custom_strips); + } else { + sur->strips = get_sorted_stripables(sur->strip_types, sur->cue, 1, sur->temp_strips); } - sur->strips = get_sorted_stripables(sur->strip_types, sur->cue, sur->custom_mode, sur->custom_strips); sur->nstrips = sur->strips.size(); if (ls) { set->strips = sur->strips; @@ -2524,6 +2529,79 @@ OSC::use_group (float value, lo_message msg) return 0; } +// this gets called for anything that starts with /select/group +int +OSC::parse_sel_group (const char *path, const char* types, lo_arg **argv, int argc, lo_message msg) +{ + OSCSurface *sur = get_surface(get_address (msg)); + boost::shared_ptr s; + if (sur->expand_enable) { + s = get_strip (sur->expand, get_address (msg)); + } else { + s = _select; + } + int ret = 1; /* unhandled */ + if (s) { + if (!strncmp (path, X_("/select/group"), 13)) { + if (argc == 1) { + if (types[0] == 's') { + return strip_select_group (s, &argv[0]->s); + } + } + } + boost::shared_ptr rt = boost::dynamic_pointer_cast (s); + if (!rt) { + PBD::warning << "OSC: VCAs can not be part of a group." << endmsg; + return ret; + } + RouteGroup *rg = rt->route_group(); + if (!rg) { + PBD::warning << "OSC: This strip is not part of a group." << endmsg; + return ret; + } + float value = 0; + if (argc == 1) { + if (types[0] == 'f') { + value = (uint32_t) argv[0]->f; + } else if (types[0] == 'i') { + value = (uint32_t) argv[0]->i; + } + } + if (!strncmp (path, X_("/select/group/enable"), 20)) { + if (argc == 1) { + rg->set_active (value, this); + ret = 0; + } + } + else if (!strncmp (path, X_("/select/group/only"), 18)) { + if ((argc == 1 && value) || !argc) { + // fill sur->strips with routes from this group and hit bank1 + sur->temp_strips.clear(); + boost::shared_ptr rl = rg->route_list(); + for (RouteList::iterator it = rl->begin(); it != rl->end(); ++it) { + boost::shared_ptr r = *it; + boost::shared_ptr s = boost::dynamic_pointer_cast (r); + sur->temp_strips.push_back(s); + } + sur->custom_mode = 7; + set_bank (1, msg); + ret = 0; + } else { + // key off is ignored + ret = 0; + } + } + else if (!strncmp (path, X_("/select/group/sharing"), 21)) { + if (argc == 9) { + // set 9 parameters + } else { + PBD::warning << "OSC: Sharing can only be set if all 9 parameters are sent." << endmsg; + } + } + } + return ret; + } + int OSC::name_session (char *n, lo_message msg) { diff --git a/libs/surfaces/osc/osc.h b/libs/surfaces/osc/osc.h index 75c88f8e1c..4c53bcbda0 100644 --- a/libs/surfaces/osc/osc.h +++ b/libs/surfaces/osc/osc.h @@ -127,7 +127,8 @@ class OSC : public ARDOUR::ControlProtocol, public AbstractUI int gainmode; // what kind of faders do we have Gain db or position 0 to 1? PBD::Controllable::GroupControlDisposition usegroup; // current group disposition Sorted custom_strips; // a sorted list of user selected strips - uint32_t custom_mode; // use custom strip list + uint32_t custom_mode; // use custom strip list + Sorted temp_strips; // temp strip list for grouponly, vcaonly, auxonly Sorted strips; // list of stripables for this surface // strips uint32_t bank; // current bank @@ -191,6 +192,7 @@ class OSC : public ARDOUR::ControlProtocol, public AbstractUI uint32_t not_ready; // number of 1st device, 0 = ready Sorted custom_strips; // a sorted list of user selected strips uint32_t custom_mode; // use custom strip list + Sorted temp_strips; // temp strip list for grouponly, vcaonly, auxonly std::bitset<32> strip_types; // strip_types for this linkset Sorted strips; // list of valid strips in order for this set }; @@ -762,6 +764,7 @@ class OSC : public ARDOUR::ControlProtocol, public AbstractUI int sel_eq_freq (int id, float val, lo_message msg); int sel_eq_q (int id, float val, lo_message msg); int sel_eq_shape (int id, float val, lo_message msg); + int parse_sel_group (const char *path, const char* types, lo_arg **argv, int argc, lo_message msg); void listen_to_route (boost::shared_ptr, lo_address);