add StartTouch and EndTouch signals to Plugin class; make PluginInsert handle these...
[ardour.git] / libs / ardour / plugin_insert.cc
index baaa632d2b683b4a9ff3ebba96c9f6b2e7f2ace9..6e7cfe373ffc7fef61bfb1482d02281be8b49aee 100644 (file)
@@ -1263,7 +1263,12 @@ PluginInsert::add_plugin (boost::shared_ptr<Plugin> plugin)
        plugin->set_insert_info (this);
        
        if (_plugins.empty()) {
+                /* first (and probably only) plugin instance - connect to relevant signals 
+                 */
+
                plugin->ParameterChanged.connect_same_thread (*this, boost::bind (&PluginInsert::parameter_changed, this, _1, _2));
+                plugin->StartTouch.connect_same_thread (*this, boost::bind (&PluginInsert::start_touch, this, _1));
+                plugin->EndTouch.connect_same_thread (*this, boost::bind (&PluginInsert::end_touch, this, _1));
        }
 
        _plugins.push_back (plugin);
@@ -1292,3 +1297,21 @@ PluginInsert::monitoring_changed ()
                (*i)->monitoring_changed ();
        }
 }
+
+void
+PluginInsert::start_touch (uint32_t param_id)
+{
+        boost::shared_ptr<AutomationControl> ac = automation_control (Evoral::Parameter (PluginAutomation, 0, param_id));
+        if (ac) {
+                ac->start_touch (session().audible_frame());
+        }
+}
+
+void
+PluginInsert::end_touch (uint32_t param_id)
+{
+        boost::shared_ptr<AutomationControl> ac = automation_control (Evoral::Parameter (PluginAutomation, 0, param_id));
+        if (ac) {
+                ac->stop_touch (true, session().audible_frame());
+        }
+}