From 4d14ae4e23bc58e356dcda387213d0ba4ab6364b Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 29 Feb 2016 18:12:13 -0500 Subject: mostly restore VCA state on session loading. This does not restore VCA assignments --- libs/ardour/vca.cc | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'libs/ardour/vca.cc') diff --git a/libs/ardour/vca.cc b/libs/ardour/vca.cc index f4737e433a..9ae0c5a2dc 100644 --- a/libs/ardour/vca.cc +++ b/libs/ardour/vca.cc @@ -47,10 +47,23 @@ VCA::next_vca_number () VCA::VCA (Session& s, const string& name, uint32_t num) : SessionHandleRef (s) + , Automatable (s) , _number (num) , _name (name) , _control (new GainControl (s, Evoral::Parameter (GainAutomation), boost::shared_ptr ())) { + add_control (_control); +} + +VCA::VCA (Session& s, XMLNode const & node, int version) + : SessionHandleRef (s) + , Automatable (s) + , _number (0) + , _control (new GainControl (s, Evoral::Parameter (GainAutomation), boost::shared_ptr ())) +{ + add_control (_control); + + set_state (node, version); } void @@ -90,11 +103,15 @@ VCA::get_state () XMLNode* node = new XMLNode (xml_node_name); node->add_property (X_("name"), _name); node->add_property (X_("number"), _number); + + node->add_child_nocopy (_control->get_state()); + node->add_child_nocopy (get_automation_xml_state()); + return *node; } int -VCA::set_state (XMLNode const& node, int /*version*/) +VCA::set_state (XMLNode const& node, int version) { XMLProperty const* prop; @@ -106,5 +123,15 @@ VCA::set_state (XMLNode const& node, int /*version*/) _number = atoi (prop->value()); } + XMLNodeList const &children (node.children()); + for (XMLNodeList::const_iterator i = children.begin(); i != children.end(); ++i) { + if ((*i)->name() == Controllable::xml_node_name) { + XMLProperty* prop = (*i)->property ("name"); + if (prop && prop->value() == X_("gaincontrol")) { + _control->set_state (**i, version); + } + } + } + return 0; } -- cgit v1.2.3