diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2016-01-27 14:15:41 -0500 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2016-01-27 14:15:41 -0500 |
commit | 66686a4e2a0b9e8eee82285b07ed83974dd0cd8c (patch) | |
tree | b34e740d5b807d6f086db8a02720ca62e7f69bf6 | |
parent | 8e585338e0bcb1e86a6c62e1f1be29111c0a7d78 (diff) |
mackie: semi-working Sends subview mode
-rw-r--r-- | libs/surfaces/mackie/mackie_control_protocol.cc | 11 | ||||
-rw-r--r-- | libs/surfaces/mackie/mackie_control_protocol.h | 1 | ||||
-rw-r--r-- | libs/surfaces/mackie/mcp_buttons.cc | 15 | ||||
-rw-r--r-- | libs/surfaces/mackie/strip.cc | 80 | ||||
-rw-r--r-- | libs/surfaces/mackie/strip.h | 3 |
5 files changed, 109 insertions, 1 deletions
diff --git a/libs/surfaces/mackie/mackie_control_protocol.cc b/libs/surfaces/mackie/mackie_control_protocol.cc index 1dec7bbf31..8ac54e6446 100644 --- a/libs/surfaces/mackie/mackie_control_protocol.cc +++ b/libs/surfaces/mackie/mackie_control_protocol.cc @@ -1670,6 +1670,7 @@ MackieControlProtocol::set_subview_mode (SubViewMode sm, boost::shared_ptr<Route pot_mode_globals (); break; case MackieControlProtocol::EQ: + update_global_button (Button::Send, off); update_global_button (Button::Eq, on); update_global_button (Button::Dyn, off); update_global_button (Button::AudioInstruments, off); /* faking up Dyn */ @@ -1678,6 +1679,7 @@ MackieControlProtocol::set_subview_mode (SubViewMode sm, boost::shared_ptr<Route update_global_button (Button::Pan, off); break; case MackieControlProtocol::Dynamics: + update_global_button (Button::Send, off); update_global_button (Button::Eq, off); update_global_button (Button::Dyn, on); update_global_button (Button::AudioInstruments, on); /* faking up Dyn */ @@ -1685,6 +1687,15 @@ MackieControlProtocol::set_subview_mode (SubViewMode sm, boost::shared_ptr<Route update_global_button (Button::Send, off); update_global_button (Button::Pan, off); break; + case MackieControlProtocol::Sends: + update_global_button (Button::Send, on); + update_global_button (Button::Eq, off); + update_global_button (Button::Dyn, off); + update_global_button (Button::AudioInstruments, on); /* faking up Dyn */ + update_global_button (Button::Trim, off); + update_global_button (Button::Send, off); + update_global_button (Button::Pan, off); + break; } } } diff --git a/libs/surfaces/mackie/mackie_control_protocol.h b/libs/surfaces/mackie/mackie_control_protocol.h index 12b9ca904a..d418871d6a 100644 --- a/libs/surfaces/mackie/mackie_control_protocol.h +++ b/libs/surfaces/mackie/mackie_control_protocol.h @@ -117,6 +117,7 @@ class MackieControlProtocol None, EQ, Dynamics, + Sends, }; enum PotMode { diff --git a/libs/surfaces/mackie/mcp_buttons.cc b/libs/surfaces/mackie/mcp_buttons.cc index d6040601a1..c239004e59 100644 --- a/libs/surfaces/mackie/mcp_buttons.cc +++ b/libs/surfaces/mackie/mcp_buttons.cc @@ -878,7 +878,20 @@ MackieControlProtocol::track_release (Mackie::Button&) Mackie::LedState MackieControlProtocol::send_press (Mackie::Button&) { - /* XXX to come */ + boost::shared_ptr<Route> r = first_selected_route (); + if (r) { +#ifndef MIXBUS + if (!r->nth_send (0)) { + /* no sends ... no send subview mode */ + if (!surfaces.empty()) { + surfaces.front()->display_message_for (_("No sends for this track/bus"), 1000); + } + return none; + } +#endif + set_subview_mode (Sends, r); + return none; /* led state handled by set_subview_mode() */ + } return none; } Mackie::LedState diff --git a/libs/surfaces/mackie/strip.cc b/libs/surfaces/mackie/strip.cc index c18a33ef15..d1500509b4 100644 --- a/libs/surfaces/mackie/strip.cc +++ b/libs/surfaces/mackie/strip.cc @@ -511,6 +511,35 @@ Strip::show_route_name () } void +Strip::notify_send_level_change (AutomationType type, uint32_t send_num, bool force_update) +{ + boost::shared_ptr<Route> r = _surface->mcp().subview_route(); + + if (!r) { + /* not in subview mode */ + return; + } + + if (_surface->mcp().subview_mode() != MackieControlProtocol::Sends) { + /* no longer in EQ subview mode */ + return; + } + + boost::shared_ptr<AutomationControl> control = r->send_level_controllable (send_num); + if (!control) { + return; + } + + if (control) { + float val = control->get_value(); + cerr << "Queue send level display of " << val << endl; + queue_parameter_display (type, val); + /* update pot/encoder */ + _surface->write (_vpot->set (control->internal_to_interface (val), true, Pot::wrap)); + } +} + +void Strip::notify_eq_change (AutomationType type, uint32_t band, bool force_update) { boost::shared_ptr<Route> r = _surface->mcp().subview_route(); @@ -953,6 +982,16 @@ Strip::do_parameter_display (AutomationType type, float val) } break; + case BusSendLevel: + if (_route) { + float dB = accurate_coefficient_to_dB (val); + snprintf (buf, sizeof (buf), "%6.1f", dB); + cerr << "send level write " << val << " as \"" << buf << '"' << endl; + _surface->write (display (1, buf)); + screen_hold = true; + } + break; + case EQGain: case EQFrequency: case EQQ: @@ -1458,6 +1497,16 @@ Strip::subview_mode_changed () } else { /* leave it as it was */ } + eq_band = -1; + break; + + case MackieControlProtocol::Sends: + if (r) { + setup_sends_vpot (r); + } else { + /* leave it as it was */ + } + eq_band = -1; break; } } @@ -1679,6 +1728,37 @@ Strip::setup_eq_vpot (boost::shared_ptr<Route> r) } void +Strip::setup_sends_vpot (boost::shared_ptr<Route> r) +{ + if (!r) { + return; + } + + const uint32_t global_pos = _surface->mcp().global_index (*this); + + boost::shared_ptr<Processor> send = r->nth_send (global_pos); + + if (!send) { + _surface->write (display (0, string())); + return; + } + + boost::shared_ptr<AutomationControl> pc = r->send_level_controllable (global_pos); + + if (!pc) { + return; + } + + pc->Changed.connect (subview_connections, MISSING_INVALIDATOR, boost::bind (&Strip::notify_send_level_change, this, BusSendLevel, global_pos, false), ui_context()); + _vpot->set_control (pc); + + cerr << "Send name @ " << global_pos << " = " << send->name() << endl; + _surface->write (display (0, send->name())); + + notify_send_level_change (BusSendLevel, global_pos, true); +} + +void Strip::set_vpot_parameter (AutomationType p) { if (!_route || (p == NullAutomation)) { diff --git a/libs/surfaces/mackie/strip.h b/libs/surfaces/mackie/strip.h index e84a0eb8e1..9dc8c1cc7d 100644 --- a/libs/surfaces/mackie/strip.h +++ b/libs/surfaces/mackie/strip.h @@ -176,6 +176,9 @@ private: void notify_dyn_change (ARDOUR::AutomationType, bool force, bool propagate_mode_change); void setup_dyn_vpot (boost::shared_ptr<ARDOUR::Route>); + + void notify_send_level_change (ARDOUR::AutomationType, uint32_t band, bool force); + void setup_sends_vpot (boost::shared_ptr<ARDOUR::Route>); }; } |