OSC: Signal for editor mixer change. (Selected or not)
authorLen Ovens <len@ovenwerks.net>
Tue, 5 Jul 2016 03:07:38 +0000 (20:07 -0700)
committerLen Ovens <len@ovenwerks.net>
Tue, 5 Jul 2016 03:07:38 +0000 (20:07 -0700)
libs/ardour/ardour/session.h
libs/ardour/session.cc
libs/surfaces/osc/osc.cc
libs/surfaces/osc/osc.h

index 61c575e0b22fa85b1533840a3decb837dcd95653..febfc2eb2f351a38beea97b89cd1db2c89739f2e 100644 (file)
@@ -823,7 +823,8 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
        boost::shared_ptr<Route> monitor_out() const { return _monitor_out; }
        boost::shared_ptr<Route> master_out() const { return _master_out; }
        boost::weak_ptr<Route> get_editor_mixer() const { return _editor_mixer; }
-       void set_editor_mixer (boost::weak_ptr<Route> r) { _editor_mixer = r; }
+       void set_editor_mixer (boost::weak_ptr<Route> r) { _editor_mixer = r; EditorMixerChanged(); }
+       static PBD::Signal0<void> EditorMixerChanged;
 
        void globally_add_internal_sends (boost::shared_ptr<Route> dest, Placement p, bool);
        void globally_set_send_gains_from_track (boost::shared_ptr<Route> dest);
index 94051b0f9deaf04777d261d0541256df22083c52..33d8b08832d30fb0806f9cdc4dd4dad597467c2c 100644 (file)
@@ -148,6 +148,7 @@ PBD::Signal0<void> Session::Quit;
 PBD::Signal0<void> Session::FeedbackDetected;
 PBD::Signal0<void> Session::SuccessfulGraphSort;
 PBD::Signal2<void,std::string,std::string> Session::VersionMismatch;
+PBD::Signal0<void> Session::EditorMixerChanged;
 
 const framecnt_t Session::bounce_chunk_size = 8192;
 static void clean_up_session_event (SessionEvent* ev) { delete ev; }
index 98bf0505f9fea3f805da89198466ca98a365b664..f2fd8af8674b7f8804174ef4d72d3cccf866c04e 100644 (file)
@@ -249,8 +249,8 @@ OSC::start ()
        periodic_connection = periodic_timeout->connect (sigc::mem_fun (*this, &OSC::periodic));
        periodic_timeout->attach (main_loop()->get_context());
 
-       // catch GUI select changes for GUI_select mode
-       StripableSelectionChanged.connect (session_connections, MISSING_INVALIDATOR, boost::bind (&OSC::gui_selection_changed, this, _1), this);
+       // catch current editor mixer changes for GUI_select mode
+       session->EditorMixerChanged.connect (session_connections, MISSING_INVALIDATOR, boost::bind (&OSC::gui_selection_changed, this), this);
 
        // catch track reordering
        // receive routes added
@@ -1226,20 +1226,7 @@ OSC::get_surface (lo_address addr)
        // if we do this when OSC is started we get the wrong stripable
        // we don't need this until we actually have a surface to deal with
        if (!_select) {
-               // guess at which stripable is the current editor mixerstrip
-               // right now just choose the first one we find, may be the wrong one
-               // hopefully we will have access to session->current_strip at some point
-               StripableList stripables;
-
-               session->get_stripables (stripables);
-
-               for (StripableList::iterator it = stripables.begin(); it != stripables.end(); ++it) {
-                       boost::shared_ptr<Stripable> s = *it;
-                       if (s->is_selected()) {
-                               _select = s;
-                               break;
-                       }
-               }
+               gui_selection_changed();
        }
 
        // No surface create one with default values
@@ -2611,13 +2598,11 @@ OSC::route_plugin_parameter_print (int ssid, int piid, int par, lo_message msg)
 }
 
 void
-OSC::gui_selection_changed (StripableNotificationListPtr stripables)
+OSC::gui_selection_changed ()
 {
        boost::shared_ptr<Stripable> strip;
 
-       if (!stripables->empty()) {
-               strip = boost::dynamic_pointer_cast<Stripable>(session->get_editor_mixer().lock());
-       }
+       strip = boost::dynamic_pointer_cast<Stripable>(session->get_editor_mixer().lock());
        if (strip) {
                _select = strip;
                for (uint32_t it = 0; it < _surface.size(); ++it) {
@@ -2628,7 +2613,6 @@ OSC::gui_selection_changed (StripableNotificationListPtr stripables)
                        }
                }
        }
-
 }
 
 // timer callbacks
index d828dffae71912c561f3d9cc47541b0646906a82..6a38d32a31b31de344b1879118887e33d0dc5332 100644 (file)
@@ -486,7 +486,7 @@ class OSC : public ARDOUR::ControlProtocol, public AbstractUI<OSCUIRequest>
        void end_listen (boost::shared_ptr<ARDOUR::Stripable>, lo_address);
        void drop_route (boost::weak_ptr<ARDOUR::Stripable>);
        void route_lost (boost::weak_ptr<ARDOUR::Stripable>);
-       void gui_selection_changed (ARDOUR::StripableNotificationListPtr stripables);
+       void gui_selection_changed (void);
 
        void route_name_changed (const PBD::PropertyChange&, boost::weak_ptr<ARDOUR::Route> r, lo_address addr);
        void recalcbanks ();