summaryrefslogtreecommitdiff
path: root/src/lib/audio_analysis.h
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-02-24 22:15:50 +0000
committerCarl Hetherington <cth@carlh.net>2013-02-24 22:15:50 +0000
commitcf1e212c30ec7419b96388e4f78b44cb55bf34c5 (patch)
treebef5e7ceb56f8df18af94bd5987b7119b4c40c53 /src/lib/audio_analysis.h
parentbbd352c3a0acf312e66b8be0d8bfb475275102d6 (diff)
Basic stuff to analyse audio (job).
Diffstat (limited to 'src/lib/audio_analysis.h')
-rw-r--r--src/lib/audio_analysis.h59
1 files changed, 59 insertions, 0 deletions
diff --git a/src/lib/audio_analysis.h b/src/lib/audio_analysis.h
new file mode 100644
index 000000000..1c668b9c2
--- /dev/null
+++ b/src/lib/audio_analysis.h
@@ -0,0 +1,59 @@
+/*
+ Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
+
+ 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
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef DVDOMATIC_AUDIO_ANALYSIS_H
+#define DVDOMATIC_AUDIO_ANALYSIS_H
+
+#include <iostream>
+#include <vector>
+
+class AudioPoint
+{
+public:
+ enum Type {
+ PEAK,
+ RMS,
+ COUNT
+ };
+
+ AudioPoint ();
+
+ void write (std::ostream &) const;
+
+ float& operator[] (Type t) {
+ return _data[t];
+ }
+
+private:
+ float _data[COUNT];
+};
+
+class AudioAnalysis
+{
+public:
+ AudioAnalysis (int c);
+
+ void add_point (int c, AudioPoint const & p);
+ void write (std::string);
+
+private:
+ std::vector<std::vector<AudioPoint> > _data;
+};
+
+#endif