From be309b913d081093b5d5d6c4c166dd9b11ee85d3 Mon Sep 17 00:00:00 2001 From: Tim Mayberry Date: Fri, 26 Aug 2016 09:20:35 +1000 Subject: Use XMLNode::get_property API in ARDOUR::Pannable class Used for float conversions from old state versions, necessary to be able to remove LocaleGuard --- libs/ardour/pannable.cc | 43 ++++++++++++++++++------------------------- 1 file changed, 18 insertions(+), 25 deletions(-) (limited to 'libs/ardour/pannable.cc') diff --git a/libs/ardour/pannable.cc b/libs/ardour/pannable.cc index abfb9d66c2..e91eb43429 100644 --- a/libs/ardour/pannable.cc +++ b/libs/ardour/pannable.cc @@ -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); } } } -- cgit v1.2.3