When a PluginInsert is created it does not have an owner right away. That's why
a we need to set the sidechains name once the owner is known, in order to
include owner's name into the name.
Furthermore we need to follow renames of the owner.
bool set_preset_out (const ChanCount&);
bool add_sidechain (uint32_t n_audio = 1, uint32_t n_midi = 0);
bool del_sidechain ();
bool set_preset_out (const ChanCount&);
bool add_sidechain (uint32_t n_audio = 1, uint32_t n_midi = 0);
bool del_sidechain ();
+ void update_sidechain_name ();
boost::shared_ptr<SideChain> sidechain () const { return _sidechain; }
// end C++ class slavery!
boost::shared_ptr<SideChain> sidechain () const { return _sidechain; }
// end C++ class slavery!
return false;
}
std::ostringstream n;
return false;
}
std::ostringstream n;
- if (n_audio > 0 || n_midi > 0) {
- n << "Sidechain " << Session::next_name_id ();
- } else {
+ if (n_audio == 0 && n_midi == 0) {
n << "TO BE RESET FROM XML";
n << "TO BE RESET FROM XML";
+ } else if (owner()) {
+ n << "SC " << owner()->name() << "/" << name() << " " << Session::next_name_id ();
+ } else {
+ n << "tobeRenamed";
}
SideChain *sc = new SideChain (_session, n.str ());
_sidechain = boost::shared_ptr<SideChain> (sc);
}
SideChain *sc = new SideChain (_session, n.str ());
_sidechain = boost::shared_ptr<SideChain> (sc);
+void
+PluginInsert::update_sidechain_name ()
+{
+ if (!_sidechain) {
+ return;
+ }
+
+ std::ostringstream n;
+
+ n << "SC ";
+ if (owner()) {
+ n << owner()->name() << "/";
+ }
+
+ n << name() << " " << Session::next_name_id ();
+
+ _sidechain->set_name (n.str());
+}
+
void
PluginInsert::control_list_automation_state_changed (Evoral::Parameter which, AutoState s)
{
void
PluginInsert::control_list_automation_state_changed (Evoral::Parameter which, AutoState s)
{
processor->activate ();
}
processor->activate ();
}
+ boost::shared_ptr<PluginInsert> pi = boost::dynamic_pointer_cast<PluginInsert> (processor);
+ if (pi) {
+ pi->update_sidechain_name ();
+ }
+
SessionObject::set_name (newname);
SessionObject::set_name (newname);
+ for (uint32_t n = 0 ; ; ++n) {
+ boost::shared_ptr<PluginInsert> pi = boost::static_pointer_cast<PluginInsert> (nth_plugin (n));
+ if (!pi) {
+ break;
+ }
+ pi->update_sidechain_name ();
+ }
+
bool ret = (_input->set_name(newname) && _output->set_name(newname));
if (ret) {
bool ret = (_input->set_name(newname) && _output->set_name(newname));
if (ret) {