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
+ FakeTouchMap::iterator x = _touch_timeout.find(control);
+ if (x != _touch_timeout.end()) {
+ _touch_timeout.erase (x);
+ }
}
}
return ret;
}
+int
+OSC::fake_touch (boost::shared_ptr<ARDOUR::AutomationControl> ctrl)
+{
+ if (ctrl) {
+ //start touch
+ if (ctrl->automation_state() == Touch && !ctrl->touching ()) {
+ ctrl->start_touch (ctrl->session().transport_frame());
+ _touch_timeout[ctrl] = 10;
+ }
+ }
+
+ return 0;
+}
+
int
OSC::route_mute (int ssid, int yn, lo_message msg)
{
if (s) {
if (s->gain_control()) {
+ fake_touch (s->gain_control());
s->gain_control()->set_value (level, PBD::Controllable::NoGroup);
} else {
return 1;
abs = dB_to_coefficient (val);
}
if (s->gain_control()) {
+ fake_touch (s->gain_control());
s->gain_control()->set_value (abs, PBD::Controllable::NoGroup);
return 0;
}
float abs;
abs = slider_position_to_gain_with_max (val, 2.0);
if (s->gain_control()) {
+ fake_touch (s->gain_control());
s->gain_control()->set_value (abs, PBD::Controllable::NoGroup);
return 0;
}
co->tick();
}
}
+ 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++);
+ } else {
+ x++;
+ }
+ }
return true;
}