diff options
author | Tim Mayberry <mojofunk@gmail.com> | 2016-09-08 10:19:12 +1000 |
---|---|---|
committer | Tim Mayberry <mojofunk@gmail.com> | 2017-04-19 09:37:00 +1000 |
commit | ca7bbea6d8378c0ca4c0e2deecd70c60178f7378 (patch) | |
tree | d1589f1fe386b4e4e5de5c92dd371d09dbde2857 /libs/ardour/automation_list.cc | |
parent | c65f30b4b10a451baa28f66a89c8035a82b11a65 (diff) |
Use PBD::string_to/to_string when de/serializing in AutomationList class
This avoids requiring a LocaleGuard to get the correct numeric formatting and
saves/restores the automation data to the precision required for roundtrip
equality.
Diffstat (limited to 'libs/ardour/automation_list.cc')
-rw-r--r-- | libs/ardour/automation_list.cc | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/libs/ardour/automation_list.cc b/libs/ardour/automation_list.cc index ff22dae5da..c397323767 100644 --- a/libs/ardour/automation_list.cc +++ b/libs/ardour/automation_list.cc @@ -347,12 +347,10 @@ AutomationList::serialize_events () XMLNode* node = new XMLNode (X_("events")); stringstream str; - str.precision(15); //10 digits is enough digits for 24 hours at 96kHz - for (iterator xx = _events.begin(); xx != _events.end(); ++xx) { - str << (double) (*xx)->when; + str << PBD::to_string ((*xx)->when); str << ' '; - str <<(double) (*xx)->value; + str << PBD::to_string ((*xx)->value); str << '\n'; } @@ -384,17 +382,19 @@ AutomationList::deserialize_events (const XMLNode& node) stringstream str (content_node->content()); + std::string x_str; + std::string y_str; double x; double y; bool ok = true; while (str) { - str >> x; - if (!str) { + str >> x_str; + if (!str || !PBD::string_to<double> (x_str, x)) { break; } - str >> y; - if (!str) { + str >> y_str; + if (!str || !PBD::string_to<double> (y_str, y)) { ok = false; break; } |