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
29
class
LIBAUDIOGRAPHER_API
Analyser
:
public
LoudnessReader
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);
33
~Analyser
();
34
void
process
(
ProcessContext<float>
const
& c);
35
ARDOUR::ExportAnalysisPtr
result
(
bool
ptr =
false
);
36
37
void
set_duration
(
samplecnt_t
n_samples);
38
39
void
set_normalization_gain
(
float
gain
) {
40
_result.normalized =
true
;
41
_result.norm_gain_factor =
gain
;
42
}
43
44
static
const
float
fft_range_db
;
45
46
using
Sink<float>::process
;
47
48
private
:
49
float
fft_power_at_bin
(
const
uint32_t b,
const
float
norm)
const
;
50
51
ARDOUR::ExportAnalysisPtr
_rp
;
52
ARDOUR::ExportAnalysis
&
_result
;
53
54
samplecnt_t
_n_samples
;
55
samplecnt_t
_pos
;
56
samplecnt_t
_spp
;
57
samplecnt_t
_fpp
;
58
59
float
*
_hann_window
;
60
uint32_t
_fft_data_size
;
61
double
_fft_freq_per_bin
;
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
LIBAUDIOGRAPHER_API
#define LIBAUDIOGRAPHER_API
Definition:
audiographer/audiographer/visibility.h:38
AudioGrapher::Analyser
Definition:
audiographer/audiographer/general/analyser.h:30
AudioGrapher::Analyser::_rp
ARDOUR::ExportAnalysisPtr _rp
Definition:
audiographer/audiographer/general/analyser.h:51
AudioGrapher::Analyser::process
void process(ProcessContext< float > const &c)
AudioGrapher::Analyser::result
ARDOUR::ExportAnalysisPtr result(bool ptr=false)
AudioGrapher::Analyser::_fft_freq_per_bin
double _fft_freq_per_bin
Definition:
audiographer/audiographer/general/analyser.h:61
AudioGrapher::Analyser::_result
ARDOUR::ExportAnalysis & _result
Definition:
audiographer/audiographer/general/analyser.h:52
AudioGrapher::Analyser::_fft_power
float * _fft_power
Definition:
audiographer/audiographer/general/analyser.h:64
AudioGrapher::Analyser::~Analyser
~Analyser()
AudioGrapher::Analyser::fft_range_db
static const float fft_range_db
Definition:
audiographer/audiographer/general/analyser.h:44
AudioGrapher::Analyser::_spp
samplecnt_t _spp
Definition:
audiographer/audiographer/general/analyser.h:56
AudioGrapher::Analyser::_fpp
samplecnt_t _fpp
Definition:
audiographer/audiographer/general/analyser.h:57
AudioGrapher::Analyser::fft_power_at_bin
float fft_power_at_bin(const uint32_t b, const float norm) const
AudioGrapher::Analyser::set_duration
void set_duration(samplecnt_t n_samples)
AudioGrapher::Analyser::_hann_window
float * _hann_window
Definition:
audiographer/audiographer/general/analyser.h:59
AudioGrapher::Analyser::set_normalization_gain
void set_normalization_gain(float gain)
Definition:
audiographer/audiographer/general/analyser.h:39
AudioGrapher::Analyser::_fft_plan
fftwf_plan _fft_plan
Definition:
audiographer/audiographer/general/analyser.h:65
AudioGrapher::Analyser::Analyser
Analyser(float sample_rate, unsigned int channels, samplecnt_t bufsize, samplecnt_t n_samples, size_t width=800, size_t bins=200)
AudioGrapher::Analyser::_fft_data_in
float * _fft_data_in
Definition:
audiographer/audiographer/general/analyser.h:62
AudioGrapher::Analyser::_pos
samplecnt_t _pos
Definition:
audiographer/audiographer/general/analyser.h:55
AudioGrapher::Analyser::_fft_data_size
uint32_t _fft_data_size
Definition:
audiographer/audiographer/general/analyser.h:60
AudioGrapher::Analyser::_fft_data_out
float * _fft_data_out
Definition:
audiographer/audiographer/general/analyser.h:63
AudioGrapher::Analyser::_n_samples
samplecnt_t _n_samples
Definition:
audiographer/audiographer/general/analyser.h:54
AudioGrapher::LoudnessReader
Definition:
loudness_reader.h:35
AudioGrapher::ProcessContext
Definition:
process_context.h:25
AudioGrapher::Sink
Definition:
sink.h:17
export_analysis.h
loudness_reader.h
ARDOUR::Properties::gain
PBD::PropertyDescriptor< gain_t > gain
ARDOUR::ExportAnalysisPtr
std::shared_ptr< ExportAnalysis > ExportAnalysisPtr
Definition:
export_analysis.h:149
AudioGrapher
Definition:
analysis_graph.h:33
AudioGrapher::samplecnt_t
int64_t samplecnt_t
Definition:
audiographer/audiographer/types.h:11
ARDOUR::ExportAnalysis
Definition:
export_analysis.h:32
width
gint width
Definition:
xcursors.h:1
libs
audiographer
audiographer
general
analyser.h
Generated on Thu Dec 26 2024 05:38:47 for Ardour by
1.9.1