mackie: make marker button work as Mackie intends it (as a modifier for rewind/ffwd)
This commit is contained in:
@@ -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())));
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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 ();
|
||||
|
||||
Reference in New Issue
Block a user