2 * Copyright (C) 2016 Robin Gareus <robin@gareus.org>
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 #ifndef AUDIOGRAPHER_ANALYSER_H
20 #define AUDIOGRAPHER_ANALYSER_H
23 #include "loudness_reader.h"
24 #include "ardour/export_analysis.h"
26 namespace AudioGrapher
29 class LIBAUDIOGRAPHER_API Analyser : public LoudnessReader
32 Analyser (float sample_rate, unsigned int channels, framecnt_t bufsize, framecnt_t n_samples);
34 void process (ProcessContext<float> const & c);
35 ARDOUR::ExportAnalysisPtr result ();
37 void set_normalization_gain (float gain) {
38 _result.normalized = true;
39 _result.norm_gain_factor = gain;
42 static const float fft_range_db;
44 using Sink<float>::process;
47 float fft_power_at_bin (const uint32_t b, const float norm) const;
49 ARDOUR::ExportAnalysis _result;
51 framecnt_t _n_samples;
57 uint32_t _fft_data_size;
58 double _fft_freq_per_bin;