add option to resize meterbridge track-labels
[ardour.git] / libs / ardour / plugin_insert.cc
index baaa632d2b683b4a9ff3ebba96c9f6b2e7f2ace9..998a03e3aa13a5583a4910dd25c6e8665236493e 100644 (file)
@@ -267,7 +267,7 @@ PluginInsert::parameter_changed (uint32_t which, float val)
        boost::shared_ptr<AutomationControl> ac = automation_control (Evoral::Parameter (PluginAutomation, 0, which));
 
        if (ac) {
-               ac->set_double (val);
+               ac->set_value (val);
                 
                 Plugins::iterator i = _plugins.begin();
                 
@@ -552,7 +552,7 @@ PluginInsert::automation_run (BufferSet& bufs, pframes_t nframes)
        framepos_t end = now + nframes;
        framecnt_t offset = 0;
 
-       Glib::Mutex::Lock lm (control_lock(), Glib::TRY_LOCK);
+       Glib::Threads::Mutex::Lock lm (control_lock(), Glib::Threads::TRY_LOCK);
 
        if (!lm.locked()) {
                connect_and_run (bufs, nframes, offset, false);
@@ -882,7 +882,12 @@ PluginInsert::set_control_ids (const XMLNode& node, int version)
 
                        if ((prop = (*iter)->property (X_("parameter"))) != 0) {
                                uint32_t p = atoi (prop->value());
+
+                               /* this may create the new controllable */
+
                                boost::shared_ptr<Evoral::Control> c = control (Evoral::Parameter (PluginAutomation, 0, p));
+
+#ifndef NO_PLUGIN_STATE
                                if (!c) {
                                        continue;
                                }
@@ -890,6 +895,7 @@ PluginInsert::set_control_ids (const XMLNode& node, int version)
                                if (ac) {
                                        ac->set_state (**iter, version);
                                }
+#endif
                        }
                }
        }
@@ -1263,7 +1269,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 +1303,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());
+        }
+}