diff options
Diffstat (limited to 'libs')
-rw-r--r-- | libs/ardour/ardour/plugin_insert.h | 2 | ||||
-rw-r--r-- | libs/ardour/ardour/sidechain.h | 2 | ||||
-rw-r--r-- | libs/ardour/plugin_insert.cc | 44 |
3 files changed, 46 insertions, 2 deletions
diff --git a/libs/ardour/ardour/plugin_insert.h b/libs/ardour/ardour/plugin_insert.h index a68110177f..0a56373972 100644 --- a/libs/ardour/ardour/plugin_insert.h +++ b/libs/ardour/ardour/plugin_insert.h @@ -388,6 +388,8 @@ private: boost::shared_ptr<Plugin> plugin_factory (boost::shared_ptr<Plugin>); void add_plugin (boost::shared_ptr<Plugin>); + void add_sidechain_from_xml (const XMLNode& node, int version); + void start_touch (uint32_t param_id); void end_touch (uint32_t param_id); diff --git a/libs/ardour/ardour/sidechain.h b/libs/ardour/ardour/sidechain.h index dd608c8951..1677360990 100644 --- a/libs/ardour/ardour/sidechain.h +++ b/libs/ardour/ardour/sidechain.h @@ -39,7 +39,7 @@ public: bool can_support_io_configuration (const ChanCount& in, ChanCount& out); bool configure_io (ChanCount in, ChanCount out); - int set_state(const XMLNode&, int version); + int set_state(const XMLNode&, int version); protected: XMLNode& state (); diff --git a/libs/ardour/plugin_insert.cc b/libs/ardour/plugin_insert.cc index 4fc97fb0c8..983d3b9aa8 100644 --- a/libs/ardour/plugin_insert.cc +++ b/libs/ardour/plugin_insert.cc @@ -2763,10 +2763,16 @@ PluginInsert::set_state(const XMLNode& node, int version) // sidechain is a Processor (IO) if ((*i)->name () == Processor::state_node_name) { if (!_sidechain) { - add_sidechain (0); + if (regenerate_xml_or_string_ids ()) { + add_sidechain_from_xml (**i, version); + } else { + add_sidechain (0); + } } if (!regenerate_xml_or_string_ids ()) { _sidechain->set_state (**i, version); + } else { + update_sidechain_name (); } } } @@ -3096,6 +3102,42 @@ PluginInsert::add_plugin (boost::shared_ptr<Plugin> plugin) _plugins.push_back (plugin); } +void +PluginInsert::add_sidechain_from_xml (const XMLNode& node, int version) +{ + if (version < 3000) { + return; + } + + XMLNodeList nlist = node.children(); + + if (nlist.size() == 0) { + return; + } + + uint32_t audio = 0; + uint32_t midi = 0; + + XMLNodeConstIterator it = nlist.front()->children().begin(); + for ( ; it != nlist.front()->children().end(); ++ it) { + if ((*it)->name() == "Port") { + DataType type(DataType::NIL); + (*it)->get_property ("type", type); + if (type == DataType::AUDIO) { + ++audio; + } else if (type == DataType::MIDI) { + ++midi; + } + } + } + + ChanCount in_cc = ChanCount(); + in_cc.set (DataType::AUDIO, audio); + in_cc.set (DataType::MIDI, midi); + + add_sidechain (audio, midi); +} + bool PluginInsert::load_preset (ARDOUR::Plugin::PresetRecord pr) { |