OSC: reworking of previous/next select
[ardour.git] / libs / surfaces / osc / osc.cc
index 332ea54067c07cc3c29808c2528cae586924af5f..8e7351e3f87b9b87247afca9780ab900cee3f1e4 100644 (file)
@@ -29,6 +29,7 @@
 #include <glibmm.h>
 
 #include "pbd/control_math.h"
+#include "pbd/controllable.h"
 #include <pbd/convert.h>
 #include <pbd/pthread_utils.h>
 #include <pbd/file_utils.h>
@@ -45,6 +46,8 @@
 #include "ardour/dB.h"
 #include "ardour/filesystem_paths.h"
 #include "ardour/panner.h"
+#include "ardour/panner_shell.h"
+#include "ardour/pannable.h"
 #include "ardour/plugin.h"
 #include "ardour/plugin_insert.h"
 #include "ardour/presentation_info.h"
@@ -504,6 +507,7 @@ OSC::register_callbacks()
                REGISTER_CALLBACK (serv, X_("/quick_snapshot_switch"), "f", quick_snapshot_switch);
                REGISTER_CALLBACK (serv, X_("/quick_snapshot_stay"), "", quick_snapshot_stay);
                REGISTER_CALLBACK (serv, X_("/quick_snapshot_stay"), "f", quick_snapshot_stay);
+               REGISTER_CALLBACK (serv, X_("/session_name"), "s", name_session);
                REGISTER_CALLBACK (serv, X_("/fit_1_track"), "", fit_1_track);
                REGISTER_CALLBACK (serv, X_("/fit_1_track"), "f", fit_1_track);
                REGISTER_CALLBACK (serv, X_("/fit_2_tracks"), "", fit_2_tracks);
@@ -570,7 +574,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);
@@ -583,6 +586,12 @@ OSC::register_callbacks()
                REGISTER_CALLBACK (serv, X_("/select/db_delta"), "f", sel_dB_delta);
                REGISTER_CALLBACK (serv, X_("/select/trimdB"), "f", sel_trim);
                REGISTER_CALLBACK (serv, X_("/select/hide"), "i", sel_hide);
+               REGISTER_CALLBACK (serv, X_("/select/bus/only"), "f", sel_bus_only);
+               REGISTER_CALLBACK (serv, X_("/select/bus/only"), "", sel_bus_only);
+               REGISTER_CALLBACK (serv, X_("/select/previous"), "f", sel_previous);
+               REGISTER_CALLBACK (serv, X_("/select/previous"), "", sel_previous);
+               REGISTER_CALLBACK (serv, X_("/select/next"), "f", sel_next);
+               REGISTER_CALLBACK (serv, X_("/select/next"), "", sel_next);
                REGISTER_CALLBACK (serv, X_("/select/pan_stereo_position"), "f", sel_pan_position);
                REGISTER_CALLBACK (serv, X_("/select/pan_stereo_width"), "f", sel_pan_width);
                REGISTER_CALLBACK (serv, X_("/select/send_gain"), "if", sel_sendgain);
@@ -629,6 +638,7 @@ OSC::register_callbacks()
                REGISTER_CALLBACK (serv, X_("/strip/polarity"), "ii", strip_phase);
                REGISTER_CALLBACK (serv, X_("/strip/gain"), "if", route_set_gain_dB);
                REGISTER_CALLBACK (serv, X_("/strip/fader"), "if", route_set_gain_fader);
+               REGISTER_CALLBACK (serv, X_("/strip/db_delta"), "if", strip_db_delta);
                REGISTER_CALLBACK (serv, X_("/strip/trimdB"), "if", route_set_trim_dB);
                REGISTER_CALLBACK (serv, X_("/strip/pan_stereo_position"), "if", route_set_pan_stereo_position);
                REGISTER_CALLBACK (serv, X_("/strip/pan_stereo_width"), "if", route_set_pan_stereo_width);
@@ -814,6 +824,8 @@ 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_mode = set->temp_mode;
+               sur->temp_strips = set->temp_strips;
        }
 
        if (strstr (path, X_("/automation"))) {
@@ -852,7 +864,7 @@ OSC::catchall (const char *path, const char* types, lo_arg **argv, int argc, lo_
        if (strcmp (path, X_("/strip/listen")) == 0) {
                if (argc <= 0) {
                        PBD::warning << "OSC: Wrong number of parameters." << endmsg;
-               } else if (sur->custom_mode) {
+               } else if (sur->custom_mode && !sur->temp_mode) {
                        PBD::warning << "OSC: Can't add strips with custom enabled." << endmsg;
                } else {
                        for (int n = 0; n < argc; ++n) {
@@ -875,7 +887,7 @@ OSC::catchall (const char *path, const char* types, lo_arg **argv, int argc, lo_
        if (strcmp (path, X_("/strip/ignore")) == 0) {
                if (argc <= 0) {
                        PBD::warning << "OSC: Wrong number of parameters." << endmsg;
-               } else if (!sur->custom_mode) {
+               } else if (!sur->custom_mode || sur->temp_mode) {
                        PBD::warning << "OSC: Can't remove strips without custom enabled." << endmsg;
                } else {
                        for (int n = 0; n < argc; ++n) {
@@ -978,8 +990,14 @@ 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/vca"))) {
+               ret = parse_sel_vca (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;
        }
@@ -1308,6 +1326,7 @@ OSC::get_surfaces ()
                PBD::info << string_compose ("\n  Surface: %1 - URL: %2  %3\n", it, sur->remote_url, port);
                PBD::info << string_compose ("  Number of strips: %1   Bank size: %2   Current Bank %3\n", sur->nstrips, sur->bank_size, sur->bank);
                PBD::info << string_compose ("  Use Custom: %1   Custom Strips: %2\n", sur->custom_mode, sur->custom_strips.size ());
+               PBD::info << string_compose ("  Temp Mode: %1   Temp Strips: %2\n", sur->temp_mode, sur->temp_strips.size ());
                bool ug = false;
                if (sur->usegroup == PBD::Controllable::UseGroup) {
                        ug = true;
@@ -1336,6 +1355,7 @@ OSC::get_surfaces ()
                PBD::info << string_compose ("  Bank size: %1   Current bank: %2   Strip Types: %3\n", set->banksize, set->bank, set->strip_types.to_ulong());
                PBD::info << string_compose ("  Auto bank sizing: %1 Linkset not ready flag: %2\n", set->autobank, set->not_ready);
                PBD::info << string_compose ("  Use Custom: %1 Number of Custom Strips: %2\n", set->custom_mode, set->custom_strips.size ());
+               PBD::info << string_compose ("  Temp Mode: %1 Number of Temp Strips: %2\n", set->temp_mode, set->temp_strips.size ());
        }
        PBD::info << endmsg;
 }
@@ -1364,11 +1384,17 @@ OSC::custom_clear (lo_message msg)
 
 int
 OSC::custom_mode (float state, lo_message msg)
+{
+       return _custom_mode ((uint32_t) state, get_address (msg));
+}
+
+int
+OSC::_custom_mode (uint32_t state, lo_address addr)
 {
        if (!session) {
                return 0;
        }
-       OSCSurface *sur = get_surface(get_address (msg), true);
+       OSCSurface *sur = get_surface(addr, true);
        LinkSet *set;
        uint32_t ls = sur->linkset;
 
@@ -1387,9 +1413,9 @@ OSC::custom_mode (float state, lo_message msg)
                        return -1;
                } else {
                        if (sur->bank_size) {
-                               sur->custom_mode = (uint32_t) state | 0x4;
+                               sur->custom_mode = state | 0x4;
                        } else {
-                               sur->custom_mode = (uint32_t) state;
+                               sur->custom_mode = state;
                        }
                        sur->strips = get_sorted_stripables(sur->strip_types, sur->cue, sur->custom_mode, sur->custom_strips);
                        sur->nstrips = sur->custom_strips.size();
@@ -1403,7 +1429,7 @@ OSC::custom_mode (float state, lo_message msg)
                set->custom_mode = sur->custom_mode;
                set->strips = sur->strips;
        }
-       return set_bank (1, msg);
+       return _set_bank (1, addr);
 }
 
 int
@@ -1565,6 +1591,7 @@ OSC::get_linkset (uint32_t set, lo_address addr)
                        new_ls.strips = sur->strips;
                        new_ls.custom_strips = sur->custom_strips;
                        new_ls.custom_mode = sur->custom_mode;
+                       new_ls.temp_mode = sur->temp_mode;
                        new_ls.urls.resize (2);
                        link_sets[set] = new_ls;
                }
@@ -1775,48 +1802,56 @@ OSC::surface_parse (const char *path, const char* types, lo_arg **argv, int argc
                                } else {
                                        linkid = argv[8]->i;
                                }
+                               [[fallthrough]];
                        case 8:
                                if (types[7] == 'f') {
                                        linkset = (int) argv[7]->f;
                                } else {
                                        linkset = argv[7]->i;
                                }
+                               [[fallthrough]];
                        case 7:
                                if (types[6] == 'f') {
                                        port = (int) argv[6]->f;
                                } else {
                                        port = argv[6]->i;
                                }
+                               [[fallthrough]];
                        case 6:
                                if (types[5] == 'f') {
                                        pi_page = (int) argv[5]->f;
                                } else {
                                        pi_page = argv[5]->i;
                                }
+                               [[fallthrough]];
                        case 5:
                                if (types[4] == 'f') {
                                        se_page = (int) argv[4]->f;
                                } else {
                                        se_page = argv[4]->i;
                                }
+                               [[fallthrough]];
                        case 4:
                                if (types[3] == 'f') {
                                        fadermode = (int) argv[3]->f;
                                } else {
                                        fadermode = argv[3]->i;
                                }
+                               [[fallthrough]];
                        case 3:
                                if (types[2] == 'f') {
                                        feedback = (int) argv[2]->f;
                                } else {
                                        feedback = argv[2]->i;
                                }
+                               [[fallthrough]];
                        case 2:
                                if (types[1] == 'f') {
                                        strip_types = (int) argv[1]->f;
                                } else {
                                        strip_types = argv[1]->i;
                                }
+                               [[fallthrough]];
                        case 1:
                                if (types[0] == 'f') {
                                        bank_size = (int) argv[0]->f;
@@ -1953,9 +1988,6 @@ OSC::set_surface (uint32_t b_size, uint32_t strips, uint32_t fb, uint32_t gm, ui
        }
        OSCSurface *s = get_surface(get_address (msg), true);
        s->bank_size = b_size;
-       if (s->custom_mode && b_size) {
-               s->custom_mode = s->custom_mode | 0x4;
-       }
        s->strip_types = strips;
        s->feedback = fb;
        s->gainmode = gm;
@@ -1966,6 +1998,9 @@ OSC::set_surface (uint32_t b_size, uint32_t strips, uint32_t fb, uint32_t gm, ui
        }
        s->send_page_size = se_size;
        s->plug_page_size = pi_size;
+       if (s->temp_mode) {
+               s->temp_mode = TempOff;
+       }
        if (s->linkset) {
                set_link (s->linkset, s->linkid, get_address (msg));
                link_strip_types (s->linkset, s->strip_types.to_ulong());
@@ -1973,6 +2008,7 @@ OSC::set_surface (uint32_t b_size, uint32_t strips, uint32_t fb, uint32_t gm, ui
                // set bank and strip feedback
                strip_feedback(s, true);
                _set_bank (1, get_address (msg));
+               _strip_select (boost::shared_ptr<Stripable> (), get_address (msg));
        }
 
        global_feedback (s);
@@ -2009,6 +2045,7 @@ OSC::set_surface_strip_types (uint32_t st, lo_message msg)
        }
        OSCSurface *s = get_surface(get_address (msg), true);
        s->strip_types = st;
+       s->temp_mode = TempOff;
        if (s->strip_types[10]) {
                s->usegroup = PBD::Controllable::UseGroup;
        } else {
@@ -2017,9 +2054,10 @@ OSC::set_surface_strip_types (uint32_t st, lo_message msg)
        if (s->linkset) {
                link_strip_types (s->linkset, st);
        }
-
        // set bank and strip feedback
-       _set_bank (1, get_address (msg));
+       strip_feedback(s, false);
+       set_bank (1, msg);
+       _strip_select (boost::shared_ptr<Stripable> (), get_address (msg));
        return 0;
 }
 
@@ -2101,7 +2139,9 @@ OSC::set_surface_port (uint32_t po, lo_message msg)
                                                it++;
                                        }
                                }
-                               refresh_surface (msg);
+                               if (sur->feedback.to_ulong()) {
+                                       refresh_surface (msg);
+                               }
                                return 0;
                        }
                }
@@ -2151,9 +2191,11 @@ OSC::get_surface (lo_address addr , bool quiet)
        s.usegroup = PBD::Controllable::NoGroup;
        s.custom_strips.clear ();
        s.custom_mode = 0;
+       s.temp_mode = TempOff;
        s.sel_obs = 0;
        s.expand = 0;
        s.expand_enable = false;
+       s.expand_strip = boost::shared_ptr<Stripable> ();
        s.cue = false;
        s.aux = 0;
        s.cue_obs = 0;
@@ -2185,7 +2227,9 @@ void
 OSC::global_feedback (OSCSurface* sur)
 {
        OSCGlobalObserver* o = sur->global_obs;
-       delete o;
+       if (o) {
+               delete o;
+       }
        if (sur->feedback[4] || sur->feedback[3] || sur->feedback[5] || sur->feedback[6]) {
 
                // create a new Global Observer for this surface
@@ -2208,11 +2252,14 @@ OSC::strip_feedback (OSCSurface* sur, bool new_bank_size)
                }
                sur->custom_mode = set->custom_mode;
                sur->custom_strips = set->custom_strips;
+               sur->temp_mode = set->temp_mode;
+               sur->temp_strips = set->temp_strips;
        }
-       if (sur->custom_strips.size () == 0) {
-               sur->custom_mode = 0;
+       if (!sur->temp_mode) {
+               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;
@@ -2237,6 +2284,14 @@ OSC::strip_feedback (OSCSurface* sur, bool new_bank_size)
                        for (uint32_t i = 0; i < bank_size; i++) {
                                OSCRouteObserver* o = new OSCRouteObserver (*this, i + 1, sur);
                                sur->observers.push_back (o);
+                               if (sur->temp_mode == BusOnly) {
+                                       boost::shared_ptr<ARDOUR::Stripable> str = get_strip (i + 1, lo_address_new_from_url (sur->remote_url.c_str()));
+                                       boost::shared_ptr<ARDOUR::Send> send = get_send (str, lo_address_new_from_url (sur->remote_url.c_str()));
+                                       if (send) {
+                                               o->refresh_send (send, true);
+                                       }
+                               }
+
                        }
                }
        } else {
@@ -2244,6 +2299,12 @@ OSC::strip_feedback (OSCSurface* sur, bool new_bank_size)
                        for (uint32_t i = 0; i < sur->observers.size(); i++) {
                                boost::shared_ptr<ARDOUR::Stripable> str = get_strip (i + 1, lo_address_new_from_url (sur->remote_url.c_str()));
                                sur->observers[i]->refresh_strip(str, true);
+                               if (sur->temp_mode == BusOnly) {
+                                       boost::shared_ptr<ARDOUR::Send> send = get_send (str, lo_address_new_from_url (sur->remote_url.c_str()));
+                                       if (send) {
+                                               sur->observers[i]->refresh_send (send, true);
+                                       }
+                               }
                        }
                }
        }
@@ -2348,17 +2409,25 @@ OSC::_set_bank (uint32_t bank_start, lo_address addr)
                set->bank = bank_start;
                uint32_t not_ready = 0;
                for (uint32_t dv = 1; dv < d_count; dv++) {
-                       OSCSurface *sur;
                        if (set->urls[dv] != "") {
                                string url = set->urls[dv];
-                               sur = get_surface (lo_address_new_from_url (url.c_str()));
+                               OSCSurface *sur = get_surface (lo_address_new_from_url (url.c_str()));
+                               if (sur->linkset != ls) {
+                                       set->urls[dv] = "";
+                                       not_ready = dv;
+                               } else {
+                                       lo_address sur_addr = lo_address_new_from_url (sur->remote_url.c_str());
+
+                                       sur->bank = bank_start;
+                                       bank_start = bank_start + sur->bank_size;
+                                       strip_feedback (sur, false);
+                                       _strip_select (boost::shared_ptr<ARDOUR::Stripable>(), sur_addr);
+                                       bank_leds (sur);
+                                       lo_address_free (sur_addr);
+                               }
                        } else {
                                not_ready = dv;
                        }
-                       if (sur->linkset != ls) {
-                               set->urls[dv] = "";
-                               not_ready = dv;
-                       }
                        if (not_ready) {
                                if (!set->not_ready) {
                                        set->not_ready = not_ready;
@@ -2366,14 +2435,6 @@ OSC::_set_bank (uint32_t bank_start, lo_address addr)
                                set->bank = 1;
                                break;
                        }
-                       lo_address sur_addr = lo_address_new_from_url (sur->remote_url.c_str());
-
-                       sur->bank = bank_start;
-                       bank_start = bank_start + sur->bank_size;
-                       strip_feedback (sur, false);
-                       _strip_select (boost::shared_ptr<ARDOUR::Stripable>(), sur_addr);
-                       bank_leds (sur);
-                       lo_address_free (sur_addr);
                }
                if (not_ready) {
                        surface_link_state (set);
@@ -2523,6 +2584,399 @@ 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 = sur->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;
+               }
+               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/only"), 18)) {
+                       if (!rg) {
+                               return ret;
+                       }
+                       if ((argc == 1 && value) || !argc) {
+                               // fill sur->strips with routes from this group and hit bank1
+                               sur->temp_mode = GroupOnly;
+                               ret = set_temp_mode (get_address (msg));
+                               set_bank (1, msg);
+                       } else {
+                               // key off is ignored
+                               ret = 0;
+                       }
+               }
+               else if (!strncmp (path, X_("/select/group/enable"), 20)) {
+                       if (rg) {
+                               if (argc == 1) {
+                                       rg->set_active (value, this);
+                                       ret = 0;
+                               }
+                       } else {
+                               int_message (X_("/select/group/enable"), 0, get_address (msg));
+                       }
+               }
+               else if (strcmp (path, X_("/select/group/gain")) == 0) {
+                       if (rg) {
+                               if (argc == 1) {
+                                       rg->set_gain ((bool) value);
+                                       ret = 0;
+                               }
+                       } else {
+                               int_message (X_("/select/group/gain"), 0, get_address (msg));
+                       }
+               }
+               else if (strcmp (path, X_("/select/group/relative")) == 0) {
+                       if (rg) {
+                               if (argc == 1) {
+                                       rg->set_relative ((bool) value, this);
+                                       ret = 0;
+                               }
+                       } else {
+                               int_message (X_("/select/group/relative"), 0, get_address (msg));
+                       }
+               }
+               else if (strcmp (path, X_("/select/group/mute")) == 0) {
+                       if (rg) {
+                               if (argc == 1) {
+                                       rg->set_mute ((bool) value);
+                                       ret = 0;
+                               }
+                       } else {
+                               int_message (X_("/select/group/mute"), 0, get_address (msg));
+                       }
+               }
+               else if (strcmp (path, X_("/select/group/solo")) == 0) {
+                       if (rg) {
+                               if (argc == 1) {
+                                       rg->set_solo ((bool) value);
+                                       ret = 0;
+                               }
+                       } else {
+                               int_message (X_("/select/group/solo"), 0, get_address (msg));
+                       }
+               }
+               else if (strcmp (path, X_("/select/group/recenable")) == 0) {
+                       if (rg) {
+                               if (argc == 1) {
+                                       rg->set_recenable ((bool) value);
+                                       ret = 0;
+                               }
+                       } else {
+                               int_message (X_("/select/group/recenable"), 0, get_address (msg));
+                       }
+               }
+               else if (strcmp (path, X_("/select/group/select")) == 0) {
+                       if (rg) {
+                               if (argc == 1) {
+                                       rg->set_select ((bool) value);
+                                       ret = 0;
+                               }
+                       } else {
+                               int_message (X_("/select/group/select"), 0, get_address (msg));
+                       }
+               }
+               else if (strcmp (path, X_("/select/group/active")) == 0) {
+                       if (rg) {
+                               if (argc == 1) {
+                                       rg->set_route_active ((bool) value);
+                                       ret = 0;
+                               }
+                       } else {
+                               int_message (X_("/select/group/active"), 0, get_address (msg));
+                       }
+               }
+               else if (strcmp (path, X_("/select/group/color")) == 0) {
+                       if (rg) {
+                               if (argc == 1) {
+                                       rg->set_color ((bool) value);
+                                       ret = 0;
+                               }
+                       } else {
+                               int_message (X_("/select/group/color"), 0, get_address (msg));
+                       }
+               }
+               else if (strcmp (path, X_("/select/group/monitoring")) == 0) {
+                       if (rg) {
+                               if (argc == 1) {
+                                       rg->set_monitoring ((bool) value);
+                                       ret = 0;
+                               }
+                       } else {
+                               int_message (X_("/select/group/monitoring"), 0, get_address (msg));
+                       }
+               }
+       }
+       return ret;
+ }
+
+// this gets called for anything that starts with /select/vca
+int
+OSC::parse_sel_vca (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;
+       s = sur->select;
+       int ret = 1; /* unhandled */
+       if (s) {
+               string svalue = "";
+               uint32_t ivalue = 1024;
+               if (strcmp (path, X_("/select/vca")) == 0) {
+                       if (argc == 2) {
+                               if (types[0] == 's') {
+                                       svalue = &argv[0]->s;
+                                       if (types[1] == 'i') {
+                                               ivalue = argv[1]->i;
+                                       } else if (types[1] == 'f') {
+                                               ivalue = (uint32_t) argv[1]->f;
+                                       } else {
+                                               return 1;
+                                       }
+                                       boost::shared_ptr<VCA> vca = get_vca_by_name (svalue);
+                                       if (vca) {
+                                               boost::shared_ptr<Slavable> slv = boost::dynamic_pointer_cast<Slavable> (s);
+                                               if (ivalue) {
+                                                       slv->assign (vca);
+                                               } else {
+                                                       slv->unassign (vca);
+                                               }
+                                               ret = 0;
+                                       }
+                               }
+                       } else {
+                               PBD::warning << "OSC: setting a vca needs both the vca name and it's state" << endmsg;
+                       }
+               }
+               else if (!strncmp (path, X_("/select/vca/only"), 16)) {
+                       if (argc == 1) {
+                               if (types[0] == 'f') {
+                                       ivalue = (uint32_t) argv[0]->f;
+                               } else if (types[0] == 'i') {
+                                       ivalue = (uint32_t) argv[0]->i;
+                               }
+                       }
+                       boost::shared_ptr<VCA> vca = boost::dynamic_pointer_cast<VCA> (s);
+                       if (vca) {
+                               if ((argc == 1 && ivalue) || !argc) {
+                                       sur->temp_mode = VCAOnly;
+                                       ret = set_temp_mode (get_address (msg));
+                                       set_bank (1, msg);
+                               } else {
+                                       // key off is ignored
+                                       ret = 0;
+                               }
+                       } else {
+                               PBD::warning << "OSC: Select is not a VCA right now" << endmsg;
+                       }
+               }
+       }
+       return ret;
+}
+
+boost::shared_ptr<VCA>
+OSC::get_vca_by_name (std::string vname)
+{
+       StripableList stripables;
+       session->get_stripables (stripables);
+       for (StripableList::iterator it = stripables.begin(); it != stripables.end(); ++it) {
+               boost::shared_ptr<Stripable> s = *it;
+               boost::shared_ptr<VCA> v = boost::dynamic_pointer_cast<VCA> (s);
+               if (v) {
+                       if (vname == v->name()) {
+                               return v;
+                       }
+               }
+       }
+       return boost::shared_ptr<VCA>();
+}
+
+int
+OSC::sel_bus_only (lo_message msg)
+{
+       OSCSurface *sur = get_surface(get_address (msg));
+       boost::shared_ptr<Stripable> s = sur->select;
+       if (s) {
+               boost::shared_ptr<Route> rt = boost::dynamic_pointer_cast<Route> (s);
+               if (rt) {
+                       if (!rt->is_track () && rt->can_solo ()) {
+                               // this is a bus, but not master, monitor or audition
+                               sur->temp_mode = BusOnly;
+                               set_temp_mode (get_address (msg));
+                               set_bank (1, msg);
+                               return 0;
+                       }
+               }
+       }
+       return 1;
+}
+
+int
+OSC::set_temp_mode (lo_address addr)
+{
+       bool ret = 1;
+       OSCSurface *sur = get_surface(addr);
+       boost::shared_ptr<Stripable> s = sur->select;
+       if (s) {
+               if (sur->temp_mode == GroupOnly) {
+                       boost::shared_ptr<Route> rt = boost::dynamic_pointer_cast<Route> (s);
+                       if (rt) {
+                               RouteGroup *rg = rt->route_group();
+                               if (rg) {
+                                       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> st = boost::dynamic_pointer_cast<Stripable> (r);
+                                               sur->temp_strips.push_back(st);
+                                       }
+                                       sur->strips = get_sorted_stripables(sur->strip_types, sur->cue, 1, sur->temp_strips);
+                                       sur->nstrips = sur->temp_strips.size();
+                                       LinkSet *set;
+                                       uint32_t ls = sur->linkset;
+                                       if (ls) {
+                                               set = &(link_sets[ls]);
+                                               set->temp_mode = GroupOnly;
+                                               set->temp_strips.clear ();
+                                               set->temp_strips = sur->temp_strips;
+                                               set->strips = sur->strips;
+                                       }
+                                       ret = 0;
+                               }
+                       }
+               } else if (sur->temp_mode == VCAOnly) {
+                       boost::shared_ptr<VCA> vca = boost::dynamic_pointer_cast<VCA> (s);
+                       if (vca) {
+                               sur->temp_strips.clear();
+                               StripableList stripables;
+                               session->get_stripables (stripables);
+                               for (StripableList::iterator it = stripables.begin(); it != stripables.end(); ++it) {
+                                       boost::shared_ptr<Stripable> st = *it;
+                                       if (st->slaved_to (vca)) {
+                                               sur->temp_strips.push_back(st);
+                                       }
+                               }
+                               sur->temp_strips.push_back(s);
+                               sur->strips = get_sorted_stripables(sur->strip_types, sur->cue, 1, sur->temp_strips);
+                               sur->nstrips = sur->temp_strips.size();
+                               LinkSet *set;
+                               uint32_t ls = sur->linkset;
+                               if (ls) {
+                                       set = &(link_sets[ls]);
+                                       set->temp_mode = VCAOnly;
+                                       set->temp_strips.clear ();
+                                       set->temp_strips = sur->temp_strips;
+                                       set->strips = sur->strips;
+                               }
+                               ret = 0;
+                       }
+               } else if (sur->temp_mode == BusOnly) {
+                       boost::shared_ptr<Route> rt = boost::dynamic_pointer_cast<Route> (s);
+                       if (rt) {
+                               if (!rt->is_track () && rt->can_solo ()) {
+                                       // this is a bus, but not master, monitor or audition
+                                       sur->temp_strips.clear();
+                                       StripableList stripables;
+                                       session->get_stripables (stripables);
+                                       for (StripableList::iterator it = stripables.begin(); it != stripables.end(); ++it) {
+                                               boost::shared_ptr<Stripable> st = *it;
+                                               boost::shared_ptr<Route> ri = boost::dynamic_pointer_cast<Route> (st);
+                                               bool sends = true;
+                                               if (ri && ri->direct_feeds_according_to_graph (rt, &sends)) {
+                                                       sur->temp_strips.push_back(st);
+                                               }
+                                       }
+                                       sur->temp_strips.push_back(s);
+                                       sur->strips = get_sorted_stripables(sur->strip_types, sur->cue, 1, sur->temp_strips);
+                                       sur->nstrips = sur->temp_strips.size();
+                                       LinkSet *set;
+                                       uint32_t ls = sur->linkset;
+                                       if (ls) {
+                                               set = &(link_sets[ls]);
+                                               set->temp_mode = BusOnly;
+                                               set->temp_strips.clear ();
+                                               set->temp_strips = sur->temp_strips;
+                                               set->strips = sur->strips;
+                                       }
+                                       ret = 0;
+                               }
+                       }
+               } else if (sur->temp_mode == TempOff) {
+                       sur->temp_mode = TempOff;
+                       ret = 0;
+               }
+       }
+       if (ret) {
+               sur->temp_mode = TempOff;
+       }
+       return ret;
+}
+
+boost::shared_ptr<Send>
+OSC::get_send (boost::shared_ptr<Stripable> st, lo_address addr)
+{
+       OSCSurface *sur = get_surface(addr);
+       boost::shared_ptr<Stripable> s = sur->select;
+       if (st && s && (st != s)) {
+               boost::shared_ptr<Route> rt = boost::dynamic_pointer_cast<Route> (s);
+               boost::shared_ptr<Route> rst = boost::dynamic_pointer_cast<Route> (st);
+               //find what send number feeds s
+               return rst->internal_send_for (rt);
+       }
+       return boost::shared_ptr<Send> ();
+}
+
+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;
+}
+
 uint32_t
 OSC::get_sid (boost::shared_ptr<ARDOUR::Stripable> strip, lo_address addr)
 {
@@ -2547,7 +3001,7 @@ OSC::get_sid (boost::shared_ptr<ARDOUR::Stripable> strip, lo_address addr)
                        }
                }
        }
-       // failsafe... should never get here.
+       // strip not in current bank
        return 0;
 }
 
@@ -2698,7 +3152,7 @@ OSC::_sel_plugin (int id, lo_address addr)
                boost::shared_ptr<Processor> proc = r->nth_plugin (sur->plugins[sur->plugin_id - 1]);
                boost::shared_ptr<PluginInsert> pi;
                if (!(pi = boost::dynamic_pointer_cast<PluginInsert>(proc))) {
-                       PBD::warning << "OSC: Plugin: " << sur->plugin_id << " does not seem to be a plugin" << endmsg;                 
+                       PBD::warning << "OSC: Plugin: " << sur->plugin_id << " does not seem to be a plugin" << endmsg;
                        return 1;
                }
                boost::shared_ptr<ARDOUR::Plugin> pip = pi->plugin();
@@ -2932,13 +3386,24 @@ OSC::set_marker (const char* types, lo_arg **argv, int argc, lo_message msg)
 
        switch (types[0]) {
                case 's':
-                       for (Locations::LocationList::const_iterator l = ll.begin(); l != ll.end(); ++l) {
-                               if ((*l)->is_mark ()) {
-                                       if (strcmp (&argv[0]->s, (*l)->name().c_str()) == 0) {
-                                               session->request_locate ((*l)->start (), false);
-                                               return 0;
+                       {
+                               Location *cur_mark = 0;
+                               for (Locations::LocationList::const_iterator l = ll.begin(); l != ll.end(); ++l) {
+                                       if ((*l)->is_mark ()) {
+                                               if (strcmp (&argv[0]->s, (*l)->name().c_str()) == 0) {
+                                                       session->request_locate ((*l)->start (), false);
+                                                       return 0;
+                                               } else if ((*l)->start () == session->transport_sample()) {
+                                                       cur_mark = (*l);
+                                               }
                                        }
                                }
+                               if (cur_mark) {
+                                       cur_mark->set_name (&argv[0]->s);
+                                       return 0;
+                               }
+                               PBD::warning << string_compose ("Marker: \"%1\" - does not exist", &argv[0]->s) << endmsg;
+                               return -1;
                        }
                        break;
                case 'i':
@@ -2979,7 +3444,6 @@ OSC::group_list (lo_message msg)
 int
 OSC::send_group_list (lo_address addr)
 {
-               //std::list<RouteGroup*> const & route_groups () const {
        lo_message reply;
        reply = lo_message_new ();
 
@@ -3342,6 +3806,7 @@ OSC::set_automation (const char *path, const char* types, lo_arg **argv, int arg
        uint32_t ctr = 0;
        uint32_t aut = 0;
        uint32_t ssid;
+       boost::shared_ptr<Send> send = boost::shared_ptr<Send> ();
 
        if (argc) {
                if (types[argc - 1] == 'f') {
@@ -3365,13 +3830,10 @@ OSC::set_automation (const char *path, const char* types, lo_arg **argv, int arg
                        ssid = atoi (&(strrchr (path, '/' ))[1]);
                        strp = get_strip (ssid, get_address (msg));
                }
+               send = get_send (strp, get_address (msg));
                ctr = 7;
        } else if (!strncmp (path, X_("/select/"), 8)) {
-               if (sur->expand_enable && sur->expand) {
-                       strp = get_strip (sur->expand, get_address (msg));
-               } else {
-                       strp = _select;
-               }
+               strp = sur->select;
                ctr = 8;
        } else {
                return ret;
@@ -3385,6 +3847,9 @@ OSC::set_automation (const char *path, const char* types, lo_arg **argv, int arg
                        } else {
                                PBD::warning << "No fader for this strip" << endmsg;
                        }
+                       if (send) {
+                               control = send->gain_control ();
+                       }
                } else {
                        PBD::warning << "Automation not available for " << path << endmsg;
                }
@@ -3408,6 +3873,10 @@ OSC::set_automation (const char *path, const char* types, lo_arg **argv, int arg
                                        control->set_automation_state (ARDOUR::Touch);
                                        ret = 0;
                                        break;
+                               case 4:
+                                       control->set_automation_state (ARDOUR::Latch);
+                                       ret = 0;
+                                       break;
                                default:
                                        break;
                        }
@@ -3425,6 +3894,7 @@ OSC::touch_detect (const char *path, const char* types, lo_arg **argv, int argc,
        int ret = 1;
        OSCSurface *sur = get_surface(get_address (msg));
        boost::shared_ptr<Stripable> strp = boost::shared_ptr<Stripable>();
+       boost::shared_ptr<Send> send = boost::shared_ptr<Send> ();
        uint32_t ctr = 0;
        uint32_t touch = 0;
        uint32_t ssid;
@@ -3451,13 +3921,10 @@ OSC::touch_detect (const char *path, const char* types, lo_arg **argv, int argc,
                        ssid = atoi (&(strrchr (path, '/' ))[1]);
                        strp = get_strip (ssid, get_address (msg));
                }
+               send = get_send (strp, get_address (msg));
                ctr = 7;
        } else if (!strncmp (path, X_("/select/"), 8)) {
-               if (sur->expand_enable && sur->expand) {
-                       strp = get_strip (sur->expand, get_address (msg));
-               } else {
-                       strp = _select;
-               }
+               strp = sur->select;
                ctr = 8;
        } else {
                return ret;
@@ -3471,6 +3938,9 @@ OSC::touch_detect (const char *path, const char* types, lo_arg **argv, int argc,
                        } else {
                                PBD::warning << "No fader for this strip" << endmsg;
                        }
+                       if (send) {
+                               control = send->gain_control ();
+                       }
                } else {
                        PBD::warning << "Automation not available for " << path << endmsg;
                }
@@ -3518,6 +3988,9 @@ OSC::route_mute (int ssid, int yn, lo_message msg)
        OSCSurface *sur = get_surface(get_address (msg));
 
        if (s) {
+               if ((sur->temp_mode == BusOnly) && (s != sur->select)) {
+                       return float_message_with_id (X_("/strip/mute"), ssid, 0, sur->feedback[2], get_address (msg));
+               }
                if (s->mute_control()) {
                        s->mute_control()->set_value (yn ? 1.0 : 0.0, sur->usegroup);
                        return 0;
@@ -3532,11 +4005,7 @@ OSC::sel_mute (uint32_t yn, 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;
-       }
+       s = sur->select;
        if (s) {
                if (s->mute_control()) {
                        s->mute_control()->set_value (yn ? 1.0 : 0.0, PBD::Controllable::NoGroup);
@@ -3554,6 +4023,9 @@ OSC::route_solo (int ssid, int yn, lo_message msg)
        OSCSurface *sur = get_surface(get_address (msg));
 
        if (s) {
+               if ((sur->temp_mode == BusOnly) && (s != sur->select)) {
+                       return float_message_with_id (X_("/strip/solo"), ssid, 0, sur->feedback[2], get_address (msg));
+               }
                if (s->solo_control()) {
                        s->solo_control()->set_value (yn ? 1.0 : 0.0, sur->usegroup);
                }
@@ -3570,6 +4042,9 @@ OSC::route_solo_iso (int ssid, int yn, lo_message msg)
        OSCSurface *sur = get_surface(get_address (msg));
 
        if (s) {
+               if ((sur->temp_mode == BusOnly) && (s != sur->select)) {
+                       return float_message_with_id (X_("/strip/solo_iso"), ssid, 0, sur->feedback[2], get_address (msg));
+               }
                if (s->solo_isolate_control()) {
                        s->solo_isolate_control()->set_value (yn ? 1.0 : 0.0, sur->usegroup);
                        return 0;
@@ -3587,6 +4062,9 @@ OSC::route_solo_safe (int ssid, int yn, lo_message msg)
        OSCSurface *sur = get_surface(get_address (msg));
 
        if (s) {
+               if ((sur->temp_mode == BusOnly) && (s != sur->select)) {
+                       return float_message_with_id (X_("/strip/solo_safe"), ssid, 0, sur->feedback[2], get_address (msg));
+               }
                if (s->solo_safe_control()) {
                        s->solo_safe_control()->set_value (yn ? 1.0 : 0.0, sur->usegroup);
                        return 0;
@@ -3601,11 +4079,7 @@ OSC::sel_solo (uint32_t yn, 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;
-       }
+       s = sur->select;
        if (s) {
                if (s->solo_control()) {
                        session->set_control (s->solo_control(), yn ? 1.0 : 0.0, PBD::Controllable::NoGroup);
@@ -3619,11 +4093,7 @@ OSC::sel_solo_iso (uint32_t yn, 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;
-       }
+       s = sur->select;
        if (s) {
                if (s->solo_isolate_control()) {
                        s->solo_isolate_control()->set_value (yn ? 1.0 : 0.0, PBD::Controllable::NoGroup);
@@ -3638,11 +4108,7 @@ OSC::sel_solo_safe (uint32_t yn, 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;
-       }
+       s = sur->select;
        if (s) {
                if (s->solo_safe_control()) {
                        s->solo_safe_control()->set_value (yn ? 1.0 : 0.0, PBD::Controllable::NoGroup);
@@ -3657,11 +4123,7 @@ OSC::sel_recenable (uint32_t yn, 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;
-       }
+       s = sur->select;
        if (s) {
                if (s->rec_enable_control()) {
                        s->rec_enable_control()->set_value (yn ? 1.0 : 0.0, PBD::Controllable::NoGroup);
@@ -3681,6 +4143,9 @@ OSC::route_recenable (int ssid, int yn, lo_message msg)
        OSCSurface *sur = get_surface(get_address (msg));
 
        if (s) {
+               if ((sur->temp_mode == BusOnly) && (s != sur->select)) {
+                       return float_message_with_id (X_("/strip/recenable"), ssid, 0, sur->feedback[2], get_address (msg));
+               }
                if (s->rec_enable_control()) {
                        s->rec_enable_control()->set_value (yn, sur->usegroup);
                        if (s->rec_enable_control()->get_value()) {
@@ -3696,10 +4161,14 @@ OSC::route_rename (int ssid, char *newname, lo_message msg) {
        if (!session) {
                return -1;
        }
-
+       OSCSurface *sur = get_surface(get_address (msg));
        boost::shared_ptr<Stripable> s = get_strip(ssid, get_address(msg));
 
        if (s) {
+               if ((sur->temp_mode == BusOnly) && (s != sur->select)) {
+                       text_message_with_id (X_("/strip/name"), ssid, string_compose ("%1-Send", s->name()), sur->feedback[2], get_address(msg));
+                       return 1;
+               }
                s->set_name(std::string(newname));
        }
 
@@ -3714,11 +4183,7 @@ OSC::sel_rename (char *newname, 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;
-       }
+       s = sur->select;
        if (s) {
                s->set_name(std::string(newname));
        }
@@ -3734,11 +4199,7 @@ OSC::sel_comment (char *newcomment, 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;
-       }
+       s = sur->select;
        if (s) {
                boost::shared_ptr<Route> rt = boost::dynamic_pointer_cast<Route> (s);
                if (!rt) {
@@ -3767,11 +4228,7 @@ OSC::sel_group (char *group, 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;
-       }
+       s = sur->select;
        return strip_select_group (s, group);
 }
 
@@ -3835,11 +4292,7 @@ OSC::sel_recsafe (uint32_t yn, 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;
-       }
+       s = sur->select;
        if (s) {
                if (s->rec_safe_control()) {
                        s->rec_safe_control()->set_value (yn ? 1.0 : 0.0, PBD::Controllable::NoGroup);
@@ -3858,6 +4311,9 @@ OSC::route_recsafe (int ssid, int yn, lo_message msg)
        boost::shared_ptr<Stripable> s = get_strip (ssid, get_address (msg));
        OSCSurface *sur = get_surface(get_address (msg));
        if (s) {
+               if ((sur->temp_mode == BusOnly) && (s != sur->select)) {
+                       return float_message_with_id (X_("/strip/record_safe"), ssid, 0, sur->feedback[2], get_address (msg));
+               }
                if (s->rec_safe_control()) {
                        s->rec_safe_control()->set_value (yn, sur->usegroup);
                        if (s->rec_safe_control()->get_value()) {
@@ -3876,6 +4332,9 @@ OSC::route_monitor_input (int ssid, int yn, lo_message msg)
        OSCSurface *sur = get_surface(get_address (msg));
 
        if (s) {
+               if ((sur->temp_mode == BusOnly) && (s != sur->select)) {
+                       return float_message_with_id (X_("/strip/monitor_input"), ssid, 0, sur->feedback[2], get_address (msg));
+               }
                boost::shared_ptr<Track> track = boost::dynamic_pointer_cast<Track> (s);
                if (track) {
                        if (track->monitoring_control()) {
@@ -3895,11 +4354,7 @@ OSC::sel_monitor_input (uint32_t yn, 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;
-       }
+       s = sur->select;
        if (s) {
                boost::shared_ptr<Track> track = boost::dynamic_pointer_cast<Track> (s);
                if (track) {
@@ -3922,6 +4377,9 @@ OSC::route_monitor_disk (int ssid, int yn, lo_message msg)
        OSCSurface *sur = get_surface(get_address (msg));
 
        if (s) {
+               if ((sur->temp_mode == BusOnly) && (s != sur->select)) {
+                       return float_message_with_id (X_("/strip/monitor_disk"), ssid, 0, sur->feedback[2], get_address (msg));
+               }
                boost::shared_ptr<Track> track = boost::dynamic_pointer_cast<Track> (s);
                if (track) {
                        if (track->monitoring_control()) {
@@ -3941,11 +4399,7 @@ OSC::sel_monitor_disk (uint32_t yn, 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;
-       }
+       s = sur->select;
        if (s) {
                boost::shared_ptr<Track> track = boost::dynamic_pointer_cast<Track> (s);
                if (track) {
@@ -3969,6 +4423,9 @@ OSC::strip_phase (int ssid, int yn, lo_message msg)
        OSCSurface *sur = get_surface(get_address (msg));
 
        if (s) {
+               if ((sur->temp_mode == BusOnly) && (s != sur->select)) {
+                       return float_message_with_id (X_("/strip/polarity"), ssid, 0, sur->feedback[2], get_address (msg));
+               }
                if (s->phase_control()) {
                        s->phase_control()->set_value (yn ? 1.0 : 0.0, sur->usegroup);
                        return 0;
@@ -3983,11 +4440,7 @@ OSC::sel_phase (uint32_t yn, 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;
-       }
+       s = sur->select;
        if (s) {
                if (s->phase_control()) {
                        s->phase_control()->set_value (yn ? 1.0 : 0.0, PBD::Controllable::NoGroup);
@@ -4001,24 +4454,40 @@ int
 OSC::strip_expand (int ssid, int yn, lo_message msg)
 {
        OSCSurface *sur = get_surface(get_address (msg));
+       boost::shared_ptr<Stripable> s = get_strip (ssid, get_address (msg));
+       if (s) {
+               if ((sur->temp_mode == BusOnly)/* && (s != sur->select)*/) {
+                       uint32_t val = 0;
+                       if (ssid == (int) sur->expand) {
+                               val = 1;
+                       }
+                       return float_message_with_id (X_("/strip/expand"), ssid, val, sur->feedback[2], get_address (msg));
+               } else {
+                       sur->expand_strip = s;
+               }
+       }
        sur->expand_enable = (bool) yn;
        sur->expand = ssid;
-       boost::shared_ptr<Stripable> s;
+       boost::shared_ptr<Stripable> sel;
        if (yn) {
-               s = get_strip (ssid, get_address (msg));
+               sel = get_strip (ssid, get_address (msg));
        } else {
-               s = _select;
+               sel = boost::shared_ptr<Stripable> ();
        }
 
-       return _strip_select (s, get_address (msg));
+       return _strip_select (sel, get_address (msg));
 }
 
 int
 OSC::strip_hide (int ssid, int state, lo_message msg)
 {
        boost::shared_ptr<Stripable> s = get_strip (ssid, get_address (msg));
+       OSCSurface *sur = get_surface(get_address (msg));
 
        if (s) {
+               if ((sur->temp_mode == BusOnly) && (s != sur->select)) {
+                       return float_message_with_id (X_("/strip/hide"), ssid, 0, sur->feedback[2], get_address (msg));
+               }
                if (state != s->is_hidden ()) {
                        s->presentation_info().set_hidden ((bool) state);
                }
@@ -4033,8 +4502,23 @@ OSC::_strip_select (boost::shared_ptr<Stripable> s, lo_address addr)
                return -1;
        }
        OSCSurface *sur = get_surface(addr, true);
+       boost::weak_ptr<Stripable> o_sel = sur->select;
+       boost::shared_ptr<Stripable> old_sel= o_sel.lock ();
+       boost::weak_ptr<Stripable> o_expand = sur->expand_strip;
+       boost::shared_ptr<Stripable> old_expand= o_expand.lock ();
+
+       // we got a null strip check that old strips are valid
+       if (!s) {
+               if (old_expand && sur->expand_enable) {
+                       sur->expand = get_sid (old_expand, addr);
+                       if (sur->strip_types[11] || sur->expand) {
+                               s = old_expand;
+                       } else {
+                               sur->expand_strip = boost::shared_ptr<Stripable> ();
+                       }
+               }
+       }
        if (!s) {
-               // expand doesn't point to a stripable, turn it off and use select
                sur->expand = 0;
                sur->expand_enable = false;
                if (ControlProtocol::first_selected_stripable()) {
@@ -4042,9 +4526,11 @@ OSC::_strip_select (boost::shared_ptr<Stripable> s, lo_address addr)
                } else {
                        s = session->master_out ();
                }
-                       _select = s;
+               _select = s;
+       }
+       if (s != old_sel) {
+               sur->select = s;
        }
-       sur->select = s;
        bool sends;
        uint32_t nsends  = 0;
        do {
@@ -4063,12 +4549,20 @@ OSC::_strip_select (boost::shared_ptr<Stripable> s, lo_address addr)
                if (so != 0) {
                        so->refresh_strip (s, nsends, sur->gainmode, true);
                } else {
-                       OSCSelectObserver* sel_fb = new OSCSelectObserver (*this, sur);
+                       OSCSelectObserver* sel_fb = new OSCSelectObserver (*this, *session, sur);
                        sur->sel_obs = sel_fb;
                }
                sur->sel_obs->set_expand (sur->expand_enable);
+       } else {
+               if (so != 0) {
+                       delete so;
+                       sur->sel_obs = 0;
+               }
+       }
+       if (sur->feedback[0] || sur->feedback[1]) {
                uint32_t obs_expand = 0;
                if (sur->expand_enable) {
+                       sur->expand = get_sid (s, addr);
                        obs_expand = sur->expand;
                } else {
                        obs_expand = 0;
@@ -4076,10 +4570,14 @@ OSC::_strip_select (boost::shared_ptr<Stripable> s, lo_address addr)
                for (uint32_t i = 0; i < sur->observers.size(); i++) {
                        sur->observers[i]->set_expand (obs_expand);
                }
-       } else {
-               if (so != 0) {
-                       delete so;
-                       sur->sel_obs = 0;
+       }
+       if (s != old_sel) {
+               if (sur->temp_mode) {
+                       set_temp_mode (addr);
+                       if (sur->temp_mode > GroupOnly) {
+                               sur->bank = 1;
+                               strip_feedback (sur, false);
+                       }
                }
        }
        // need to set monitor for processor changed signal (for paging)
@@ -4115,9 +4613,12 @@ OSC::strip_gui_select (int ssid, int yn, lo_message msg)
                return -1;
        }
        OSCSurface *sur = get_surface(get_address (msg));
-       sur->expand_enable = false;
        boost::shared_ptr<Stripable> s = get_strip (ssid, get_address (msg));
        if (s) {
+               if ((sur->temp_mode == BusOnly) && (s != sur->select)) {
+                       return -1;
+               }
+               sur->expand_enable = false;
                SetStripableSelection (s);
        } else {
                if ((int) (sur->feedback.to_ulong())) {
@@ -4133,17 +4634,93 @@ OSC::sel_expand (uint32_t state, lo_message msg)
 {
        OSCSurface *sur = get_surface(get_address (msg));
        boost::shared_ptr<Stripable> s;
-       if (state && sur->expand) {
+       if (!sur->expand_strip) {
+               state = 0;
+               float_message (X_("/select/expand"), 0.0, get_address (msg));
+       }
+       if (state) {
                sur->expand_enable = (bool) state;
-               s = get_strip (sur->expand, get_address (msg));
+               s = boost::shared_ptr<Stripable> ();
        } else {
                sur->expand_enable = false;
-               s = _select;
+               s = boost::shared_ptr<Stripable> ();
        }
 
        return _strip_select (s, get_address (msg));
 }
 
+int
+OSC::sel_previous (lo_message msg)
+{
+       return sel_delta (-1, msg);
+}
+
+int
+OSC::sel_next (lo_message msg)
+{
+       return sel_delta (1, msg);
+}
+
+int
+OSC::sel_delta (int delta, lo_message msg)
+{
+       if (!delta) {
+               return 0;
+       }
+       OSCSurface *sur = get_surface(get_address (msg));
+       Sorted sel_strips;
+       if (sur->temp_mode < VCAOnly) {
+               sel_strips = sur->strips;
+       } else if (sur->temp_mode == VCAOnly) {
+               sel_strips = get_sorted_stripables(16, false, 0, sur->strips);
+       } else if (sur->temp_mode == BusOnly) {
+               sel_strips = get_sorted_stripables(132, false, 0, sur->strips);
+       } else {
+               return -1;
+       }
+       // the current selected strip _should_ be in sel_strips
+       uint32_t nstps = sel_strips.size ();
+       if (!nstps) {
+               return -1;
+       }
+       boost::shared_ptr<Stripable> new_sel = boost::shared_ptr<Stripable> ();
+       boost::weak_ptr<Stripable> o_sel = sur->select;
+       boost::shared_ptr<Stripable> old_sel= o_sel.lock ();
+       for (uint32_t i = 0; i < nstps; i++) {
+               if (old_sel == sel_strips[i]) {
+                       if (i && delta < 0) {
+                               // i is > 0 and delta is -1
+                               new_sel = sel_strips[i - 1];
+                       } else if ((i + 1) < nstps && delta > 0) {
+                               // i is at least 1 less than greatest and delta = 1
+                               new_sel = sel_strips[i + 1];
+                       } else if ((i + 1) >= nstps && delta > 0) {
+                               // i is greatest strip and delta 1
+                               new_sel = sel_strips[0];
+                       } else if (!i && delta < 0) {
+                               // i = 0 and delta -1
+                               new_sel = sel_strips[nstps - 1];
+                       } else {
+                               // should not happen
+                               return -1;
+                       }
+               }
+       }
+       if (!new_sel) {
+               // our selected strip has vanished use the first one
+               new_sel = sel_strips[0];
+       }
+       if (new_sel) {
+               if (!sur->expand_enable) {
+                       SetStripableSelection (new_sel);
+               } else {
+                       _strip_select (new_sel, get_address (msg));
+               }
+               return 0;
+       }
+       return -1;
+}
+
 int
 OSC::route_set_gain_dB (int ssid, float dB, lo_message msg)
 {
@@ -4153,19 +4730,25 @@ OSC::route_set_gain_dB (int ssid, float dB, lo_message msg)
        OSCSurface *sur = get_surface(get_address (msg));
        boost::shared_ptr<Stripable> s = get_strip (ssid, get_address (msg));
        if (s) {
+               boost::shared_ptr<GainControl> gain_control;
+               if (sur->temp_mode == BusOnly && get_send (s, get_address (msg))) {
+                       gain_control = get_send(s, get_address (msg))->gain_control();
+               } else {
+                       gain_control = s->gain_control();
+               }
                float abs;
-               if (s->gain_control()) {
+               if (gain_control) {
                        if (dB < -192) {
                                abs = 0;
                        } else {
                                abs = dB_to_coefficient (dB);
-                               float top = s->gain_control()->upper();
+                               float top = gain_control->upper();
                                if (abs > top) {
                                        abs = top;
                                }
                        }
-                       fake_touch (s->gain_control());
-                       s->gain_control()->set_value (abs, sur->usegroup);
+                       fake_touch (gain_control);
+                       gain_control->set_value (abs, sur->usegroup);
                        return 0;
                }
        }
@@ -4177,11 +4760,7 @@ OSC::sel_gain (float val, 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;
-       }
+       s = sur->select;
        if (s) {
                float abs;
                if (s->gain_control()) {
@@ -4207,11 +4786,7 @@ OSC::sel_dB_delta (float delta, 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;
-       }
+       s = sur->select;
        if (s) {
                if (s->gain_control()) {
                        float dB = accurate_coefficient_to_dB (s->gain_control()->get_value()) + delta;
@@ -4243,9 +4818,15 @@ OSC::route_set_gain_fader (int ssid, float pos, lo_message msg)
        OSCSurface *sur = get_surface(get_address (msg));
 
        if (s) {
-               if (s->gain_control()) {
-                       fake_touch (s->gain_control());
-                       s->gain_control()->set_value (s->gain_control()->interface_to_internal (pos), sur->usegroup);
+               boost::shared_ptr<GainControl> gain_control;
+               if (sur->temp_mode == BusOnly && get_send (s, get_address (msg))) {
+                       gain_control = get_send(s, get_address (msg))->gain_control();
+               } else {
+                       gain_control = s->gain_control();
+               }
+               if (gain_control) {
+                       fake_touch (gain_control);
+                       gain_control->set_value (gain_control->interface_to_internal (pos), sur->usegroup);
                } else {
                        return float_message_with_id (X_("/strip/fader"), ssid, 0, sur->feedback[2], get_address (msg));
                }
@@ -4262,18 +4843,24 @@ OSC::strip_db_delta (int ssid, float delta, lo_message msg)
        boost::shared_ptr<Stripable> s = get_strip (ssid, get_address (msg));
        OSCSurface *sur = get_surface(get_address (msg));
        if (s) {
-               float db = accurate_coefficient_to_dB (s->gain_control()->get_value()) + delta;
+               boost::shared_ptr<GainControl> gain_control;
+               if (sur->temp_mode == BusOnly && get_send (s, get_address (msg))) {
+                       gain_control = get_send(s, get_address (msg))->gain_control();
+               } else {
+                       gain_control = s->gain_control();
+               }
+               float db = accurate_coefficient_to_dB (gain_control->get_value()) + delta;
                float abs;
                if (db < -192) {
                        abs = 0;
                } else {
                        abs = dB_to_coefficient (db);
-                       float top = s->gain_control()->upper();
+                       float top = gain_control->upper();
                        if (abs > top) {
                                abs = top;
                        }
                }
-               s->gain_control()->set_value (abs, sur->usegroup);
+               gain_control->set_value (abs, sur->usegroup);
                return 0;
        }
        return -1;
@@ -4284,11 +4871,7 @@ OSC::sel_fader (float val, 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;
-       }
+       s = sur->select;
        if (s) {
                if (s->gain_control()) {
                        fake_touch (s->gain_control());
@@ -4307,6 +4890,9 @@ OSC::route_set_trim_abs (int ssid, float level, lo_message msg)
        OSCSurface *sur = get_surface(get_address (msg));
 
        if (s) {
+               if ((sur->temp_mode == BusOnly) && (s != sur->select)) {
+                       return float_message_with_id (X_("/strip/trimdB"), ssid, 0, sur->feedback[2], get_address (msg));
+               }
                if (s->trim_control()) {
                        s->trim_control()->set_value (level, sur->usegroup);
                        return 0;
@@ -4335,11 +4921,7 @@ OSC::sel_trim (float val, 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;
-       }
+       s = sur->select;
        if (s) {
                if (s->trim_control()) {
                        s->trim_control()->set_value (dB_to_coefficient (val), PBD::Controllable::NoGroup);
@@ -4354,11 +4936,7 @@ OSC::sel_hide (uint32_t state, 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;
-       }
+       s = sur->select;
        if (s) {
                if (state != s->is_hidden ()) {
                        s->presentation_info().set_hidden ((bool) state);
@@ -4372,11 +4950,7 @@ OSC::sel_pan_position (float val, 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;
-       }
+       s = sur->select;
        if (s) {
                if(s->pan_azimuth_control()) {
                        s->pan_azimuth_control()->set_value (s->pan_azimuth_control()->interface_to_internal (val), PBD::Controllable::NoGroup);
@@ -4391,11 +4965,7 @@ OSC::sel_pan_width (float val, 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;
-       }
+       s = sur->select;
        if (s) {
                if (s->pan_width_control()) {
                        s->pan_width_control()->set_value (s->pan_width_control()->interface_to_internal (val), PBD::Controllable::NoGroup);
@@ -4413,8 +4983,17 @@ OSC::route_set_pan_stereo_position (int ssid, float pos, lo_message msg)
        OSCSurface *sur = get_surface(get_address (msg));
 
        if (s) {
-               if(s->pan_azimuth_control()) {
-                       s->pan_azimuth_control()->set_value (s->pan_azimuth_control()->interface_to_internal (pos), sur->usegroup);
+               boost::shared_ptr<PBD::Controllable> pan_control = boost::shared_ptr<PBD::Controllable>();
+               if (sur->temp_mode == BusOnly && get_send (s, get_address (msg))) {
+                       boost::shared_ptr<ARDOUR::Send> send = get_send (s, get_address (msg));
+                       if (send->pan_outs() > 1) {
+                               pan_control = send->panner_shell()->panner()->pannable()->pan_azimuth_control;
+                       }
+               } else {
+                       pan_control = s->pan_azimuth_control();
+               }
+               if(pan_control) {
+                       pan_control->set_value (s->pan_azimuth_control()->interface_to_internal (pos), sur->usegroup);
                        return 0;
                }
        }
@@ -4430,6 +5009,9 @@ OSC::route_set_pan_stereo_width (int ssid, float pos, lo_message msg)
        OSCSurface *sur = get_surface(get_address (msg));
 
        if (s) {
+               if ((sur->temp_mode == BusOnly) && (s != sur->select)) {
+                       return float_message_with_id (X_("/strip/pan_stereo_width"), ssid, 1, sur->feedback[2], get_address (msg));
+               }
                if (s->pan_width_control()) {
                        s->pan_width_control()->set_value (pos, sur->usegroup);
                        return 0;
@@ -4501,11 +5083,7 @@ OSC::sel_sendgain (int id, float val, lo_message msg)
                return float_message_with_id (X_("/select/send_gain"), id, -193, sur->feedback[2], get_address (msg));
        }
        boost::shared_ptr<Stripable> s;
-       if (sur->expand_enable) {
-               s = get_strip (sur->expand, get_address (msg));
-       } else {
-               s = _select;
-       }
+       s = sur->select;
        float abs;
        int send_id = 0;
        if (s) {
@@ -4540,11 +5118,7 @@ OSC::sel_sendfader (int id, float val, lo_message msg)
                return float_message_with_id (X_("/select/send_fader"), id, 0, sur->feedback[2], get_address (msg));
        }
        boost::shared_ptr<Stripable> s;
-       if (sur->expand_enable) {
-               s = get_strip (sur->expand, get_address (msg));
-       } else {
-               s = _select;
-       }
+       s = sur->select;
        float abs;
        int send_id = 0;
        if (s) {
@@ -4616,11 +5190,7 @@ OSC::sel_sendenable (int id, float val, lo_message msg)
                return float_message_with_id (X_("/select/send_enable"), id, 0, sur->feedback[2], get_address (msg));
        }
        boost::shared_ptr<Stripable> s;
-       if (sur->expand_enable) {
-               s = get_strip (sur->expand, get_address (msg));
-       } else {
-               s = _select;
-       }
+       s = sur->select;
        int send_id = 0;
        if (s) {
                if (id > 0) {
@@ -4658,11 +5228,7 @@ OSC::sel_master_send_enable (int state, 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;
-       }
+       s = sur->select;
        if (s) {
                if (s->master_send_enable_controllable ()) {
                        s->master_send_enable_controllable()->set_value (state, PBD::Controllable::NoGroup);
@@ -5198,11 +5764,7 @@ OSC::sel_pan_elevation (float val, 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;
-       }
+       s = sur->select;
        if (s) {
                if (s->pan_elevation_control()) {
                        s->pan_elevation_control()->set_value (s->pan_elevation_control()->interface_to_internal (val), PBD::Controllable::NoGroup);
@@ -5217,11 +5779,7 @@ OSC::sel_pan_frontback (float val, 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;
-       }
+       s = sur->select;
        if (s) {
                if (s->pan_frontback_control()) {
                        s->pan_frontback_control()->set_value (s->pan_frontback_control()->interface_to_internal (val), PBD::Controllable::NoGroup);
@@ -5236,11 +5794,7 @@ OSC::sel_pan_lfe (float val, 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;
-       }
+       s = sur->select;
        if (s) {
                if (s->pan_lfe_control()) {
                        s->pan_lfe_control()->set_value (s->pan_lfe_control()->interface_to_internal (val), PBD::Controllable::NoGroup);
@@ -5256,11 +5810,7 @@ OSC::sel_comp_enable (float val, 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;
-       }
+       s = sur->select;
        if (s) {
                if (s->comp_enable_controllable()) {
                        s->comp_enable_controllable()->set_value (s->comp_enable_controllable()->interface_to_internal (val), PBD::Controllable::NoGroup);
@@ -5275,11 +5825,7 @@ OSC::sel_comp_threshold (float val, 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;
-       }
+       s = sur->select;
        if (s) {
                if (s->comp_threshold_controllable()) {
                        s->comp_threshold_controllable()->set_value (s->comp_threshold_controllable()->interface_to_internal (val), PBD::Controllable::NoGroup);
@@ -5294,11 +5840,7 @@ OSC::sel_comp_speed (float val, 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;
-       }
+       s = sur->select;
        if (s) {
                if (s->comp_speed_controllable()) {
                        s->comp_speed_controllable()->set_value (s->comp_speed_controllable()->interface_to_internal (val), PBD::Controllable::NoGroup);
@@ -5313,11 +5855,7 @@ OSC::sel_comp_mode (float val, 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;
-       }
+       s = sur->select;
        if (s) {
                if (s->comp_mode_controllable()) {
                        s->comp_mode_controllable()->set_value (s->comp_mode_controllable()->interface_to_internal (val), PBD::Controllable::NoGroup);
@@ -5332,11 +5870,7 @@ OSC::sel_comp_makeup (float val, 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;
-       }
+       s = sur->select;
        if (s) {
                if (s->comp_makeup_controllable()) {
                        s->comp_makeup_controllable()->set_value (s->comp_makeup_controllable()->interface_to_internal (val), PBD::Controllable::NoGroup);
@@ -5353,11 +5887,7 @@ OSC::sel_eq_enable (float val, 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;
-       }
+       s = sur->select;
        if (s) {
                if (s->eq_enable_controllable()) {
                        s->eq_enable_controllable()->set_value (s->eq_enable_controllable()->interface_to_internal (val), PBD::Controllable::NoGroup);
@@ -5372,11 +5902,7 @@ OSC::sel_eq_hpf_freq (float val, 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;
-       }
+       s = sur->select;
        if (s) {
                if (s->filter_freq_controllable(true)) {
                        s->filter_freq_controllable(true)->set_value (s->filter_freq_controllable(true)->interface_to_internal (val), PBD::Controllable::NoGroup);
@@ -5391,11 +5917,7 @@ OSC::sel_eq_lpf_freq (float val, 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;
-       }
+       s = sur->select;
        if (s) {
                if (s->filter_freq_controllable(false)) {
                        s->filter_freq_controllable(false)->set_value (s->filter_freq_controllable(false)->interface_to_internal (val), PBD::Controllable::NoGroup);
@@ -5410,11 +5932,7 @@ OSC::sel_eq_hpf_enable (float val, 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;
-       }
+       s = sur->select;
        if (s) {
                if (s->filter_enable_controllable(true)) {
                        s->filter_enable_controllable(true)->set_value (s->filter_enable_controllable(true)->interface_to_internal (val), PBD::Controllable::NoGroup);
@@ -5429,11 +5947,7 @@ OSC::sel_eq_lpf_enable (float val, 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;
-       }
+       s = sur->select;
        if (s) {
                if (s->filter_enable_controllable(false)) {
                        s->filter_enable_controllable(false)->set_value (s->filter_enable_controllable(false)->interface_to_internal (val), PBD::Controllable::NoGroup);
@@ -5448,11 +5962,7 @@ OSC::sel_eq_hpf_slope (float val, 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;
-       }
+       s = sur->select;
        if (s) {
                if (s->filter_slope_controllable(true)) {
                        s->filter_slope_controllable(true)->set_value (s->filter_slope_controllable(true)->interface_to_internal (val), PBD::Controllable::NoGroup);
@@ -5467,11 +5977,7 @@ OSC::sel_eq_lpf_slope (float val, 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;
-       }
+       s = sur->select;
        if (s) {
                if (s->filter_slope_controllable(false)) {
                        s->filter_slope_controllable(false)->set_value (s->filter_slope_controllable(false)->interface_to_internal (val), PBD::Controllable::NoGroup);
@@ -5486,11 +5992,7 @@ OSC::sel_eq_gain (int id, float val, 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;
-       }
+       s = sur->select;
        if (s) {
                if (id > 0) {
                        --id;
@@ -5508,11 +6010,7 @@ OSC::sel_eq_freq (int id, float val, 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;
-       }
+       s = sur->select;
        if (s) {
                if (id > 0) {
                        --id;
@@ -5530,11 +6028,7 @@ OSC::sel_eq_q (int id, float val, 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;
-       }
+       s = sur->select;
        if (s) {
                if (id > 0) {
                        --id;
@@ -5552,11 +6046,7 @@ OSC::sel_eq_shape (int id, float val, 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;
-       }
+       s = sur->select;
        if (s) {
                if (id > 0) {
                        --id;
@@ -6070,13 +6560,16 @@ OSC::cue_send_enable (uint32_t id, float state, lo_message msg)
 int
 OSC::float_message (string path, float val, lo_address addr)
 {
+       _lo_lock.lock ();
 
        lo_message reply;
        reply = lo_message_new ();
        lo_message_add_float (reply, (float) val);
 
        lo_send_message (addr, path.c_str(), reply);
+       Glib::usleep(1);
        lo_message_free (reply);
+       _lo_lock.unlock ();
 
        return 0;
 }
@@ -6084,6 +6577,7 @@ OSC::float_message (string path, float val, lo_address addr)
 int
 OSC::float_message_with_id (std::string path, uint32_t ssid, float value, bool in_line, lo_address addr)
 {
+       _lo_lock.lock ();
        lo_message msg = lo_message_new ();
        if (in_line) {
                path = string_compose ("%1/%2", path, ssid);
@@ -6093,20 +6587,25 @@ OSC::float_message_with_id (std::string path, uint32_t ssid, float value, bool i
        lo_message_add_float (msg, value);
 
        lo_send_message (addr, path.c_str(), msg);
+       Glib::usleep(1);
        lo_message_free (msg);
+       _lo_lock.unlock ();
        return 0;
 }
 
 int
 OSC::int_message (string path, int val, lo_address addr)
 {
+       _lo_lock.lock ();
 
        lo_message reply;
        reply = lo_message_new ();
        lo_message_add_int32 (reply, (float) val);
 
        lo_send_message (addr, path.c_str(), reply);
+       Glib::usleep(1);
        lo_message_free (reply);
+       _lo_lock.unlock ();
 
        return 0;
 }
@@ -6114,6 +6613,7 @@ OSC::int_message (string path, int val, lo_address addr)
 int
 OSC::int_message_with_id (std::string path, uint32_t ssid, int value, bool in_line, lo_address addr)
 {
+       _lo_lock.lock ();
        lo_message msg = lo_message_new ();
        if (in_line) {
                path = string_compose ("%1/%2", path, ssid);
@@ -6123,20 +6623,25 @@ OSC::int_message_with_id (std::string path, uint32_t ssid, int value, bool in_li
        lo_message_add_int32 (msg, value);
 
        lo_send_message (addr, path.c_str(), msg);
+       Glib::usleep(1);
        lo_message_free (msg);
+       _lo_lock.unlock ();
        return 0;
 }
 
 int
 OSC::text_message (string path, string val, lo_address addr)
 {
+       _lo_lock.lock ();
 
        lo_message reply;
        reply = lo_message_new ();
        lo_message_add_string (reply, val.c_str());
 
        lo_send_message (addr, path.c_str(), reply);
+       Glib::usleep(1);
        lo_message_free (reply);
+       _lo_lock.unlock ();
 
        return 0;
 }
@@ -6144,6 +6649,7 @@ OSC::text_message (string path, string val, lo_address addr)
 int
 OSC::text_message_with_id (std::string path, uint32_t ssid, std::string val, bool in_line, lo_address addr)
 {
+       _lo_lock.lock ();
        lo_message msg = lo_message_new ();
        if (in_line) {
                path = string_compose ("%1/%2", path, ssid);
@@ -6154,7 +6660,9 @@ OSC::text_message_with_id (std::string path, uint32_t ssid, std::string val, boo
        lo_message_add_string (msg, val.c_str());
 
        lo_send_message (addr, path.c_str(), msg);
+       Glib::usleep(1);
        lo_message_free (msg);
+       _lo_lock.unlock ();
        return 0;
 }