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
24 #include <vamp-hostsdk/PluginLoader.h>
25 #include <vamp-sdk/Plugin.h>
27 #include "audiographer/visibility.h"
28 #include "audiographer/sink.h"
29 #include "audiographer/utils/listed_source.h"
31 #include "ardour/export_analysis.h"
33 namespace AudioGrapher
36 class LIBAUDIOGRAPHER_API Analyser : public ListedSource<float>, public Sink<float>
39 Analyser (float sample_rate, unsigned int channels, framecnt_t bufsize, framecnt_t n_samples);
41 void process (ProcessContext<float> const & c);
42 ARDOUR::ExportAnalysisPtr result ();
44 using Sink<float>::process;
47 float fft_power_at_bin (const uint32_t b, const float norm) const;
49 ARDOUR::ExportAnalysis _result;
50 Vamp::Plugin* _ebur128_plugin;
51 Vamp::Plugin** _dbtp_plugin;
54 unsigned int _channels;
56 framecnt_t _n_samples;
64 uint32_t _fft_data_size;
65 double _fft_freq_per_bin;