summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Loftis <ben@harrisonconsoles.com>2017-12-11 10:49:44 -0600
committerBen Loftis <ben@harrisonconsoles.com>2017-12-11 10:51:33 -0600
commit23a403015955d63cc0c1d505e7dc65875005cf31 (patch)
treef52c44c5f24b0a7b4519be441e050dfea557bd60
parent0b7298e22e3b739b462cb8e42c307154283698c2 (diff)
US-2400: ignore joystick moves until the user clicks the joystick NULL button.
-rw-r--r--libs/surfaces/us2400/surface.cc21
-rw-r--r--libs/surfaces/us2400/surface.h1
2 files changed, 21 insertions, 1 deletions
diff --git a/libs/surfaces/us2400/surface.cc b/libs/surfaces/us2400/surface.cc
index 063d628694..e5506ef4ac 100644
--- a/libs/surfaces/us2400/surface.cc
+++ b/libs/surfaces/us2400/surface.cc
@@ -99,6 +99,7 @@ Surface::Surface (US2400Protocol& mcp, const std::string& device_name, uint32_t
, _last_master_gain_written (-0.0f)
, connection_state (0)
, input_source (0)
+ , _joystick_active (false)
{
DEBUG_TRACE (DEBUG::US2400, "Surface::Surface init\n");
@@ -601,8 +602,21 @@ Surface::handle_midi_controller_message (MIDI::Parser &, MIDI::EventTwoBytes* ev
turn_it_on ();
+ //the joystick is not touch sensitive.
+ //ignore the joystick until the user clicks the "null" button. the joystick sends spurious controller messages.
+ //and since they are absolute values (joy position) this can send undesired changes.
+ if ( _stype == st_joy && ev->controller_number == 0x01 ) {
+ _joystick_active = true;
+
+//unfortunately the device does not appear to respond to the NULL button's LED, to indicate that the joystick is active.
+// MidiByteArray joy_active (3, 0xB0, 0x01, 0x01);
+// _port->write (joy_active);
+
+ }
+
#ifdef MIXBUS32C //in 32C, we can use the joystick for the last 2 mixbus send level & pans
- if (_stype == st_joy) {
+
+ if (_stype == st_joy && _joystick_active ) {
if ( ev->controller_number == 0x03 ) {
float value = (float)ev->value / 127.0;
float db_value = 20.0 * value;
@@ -966,6 +980,11 @@ Surface::subview_mode_changed ()
for (Strips::iterator s = strips.begin(); s != strips.end(); ++s) {
(*s)->subview_mode_changed ();
}
+
+ //channel selection likely changed. disable the joystick so it doesn't send spurious messages
+ if ( _stype == st_joy ) {
+ _joystick_active = false;
+ }
}
void
diff --git a/libs/surfaces/us2400/surface.h b/libs/surfaces/us2400/surface.h
index e17bacb8d4..d3f5d2d4ac 100644
--- a/libs/surfaces/us2400/surface.h
+++ b/libs/surfaces/us2400/surface.h
@@ -175,6 +175,7 @@ public:
Fader* _master_fader;
float _last_master_gain_written;
PBD::ScopedConnection master_connection;
+ bool _joystick_active;
void handle_midi_sysex (MIDI::Parser&, MIDI::byte *, size_t count);
MidiByteArray host_connection_query (MidiByteArray& bytes);