13
0

Use XMLNode::get_property API in ARDOUR::Pannable class

Used for float conversions from old state versions, necessary to be able to
remove LocaleGuard
This commit is contained in:
Tim Mayberry 2016-08-26 09:20:35 +10:00
parent f2fb8523d8
commit be309b913d

View File

@ -18,7 +18,6 @@
*/
#include "pbd/error.h"
#include "pbd/convert.h"
#include "pbd/compose.h"
#include "ardour/boost_debug.h"
@ -220,21 +219,21 @@ Pannable::set_state (const XMLNode& root, int version)
for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
if ((*niter)->name() == Controllable::xml_node_name) {
XMLProperty const * prop = (*niter)->property (X_("name"));
std::string control_name;
if (!prop) {
if (!(*niter)->get_property (X_("name"), control_name)) {
continue;
}
if (prop->value() == pan_azimuth_control->name()) {
if (control_name == pan_azimuth_control->name()) {
pan_azimuth_control->set_state (**niter, version);
} else if (prop->value() == pan_width_control->name()) {
} else if (control_name == pan_width_control->name()) {
pan_width_control->set_state (**niter, version);
} else if (prop->value() == pan_elevation_control->name()) {
} else if (control_name == pan_elevation_control->name()) {
pan_elevation_control->set_state (**niter, version);
} else if (prop->value() == pan_frontback_control->name()) {
} else if (control_name == pan_frontback_control->name()) {
pan_frontback_control->set_state (**niter, version);
} else if (prop->value() == pan_lfe_control->name()) {
} else if (control_name == pan_lfe_control->name()) {
pan_lfe_control->set_state (**niter, version);
}
@ -242,34 +241,28 @@ Pannable::set_state (const XMLNode& root, int version)
set_automation_xml_state (**niter, PanAzimuthAutomation);
} else {
XMLProperty const * prop;
/* old school (alpha1-6) XML info */
float val;
if ((*niter)->name() == X_("azimuth")) {
prop = (*niter)->property (X_("value"));
if (prop) {
pan_azimuth_control->set_value (atof (prop->value()), Controllable::NoGroup);
if ((*niter)->get_property (X_("value"), val)) {
pan_azimuth_control->set_value (val, Controllable::NoGroup);
}
} else if ((*niter)->name() == X_("width")) {
prop = (*niter)->property (X_("value"));
if (prop) {
pan_width_control->set_value (atof (prop->value()), Controllable::NoGroup);
if ((*niter)->get_property (X_("value"), val)) {
pan_width_control->set_value (val, Controllable::NoGroup);
}
} else if ((*niter)->name() == X_("elevation")) {
prop = (*niter)->property (X_("value"));
if (prop) {
pan_elevation_control->set_value (atof (prop->value()), Controllable::NoGroup);
if ((*niter)->get_property (X_("value"), val)) {
pan_elevation_control->set_value (val, Controllable::NoGroup);
}
} else if ((*niter)->name() == X_("frontback")) {
prop = (*niter)->property (X_("value"));
if (prop) {
pan_frontback_control->set_value (atof (prop->value()), Controllable::NoGroup);
if ((*niter)->get_property (X_("value"), val)) {
pan_frontback_control->set_value (val, Controllable::NoGroup);
}
} else if ((*niter)->name() == X_("lfe")) {
prop = (*niter)->property (X_("value"));
if (prop) {
pan_lfe_control->set_value (atof (prop->value()), Controllable::NoGroup);
if ((*niter)->get_property (X_("value"), val)) {
pan_lfe_control->set_value (val, Controllable::NoGroup);
}
}
}