Ardour  9.0-pre0-582-g084a23a80d
audiographer/audiographer/general/analyser.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016 Robin Gareus <robin@gareus.org>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
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.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18 
19 #ifndef AUDIOGRAPHER_ANALYSER_H
20 #define AUDIOGRAPHER_ANALYSER_H
21 
22 #include <fftw3.h>
23 #include "loudness_reader.h"
24 #include "ardour/export_analysis.h"
25 
26 namespace AudioGrapher
27 {
28 
30 {
31  public:
32  Analyser (float sample_rate, unsigned int channels, samplecnt_t bufsize, samplecnt_t n_samples, size_t width = 800, size_t bins = 200);
34  void process (ProcessContext<float> const & c);
35  ARDOUR::ExportAnalysisPtr result (bool ptr = false);
36 
37  void set_duration (samplecnt_t n_samples);
38 
40  _result.normalized = true;
41  _result.norm_gain_factor = gain;
42  }
43 
44  static const float fft_range_db;
45 
47 
48  private:
49  float fft_power_at_bin (const uint32_t b, const float norm) const;
50 
53 
58 
59  float* _hann_window;
60  uint32_t _fft_data_size;
62  float* _fft_data_in;
63  float* _fft_data_out;
64  float* _fft_power;
65  fftwf_plan _fft_plan;
66 };
67 
68 } // namespace
69 
70 #endif
void process(ProcessContext< float > const &c)
ARDOUR::ExportAnalysisPtr result(bool ptr=false)
float fft_power_at_bin(const uint32_t b, const float norm) const
void set_duration(samplecnt_t n_samples)
Analyser(float sample_rate, unsigned int channels, samplecnt_t bufsize, samplecnt_t n_samples, size_t width=800, size_t bins=200)
PBD::PropertyDescriptor< gain_t > gain
std::shared_ptr< ExportAnalysis > ExportAnalysisPtr
gint width
Definition: xcursors.h:1