Address sidechain-port name uniqueness

[Re]name sidechain port directly when a plugin is added.

Usually plugins are constructed without an Route (owner is unset).
PluginInsert c'tor may already create a side-chain port, at the
time of construction the sidechain port will be created using
the port-name "toBeRenamed".

Previously the plugin had to be added to a route using "add_processor",
in order to set a unique name, before a new plugin with sidechain
could be constructed.

ProcessorBox::use_plugins() did that in the correct sequence,
however there may have been cases where this didn't work, and
Route::add_processors() was called directly..
This commit is contained in:
Robin Gareus 2020-02-13 00:47:18 +01:00
parent 260e7ad5a9
commit 46a6f47362
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 2 additions and 6 deletions

View File

@ -222,7 +222,7 @@ PluginInsert::add_sidechain (uint32_t n_audio, uint32_t n_midi)
} else if (owner()) {
n << "SC " << owner()->name() << "/" << name() << " " << Session::next_name_id ();
} else {
n << "tobeRenamed";
n << "toBeRenamed" << id().to_s();
}
SideChain *sc = new SideChain (_session, n.str ());
_sidechain = boost::shared_ptr<SideChain> (sc);

View File

@ -894,11 +894,6 @@ Route::add_processor (boost::shared_ptr<Processor> processor, boost::shared_ptr<
processor->activate ();
}
boost::shared_ptr<PluginInsert> pi = boost::dynamic_pointer_cast<PluginInsert> (processor);
if (pi) {
pi->update_sidechain_name ();
}
return 0;
}
@ -1143,6 +1138,7 @@ Route::add_processors (const ProcessorList& others, boost::shared_ptr<Processor>
}
if (pi && pi->has_sidechain ()) {
pi->update_sidechain_name ();
pi->sidechain_input ()->changed.connect_same_thread (*this, boost::bind (&Route::sidechain_change_handler, this, _1, _2));
}