mackie: cleanup subview mode a little

This commit is contained in:
Paul Davis 2015-12-11 11:46:39 -05:00
parent 8ba8f1c0b0
commit 81179389d3
7 changed files with 92 additions and 75 deletions

View file

@ -1622,10 +1622,33 @@ MackieControlProtocol::clear_ports ()
} }
void void
MackieControlProtocol::set_subview_mode (SubViewMode sm) MackieControlProtocol::set_subview_mode (SubViewMode sm, boost::shared_ptr<Route> r)
{ {
_subview_mode = sm; _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 void
@ -1649,15 +1672,6 @@ MackieControlProtocol::display_view_mode ()
(*s)->update_view_mode_display (); (*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 void
@ -2150,3 +2164,21 @@ MackieControlProtocol::selected (boost::shared_ptr<Route> r) const
} }
return false; 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;
}

View file

@ -150,6 +150,7 @@ class MackieControlProtocol
FlipMode flip_mode () const { return _flip_mode; } FlipMode flip_mode () const { return _flip_mode; }
ViewMode view_mode () const { return _view_mode; } ViewMode view_mode () const { return _view_mode; }
SubViewMode subview_mode () const { return _subview_mode; } SubViewMode subview_mode () const { return _subview_mode; }
boost::shared_ptr<ARDOUR::Route> subview_route() const;
PotMode pot_mode () const { return _pot_mode; } PotMode pot_mode () const { return _pot_mode; }
bool zoom_mode () const { return modifier_state() & MODIFIER_ZOOM; } bool zoom_mode () const { return modifier_state() & MODIFIER_ZOOM; }
bool metering_active () const { return _metering_active; } 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_audio_track (boost::shared_ptr<ARDOUR::Route>) const;
bool is_midi_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; bool selected (boost::shared_ptr<ARDOUR::Route>) const;
boost::shared_ptr<ARDOUR::Route> first_selected_route () const;
void set_view_mode (ViewMode); 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_flip_mode (FlipMode);
void set_pot_mode (PotMode); void set_pot_mode (PotMode);
void pot_mode_globals (); void pot_mode_globals ();
@ -330,6 +332,7 @@ class MackieControlProtocol
FlipMode _flip_mode; FlipMode _flip_mode;
ViewMode _view_mode; ViewMode _view_mode;
SubViewMode _subview_mode; SubViewMode _subview_mode;
boost::shared_ptr<ARDOUR::Route> _subview_route;
PotMode _pot_mode; PotMode _pot_mode;
int _current_selected_track; int _current_selected_track;
int _modifier_state; int _modifier_state;

View file

@ -690,8 +690,9 @@ LedState
MackieControlProtocol::eq_press (Button &) MackieControlProtocol::eq_press (Button &)
{ {
if (Profile->get_mixbus()) { if (Profile->get_mixbus()) {
if (_last_selected_routes.size() == 1) { boost::shared_ptr<Route> r = first_selected_route ();
set_subview_mode (EQ); if (r) {
set_subview_mode (EQ, r);
return on; return on;
} }
} }
@ -707,11 +708,17 @@ LedState
MackieControlProtocol::dyn_press (Button &) MackieControlProtocol::dyn_press (Button &)
{ {
if (Profile->get_mixbus()) { if (Profile->get_mixbus()) {
set_subview_mode (Dynamics); boost::shared_ptr<Route> r = first_selected_route ();
return on;
if (r) {
set_subview_mode (Dynamics, r);
return on;
}
} }
return none; return none;
} }
LedState LedState
MackieControlProtocol::dyn_release (Button &) MackieControlProtocol::dyn_release (Button &)
{ {

View file

@ -575,7 +575,7 @@ Strip::show_route_name ()
void void
Strip::notify_eq_change (AutomationType p, uint32_t port_number, bool force_update) 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 */ /* no longer in EQ subview mode */
return; return;
} }
@ -585,7 +585,7 @@ Strip::notify_eq_change (AutomationType p, uint32_t port_number, bool force_upda
return; return;
} }
boost::shared_ptr<PluginInsert> eq = _subview_route->ch_eq(); boost::shared_ptr<PluginInsert> eq = _surface->mcp().subview_route()->ch_eq();
if (eq) { if (eq) {
boost::shared_ptr<AutomationControl> control = boost::dynamic_pointer_cast<ARDOUR::AutomationControl> (eq->control (Evoral::Parameter (ARDOUR::PluginAutomation, 0, port_number))); 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"; return "LFE";
} }
if (_subview_route) { if (_surface->mcp().subview_mode() != MackieControlProtocol::None) {
return string(); return string();
} }
@ -1287,7 +1287,8 @@ Strip::return_to_vpot_mode_display ()
/* returns the second line of the two-line per-strip display /* returns the second line of the two-line per-strip display
back the mode where it shows what the VPot controls. 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 */ /* do nothing - second line shows value of current subview parameter */
return; return;
} else if (_route) { } else if (_route) {
@ -1387,13 +1388,13 @@ Strip::next_pot_mode ()
} }
void void
Strip::use_subview (MackieControlProtocol::SubViewMode sm, boost::shared_ptr<Route> target_route) Strip::subview_mode_changed ()
{ {
if (!_route) { boost::shared_ptr<Route> r = _surface->mcp().subview_route();
return;
}
switch (sm) { subview_connections.drop_connections ();
switch (_surface->mcp().subview_mode()) {
case MackieControlProtocol::None: case MackieControlProtocol::None:
if (vpot_parameter != NullAutomation) { if (vpot_parameter != NullAutomation) {
set_vpot_parameter (vpot_parameter); set_vpot_parameter (vpot_parameter);
@ -1403,28 +1404,28 @@ Strip::use_subview (MackieControlProtocol::SubViewMode sm, boost::shared_ptr<Rou
case MackieControlProtocol::EQ: case MackieControlProtocol::EQ:
switch (_index) { switch (_index) {
case 0: case 0:
set_vpot_parameter (ARDOUR::EQParam1, target_route); set_vpot_parameter (ARDOUR::EQParam1);
break; break;
case 1: case 1:
set_vpot_parameter (ARDOUR::EQParam2, target_route); set_vpot_parameter (ARDOUR::EQParam2);
break; break;
case 2: case 2:
set_vpot_parameter (ARDOUR::EQParam3, target_route); set_vpot_parameter (ARDOUR::EQParam3);
break; break;
case 3: case 3:
set_vpot_parameter (ARDOUR::EQParam4, target_route); set_vpot_parameter (ARDOUR::EQParam4);
break; break;
case 4: case 4:
set_vpot_parameter (ARDOUR::EQParam5, target_route); set_vpot_parameter (ARDOUR::EQParam5);
break; break;
case 5: case 5:
set_vpot_parameter (ARDOUR::EQParam6, target_route); set_vpot_parameter (ARDOUR::EQParam6);
break; break;
case 6: case 6:
set_vpot_parameter (ARDOUR::EQParam7, target_route); set_vpot_parameter (ARDOUR::EQParam7);
break; break;
case 7: case 7:
set_vpot_parameter (ARDOUR::EQParam8, target_route); set_vpot_parameter (ARDOUR::EQParam8);
break; break;
} }
break; break;
@ -1435,7 +1436,7 @@ Strip::use_subview (MackieControlProtocol::SubViewMode sm, boost::shared_ptr<Rou
} }
void 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; boost::shared_ptr<Pannable> pannable;
@ -1443,17 +1444,6 @@ Strip::set_vpot_parameter (Evoral::Parameter p, boost::shared_ptr<Route> target_
reset_saved_values (); 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 */ /* unset any mapping between the vpot and any existing parameters */
for (ControlParameterMap::iterator i = control_by_parameter.begin(); i != control_by_parameter.end(); ++i) { for (ControlParameterMap::iterator i = control_by_parameter.begin(); i != control_by_parameter.end(); ++i) {
@ -1726,12 +1716,14 @@ Strip::notify_metering_state_changed()
void void
Strip::hookup_eq (AutomationType param, uint32_t port_number) 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>()); _vpot->set_control (boost::shared_ptr<AutomationControl>());
return; return;
} }
boost::shared_ptr<PluginInsert> eq = _subview_route->ch_eq(); boost::shared_ptr<PluginInsert> eq = r->ch_eq();
if (!eq) { if (!eq) {
_vpot->set_control (boost::shared_ptr<AutomationControl>()); _vpot->set_control (boost::shared_ptr<AutomationControl>());

View file

@ -77,6 +77,7 @@ public:
void zero (); void zero ();
void potmode_changed (bool notify=false); void potmode_changed (bool notify=false);
void subview_mode_changed ();
void lock_controls (); void lock_controls ();
void unlock_controls (); void unlock_controls ();
@ -89,8 +90,6 @@ public:
void block_screen_display_for (uint32_t msecs); void block_screen_display_for (uint32_t msecs);
void block_vpot_mode_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: private:
Button* _solo; Button* _solo;
Button* _recenable; Button* _recenable;
@ -109,7 +108,6 @@ private:
uint64_t _block_vpot_mode_redisplay_until; uint64_t _block_vpot_mode_redisplay_until;
uint64_t _block_screen_redisplay_until; uint64_t _block_screen_redisplay_until;
boost::shared_ptr<ARDOUR::Route> _route; boost::shared_ptr<ARDOUR::Route> _route;
boost::shared_ptr<ARDOUR::Route> _subview_route;
PBD::ScopedConnectionList route_connections; PBD::ScopedConnectionList route_connections;
PBD::ScopedConnectionList subview_connections; PBD::ScopedConnectionList subview_connections;
PBD::ScopedConnectionList send_connections; PBD::ScopedConnectionList send_connections;
@ -161,7 +159,7 @@ private:
std::vector<Evoral::Parameter> possible_pot_parameters; std::vector<Evoral::Parameter> possible_pot_parameters;
std::vector<Evoral::Parameter> possible_trim_parameters; std::vector<Evoral::Parameter> possible_trim_parameters;
void next_pot_mode (); 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 show_route_name ();
void reset_saved_values (); void reset_saved_values ();

View file

@ -1029,7 +1029,7 @@ Surface::update_flip_mode_display ()
} }
} }
void void
Surface::update_potmode () Surface::update_potmode ()
{ {
for (Strips::iterator s = strips.begin(); s != strips.end(); ++s) { for (Strips::iterator s = strips.begin(); s != strips.end(); ++s) {
@ -1037,27 +1037,16 @@ Surface::update_potmode ()
} }
} }
bool void
Surface::update_subview_mode_display () Surface::subview_mode_changed ()
{ {
switch (_mcp.subview_mode()) { for (Strips::iterator s = strips.begin(); s != strips.end(); ++s) {
case MackieControlProtocol::None: (*s)->subview_mode_changed ();
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;
} }
/* no normal display required */ if (_mcp.subview_mode() == MackieControlProtocol::None) {
return true; update_view_mode_display ();
}
} }
void void
@ -1070,10 +1059,6 @@ Surface::update_view_mode_display ()
return; return;
} }
if (update_subview_mode_display ()) {
return;
}
switch (_mcp.view_mode()) { switch (_mcp.view_mode()) {
case MackieControlProtocol::Mixer: case MackieControlProtocol::Mixer:
show_two_char_display ("Mx"); show_two_char_display ("Mx");

View file

@ -156,6 +156,7 @@ public:
void update_potmode (); void update_potmode ();
void gui_selection_changed (const ARDOUR::StrongRouteNotificationList&); void gui_selection_changed (const ARDOUR::StrongRouteNotificationList&);
void subview_mode_changed ();
MackieControlProtocol& mcp() const { return _mcp; } MackieControlProtocol& mcp() const { return _mcp; }
@ -205,7 +206,6 @@ public:
int connection_state; int connection_state;
MidiByteArray display_line (std::string const& msg, int line_num); MidiByteArray display_line (std::string const& msg, int line_num);
bool update_subview_mode_display ();
public: public:
/* IP MIDI devices need to keep a handle on this and destroy it */ /* IP MIDI devices need to keep a handle on this and destroy it */