OSC: reworking of previous/next select
[ardour.git] / libs / surfaces / osc / osc.cc
index 6e38b88344867e917253aa908ab8d582039761a9..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"
@@ -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,7 @@ OSC::catchall (const char *path, const char* types, lo_arg **argv, int argc, lo_
                set = &(link_sets[ls]);
                sur->custom_mode = set->custom_mode;
                sur->custom_strips = set->custom_strips;
+               sur->temp_mode = set->temp_mode;
                sur->temp_strips = set->temp_strips;
        }
 
@@ -853,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) {
@@ -876,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) {
@@ -1315,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;
@@ -1343,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;
 }
@@ -1371,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;
 
@@ -1394,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();
@@ -1410,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
@@ -1572,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;
                }
@@ -1782,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;
@@ -1960,7 +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;
-       s->custom_mode = 0;
        s->strip_types = strips;
        s->feedback = fb;
        s->gainmode = gm;
@@ -1971,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());
@@ -1978,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);
@@ -2014,7 +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->custom_mode = 0;
+       s->temp_mode = TempOff;
        if (s->strip_types[10]) {
                s->usegroup = PBD::Controllable::UseGroup;
        } else {
@@ -2023,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;
 }
 
@@ -2107,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;
                        }
                }
@@ -2157,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;
@@ -2191,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
@@ -2214,9 +2252,10 @@ 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_mode < 7) {
+       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);
@@ -2245,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 {
@@ -2252,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);
+                                       }
+                               }
                        }
                }
        }
@@ -2536,12 +2589,7 @@ int
 OSC::parse_sel_group (const char *path, const char* types, lo_arg **argv, int argc, lo_message msg)
 {
        OSCSurface *sur = get_surface(get_address (msg));
-       boost::shared_ptr<Stripable> s;
-       if (sur->expand_enable) {
-               s = get_strip (sur->expand, get_address (msg));
-       } else {
-               s = _select;
-       }
+       boost::shared_ptr<Stripable> s = sur->select;
        int ret = 1; /* unhandled */
        if (s) {
                if (!strncmp (path, X_("/select/group"), 13)) {
@@ -2559,7 +2607,6 @@ OSC::parse_sel_group (const char *path, const char* types, lo_arg **argv, int ar
                RouteGroup *rg = rt->route_group();
                if (!rg) {
                        PBD::warning << "OSC: This strip is not part of a group." << endmsg;
-                       return ret;
                }
                float value = 0;
                if (argc == 1) {
@@ -2569,82 +2616,118 @@ OSC::parse_sel_group (const char *path, const char* types, lo_arg **argv, int ar
                                value = (uint32_t) argv[0]->i;
                        }
                }
-               if (!strncmp (path, X_("/select/group/enable"), 20)) {
-                       if (argc == 1) {
-                               rg->set_active (value, this);
-                               ret = 0;
+               if (!strncmp (path, X_("/select/group/only"), 18)) {
+                       if (!rg) {
+                               return ret;
                        }
-               }
-               else if (!strncmp (path, X_("/select/group/only"), 18)) {
                        if ((argc == 1 && value) || !argc) {
                                // fill sur->strips with routes from this group and hit bank1
-                               sur->temp_strips.clear();
-                               boost::shared_ptr<RouteList> rl = rg->route_list();
-                               for (RouteList::iterator it = rl->begin(); it != rl->end(); ++it) {
-                                       boost::shared_ptr<Route> r = *it;
-                                       boost::shared_ptr<Stripable> s = boost::dynamic_pointer_cast<Stripable> (r);
-                                       sur->temp_strips.push_back(s);
-                               }
-                               sur->custom_mode = 7;
+                               sur->temp_mode = GroupOnly;
+                               ret = set_temp_mode (get_address (msg));
                                set_bank (1, msg);
-                               ret = 0;
                        } 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 (argc == 1) {
-                               rg->set_gain ((bool) value);
-                               ret = 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 (argc == 1) {
-                               rg->set_relative ((bool) value, this);
-                               ret = 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 (argc == 1) {
-                               rg->set_mute ((bool) value);
-                               ret = 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 (argc == 1) {
-                               rg->set_solo ((bool) value);
-                               ret = 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 (argc == 1) {
-                               rg->set_recenable ((bool) value);
-                               ret = 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 (argc == 1) {
-                               rg->set_select ((bool) value);
-                               ret = 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 (argc == 1) {
-                               rg->set_route_active ((bool) value);
-                               ret = 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 (argc == 1) {
-                               rg->set_color ((bool) value);
-                               ret = 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 (argc == 1) {
-                               rg->set_monitoring ((bool) value);
-                               ret = 0;
+                       if (rg) {
+                               if (argc == 1) {
+                                       rg->set_monitoring ((bool) value);
+                                       ret = 0;
+                               }
+                       } else {
+                               int_message (X_("/select/group/monitoring"), 0, get_address (msg));
                        }
                }
        }
@@ -2657,11 +2740,7 @@ OSC::parse_sel_vca (const char *path, const char* types, lo_arg **argv, int argc
 {
        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;
        int ret = 1; /* unhandled */
        if (s) {
                string svalue = "";
@@ -2703,19 +2782,9 @@ OSC::parse_sel_vca (const char *path, const char* types, lo_arg **argv, int argc
                        boost::shared_ptr<VCA> vca = boost::dynamic_pointer_cast<VCA> (s);
                        if (vca) {
                                if ((argc == 1 && ivalue) || !argc) {
-                                       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->custom_mode = 7;
+                                       sur->temp_mode = VCAOnly;
+                                       ret = set_temp_mode (get_address (msg));
                                        set_bank (1, msg);
-                                       ret = 0;
                                } else {
                                        // key off is ignored
                                        ret = 0;
@@ -2745,6 +2814,141 @@ OSC::get_vca_by_name (std::string vname)
        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)
 {
@@ -2797,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;
 }
 
@@ -2948,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();
@@ -3602,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') {
@@ -3625,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;
@@ -3645,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;
                }
@@ -3668,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;
                        }
@@ -3685,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;
@@ -3711,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;
@@ -3731,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;
                }
@@ -3778,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;
@@ -3792,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);
@@ -3814,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);
                }
@@ -3830,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;
@@ -3847,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;
@@ -3861,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);
@@ -3879,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);
@@ -3898,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);
@@ -3917,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);
@@ -3941,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()) {
@@ -3956,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));
        }
 
@@ -3974,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));
        }
@@ -3994,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) {
@@ -4027,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);
 }
 
@@ -4095,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);
@@ -4118,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()) {
@@ -4136,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()) {
@@ -4155,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) {
@@ -4182,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()) {
@@ -4201,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) {
@@ -4229,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;
@@ -4243,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);
@@ -4261,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);
                }
@@ -4293,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()) {
@@ -4302,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 {
@@ -4327,8 +4553,16 @@ OSC::_strip_select (boost::shared_ptr<Stripable> s, lo_address addr)
                        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;
@@ -4336,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)
@@ -4375,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())) {
@@ -4393,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)
 {
@@ -4413,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;
                }
        }
@@ -4437,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()) {
@@ -4467,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;
@@ -4503,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));
                }
@@ -4522,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;
@@ -4544,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());
@@ -4567,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;
@@ -4595,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);
@@ -4614,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);
@@ -4632,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);
@@ -4651,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);
@@ -4673,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;
                }
        }
@@ -4690,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;
@@ -4761,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) {
@@ -4800,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) {
@@ -4876,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) {
@@ -4918,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);
@@ -5458,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);
@@ -5477,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);
@@ -5496,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);
@@ -5516,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);
@@ -5535,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);
@@ -5554,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);
@@ -5573,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);
@@ -5592,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);
@@ -5613,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);
@@ -5632,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);
@@ -5651,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);
@@ -5670,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);
@@ -5689,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);
@@ -5708,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);
@@ -5727,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);
@@ -5746,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;
@@ -5768,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;
@@ -5790,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;
@@ -5812,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;
@@ -6330,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;
 }
@@ -6344,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);
@@ -6353,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;
 }
@@ -6374,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);
@@ -6383,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;
 }
@@ -6404,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);
@@ -6414,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;
 }