mackie: basically (fully?) operation fader automatio control for first selected route

This commit is contained in:
Paul Davis 2016-01-29 18:37:03 -05:00
parent da35f58218
commit d5a8825ce8
3 changed files with 102 additions and 15 deletions

View file

@ -123,7 +123,6 @@ MackieControlProtocol::MackieControlProtocol (Session& session)
, _initialized (false) , _initialized (false)
, configuration_state (0) , configuration_state (0)
, state_version (0) , state_version (0)
, _group_on (false)
{ {
DEBUG_TRACE (DEBUG::MackieControl, "MackieControlProtocol::MackieControlProtocol\n"); DEBUG_TRACE (DEBUG::MackieControl, "MackieControlProtocol::MackieControlProtocol\n");
@ -615,6 +614,10 @@ MackieControlProtocol::update_global_button (int id, LedState ls)
if (x != surface->controls_by_device_independent_id.end()) { if (x != surface->controls_by_device_independent_id.end()) {
Button * button = dynamic_cast<Button*> (x->second); Button * button = dynamic_cast<Button*> (x->second);
surface->write (button->set_state (ls)); surface->write (button->set_state (ls));
if (ls == on) {
// blinkers.erase (id);
}
} else { } else {
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("Button %1 not found\n", id)); DEBUG_TRACE (DEBUG::MackieControl, string_compose ("Button %1 not found\n", id));
} }
@ -1962,6 +1965,8 @@ MackieControlProtocol::_gui_track_selection_changed (ARDOUR::RouteNotificationLi
if (gui_selection_did_change) { if (gui_selection_did_change) {
check_fader_automation_state ();
/* note: this method is also called when we switch banks. /* note: this method is also called when we switch banks.
* But ... we don't allow bank switching when in subview mode. * But ... we don't allow bank switching when in subview mode.
* *
@ -1981,6 +1986,82 @@ MackieControlProtocol::_gui_track_selection_changed (ARDOUR::RouteNotificationLi
} }
} }
void
MackieControlProtocol::check_fader_automation_state ()
{
fader_automation_connections.drop_connections ();
boost::shared_ptr<Route> r = first_selected_route ();
if (!r) {
update_global_button (Button::Read, off);
update_global_button (Button::Write, off);
update_global_button (Button::Touch, off);
update_global_button (Button::Trim, off);
update_global_button (Button::Latch, off);
update_global_button (Button::Grp, on);
return;
}
r->gain_control()->alist()->automation_state_changed.connect (fader_automation_connections,
MISSING_INVALIDATOR,
boost::bind (&MackieControlProtocol::update_fader_automation_state, this),
this);
update_fader_automation_state ();
}
void
MackieControlProtocol::update_fader_automation_state ()
{
boost::shared_ptr<Route> r = first_selected_route ();
if (!r) {
update_global_button (Button::Read, off);
update_global_button (Button::Write, off);
update_global_button (Button::Touch, off);
update_global_button (Button::Trim, off);
update_global_button (Button::Latch, off);
update_global_button (Button::Grp, on);
return;
}
switch (r->gain_control()->automation_state()) {
case Off:
update_global_button (Button::Read, off);
update_global_button (Button::Write, off);
update_global_button (Button::Touch, off);
update_global_button (Button::Trim, off);
update_global_button (Button::Latch, off);
update_global_button (Button::Grp, on);
break;
case Play:
update_global_button (Button::Read, on);
update_global_button (Button::Write, off);
update_global_button (Button::Touch, off);
update_global_button (Button::Trim, off);
update_global_button (Button::Latch, off);
update_global_button (Button::Grp, off);
break;
case Write:
update_global_button (Button::Read, off);
update_global_button (Button::Write, on);
update_global_button (Button::Touch, off);
update_global_button (Button::Trim, off);
update_global_button (Button::Latch, off);
update_global_button (Button::Grp, off);
break;
case Touch:
update_global_button (Button::Read, off);
update_global_button (Button::Write, off);
update_global_button (Button::Touch, on);
update_global_button (Button::Trim, off);
update_global_button (Button::Latch, off);
update_global_button (Button::Grp, off);
break;
}
}
framepos_t framepos_t
MackieControlProtocol::transport_frame() const MackieControlProtocol::transport_frame() const
{ {
@ -2420,16 +2501,17 @@ MackieControlProtocol::request_factory (uint32_t num_requests)
void void
MackieControlProtocol::set_automation_state (AutoState as) MackieControlProtocol::set_automation_state (AutoState as)
{ {
for (RouteNotificationList::iterator wr = _last_selected_routes.begin(); wr != _last_selected_routes.end(); ++wr) { boost::shared_ptr<Route> r = first_selected_route ();
boost::shared_ptr<Route> r = (*wr).lock();
if (!r) {
continue;
}
boost::shared_ptr<AutomationControl> ac = r->gain_control();
if (!ac) {
continue;
}
ac->set_automation_state (as); if (!r) {
return;
} }
boost::shared_ptr<AutomationControl> ac = r->gain_control();
if (!ac) {
return;
}
ac->set_automation_state (as);
} }

View file

@ -166,6 +166,8 @@ class MackieControlProtocol
bool is_mapped (boost::shared_ptr<ARDOUR::Route>) const; bool is_mapped (boost::shared_ptr<ARDOUR::Route>) const;
boost::shared_ptr<ARDOUR::Route> first_selected_route () const; boost::shared_ptr<ARDOUR::Route> first_selected_route () const;
void check_fader_automation_state ();
void update_fader_automation_state ();
void set_automation_state (ARDOUR::AutoState); void set_automation_state (ARDOUR::AutoState);
void set_view_mode (ViewMode); void set_view_mode (ViewMode);
@ -328,6 +330,7 @@ class MackieControlProtocol
PBD::ScopedConnectionList route_connections; PBD::ScopedConnectionList route_connections;
PBD::ScopedConnectionList subview_route_connections; PBD::ScopedConnectionList subview_route_connections;
PBD::ScopedConnectionList gui_connections; PBD::ScopedConnectionList gui_connections;
PBD::ScopedConnectionList fader_automation_connections;
// timer for two quick marker left presses // timer for two quick marker left presses
Mackie::Timer _frm_left_last; Mackie::Timer _frm_left_last;
// last written timecode string // last written timecode string
@ -357,7 +360,6 @@ class MackieControlProtocol
XMLNode* configuration_state; XMLNode* configuration_state;
int state_version; int state_version;
int _last_bank[9]; int _last_bank[9];
bool _group_on;
boost::shared_ptr<ArdourSurface::Mackie::Surface> _master_surface; boost::shared_ptr<ArdourSurface::Mackie::Surface> _master_surface;

View file

@ -817,7 +817,7 @@ MackieControlProtocol::read_press (Mackie::Button&)
Mackie::LedState Mackie::LedState
MackieControlProtocol::read_release (Mackie::Button&) MackieControlProtocol::read_release (Mackie::Button&)
{ {
set_automation_state (ARDOUR::Off); set_automation_state (ARDOUR::Play);
return none; return none;
} }
Mackie::LedState Mackie::LedState
@ -987,8 +987,11 @@ MackieControlProtocol::grp_press (Mackie::Button&)
Mackie::LedState Mackie::LedState
MackieControlProtocol::grp_release (Mackie::Button&) MackieControlProtocol::grp_release (Mackie::Button&)
{ {
_group_on = !_group_on; /* There is no "Off" button for automation,
return _group_on; so we use Group for this purpose.
*/
set_automation_state (Off);
return none;
} }
Mackie::LedState Mackie::LedState
MackieControlProtocol::nudge_press (Mackie::Button&) MackieControlProtocol::nudge_press (Mackie::Button&)