+// 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) {
+ if (rg->is_gain() != (bool) argv[0]->i) {
+ rg->set_gain ((bool) argv[0]->i);
+ }
+ if (rg->is_relative() != (bool) argv[1]->i) {
+ rg->set_relative ((bool) argv[1]->i, this);
+ }
+ if (rg->is_mute() != (bool) argv[2]->i) {
+ rg->set_mute ((bool) argv[2]->i);
+ }
+ if (rg->is_solo() != (bool) argv[3]->i) {
+ rg->set_solo ((bool) argv[3]->i);
+ }
+ if (rg->is_recenable() != (bool) argv[4]->i) {
+ rg->set_recenable ((bool) argv[4]->i);
+ }
+ if (rg->is_select() != (bool) argv[5]->i) {
+ rg->set_select ((bool) argv[5]->i);
+ }
+ if (rg->is_route_active() != (bool) argv[6]->i) {
+ rg->set_route_active ((bool) argv[6]->i);
+ }
+ if (rg->is_color() != (bool) argv[7]->i) {
+ rg->set_color ((bool) argv[7]->i);
+ }
+ if (rg->is_monitoring() != (bool) argv[8]->i) {
+ rg->set_monitoring ((bool) argv[8]->i);
+ }
+ ret = 0;
+ } 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)
+{
+ if (!session) {
+ return -1;
+ }
+ string new_name = n;
+ char illegal = Session::session_name_is_legal (new_name);
+
+ if (illegal) {
+ PBD::warning << (string_compose (_("To ensure compatibility with various systems\n"
+ "session names may not contain a '%1' character"), illegal)) << endmsg;
+ return -1;
+ }
+ switch (session->rename (new_name)) {
+ case -1:
+ PBD::warning << (_("That name is already in use by another directory/folder. Please try again.")) << endmsg;
+ break;
+ case 0:
+ return 0;
+ break;
+ default:
+ PBD::warning << (_("Renaming this session failed.\nThings could be seriously messed up at this point")) << endmsg;
+ break;
+ }
+ return -1;
+}
+