X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fspeakers.cc;h=928fb0be50e1fa519dcd96d87cf3a4c7b96c01f7;hb=5fa05b403ca21a6573d07b921dc14f0769dc9fc7;hp=b2f46fa0693afc5cd8c52db8a8903c82d0ab33c1;hpb=3dc7728038860bda6eb4b0de1f4a3e14ec9e86cc;p=ardour.git diff --git a/libs/ardour/speakers.cc b/libs/ardour/speakers.cc index b2f46fa069..928fb0be50 100644 --- a/libs/ardour/speakers.cc +++ b/libs/ardour/speakers.cc @@ -17,13 +17,11 @@ */ #include "pbd/error.h" -#include "pbd/convert.h" -#include "pbd/locale_guard.h" #include "ardour/speaker.h" #include "ardour/speakers.h" -#include "i18n.h" +#include "pbd/i18n.h" using namespace ARDOUR; using namespace PBD; @@ -244,18 +242,13 @@ XMLNode& Speakers::get_state () { XMLNode* node = new XMLNode (X_("Speakers")); - char buf[32]; - LocaleGuard lg (); for (vector::const_iterator i = _speakers.begin(); i != _speakers.end(); ++i) { XMLNode* speaker = new XMLNode (X_("Speaker")); - snprintf (buf, sizeof (buf), "%.12g", (*i).angles().azi); - speaker->add_property (X_("azimuth"), buf); - snprintf (buf, sizeof (buf), "%.12g", (*i).angles().ele); - speaker->add_property (X_("elevation"), buf); - snprintf (buf, sizeof (buf), "%.12g", (*i).angles().length); - speaker->add_property (X_("distance"), buf); + speaker->set_property (X_("azimuth"), (*i).angles().azi); + speaker->set_property (X_("elevation"), (*i).angles().ele); + speaker->set_property (X_("distance"), (*i).angles().length); node->add_child_nocopy (*speaker); } @@ -267,32 +260,18 @@ int Speakers::set_state (const XMLNode& node, int /*version*/) { XMLNodeConstIterator i; - XMLProperty const * prop; - double a, e, d; - LocaleGuard lg (); - int n = 0; _speakers.clear (); - for (i = node.children().begin(); i != node.children().end(); ++i, ++n) { + for (i = node.children().begin(); i != node.children().end(); ++i) { if ((*i)->name() == X_("Speaker")) { - if ((prop = (*i)->property (X_("azimuth"))) == 0) { - warning << _("Speaker information is missing azimuth - speaker ignored") << endmsg; + double a, e, d; + if (!(*i)->get_property (X_("azimuth"), a) || + !(*i)->get_property (X_("elevation"), e) || + !(*i)->get_property (X_("distance"), d)) { + warning << _("Speaker information is missing - speaker ignored") << endmsg; continue; } - a = atof (prop->value()); - - if ((prop = (*i)->property (X_("elevation"))) == 0) { - warning << _("Speaker information is missing elevation - speaker ignored") << endmsg; - continue; - } - e = atof (prop->value()); - - if ((prop = (*i)->property (X_("distance"))) == 0) { - warning << _("Speaker information is missing distance - speaker ignored") << endmsg; - continue; - } - d = atof (prop->value()); add_speaker (AngularVector (a, e, d)); }