mackie: semi-working Sends subview mode

This commit is contained in:
Paul Davis 2016-01-27 14:15:41 -05:00
parent 8e585338e0
commit 66686a4e2a
5 changed files with 109 additions and 1 deletions

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

View file

@ -117,6 +117,7 @@ class MackieControlProtocol
None,
EQ,
Dynamics,
Sends,
};
enum PotMode {

View 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

View 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)
{

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