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 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 @@ -510,6 +510,35 @@ Strip::show_route_name () _surface->write (display (0, line1)); } +void +Strip::notify_send_level_change (AutomationType type, uint32_t send_num, bool force_update) +{ + boost::shared_ptr 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 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) { @@ -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; } } @@ -1678,6 +1727,37 @@ Strip::setup_eq_vpot (boost::shared_ptr r) } } +void +Strip::setup_sends_vpot (boost::shared_ptr r) +{ + if (!r) { + return; + } + + const uint32_t global_pos = _surface->mcp().global_index (*this); + + boost::shared_ptr send = r->nth_send (global_pos); + + if (!send) { + _surface->write (display (0, string())); + return; + } + + boost::shared_ptr 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) { 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); + + void notify_send_level_change (ARDOUR::AutomationType, uint32_t band, bool force); + void setup_sends_vpot (boost::shared_ptr); }; }