Mackie Control: if master surface has a jog wheel *and* a scrub button, button toggles between scroll and shuttle behavior

This commit is contained in:
Paul Davis
2021-05-04 21:30:22 -06:00
parent f792735672
commit 273049a5a1
4 changed files with 27 additions and 4 deletions

View File

@@ -21,6 +21,7 @@
#include "ardour/session.h"
#include "button.h"
#include "jog_wheel.h"
#include "mackie_control_protocol.h"
#include "surface_port.h"
@@ -36,12 +37,19 @@ JogWheel::JogWheel (MackieControlProtocol & mcp)
: _mcp (mcp)
, _mode (scroll)
{
/* do it again to get the LED in the correct state */
set_mode (scroll);
}
void
JogWheel::set_mode (Mode m)
{
_mode = m;
if (_mode == shuttle) {
_mcp.update_global_button (Button::Scrub, on);
} else {
_mcp.update_global_button (Button::Scrub, off);
}
}
void JogWheel::jog_event (float delta)
@@ -64,6 +72,11 @@ void JogWheel::jog_event (float delta)
_mcp.ScrollTimeline (delta/4.0);
break;
default:
if (delta > 0) {
_mcp.button_varispeed (true);
} else if (delta < 0) {
_mcp.button_varispeed (false);
}
break;
}
}

View File

@@ -36,7 +36,7 @@ namespace Mackie
class JogWheel
{
public:
enum Mode { scroll };
enum Mode { scroll, shuttle };
JogWheel (MackieControlProtocol & mcp);

View File

@@ -353,10 +353,10 @@ MackieControlProtocol::zoom_release (Mackie::Button &)
Mackie::LedState
MackieControlProtocol::scrub_press (Mackie::Button &)
{
if (!surfaces.empty()) {
// surfaces.front()->next_jog_mode ();
if (_master_surface) {
_master_surface->next_jog_mode ();
}
return none;
}

View File

@@ -1217,11 +1217,21 @@ Surface::say_hello ()
void
Surface::next_jog_mode ()
{
if (_jog_wheel) {
if (_jog_wheel->mode() == JogWheel::scroll) {
_jog_wheel->set_mode (JogWheel::shuttle);
} else {
_jog_wheel->set_mode (JogWheel::scroll);
}
}
}
void
Surface::set_jog_mode (JogWheel::Mode)
Surface::set_jog_mode (JogWheel::Mode m)
{
if (_jog_wheel) {
_jog_wheel->set_mode (m);
}
}
bool