diff --git a/libs/surfaces/osc/osc.cc b/libs/surfaces/osc/osc.cc index 3e1e8c4c0b..808f88d289 100644 --- a/libs/surfaces/osc/osc.cc +++ b/libs/surfaces/osc/osc.cc @@ -2938,7 +2938,7 @@ OSC::get_sid (boost::shared_ptr strip, lo_address addr) } } } - // failsafe... should never get here. + // strip not in current bank return 0; } @@ -4399,6 +4399,8 @@ OSC::strip_expand (int ssid, int yn, lo_message msg) 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; @@ -4439,22 +4441,30 @@ OSC::_strip_select (boost::shared_ptr s, lo_address addr) OSCSurface *sur = get_surface(addr, true); boost::weak_ptr o_sel = sur->select; boost::shared_ptr old_sel= o_sel.lock (); + boost::weak_ptr o_expand = sur->expand_strip; + boost::shared_ptr old_expand= o_expand.lock (); if (!s) { - // we got a null strip check that old strip is valid - if (old_sel && sur->expand_enable) { - s = old_sel; - } else { - sur->expand = 0; - sur->expand_enable = false; - if (ControlProtocol::first_selected_stripable()) { - s = ControlProtocol::first_selected_stripable(); + // we got a null strip check that old strips are valid + if (old_expand && sur->expand_enable) { + sur->expand = get_sid (old_expand, addr); + if (sur->strip_types[11] || sur->expand) { + s = old_expand; } else { - s = session->master_out (); + sur->expand_strip = boost::shared_ptr (); } - _select = s; } } + if (!s) { + sur->expand = 0; + sur->expand_enable = false; + if (ControlProtocol::first_selected_stripable()) { + s = ControlProtocol::first_selected_stripable(); + } else { + s = session->master_out (); + } + _select = s; + } if (s != old_sel) { sur->select = s; if (sur->custom_mode >= GroupOnly) { @@ -4552,9 +4562,9 @@ OSC::sel_expand (uint32_t state, lo_message msg) { OSCSurface *sur = get_surface(get_address (msg)); boost::shared_ptr s; - if (state && sur->expand) { + if (state) { sur->expand_enable = (bool) state; - s = get_strip (sur->expand, get_address (msg)); + s = sur->expand_strip; } else { sur->expand_enable = false; s = _select; diff --git a/libs/surfaces/osc/osc.h b/libs/surfaces/osc/osc.h index f7284063f5..1c7e1a732b 100644 --- a/libs/surfaces/osc/osc.h +++ b/libs/surfaces/osc/osc.h @@ -150,7 +150,8 @@ class OSC : public ARDOUR::ControlProtocol, public AbstractUI OSCSelectObserver* sel_obs; // So we can sync select feedback with selected channel uint32_t expand; // Used by /select/select bool expand_enable; // use expand instead of select - boost::shared_ptr select; // stripable this surface uses (maybe expand strip) + boost::shared_ptr expand_strip; // stripable this surface uses for expand + boost::shared_ptr select; // stripable this surface uses as selected int plug_page; // current plugin page uint32_t plug_page_size; // plugin page size (number of controls) int plugin_id; // id of current plugin @@ -185,9 +186,22 @@ class OSC : public ARDOUR::ControlProtocol, public AbstractUI * [12] - Send Playhead position like primary/secondary GUI clocks * [13] - Send well known feedback (for /select/command * [14] - use OSC 1.0 only (#reply -> /reply) + * + * Strip_type bits: + * [0] - Audio Tracks + * [1] - Midi Tracks + * [2] - Audio Bus + * [3] - Midi Bus + * [4] - VCAs + * [5] - master + * [6] - Monitor + * [7] - Aux Bus + * [8] - Selected + * [9] - Hidden + * [10] - Use Groups + * [11] - Global Expand */ - // storage for each surface's settings mutable Glib::Threads::Mutex surfaces_lock; typedef std::vector Surface;