13
0

OSC: display only strips in group.

This commit is contained in:
Len Ovens 2018-02-27 11:15:08 -08:00
parent e069b0c797
commit d99060134b
2 changed files with 88 additions and 7 deletions

View File

@ -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<Stripable> 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<Route> rt = boost::dynamic_pointer_cast<Route> (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<RouteList> rl = rg->route_list();
for (RouteList::iterator it = rl->begin(); it != rl->end(); ++it) {
boost::shared_ptr<Route> r = *it;
boost::shared_ptr<Stripable> s = boost::dynamic_pointer_cast<Stripable> (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)
{

View File

@ -127,7 +127,8 @@ class OSC : public ARDOUR::ControlProtocol, public AbstractUI<OSCUIRequest>
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<OSCUIRequest>
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<OSCUIRequest>
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<ARDOUR::Stripable>, lo_address);