Include tidying.
[dcpomatic.git] / src / lib / audio_analysis.cc
index 73422a9be9ad8a2f3a6039d7487c284ddfe4f8bf..127def8074625742ecc54bd3535ecb40a0b36075 100644 (file)
@@ -65,7 +65,7 @@ AudioPoint::operator= (AudioPoint const & other)
        if (this == &other) {
                return *this;
        }
-       
+
        for (int i = 0; i < COUNT; ++i) {
                _data[i] = other._data[i];
        }
@@ -79,7 +79,7 @@ AudioPoint::as_xml (xmlpp::Element* parent) const
        parent->add_child ("Peak")->add_child_text (raw_convert<string> (_data[PEAK]));
        parent->add_child ("RMS")->add_child_text (raw_convert<string> (_data[RMS]));
 }
-       
+
 AudioAnalysis::AudioAnalysis (int channels)
 {
        _data.resize (channels);
@@ -102,6 +102,7 @@ AudioAnalysis::AudioAnalysis (boost::filesystem::path filename)
 
        _peak = f.number_child<float> ("Peak");
        _peak_time = DCPTime (f.number_child<DCPTime::Type> ("PeakTime"));
+       _analysis_gain = f.optional_number_child<double> ("AnalysisGain");
 }
 
 void
@@ -149,5 +150,9 @@ AudioAnalysis::write (boost::filesystem::path filename)
                root->add_child("PeakTime")->add_child_text (raw_convert<string> (_peak_time.get().get ()));
        }
 
+       if (_analysis_gain) {
+               root->add_child("AnalysisGain")->add_child_text (raw_convert<string> (_analysis_gain.get ()));
+       }
+
        doc->write_to_file_formatted (filename.string ());
 }