X-Git-Url: https://main.carlh.net/gitweb/?p=dcpomatic.git;a=blobdiff_plain;f=src%2Flib%2Faudio_analysis.h;h=0d06e5973eca297bcf6d6e4f1240059ab2b68691;hp=9387ec896b67b92f072a3d31b0509a4373dc03e3;hb=aeb835a18c8df347e0ed68fb24631b320abeb611;hpb=1504f8460d6c438525489ee22eb9a4b437cb449e diff --git a/src/lib/audio_analysis.h b/src/lib/audio_analysis.h index 9387ec896..0d06e5973 100644 --- a/src/lib/audio_analysis.h +++ b/src/lib/audio_analysis.h @@ -20,36 +20,18 @@ #ifndef DCPOMATIC_AUDIO_ANALYSIS_H #define DCPOMATIC_AUDIO_ANALYSIS_H -#include -#include -#include -#include +#include "dcpomatic_time.h" +#include "audio_point.h" #include -#include "types.h" +#include +#include +#include -class AudioPoint -{ -public: - enum Type { - PEAK, - RMS, - COUNT - }; - - AudioPoint (); - AudioPoint (cxml::ConstNodePtr node); - AudioPoint (AudioPoint const &); - AudioPoint& operator= (AudioPoint const &); - - void as_xml (xmlpp::Element *) const; - - float& operator[] (int t) { - return _data[t]; - } +namespace xmlpp { + class Element; +} -private: - float _data[COUNT]; -}; +class Playlist; class AudioAnalysis : public boost::noncopyable { @@ -62,7 +44,7 @@ public: _peak = peak; _peak_time = time; } - + AudioPoint get_point (int c, int p) const; int points (int c) const; int channels () const; @@ -75,12 +57,27 @@ public: return _peak_time; } + boost::optional analysis_gain () const { + return _analysis_gain; + } + + void set_analysis_gain (double gain) { + _analysis_gain = gain; + } + void write (boost::filesystem::path); + float gain_correction (boost::shared_ptr playlist); + private: std::vector > _data; boost::optional _peak; boost::optional _peak_time; + /** If this analysis was run on a single piece of + * content we store its gain in dB when the analysis + * happened. + */ + boost::optional _analysis_gain; }; #endif