X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Faudio_analysis.h;h=9387ec896b67b92f072a3d31b0509a4373dc03e3;hb=661de111c0dbc968ecb004eca5b26f8400b136f1;hp=ec6905105934cf5cc78b3a48d736a98806c51001;hpb=a84e33159d708362b10ff61af186a59cc9f5be6b;p=dcpomatic.git diff --git a/src/lib/audio_analysis.h b/src/lib/audio_analysis.h index ec6905105..9387ec896 100644 --- a/src/lib/audio_analysis.h +++ b/src/lib/audio_analysis.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2012 Carl Hetherington + Copyright (C) 2012-2015 Carl Hetherington This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,9 +20,12 @@ #ifndef DCPOMATIC_AUDIO_ANALYSIS_H #define DCPOMATIC_AUDIO_ANALYSIS_H -#include #include #include +#include +#include +#include +#include "types.h" class AudioPoint { @@ -34,9 +37,11 @@ public: }; AudioPoint (); - AudioPoint (std::istream &); + AudioPoint (cxml::ConstNodePtr node); + AudioPoint (AudioPoint const &); + AudioPoint& operator= (AudioPoint const &); - void write (std::ostream &) const; + void as_xml (xmlpp::Element *) const; float& operator[] (int t) { return _data[t]; @@ -46,22 +51,36 @@ private: float _data[COUNT]; }; -class AudioAnalysis +class AudioAnalysis : public boost::noncopyable { public: AudioAnalysis (int c); - AudioAnalysis (std::string); + AudioAnalysis (boost::filesystem::path); void add_point (int c, AudioPoint const & p); + void set_peak (float peak, DCPTime time) { + _peak = peak; + _peak_time = time; + } AudioPoint get_point (int c, int p) const; int points (int c) const; int channels () const; - void write (std::string); + boost::optional peak () const { + return _peak; + } + + boost::optional peak_time () const { + return _peak_time; + } + + void write (boost::filesystem::path); private: std::vector > _data; + boost::optional _peak; + boost::optional _peak_time; }; #endif