fix a typo
[ardour.git] / libs / ardour / plugin_insert.cc
index 8da0abb00fac440f58630e57eb383c7d96342449..e09cce8f5a973c09dcc0861af6c0c1bc7ea33774 100644 (file)
@@ -715,36 +715,42 @@ PluginInsert::configure_io (ChanCount in, ChanCount out)
        ChanCount old_in = input_streams ();
        ChanCount old_out = output_streams ();
 
+       _configured_in = in;
+       _configured_out = out;
+
        /* set the matching method and number of plugins that we will use to meet this configuration */
        _match = private_can_support_io_configuration (in, out);
        if (set_count (_match.plugins) == false) {
-               return false;
-       }
-
-       if (  (old_match.method != _match.method && (old_match.method == Split || _match.method == Split))
-                       || old_in != in
-                       || old_out != out
-                       )
-       {
                PluginIoReConfigure (); /* EMIT SIGNAL */
+               return false;
        }
 
        /* configure plugins */
        switch (_match.method) {
        case Split:
        case Hide:
-               if (_plugins.front()->configure_io (_plugins.front()->get_info()->n_inputs, out)) {
+               if (_plugins.front()->configure_io (_plugins.front()->get_info()->n_inputs, out) == false) {
+                       PluginIoReConfigure (); /* EMIT SIGNAL */
                        return false;
                }
                break;
 
        default:
                if (_plugins.front()->configure_io (in, out) == false) {
+                       PluginIoReConfigure (); /* EMIT SIGNAL */
                        return false;
                }
                break;
        }
 
+       if (  (old_match.method != _match.method && (old_match.method == Split || _match.method == Split))
+                       || old_in != in
+                       || old_out != out
+                       )
+       {
+               PluginIoReConfigure (); /* EMIT SIGNAL */
+       }
+
        // we don't know the analysis window size, so we must work with the
        // current buffer size here. each request for data fills in these
        // buffers and the analyser makes sure it gets enough data for the
@@ -939,6 +945,12 @@ PluginInsert::state (bool full)
        node.add_property("type", _plugins[0]->state_node_name());
        node.add_property("unique-id", _plugins[0]->unique_id());
        node.add_property("count", string_compose("%1", _plugins.size()));
+
+       /* remember actual i/o configuration (for later placeholder
+        * in case the plugin goes missing) */
+       node.add_child_nocopy (* _configured_in.state (X_("ConfiguredInput")));
+       node.add_child_nocopy (* _configured_out.state (X_("ConfiguredOutput")));
+
        node.add_child_nocopy (_plugins[0]->get_state());
 
        for (Controls::iterator c = controls().begin(); c != controls().end(); ++c) {
@@ -1145,6 +1157,15 @@ PluginInsert::set_state(const XMLNode& node, int version)
        return 0;
 }
 
+void
+PluginInsert::update_id (PBD::ID id)
+{
+       set_id (id.to_s());
+       for (Plugins::iterator i = _plugins.begin(); i != _plugins.end(); ++i) {
+               (*i)->set_insert_id (id);
+       }
+}
+
 void
 PluginInsert::set_parameter_state_2X (const XMLNode& node, int version)
 {
@@ -1378,6 +1399,7 @@ PluginInsert::get_impulse_analysis_plugin()
        boost::shared_ptr<Plugin> ret;
        if (_impulseAnalysisPlugin.expired()) {
                ret = plugin_factory(_plugins[0]);
+               ret->configure_io (input_streams (), output_streams ());
                _impulseAnalysisPlugin = ret;
        } else {
                ret = _impulseAnalysisPlugin.lock();