Change end() to only do one thing, and copy the required stuff into pause()
[dcpomatic.git] / src / lib / audio_analysis.cc
index 6f1bb2375613f851116eb66d096c9fc147296d99..c50a2bb9db525b61c6c1b2d1c90c785618204077 100644 (file)
@@ -66,7 +66,7 @@ AudioAnalysis::AudioAnalysis (int channels)
 AudioAnalysis::AudioAnalysis (boost::filesystem::path filename)
 {
        cxml::Document f ("AudioAnalysis");
-       f.read_file (filename);
+       f.read_file(dcp::filesystem::fix_long_path(filename));
 
        if (f.optional_number_child<int>("Version").get_value_or(1) < _current_state_version) {
                /* Too old.  Throw an exception so that this analysis is re-run. */
@@ -84,11 +84,8 @@ AudioAnalysis::AudioAnalysis (boost::filesystem::path filename)
        }
 
        for (auto i: f.node_children ("SamplePeak")) {
-               _sample_peak.push_back (
-                       PeakTime(
-                               dcp::raw_convert<float>(i->content()), DCPTime(i->number_attribute<Frame>("Time"))
-                               )
-                       );
+               auto const time = number_attribute<Frame>(i, "Time", "time");
+               _sample_peak.push_back(PeakTime(dcp::raw_convert<float>(i->content()), DCPTime(time)));
        }
 
        for (auto i: f.node_children("TruePeak")) {
@@ -155,7 +152,7 @@ AudioAnalysis::write (boost::filesystem::path filename)
        for (size_t i = 0; i < _sample_peak.size(); ++i) {
                auto n = root->add_child("SamplePeak");
                n->add_child_text (raw_convert<string> (_sample_peak[i].peak));
-               n->set_attribute ("Time", raw_convert<string> (_sample_peak[i].time.get()));
+               n->set_attribute("time", raw_convert<string> (_sample_peak[i].time.get()));
        }
 
        for (auto i: _true_peak) {