From fef79d46bb54c0e9179e54a0977eeb602e4b2db3 Mon Sep 17 00:00:00 2001 From: Len Ovens Date: Mon, 4 Jul 2016 20:07:38 -0700 Subject: OSC: Signal for editor mixer change. (Selected or not) --- libs/ardour/ardour/session.h | 3 ++- libs/ardour/session.cc | 1 + libs/surfaces/osc/osc.cc | 26 +++++--------------------- libs/surfaces/osc/osc.h | 2 +- 4 files changed, 9 insertions(+), 23 deletions(-) (limited to 'libs') diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index 61c575e0b2..febfc2eb2f 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -823,7 +823,8 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop boost::shared_ptr monitor_out() const { return _monitor_out; } boost::shared_ptr master_out() const { return _master_out; } boost::weak_ptr get_editor_mixer() const { return _editor_mixer; } - void set_editor_mixer (boost::weak_ptr r) { _editor_mixer = r; } + void set_editor_mixer (boost::weak_ptr r) { _editor_mixer = r; EditorMixerChanged(); } + static PBD::Signal0 EditorMixerChanged; void globally_add_internal_sends (boost::shared_ptr dest, Placement p, bool); void globally_set_send_gains_from_track (boost::shared_ptr dest); diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 94051b0f9d..33d8b08832 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -148,6 +148,7 @@ PBD::Signal0 Session::Quit; PBD::Signal0 Session::FeedbackDetected; PBD::Signal0 Session::SuccessfulGraphSort; PBD::Signal2 Session::VersionMismatch; +PBD::Signal0 Session::EditorMixerChanged; const framecnt_t Session::bounce_chunk_size = 8192; static void clean_up_session_event (SessionEvent* ev) { delete ev; } diff --git a/libs/surfaces/osc/osc.cc b/libs/surfaces/osc/osc.cc index 98bf0505f9..f2fd8af867 100644 --- a/libs/surfaces/osc/osc.cc +++ b/libs/surfaces/osc/osc.cc @@ -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 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 strip; - if (!stripables->empty()) { - strip = boost::dynamic_pointer_cast(session->get_editor_mixer().lock()); - } + strip = boost::dynamic_pointer_cast(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 diff --git a/libs/surfaces/osc/osc.h b/libs/surfaces/osc/osc.h index d828dffae7..6a38d32a31 100644 --- a/libs/surfaces/osc/osc.h +++ b/libs/surfaces/osc/osc.h @@ -486,7 +486,7 @@ class OSC : public ARDOUR::ControlProtocol, public AbstractUI void end_listen (boost::shared_ptr, lo_address); void drop_route (boost::weak_ptr); void route_lost (boost::weak_ptr); - void gui_selection_changed (ARDOUR::StripableNotificationListPtr stripables); + void gui_selection_changed (void); void route_name_changed (const PBD::PropertyChange&, boost::weak_ptr r, lo_address addr); void recalcbanks (); -- cgit v1.2.3