13
0

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
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;
}

View File

@ -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;

View File

@ -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 &)
{

View File

@ -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();
switch (sm) {
subview_connections.drop_connections ();
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>());

View File

@ -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 ();

View File

@ -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");

View File

@ -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 */