diff options
| author | Carl Hetherington <cth@carlh.net> | 2015-05-10 00:15:44 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2015-05-10 00:15:44 +0100 |
| commit | fc96a4b3d6985f28db6bc0e9418e98cc5bec87e3 (patch) | |
| tree | e6866c8006ccf4fb400bfb8e8481a4f1142fb2e3 /src/lib/audio_analysis.cc | |
| parent | 55002ca15ba288002aeedf3867fb9d07b7b653f0 (diff) | |
7fd73c0cf1f723896826c77fec3720c5c404d4e8 from master; tidy audio analysis dialogue and add overall peak.
Diffstat (limited to 'src/lib/audio_analysis.cc')
| -rw-r--r-- | src/lib/audio_analysis.cc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/lib/audio_analysis.cc b/src/lib/audio_analysis.cc index 19a0d876e..ee34b0d80 100644 --- a/src/lib/audio_analysis.cc +++ b/src/lib/audio_analysis.cc @@ -22,6 +22,7 @@ #include "cross.h" #include <boost/filesystem.hpp> #include <stdint.h> +#include <inttypes.h> #include <cmath> #include <cassert> #include <cstdio> @@ -115,6 +116,17 @@ AudioAnalysis::AudioAnalysis (boost::filesystem::path filename) } } + /* These may not exist in old analysis files, so be careful + about reading them. + */ + + float peak; + DCPTime::Type peak_time; + if (fscanf (f, "%f%" SCNd64, &peak, &peak_time) == 2) { + _peak = peak; + _peak_time = DCPTime (peak_time); + } + fclose (f); } @@ -164,6 +176,10 @@ AudioAnalysis::write (boost::filesystem::path filename) } } + if (_peak) { + fprintf (f, "%f%" PRId64, _peak.get (), _peak_time.get().get ()); + } + fclose (f); boost::filesystem::rename (tmp, filename); } |
