}
for (Plugins::iterator i = _plugins.begin(); i != _plugins.end(); ++i) {
- (*i)->connect_and_run(bufs, in_map, out_map, nframes, offset);
+ if ((*i)->connect_and_run(bufs, in_map, out_map, nframes, offset)) {
+ deactivate ();
+ }
for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) {
in_map.offset_to(*t, natural_input_streams().get(*t));
out_map.offset_to(*t, natural_output_streams().get(*t));
continue;
}
- ac->set_value (dflt);
+ ac->set_value (dflt, Controllable::NoGroup);
}
return all;
}
if ((*iter)->name() == Controllable::xml_node_name) {
const XMLProperty* prop;
- if ((prop = (*iter)->property (X_("parameter"))) != 0) {
- uint32_t p = atoi (prop->value());
+ uint32_t p = (uint32_t)-1;
+#ifdef LV2_SUPPORT
+ if ((prop = (*iter)->property (X_("symbol"))) != 0) {
+ boost::shared_ptr<LV2Plugin> lv2plugin = boost::dynamic_pointer_cast<LV2Plugin> (_plugins[0]);
+ if (lv2plugin) {
+ p = lv2plugin->port_index(prop->value().c_str());
+ }
+ }
+#endif
+ if (p == (uint32_t)-1 && (prop = (*iter)->property (X_("parameter"))) != 0) {
+ p = atoi (prop->value());
+ }
+
+ if (p != (uint32_t)-1) {
/* this may create the new controllable */
}
}
- PBD::ID this_id = this->id();
+ Processor::set_state (node, version);
- if (regenerate_xml_or_string_ids ()) {
- /* when duplicating a track, we need to use the
- * original ID for loading plugin state (from file)
- */
- const XMLProperty* prop;
- if ((prop = node.property ("id")) != 0) {
- plugin->set_insert_id (prop->value ());
- }
- }
+ PBD::ID new_id = this->id();
+ PBD::ID old_id = this->id();
- Processor::set_state (node, version);
+ if ((prop = node.property ("id")) != 0) {
+ old_id = prop->value ();
+ }
for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
if ((*niter)->name() == plugin->state_node_name()) {
for (Plugins::iterator i = _plugins.begin(); i != _plugins.end(); ++i) {
+ /* Plugin state can include external files which are named after the ID.
+ *
+ * If regenerate_xml_or_string_ids() is set, the ID will already have
+ * been changed, so we need to use the old ID from the XML to load the
+ * state and then update the ID.
+ *
+ * When copying a plugin-state, route_ui takes care of of updating the ID,
+ * but we need to call set_insert_id() to clear the cached plugin-state
+ * and force a change.
+ */
if (!regenerate_xml_or_string_ids ()) {
- (*i)->set_insert_id (this->id());
+ (*i)->set_insert_id (new_id);
+ } else {
+ (*i)->set_insert_id (old_id);
}
+
(*i)->set_state (**niter, version);
+
if (regenerate_xml_or_string_ids ()) {
- (*i)->set_insert_id (this_id);
+ (*i)->set_insert_id (new_id);
}
}
}
}
- if (regenerate_xml_or_string_ids ()) {
- plugin->set_insert_id (this_id);
- }
-
if (version < 3000) {
/* Only 2.X sessions need a call to set_parameter_state() - in 3.X and above
}
}
+void
+PluginInsert::set_state_dir (const std::string& d)
+{
+ // state() only saves the state of the first plugin
+ _plugins[0]->set_state_dir (d);
+}
+
void
PluginInsert::set_parameter_state_2X (const XMLNode& node, int version)
{
/** @param val `user' value */
void
-PluginInsert::PluginControl::set_value (double user_val)
+PluginInsert::PluginControl::set_value (double user_val, PBD::Controllable::GroupControlDisposition group_override)
{
if (writable()) {
- set_value_unchecked (user_val);
+ _set_value (user_val, group_override);
}
}
-
void
PluginInsert::PluginControl::set_value_unchecked (double user_val)
+{
+ /* used only by automation playback */
+ _set_value (user_val, Controllable::NoGroup);
+}
+
+void
+PluginInsert::PluginControl::_set_value (double user_val, PBD::Controllable::GroupControlDisposition group_override)
{
/* FIXME: probably should be taking out some lock here.. */
iasp->set_parameter (_list->parameter().id(), user_val);
}
- AutomationControl::set_value (user_val);
+ AutomationControl::set_value (user_val, group_override);
}
void
PluginInsert::PluginControl::catch_up_with_external_value (double user_val)
{
- AutomationControl::set_value (user_val);
+ AutomationControl::set_value (user_val, Controllable::NoGroup);
}
XMLNode&
XMLNode& node (AutomationControl::get_state());
ss << parameter().id();
node.add_property (X_("parameter"), ss.str());
+#ifdef LV2_SUPPORT
+ boost::shared_ptr<LV2Plugin> lv2plugin = boost::dynamic_pointer_cast<LV2Plugin> (_plugin->_plugins[0]);
+ if (lv2plugin) {
+ node.add_property (X_("symbol"), lv2plugin->port_symbol (parameter().id()));
+ }
+#endif
return node;
}
}
void
-PluginInsert::PluginPropertyControl::set_value (double user_val)
+PluginInsert::PluginPropertyControl::set_value (double user_val, PBD::Controllable::GroupControlDisposition /* group_override*/)
{
if (writable()) {
set_value_unchecked (user_val);
}
_value = value;
- AutomationControl::set_value(user_val);
+ AutomationControl::set_value (user_val, Controllable::NoGroup);
}
XMLNode&