diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2015-12-11 11:46:39 -0500 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2015-12-16 05:55:10 -0500 |
commit | 81179389d31feeb69218a99f3dbbd91161d48c7a (patch) | |
tree | 7f84eed4d49c1f4822c4e56093683c7820d05b4c | |
parent | 8ba8f1c0b08bb1c8ffbb4f419806e0c05619808b (diff) |
mackie: cleanup subview mode a little
-rw-r--r-- | libs/surfaces/mackie/mackie_control_protocol.cc | 54 | ||||
-rw-r--r-- | libs/surfaces/mackie/mackie_control_protocol.h | 5 | ||||
-rw-r--r-- | libs/surfaces/mackie/mcp_buttons.cc | 15 | ||||
-rw-r--r-- | libs/surfaces/mackie/strip.cc | 54 | ||||
-rw-r--r-- | libs/surfaces/mackie/strip.h | 6 | ||||
-rw-r--r-- | libs/surfaces/mackie/surface.cc | 31 | ||||
-rw-r--r-- | libs/surfaces/mackie/surface.h | 2 |
7 files changed, 92 insertions, 75 deletions
diff --git a/libs/surfaces/mackie/mackie_control_protocol.cc b/libs/surfaces/mackie/mackie_control_protocol.cc index c6263ef9bf..d331851975 100644 --- a/libs/surfaces/mackie/mackie_control_protocol.cc +++ b/libs/surfaces/mackie/mackie_control_protocol.cc @@ -1622,10 +1622,33 @@ MackieControlProtocol::clear_ports () } void -MackieControlProtocol::set_subview_mode (SubViewMode sm) +MackieControlProtocol::set_subview_mode (SubViewMode sm, boost::shared_ptr<Route> r) { _subview_mode = sm; - display_view_mode (); + _subview_route = r; + + if (_subview_mode == None) { + assert (!_subview_route); + } + + { + Glib::Threads::Mutex::Lock lm (surfaces_lock); + + for (Surfaces::iterator s = surfaces.begin(); s != surfaces.end(); ++s) { + (*s)->subview_mode_changed (); + } + } + + /* turn buttons related to vpot mode on or off as required */ + + if (_subview_mode != None) { + update_global_button (Button::Trim, off); + update_global_button (Button::Send, off); + update_global_button (Button::Pan, off); + } else { + pot_mode_globals (); + } + } void @@ -1649,15 +1672,6 @@ MackieControlProtocol::display_view_mode () (*s)->update_view_mode_display (); } } - - /* turn buttons related to vpot mode on or off as required */ - if (_subview_mode != None) { - update_global_button (Button::Trim, off); - update_global_button (Button::Send, off); - update_global_button (Button::Pan, off); - } else { - pot_mode_globals (); - } } void @@ -2150,3 +2164,21 @@ MackieControlProtocol::selected (boost::shared_ptr<Route> r) const } return false; } + +boost::shared_ptr<Route> +MackieControlProtocol::first_selected_route () const +{ + if (_last_selected_routes.empty()) { + return boost::shared_ptr<Route>(); + } + + boost::shared_ptr<Route> r = _last_selected_routes.front().lock(); + + return r; /* may be null */ +} + +boost::shared_ptr<Route> +MackieControlProtocol::subview_route () const +{ + return _subview_route; +} diff --git a/libs/surfaces/mackie/mackie_control_protocol.h b/libs/surfaces/mackie/mackie_control_protocol.h index a5ec5da4d1..93e90c56f2 100644 --- a/libs/surfaces/mackie/mackie_control_protocol.h +++ b/libs/surfaces/mackie/mackie_control_protocol.h @@ -150,6 +150,7 @@ class MackieControlProtocol FlipMode flip_mode () const { return _flip_mode; } ViewMode view_mode () const { return _view_mode; } SubViewMode subview_mode () const { return _subview_mode; } + boost::shared_ptr<ARDOUR::Route> subview_route() const; PotMode pot_mode () const { return _pot_mode; } bool zoom_mode () const { return modifier_state() & MODIFIER_ZOOM; } bool metering_active () const { return _metering_active; } @@ -158,9 +159,10 @@ class MackieControlProtocol bool is_audio_track (boost::shared_ptr<ARDOUR::Route>) const; bool is_midi_track (boost::shared_ptr<ARDOUR::Route>) const; bool selected (boost::shared_ptr<ARDOUR::Route>) const; + boost::shared_ptr<ARDOUR::Route> first_selected_route () const; void set_view_mode (ViewMode); - void set_subview_mode (SubViewMode); + void set_subview_mode (SubViewMode, boost::shared_ptr<ARDOUR::Route>); void set_flip_mode (FlipMode); void set_pot_mode (PotMode); void pot_mode_globals (); @@ -330,6 +332,7 @@ class MackieControlProtocol FlipMode _flip_mode; ViewMode _view_mode; SubViewMode _subview_mode; + boost::shared_ptr<ARDOUR::Route> _subview_route; PotMode _pot_mode; int _current_selected_track; int _modifier_state; diff --git a/libs/surfaces/mackie/mcp_buttons.cc b/libs/surfaces/mackie/mcp_buttons.cc index e92b8e8a75..0ae214cc78 100644 --- a/libs/surfaces/mackie/mcp_buttons.cc +++ b/libs/surfaces/mackie/mcp_buttons.cc @@ -690,8 +690,9 @@ LedState MackieControlProtocol::eq_press (Button &) { if (Profile->get_mixbus()) { - if (_last_selected_routes.size() == 1) { - set_subview_mode (EQ); + boost::shared_ptr<Route> r = first_selected_route (); + if (r) { + set_subview_mode (EQ, r); return on; } } @@ -707,11 +708,17 @@ LedState MackieControlProtocol::dyn_press (Button &) { if (Profile->get_mixbus()) { - set_subview_mode (Dynamics); - return on; + boost::shared_ptr<Route> r = first_selected_route (); + + if (r) { + set_subview_mode (Dynamics, r); + return on; + } } + return none; } + LedState MackieControlProtocol::dyn_release (Button &) { diff --git a/libs/surfaces/mackie/strip.cc b/libs/surfaces/mackie/strip.cc index be3d622213..f4eda5b919 100644 --- a/libs/surfaces/mackie/strip.cc +++ b/libs/surfaces/mackie/strip.cc @@ -575,7 +575,7 @@ Strip::show_route_name () void Strip::notify_eq_change (AutomationType p, uint32_t port_number, bool force_update) { - if (!_subview_route) { + if (_surface->mcp().subview_mode() == MackieControlProtocol::None) { /* no longer in EQ subview mode */ return; } @@ -585,7 +585,7 @@ Strip::notify_eq_change (AutomationType p, uint32_t port_number, bool force_upda return; } - boost::shared_ptr<PluginInsert> eq = _subview_route->ch_eq(); + boost::shared_ptr<PluginInsert> eq = _surface->mcp().subview_route()->ch_eq(); if (eq) { boost::shared_ptr<AutomationControl> control = boost::dynamic_pointer_cast<ARDOUR::AutomationControl> (eq->control (Evoral::Parameter (ARDOUR::PluginAutomation, 0, port_number))); @@ -1231,7 +1231,7 @@ Strip::vpot_mode_string () return "LFE"; } - if (_subview_route) { + if (_surface->mcp().subview_mode() != MackieControlProtocol::None) { return string(); } @@ -1287,7 +1287,8 @@ Strip::return_to_vpot_mode_display () /* returns the second line of the two-line per-strip display back the mode where it shows what the VPot controls. */ - if (_subview_route) { + + if (_surface->mcp().subview_mode() != MackieControlProtocol::None) { /* do nothing - second line shows value of current subview parameter */ return; } else if (_route) { @@ -1387,13 +1388,13 @@ Strip::next_pot_mode () } void -Strip::use_subview (MackieControlProtocol::SubViewMode sm, boost::shared_ptr<Route> target_route) +Strip::subview_mode_changed () { - if (!_route) { - return; - } + boost::shared_ptr<Route> r = _surface->mcp().subview_route(); + + subview_connections.drop_connections (); - switch (sm) { + switch (_surface->mcp().subview_mode()) { case MackieControlProtocol::None: if (vpot_parameter != NullAutomation) { set_vpot_parameter (vpot_parameter); @@ -1403,28 +1404,28 @@ Strip::use_subview (MackieControlProtocol::SubViewMode sm, boost::shared_ptr<Rou case MackieControlProtocol::EQ: switch (_index) { case 0: - set_vpot_parameter (ARDOUR::EQParam1, target_route); + set_vpot_parameter (ARDOUR::EQParam1); break; case 1: - set_vpot_parameter (ARDOUR::EQParam2, target_route); + set_vpot_parameter (ARDOUR::EQParam2); break; case 2: - set_vpot_parameter (ARDOUR::EQParam3, target_route); + set_vpot_parameter (ARDOUR::EQParam3); break; case 3: - set_vpot_parameter (ARDOUR::EQParam4, target_route); + set_vpot_parameter (ARDOUR::EQParam4); break; case 4: - set_vpot_parameter (ARDOUR::EQParam5, target_route); + set_vpot_parameter (ARDOUR::EQParam5); break; case 5: - set_vpot_parameter (ARDOUR::EQParam6, target_route); + set_vpot_parameter (ARDOUR::EQParam6); break; case 6: - set_vpot_parameter (ARDOUR::EQParam7, target_route); + set_vpot_parameter (ARDOUR::EQParam7); break; case 7: - set_vpot_parameter (ARDOUR::EQParam8, target_route); + set_vpot_parameter (ARDOUR::EQParam8); break; } break; @@ -1435,7 +1436,7 @@ Strip::use_subview (MackieControlProtocol::SubViewMode sm, boost::shared_ptr<Rou } void -Strip::set_vpot_parameter (Evoral::Parameter p, boost::shared_ptr<Route> target_route) +Strip::set_vpot_parameter (Evoral::Parameter p) { boost::shared_ptr<Pannable> pannable; @@ -1443,17 +1444,6 @@ Strip::set_vpot_parameter (Evoral::Parameter p, boost::shared_ptr<Route> target_ reset_saved_values (); - /* target route is either null, or points to a route other than the one - we are controlling/viewing, to be used while in a particular subview - state (e.g. EQ or Dynamics) - */ - - if (target_route != _subview_route) { - subview_connections.drop_connections (); - } - - _subview_route = target_route; - /* unset any mapping between the vpot and any existing parameters */ for (ControlParameterMap::iterator i = control_by_parameter.begin(); i != control_by_parameter.end(); ++i) { @@ -1726,12 +1716,14 @@ Strip::notify_metering_state_changed() void Strip::hookup_eq (AutomationType param, uint32_t port_number) { - if (!_subview_route) { + boost::shared_ptr<Route> r = _surface->mcp().subview_route(); + + if (!r) { _vpot->set_control (boost::shared_ptr<AutomationControl>()); return; } - boost::shared_ptr<PluginInsert> eq = _subview_route->ch_eq(); + boost::shared_ptr<PluginInsert> eq = r->ch_eq(); if (!eq) { _vpot->set_control (boost::shared_ptr<AutomationControl>()); diff --git a/libs/surfaces/mackie/strip.h b/libs/surfaces/mackie/strip.h index 4f3b0136dd..1320df0187 100644 --- a/libs/surfaces/mackie/strip.h +++ b/libs/surfaces/mackie/strip.h @@ -77,6 +77,7 @@ public: void zero (); void potmode_changed (bool notify=false); + void subview_mode_changed (); void lock_controls (); void unlock_controls (); @@ -89,8 +90,6 @@ public: void block_screen_display_for (uint32_t msecs); void block_vpot_mode_display_for (uint32_t msecs); - void use_subview (MackieControlProtocol::SubViewMode, boost::shared_ptr<ARDOUR::Route>); - private: Button* _solo; Button* _recenable; @@ -109,7 +108,6 @@ private: uint64_t _block_vpot_mode_redisplay_until; uint64_t _block_screen_redisplay_until; boost::shared_ptr<ARDOUR::Route> _route; - boost::shared_ptr<ARDOUR::Route> _subview_route; PBD::ScopedConnectionList route_connections; PBD::ScopedConnectionList subview_connections; PBD::ScopedConnectionList send_connections; @@ -161,7 +159,7 @@ private: std::vector<Evoral::Parameter> possible_pot_parameters; std::vector<Evoral::Parameter> possible_trim_parameters; void next_pot_mode (); - void set_vpot_parameter (Evoral::Parameter, boost::shared_ptr<ARDOUR::Route> target_route = boost::shared_ptr<ARDOUR::Route>()); + void set_vpot_parameter (Evoral::Parameter); void show_route_name (); void reset_saved_values (); diff --git a/libs/surfaces/mackie/surface.cc b/libs/surfaces/mackie/surface.cc index 336855659b..44a31804e3 100644 --- a/libs/surfaces/mackie/surface.cc +++ b/libs/surfaces/mackie/surface.cc @@ -1029,7 +1029,7 @@ Surface::update_flip_mode_display () } } - void +void Surface::update_potmode () { for (Strips::iterator s = strips.begin(); s != strips.end(); ++s) { @@ -1037,27 +1037,16 @@ Surface::update_potmode () } } -bool -Surface::update_subview_mode_display () +void +Surface::subview_mode_changed () { - switch (_mcp.subview_mode()) { - case MackieControlProtocol::None: - for (Strips::iterator s = strips.begin(); s != strips.end(); ++s) { - (*s)->use_subview (MackieControlProtocol::None, strips.front()->route()); - } - /* normal display is required */ - return false; - case MackieControlProtocol::EQ: - for (Strips::iterator s = strips.begin(); s != strips.end(); ++s) { - (*s)->use_subview (MackieControlProtocol::EQ, strips.front()->route()); - } - break; - case MackieControlProtocol::Dynamics: - break; + for (Strips::iterator s = strips.begin(); s != strips.end(); ++s) { + (*s)->subview_mode_changed (); } - /* no normal display required */ - return true; + if (_mcp.subview_mode() == MackieControlProtocol::None) { + update_view_mode_display (); + } } void @@ -1070,10 +1059,6 @@ Surface::update_view_mode_display () return; } - if (update_subview_mode_display ()) { - return; - } - switch (_mcp.view_mode()) { case MackieControlProtocol::Mixer: show_two_char_display ("Mx"); diff --git a/libs/surfaces/mackie/surface.h b/libs/surfaces/mackie/surface.h index df667ec1e2..5246cf9857 100644 --- a/libs/surfaces/mackie/surface.h +++ b/libs/surfaces/mackie/surface.h @@ -156,6 +156,7 @@ public: void update_potmode (); void gui_selection_changed (const ARDOUR::StrongRouteNotificationList&); + void subview_mode_changed (); MackieControlProtocol& mcp() const { return _mcp; } @@ -205,7 +206,6 @@ public: int connection_state; MidiByteArray display_line (std::string const& msg, int line_num); - bool update_subview_mode_display (); public: /* IP MIDI devices need to keep a handle on this and destroy it */ |