mackie: semi-working Sends subview mode
authorPaul Davis <paul@linuxaudiosystems.com>
Wed, 27 Jan 2016 19:15:41 +0000 (14:15 -0500)
committerPaul Davis <paul@linuxaudiosystems.com>
Wed, 27 Jan 2016 19:15:41 +0000 (14:15 -0500)
libs/surfaces/mackie/mackie_control_protocol.cc
libs/surfaces/mackie/mackie_control_protocol.h
libs/surfaces/mackie/mcp_buttons.cc
libs/surfaces/mackie/strip.cc
libs/surfaces/mackie/strip.h

index 1dec7bbf31dfeafd84e28612f9da76f5a7508a90..8ac54e64460dc1fa02ce9860cd9e1418085a7727 100644 (file)
@@ -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;
                        }
                }
        }
index 12b9ca904ad077fffdd3448d9cdf0bff2092b100..d418871d6a3cc25c639958c31774c49186907d9b 100644 (file)
@@ -117,6 +117,7 @@ class MackieControlProtocol
                None,
                EQ,
                Dynamics,
+               Sends,
        };
 
        enum PotMode {
index d6040601a1e8a54285eeddae46e6b19c4f708702..c239004e5954c6b8fce4974827be8b207a259978 100644 (file)
@@ -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
index c18a33ef15762007883adc8deb9a93b873cad9bf..d1500509b496cd1ecad1f7ab735ec53785e75976 100644 (file)
@@ -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<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)
 {
@@ -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<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)
 {
index e84a0eb8e174ccf4909f1323ef87c982903ea3bd..9dc8c1cc7d2e17624d99e4d94b61600f7647198c 100644 (file)
@@ -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>);
 };
 
 }