+}
+
+int
+VCA::init ()
+{
+ _solo_control.reset (new SoloControl (_session, X_("solo"), *this, *this));
+ _mute_control.reset (new MuteControl (_session, X_("mute"), *this));
+
+ add_control (_gain_control);
+ add_control (_solo_control);
+ add_control (_mute_control);
+
+ return 0;
+}
+
+VCA::~VCA ()
+{
+ DEBUG_TRACE (DEBUG::Destruction, string_compose ("delete VCA %1\n", number()));
+ {
+ Glib::Threads::Mutex::Lock lm (_control_lock);
+ for (Controls::const_iterator li = _controls.begin(); li != _controls.end(); ++li) {
+ boost::dynamic_pointer_cast<AutomationControl>(li->second)->drop_references ();
+ }
+ }
+ {
+ Glib::Threads::Mutex::Lock lm (number_lock);
+ if (_number == next_number - 1) {
+ /* this was the "last" VCA added, so rewind the next number so
+ * that future VCAs get numbered as intended
+ */
+ next_number--;
+ }
+ }
+}
+
+string
+VCA::full_name() const
+{
+ /* name() is never empty - default is VCA %n */
+ return string_compose (_("VCA %1 : %2"), _number, name());
+}
+
+XMLNode&
+VCA::get_state ()
+{
+ XMLNode* node = new XMLNode (xml_node_name);
+ node->set_property (X_("name"), name());
+ node->set_property (X_("number"), _number);
+
+ node->add_child_nocopy (_presentation_info.get_state());
+
+ node->add_child_nocopy (_gain_control->get_state());
+ node->add_child_nocopy (_solo_control->get_state());
+ node->add_child_nocopy (_mute_control->get_state());
+ node->add_child_nocopy (get_automation_xml_state());
+
+ node->add_child_nocopy (Slavable::get_state());
+
+ return *node;
+}
+
+int
+VCA::set_state (XMLNode const& node, int version)
+{
+ Stripable::set_state (node, version);
+
+ std::string str;
+ if (node.get_property ("name", str)) {
+ set_name (str);
+ }
+
+ node.get_property ("number", _number);
+
+ XMLNodeList const &children (node.children());
+ for (XMLNodeList::const_iterator i = children.begin(); i != children.end(); ++i) {
+ if ((*i)->name() == Controllable::xml_node_name) {
+
+ if (!(*i)->get_property ("name", str)) {
+ continue;
+ }
+
+ if (str == _gain_control->name()) {
+ _gain_control->set_state (**i, version);
+ }
+ if (str == _solo_control->name()) {
+ _solo_control->set_state (**i, version);
+ }
+ if (str == _mute_control->name()) {
+ _mute_control->set_state (**i, version);
+ }
+ } else if ((*i)->name() == Slavable::xml_node_name) {
+ Slavable::set_state (**i, version);
+ } else if ((*i)->name() == Automatable::xml_node_name) {
+ set_automation_xml_state (**i, Evoral::Parameter(NullAutomation));
+ }
+ }
+
+ return 0;