OSC: Further fixes so multiple controls can touch at once.
authorLen Ovens <len@ovenwerks.net>
Sat, 20 May 2017 17:17:31 +0000 (10:17 -0700)
committerLen Ovens <len@ovenwerks.net>
Sat, 20 May 2017 17:17:31 +0000 (10:17 -0700)
libs/surfaces/osc/osc.cc

index 05eeab5b0c9c302e4038374a61d585c7b07a8bb0..70b02a7501c324e83cd3f053283c434bfd0591ef 100644 (file)
@@ -2343,11 +2343,9 @@ OSC::touch_detect (const char *path, lo_arg **argv, int argc, lo_message msg)
                                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(); x++) {
-                               if ((*x).first == control) {
-                                       _touch_timeout.erase (x);
-                                       break;
-                               }
+                       FakeTouchMap::iterator x = _touch_timeout.find(control);
+                       if (x != _touch_timeout.end()) {
+                               _touch_timeout.erase (x);
                        }
                }
        }
@@ -3975,14 +3973,15 @@ OSC::periodic (void)
                        co->tick();
                }
        }
-       for (FakeTouchMap::iterator x = _touch_timeout.begin(); x != _touch_timeout.end(); x++) {
+       for (FakeTouchMap::iterator x = _touch_timeout.begin(); x != _touch_timeout.end();) {
                _touch_timeout[(*x).first] = (*x).second - 1;
                if (!(*x).second) {
                        boost::shared_ptr<ARDOUR::AutomationControl> ctrl = (*x).first;
                        // turn touch off
                        ctrl->stop_touch (true, ctrl->session().transport_frame());
-                       _touch_timeout.erase (x);
-                       break;
+                       _touch_timeout.erase (x++);
+               } else {
+                       x++;
                }
        }
        return true;