summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2011-06-09 20:21:46 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2011-06-09 20:21:46 +0000
commit071cc3ef0154919ebd226a1dbc75623f756d9582 (patch)
tree333a57b48aa6a6d2c8c574d47afc678e072dac2e
parent5b3916c62ec07168b8c554a87241917b06d54fb9 (diff)
fix serious breakage with setup of plugin automatable controls/parameters, in which the relative ordering of things during ::set_state() was totally wrong. still see multiple instances of automation tracks for processors in GUI
git-svn-id: svn://localhost/ardour2/branches/3.0@9698 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r--libs/ardour/ardour/plugin_insert.h3
-rw-r--r--libs/ardour/audio_unit.cc1
-rw-r--r--libs/ardour/automatable.cc2
-rw-r--r--libs/ardour/plugin_insert.cc70
-rw-r--r--libs/ardour/session_command.cc2
5 files changed, 42 insertions, 36 deletions
diff --git a/libs/ardour/ardour/plugin_insert.h b/libs/ardour/ardour/plugin_insert.h
index 6e33ad9b61..ff2af9d150 100644
--- a/libs/ardour/ardour/plugin_insert.h
+++ b/libs/ardour/ardour/plugin_insert.h
@@ -155,7 +155,7 @@ class PluginInsert : public Processor
void automation_run (BufferSet& bufs, pframes_t nframes);
void connect_and_run (BufferSet& bufs, pframes_t nframes, framecnt_t offset, bool with_auto, framepos_t now = 0);
- void set_automatable ();
+ void create_automatable_parameters ();
void control_list_automation_state_changed (Evoral::Parameter, AutoState);
void set_parameter_state_2X (const XMLNode& node, int version);
void set_control_ids (const XMLNode&, int version);
@@ -164,6 +164,7 @@ class PluginInsert : public Processor
boost::shared_ptr<Plugin> plugin_factory (boost::shared_ptr<Plugin>);
void add_plugin_with_activation (boost::shared_ptr<Plugin>);
+ void add_plugin (boost::shared_ptr<Plugin>);
};
} // namespace ARDOUR
diff --git a/libs/ardour/audio_unit.cc b/libs/ardour/audio_unit.cc
index 9c1f8948ce..a4d2dd241e 100644
--- a/libs/ardour/audio_unit.cc
+++ b/libs/ardour/audio_unit.cc
@@ -370,6 +370,7 @@ AUPlugin::AUPlugin (AudioEngine& engine, Session& session, boost::shared_ptr<CAC
init ();
}
+
AUPlugin::AUPlugin (const AUPlugin& other)
: Plugin (other)
, comp (other.get_comp())
diff --git a/libs/ardour/automatable.cc b/libs/ardour/automatable.cc
index 661b153244..8c17a99bea 100644
--- a/libs/ardour/automatable.cc
+++ b/libs/ardour/automatable.cc
@@ -255,8 +255,6 @@ Automatable::set_automation_xml_state (const XMLNode& node, Evoral::Parameter le
continue;
}
-
-
if (!id_prop) {
warning << "AutomationList node without automation-id property, "
<< "using default: " << EventTypeMap::instance().to_symbol(legacy_param) << endmsg;
diff --git a/libs/ardour/plugin_insert.cc b/libs/ardour/plugin_insert.cc
index a92427409c..fadf588ffe 100644
--- a/libs/ardour/plugin_insert.cc
+++ b/libs/ardour/plugin_insert.cc
@@ -72,7 +72,8 @@ PluginInsert::PluginInsert (Session& s, boost::shared_ptr<Plugin> plug)
if (plug) {
plug->set_insert_info (this);
_plugins.push_back (plug);
- set_automatable ();
+
+ create_automatable_parameters ();
Glib::Mutex::Lock em (_session.engine().process_lock());
IO::PortCountChanged (max(input_streams(), output_streams()));
@@ -192,8 +193,10 @@ PluginInsert::is_generator() const
}
void
-PluginInsert::set_automatable ()
+PluginInsert::create_automatable_parameters ()
{
+ assert (!_plugins.empty());
+
set<Evoral::Parameter> a = _plugins.front()->automatable ();
Plugin::ParameterDescriptor desc;
@@ -876,60 +879,50 @@ PluginInsert::set_state(const XMLNode& node, int version)
return -1;
}
+ // The name of the PluginInsert comes from the plugin, nothing else
+ _name = plugin->get_info()->name;
+
uint32_t count = 1;
- bool need_automatables = true;
if (_plugins.empty()) {
/* if we are adding the first plugin, we will need to set
up automatable controls.
*/
- need_automatables = true;
+ add_plugin (plugin);
+ create_automatable_parameters ();
+ set_control_ids (node, version);
}
- plugin->set_insert_info (this);
-
if ((prop = node.property ("count")) != 0) {
sscanf (prop->value().c_str(), "%u", &count);
}
- /* Handle the node list for this Processor (or Insert if an A2 session).
- * This needs to happen before the add_plugin_with_activation below, as
- * the plugin set_state calls may themselves call latency_compute_run,
- * which will leave the plugin deactivated whether it is currently
- * activated or not.
- */
+ if (_plugins.size() != count) {
+ for (uint32_t n = 1; n < count; ++n) {
+ add_plugin (plugin_factory (plugin));
+ }
+ }
+
for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
+ /* find the node with the type-specific node name ("lv2", "ladspa", etc)
+ and set all plugins to the same state.
+ */
+
if ((*niter)->name() == plugin->state_node_name()) {
plugin->set_state (**niter, version);
+
for (Plugins::iterator i = _plugins.begin(); i != _plugins.end(); ++i) {
(*i)->set_state (**niter, version);
}
- break;
- }
- }
- if (_plugins.size() != count) {
-
- add_plugin_with_activation (plugin);
-
- for (uint32_t n = 1; n < count; ++n) {
- add_plugin_with_activation (plugin_factory (plugin));
+ break;
}
}
- /* we cannot call this until the _plugins contains at least 1
- plugin so that we can look up parameter information etc.
- */
-
Processor::set_state (node, version);
- if (need_automatables) {
- set_automatable ();
- set_control_ids (node, version);
- }
-
if (version < 3000) {
/* Only 2.X sessions need a call to set_parameter_state() - in 3.X and above
@@ -947,8 +940,13 @@ PluginInsert::set_state(const XMLNode& node, int version)
set_parameter_state_2X (node, version);
}
- // The name of the PluginInsert comes from the plugin, nothing else
- _name = plugin->get_info()->name;
+ for (Plugins::iterator i = _plugins.begin(); i != _plugins.end(); ++i) {
+ if (active()) {
+ (*i)->activate ();
+ } else {
+ (*i)->deactivate ();
+ }
+ }
/* catch up on I/O */
@@ -1204,6 +1202,14 @@ PluginInsert::add_plugin_with_activation (boost::shared_ptr<Plugin> plugin)
}
}
+/** Add a plugin to our list */
+void
+PluginInsert::add_plugin (boost::shared_ptr<Plugin> plugin)
+{
+ plugin->set_insert_info (this);
+ _plugins.push_back (plugin);
+}
+
void
PluginInsert::realtime_handle_transport_stopped ()
{
diff --git a/libs/ardour/session_command.cc b/libs/ardour/session_command.cc
index 36ad015277..c240a4aa94 100644
--- a/libs/ardour/session_command.cc
+++ b/libs/ardour/session_command.cc
@@ -140,7 +140,7 @@ Session::memento_command_factory(XMLNode *n)
);
}
- cerr << "Alist not found\n";
+ cerr << "Alist " << id << " not found\n";
} else if (obj_T == "ARDOUR::Crossfade") {
boost::shared_ptr<Crossfade> c = playlists->find_crossfade (id);