- const XMLProperty *prop;
-
- nlist = root.children();
-
- for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
- if ((*niter)->name() == X_("azimuth")) {
- prop = (*niter)->property (X_("value"));
- if (prop) {
- pan_azimuth_control->set_value (atof (prop->value()));
- }
- } else if ((*niter)->name() == X_("width")) {
- prop = (*niter)->property (X_("value"));
- if (prop) {
- pan_width_control->set_value (atof (prop->value()));
- }
- } else if ((*niter)->name() == X_("elevation")) {
- prop = (*niter)->property (X_("value"));
- if (prop) {
- pan_elevation_control->set_value (atof (prop->value()));
- }
- } else if ((*niter)->name() == X_("azimuth")) {
- prop = (*niter)->property (X_("value"));
- if (prop) {
- pan_frontback_control->set_value (atof (prop->value()));
- }
- } else if ((*niter)->name() == X_("lfe")) {
- prop = (*niter)->property (X_("value"));
- if (prop) {
- pan_lfe_control->set_value (atof (prop->value()));
- }
- } else if ((*niter)->name() == Automatable::xml_node_name) {
- set_automation_xml_state (**niter, PanAzimuthAutomation);
- }
- }
-
- _has_state = true;
-
- return 0;
+
+ for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
+ if ((*niter)->name() == Controllable::xml_node_name) {
+ std::string control_name;
+
+ if (!(*niter)->get_property (X_("name"), control_name)) {
+ continue;
+ }
+
+ if (control_name == pan_azimuth_control->name()) {
+ pan_azimuth_control->set_state (**niter, version);
+ } else if (control_name == pan_width_control->name()) {
+ pan_width_control->set_state (**niter, version);
+ } else if (control_name == pan_elevation_control->name()) {
+ pan_elevation_control->set_state (**niter, version);
+ } else if (control_name == pan_frontback_control->name()) {
+ pan_frontback_control->set_state (**niter, version);
+ } else if (control_name == pan_lfe_control->name()) {
+ pan_lfe_control->set_state (**niter, version);
+ }
+
+ } else if ((*niter)->name() == Automatable::xml_node_name) {
+ set_automation_xml_state (**niter, PanAzimuthAutomation);
+
+ } else {
+ /* old school (alpha1-6) XML info */
+
+ float val;
+ if ((*niter)->name() == X_("azimuth")) {
+ if ((*niter)->get_property (X_("value"), val)) {
+ pan_azimuth_control->set_value (val, Controllable::NoGroup);
+ }
+ } else if ((*niter)->name() == X_("width")) {
+ if ((*niter)->get_property (X_("value"), val)) {
+ pan_width_control->set_value (val, Controllable::NoGroup);
+ }
+ } else if ((*niter)->name() == X_("elevation")) {
+ if ((*niter)->get_property (X_("value"), val)) {
+ pan_elevation_control->set_value (val, Controllable::NoGroup);
+ }
+ } else if ((*niter)->name() == X_("frontback")) {
+ if ((*niter)->get_property (X_("value"), val)) {
+ pan_frontback_control->set_value (val, Controllable::NoGroup);
+ }
+ } else if ((*niter)->name() == X_("lfe")) {
+ if ((*niter)->get_property (X_("value"), val)) {
+ pan_lfe_control->set_value (val, Controllable::NoGroup);
+ }
+ }
+ }
+ }
+
+ _has_state = true;
+
+ return 0;