From 6926b7eb75ccd26a6a39d24cea8ea45c7bd7101b Mon Sep 17 00:00:00 2001 From: Len Ovens Date: Fri, 19 May 2017 15:48:36 -0700 Subject: [PATCH] OSC: Catch case of surface sending fader move before touch --- libs/surfaces/osc/osc.cc | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/libs/surfaces/osc/osc.cc b/libs/surfaces/osc/osc.cc index fc72e96d6f..d23fe21ad1 100644 --- a/libs/surfaces/osc/osc.cc +++ b/libs/surfaces/osc/osc.cc @@ -2335,14 +2335,21 @@ OSC::touch_detect (const char *path, lo_arg **argv, int argc, lo_message msg) if (control) { if (touch) { //start touch - if (!control->touching ()) { + if (control->automation_state() == Touch && !control->touching ()) { control->start_touch (control->session().transport_frame()); } } else { // end touch control->stop_touch (true, control->session().transport_frame()); } - + // just in case some crazy surface starts sending control values before touch + for (FakeTouchMap::iterator x = _touch_timeout.begin(); x != _touch_timeout.end();) { + if ((*x).first == control) { + x = _touch_timeout.erase (x); + } else { + ++x; + } + } } } @@ -2354,10 +2361,10 @@ OSC::fake_touch (boost::shared_ptr ctrl) { if (ctrl) { //start touch - if (!ctrl->touching ()) { + if (ctrl->automation_state() == Touch && !ctrl->touching ()) { ctrl->start_touch (ctrl->session().transport_frame()); - } _touch_timeout[ctrl] = 10; + } } return 0;