diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2016-01-31 11:01:41 -0500 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2016-01-31 11:01:41 -0500 |
commit | af1028bd90785dda5f5067a0f63523cb2760eb56 (patch) | |
tree | 2faaa87e426776ac0fe6f24b0761f6604e17962a | |
parent | 2b56dc17e3bc387c52bcd656e3487164ea8f6e06 (diff) |
mackie: make marker button work as Mackie intends it (as a modifier for rewind/ffwd)
-rw-r--r-- | libs/surfaces/mackie/mackie_control_protocol.cc | 6 | ||||
-rw-r--r-- | libs/surfaces/mackie/mackie_control_protocol.h | 3 | ||||
-rw-r--r-- | libs/surfaces/mackie/mcp_buttons.cc | 32 |
3 files changed, 32 insertions, 9 deletions
diff --git a/libs/surfaces/mackie/mackie_control_protocol.cc b/libs/surfaces/mackie/mackie_control_protocol.cc index 1b35e5af58..c8ae29b6b9 100644 --- a/libs/surfaces/mackie/mackie_control_protocol.cc +++ b/libs/surfaces/mackie/mackie_control_protocol.cc @@ -91,6 +91,7 @@ const int MackieControlProtocol::MODIFIER_SHIFT = 0x4; const int MackieControlProtocol::MODIFIER_CMDALT = 0x8; const int MackieControlProtocol::MODIFIER_ZOOM = 0x10; const int MackieControlProtocol::MODIFIER_SCRUB = 0x20; +const int MackieControlProtocol::MODIFIER_MARKER = 0x40; const int MackieControlProtocol::MAIN_MODIFIER_MASK = (MackieControlProtocol::MODIFIER_OPTION| MackieControlProtocol::MODIFIER_CONTROL| MackieControlProtocol::MODIFIER_SHIFT| @@ -123,6 +124,7 @@ MackieControlProtocol::MackieControlProtocol (Session& session) , _initialized (false) , configuration_state (0) , state_version (0) + , marker_modifier_consumed_by_button (false) { DEBUG_TRACE (DEBUG::MackieControl, "MackieControlProtocol::MackieControlProtocol\n"); @@ -1514,6 +1516,10 @@ MackieControlProtocol::handle_button_event (Surface& surface, Button& button, Bu return; } + if ((button_id != Button::Marker) && (modifier_state() & MODIFIER_MARKER)) { + marker_modifier_consumed_by_button = true; + } + DEBUG_TRACE (DEBUG::MackieControl, string_compose ("Handling %1 for button %2 (%3)\n", (bs == press ? "press" : "release"), button.id(), Button::id_to_name (button.bid()))); diff --git a/libs/surfaces/mackie/mackie_control_protocol.h b/libs/surfaces/mackie/mackie_control_protocol.h index 09654230d6..3f0db2f53a 100644 --- a/libs/surfaces/mackie/mackie_control_protocol.h +++ b/libs/surfaces/mackie/mackie_control_protocol.h @@ -100,6 +100,8 @@ class MackieControlProtocol static const int MODIFIER_CMDALT; static const int MODIFIER_ZOOM; static const int MODIFIER_SCRUB; + static const int MODIFIER_MARKER; + static const int MODIFIER_NUDGE; static const int MAIN_MODIFIER_MASK; enum ViewMode { @@ -360,6 +362,7 @@ class MackieControlProtocol XMLNode* configuration_state; int state_version; int _last_bank[9]; + bool marker_modifier_consumed_by_button; boost::shared_ptr<ArdourSurface::Mackie::Surface> _master_surface; diff --git a/libs/surfaces/mackie/mcp_buttons.cc b/libs/surfaces/mackie/mcp_buttons.cc index 2e87117920..0ead9edca1 100644 --- a/libs/surfaces/mackie/mcp_buttons.cc +++ b/libs/surfaces/mackie/mcp_buttons.cc @@ -414,13 +414,29 @@ MackieControlProtocol::timecode_beats_release (Button &) LedState MackieControlProtocol::marker_press (Button &) { + _modifier_state |= MODIFIER_MARKER; + marker_modifier_consumed_by_button = false; + return on; +} + +LedState +MackieControlProtocol::marker_release (Button &) +{ + if (marker_modifier_consumed_by_button) { + /* marker was used a modifier for some other button(s), so do + nothing + */ + return off; + } + string markername; + _modifier_state &= ~MODIFIER_MARKER; + /* Don't add another mark if one exists within 1/100th of a second of * the current position and we're not rolling. */ - framepos_t where = session->audible_frame(); if (session->transport_stopped() && session->locations()->mark_at (where, session->frame_rate() / 100.0)) { @@ -430,12 +446,6 @@ MackieControlProtocol::marker_press (Button &) session->locations()->next_available_name (markername,"marker"); add_marker (markername); - return on; -} - -LedState -MackieControlProtocol::marker_release (Button &) -{ return off; } @@ -494,7 +504,9 @@ MackieControlProtocol::record_release (Button &) LedState MackieControlProtocol::rewind_press (Button &) { - if (main_modifier_state() == MODIFIER_CONTROL) { + if (modifier_state() & MODIFIER_MARKER) { + prev_marker (); + } else if (main_modifier_state() == MODIFIER_SHIFT) { goto_start (); } else { rewind (); @@ -511,7 +523,9 @@ MackieControlProtocol::rewind_release (Button &) LedState MackieControlProtocol::ffwd_press (Button &) { - if (main_modifier_state() == MODIFIER_CONTROL) { + if (modifier_state() & MODIFIER_MARKER) { + next_marker (); + } else if (main_modifier_state() == MODIFIER_SHIFT) { goto_end(); } else { ffwd (); |