+ if ((prop = node.property (X_("flags"))) != 0) {
+ _flags = Flag (string_2_enum (prop->value(), _flags));
+ } else {
+ _flags = Flag (0);
+ }
+
+ /* add all processors (except amp, which is always present) */
+
+ nlist = node.children();
+ XMLNode processor_state (X_("processor_state"));
+
+ for (niter = nlist.begin(); niter != nlist.end(); ++niter){
+
+ child = *niter;
+
+ if (child->name() == IO::state_node_name) {
+ if ((prop = child->property (X_("direction"))) == 0) {
+ continue;
+ }
+
+ if (prop->value() == "Input") {
+ _input->set_state (*child, version);
+ } else if (prop->value() == "Output") {
+ _output->set_state (*child, version);
+ }
+ }
+
+ if (child->name() == X_("Processor")) {
+ processor_state.add_child_copy (*child);
+ }
+ }
+
+ set_processor_state (processor_state);
+
+ if ((prop = node.property ("self-solo")) != 0) {
+ set_self_solo (string_is_affirmative (prop->value()));
+ }
+
+ if ((prop = node.property ("soloed-by-others")) != 0) {
+ _soloed_by_others = 0; // needed for mod_solo_by_others () to work
+ mod_solo_by_others (atoi (prop->value()));
+ }
+
+ if ((prop = node.property ("solo-isolated")) != 0) {
+ set_solo_isolated (string_is_affirmative (prop->value()), this);
+ }
+
+ if ((prop = node.property (X_("phase-invert"))) != 0) {
+ set_phase_invert (string_is_affirmative (prop->value()));
+ }
+
+ if ((prop = node.property (X_("denormal-protection"))) != 0) {
+ set_denormal_protection (string_is_affirmative (prop->value()));
+ }
+
+ if ((prop = node.property (X_("active"))) != 0) {
+ bool yn = string_is_affirmative (prop->value());
+ _active = !yn; // force switch
+ set_active (yn);
+ }
+
+ if ((prop = node.property (X_("meter-point"))) != 0) {
+ _meter_point = MeterPoint (string_2_enum (prop->value (), _meter_point));
+ if (_meter) {
+ _meter->set_display_to_user (_meter_point == MeterCustom);
+ }
+ }
+
+ if ((prop = node.property (X_("order-keys"))) != 0) {
+
+ long n;
+
+ string::size_type colon, equal;
+ string remaining = prop->value();
+
+ while (remaining.length()) {
+
+ if ((equal = remaining.find_first_of ('=')) == string::npos || equal == remaining.length()) {
+ error << string_compose (_("badly formed order key string in state file! [%1] ... ignored."), remaining)
+ << endmsg;
+ } else {
+ if (sscanf (remaining.substr (equal+1).c_str(), "%ld", &n) != 1) {
+ error << string_compose (_("badly formed order key string in state file! [%1] ... ignored."), remaining)
+ << endmsg;
+ } else {
+ set_order_key (remaining.substr (0, equal), n);
+ }
+ }
+
+ colon = remaining.find_first_of (':');
+
+ if (colon != string::npos) {
+ remaining = remaining.substr (colon+1);
+ } else {
+ break;
+ }
+ }
+ }
+
+ for (niter = nlist.begin(); niter != nlist.end(); ++niter){
+ child = *niter;
+
+ if (child->name() == X_("Comment")) {
+
+ /* XXX this is a terrible API design in libxml++ */
+
+ XMLNode *cmt = *(child->children().begin());
+ _comment = cmt->content();
+
+ } else if (child->name() == X_("Extra")) {
+
+ _extra_xml = new XMLNode (*child);
+
+ } else if (child->name() == X_("Controllable") && (prop = child->property("name")) != 0) {
+
+ if (prop->value() == "solo") {
+ _solo_control->set_state (*child, version);
+ _session.add_controllable (_solo_control);
+ }
+
+ } else if (child->name() == X_("RemoteControl")) {
+ if ((prop = child->property (X_("id"))) != 0) {
+ int32_t x;
+ sscanf (prop->value().c_str(), "%d", &x);
+ set_remote_control_id (x);
+ }
+
+ } else if (child->name() == X_("MuteMaster")) {
+ _mute_master->set_state (*child, version);
+ }
+ }
+
+ return 0;
+}
+
+int
+Route::_set_state_2X (const XMLNode& node, int version)
+{
+ XMLNodeList nlist;
+ XMLNodeConstIterator niter;
+ XMLNode *child;
+ XMLPropertyList plist;
+ const XMLProperty *prop;
+
+ /* 2X things which still remain to be handled:
+ * default-type
+ * muted
+ * mute-affects-pre-fader
+ * mute-affects-post-fader
+ * mute-affects-control-outs
+ * mute-affects-main-outs
+ * automation
+ * controlouts
+ */
+
+ if (node.name() != "Route") {
+ error << string_compose(_("Bad node sent to Route::set_state() [%1]"), node.name()) << endmsg;
+ return -1;
+ }
+
+ if ((prop = node.property (X_("flags"))) != 0) {
+ _flags = Flag (string_2_enum (prop->value(), _flags));
+ } else {
+ _flags = Flag (0);
+ }
+
+ /* add standard processors */
+
+ _meter.reset (new PeakMeter (_session));
+ add_processor (_meter, PreFader);
+
+ if (_flags & ControlOut) {
+ /* where we listen to tracks */
+ _intreturn.reset (new InternalReturn (_session));
+ add_processor (_intreturn, PreFader);
+ }
+
+ _main_outs.reset (new Delivery (_session, _output, _mute_master, _name, Delivery::Main));
+ add_processor (_main_outs, PostFader);