X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Faudio_analysis.cc;h=bc59bcccaa56539a6f8a4a1728c2d9e50e9e1a50;hb=673b88a8041052754d2208142df94aa7c90fcc0c;hp=9d708bbfdd07f30e07327781cc328828a4ecce06;hpb=a6901cb85be6e7664375b68c8315c32d57de8107;p=dcpomatic.git diff --git a/src/lib/audio_analysis.cc b/src/lib/audio_analysis.cc index 9d708bbfd..bc59bccca 100644 --- a/src/lib/audio_analysis.cc +++ b/src/lib/audio_analysis.cc @@ -48,6 +48,27 @@ AudioPoint::AudioPoint (istream& s) } } +AudioPoint::AudioPoint (AudioPoint const & other) +{ + for (int i = 0; i < COUNT; ++i) { + _data[i] = other._data[i]; + } +} + +AudioPoint & +AudioPoint::operator= (AudioPoint const & other) +{ + if (this == &other) { + return *this; + } + + for (int i = 0; i < COUNT; ++i) { + _data[i] = other._data[i]; + } + + return *this; +} + void AudioPoint::write (ostream& s) const { @@ -62,9 +83,9 @@ AudioAnalysis::AudioAnalysis (int channels) _data.resize (channels); } -AudioAnalysis::AudioAnalysis (string filename) +AudioAnalysis::AudioAnalysis (boost::filesystem::path filename) { - ifstream f (filename.c_str ()); + ifstream f (filename.string().c_str ()); int channels; f >> channels; @@ -107,10 +128,10 @@ AudioAnalysis::points (int c) const } void -AudioAnalysis::write (string filename) +AudioAnalysis::write (boost::filesystem::path filename) { - string tmp = filename + ".tmp"; - + string tmp = filename.string() + ".tmp"; + ofstream f (tmp.c_str ()); f << _data.size() << "\n"; for (vector >::iterator i = _data.begin(); i != _data.end(); ++i) {