}
void
-PluginInsert::parameter_changed (Evoral::Parameter which, float val)
+PluginInsert::parameter_changed (uint32_t which, float val)
{
- if (which.type() != PluginAutomation)
- return;
-
- Plugins::iterator i = _plugins.begin();
+ boost::shared_ptr<AutomationControl> ac = automation_control (Evoral::Parameter (PluginAutomation, 0, which));
- /* don't set the first plugin, just all the slaves */
-
- if (i != _plugins.end()) {
- ++i;
- for (; i != _plugins.end(); ++i) {
- (*i)->set_parameter (which, val);
- }
- }
+ if (ac) {
+ ac->set_value (val);
+
+ Plugins::iterator i = _plugins.begin();
+
+ /* don't set the first plugin, just all the slaves */
+
+ if (i != _plugins.end()) {
+ ++i;
+ for (; i != _plugins.end(); ++i) {
+ (*i)->set_parameter (which, val);
+ }
+ }
+ }
}
int
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);
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);
}
(*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());
+ }
+}