Ardour
9.0-pre0-582-g084a23a80d
fft.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2008 Sampo Savolainen <v2@iki.fi>
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
#pragma once
20
21
22
#include <iostream>
23
24
#include <stdio.h>
25
#include <sys/types.h>
26
#include <complex>
// this needs to be included before fftw3.h
27
#include <fftw3.h>
28
29
30
#include "
ardour/types.h
"
31
32
namespace
GTKArdour
{
33
34
class
FFT
35
{
36
public
:
37
FFT
(uint32_t);
38
~FFT
();
39
40
enum
WindowingType
{
41
NONE
,
42
HANN
43
};
44
45
void
reset
();
46
void
analyze
(
ARDOUR::Sample
*,
WindowingType
w =
NONE
);
47
void
calculate
();
48
49
uint32_t
bins
()
const
{
return
_data_size
; }
50
51
float
power_at_bin
(uint32_t i)
const
{
return
_power_at_bin
[i]; }
52
float
phase_at_bin
(uint32_t i)
const
{
return
_phase_at_bin
[i]; }
53
54
private
:
55
float
*
get_hann_window
();
56
57
uint32_t
const
_window_size
;
58
uint32_t
const
_data_size
;
59
uint32_t
_iterations
;
60
61
float
*
_hann_window
;
62
63
float
*
_fftInput
;
64
float
*
_fftOutput
;
65
66
float
*
_power_at_bin
;
67
float
*
_phase_at_bin
;
68
69
fftwf_plan
_plan
;
70
};
71
72
}
73
types.h
GTKArdour::FFT
Definition:
fft.h:35
GTKArdour::FFT::power_at_bin
float power_at_bin(uint32_t i) const
Definition:
fft.h:51
GTKArdour::FFT::calculate
void calculate()
GTKArdour::FFT::reset
void reset()
GTKArdour::FFT::phase_at_bin
float phase_at_bin(uint32_t i) const
Definition:
fft.h:52
GTKArdour::FFT::_power_at_bin
float * _power_at_bin
Definition:
fft.h:66
GTKArdour::FFT::_phase_at_bin
float * _phase_at_bin
Definition:
fft.h:67
GTKArdour::FFT::_plan
fftwf_plan _plan
Definition:
fft.h:69
GTKArdour::FFT::FFT
FFT(uint32_t)
GTKArdour::FFT::bins
uint32_t bins() const
Definition:
fft.h:49
GTKArdour::FFT::analyze
void analyze(ARDOUR::Sample *, WindowingType w=NONE)
GTKArdour::FFT::_hann_window
float * _hann_window
Definition:
fft.h:61
GTKArdour::FFT::WindowingType
WindowingType
Definition:
fft.h:40
GTKArdour::FFT::HANN
@ HANN
Definition:
fft.h:42
GTKArdour::FFT::NONE
@ NONE
Definition:
fft.h:41
GTKArdour::FFT::_window_size
uint32_t const _window_size
Definition:
fft.h:57
GTKArdour::FFT::_fftInput
float * _fftInput
Definition:
fft.h:63
GTKArdour::FFT::_iterations
uint32_t _iterations
Definition:
fft.h:59
GTKArdour::FFT::_fftOutput
float * _fftOutput
Definition:
fft.h:64
GTKArdour::FFT::~FFT
~FFT()
GTKArdour::FFT::get_hann_window
float * get_hann_window()
GTKArdour::FFT::_data_size
uint32_t const _data_size
Definition:
fft.h:58
ARDOUR::Sample
float Sample
Definition:
ardour/ardour/types.h:80
GTKArdour
Definition:
fft.h:32
gtk2_ardour
fft.h
Generated on Wed Dec 25 2024 05:44:15 for Ardour by
1.9.1