LMMS
Loading...
Searching...
No Matches
analyzer.h
Go to the documentation of this file.
1/* Calf Analyzer FFT Library
2 * Copyright (C) 2007-2013 Krzysztof Foltman, Markus Schmidt,
3 * Christian Holschuh and others
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General
16 * Public License along with this program; if not, write to the
17 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301 USA
19 */
20
21#ifndef CALF_ANALYZER_H
22#define CALF_ANALYZER_H
23
24#include <assert.h>
25#include <limits.h>
26#include "biquad.h"
27#include "inertia.h"
28#include "audio_fx.h"
29#include "giface.h"
30#include "metadata.h"
31#include "loudness.h"
32#include <math.h>
33#include "plugin_tools.h"
34#include "fft.h"
35
36#define MATH_E 2.718281828
37
38namespace calf_plugins {
39
41{
42private:
43 mutable int _accuracy;
44 mutable int _acc;
45 mutable int _scale;
46 mutable int _post;
47 mutable int _hold;
48 mutable int _smooth;
49 mutable int _speed;
50 mutable int _windowing;
51 mutable int _view;
52 mutable int _freeze;
53 mutable int _mode;
54 mutable float _resolution;
55 mutable float _offset;
56 mutable bool _falling;
57 mutable int _draw_upper;
58
59
60public:
65
67 analyzer();
68 void process(float L, float R);
70 bool set_mode(int mode);
71 void invalidate();
72 void set_params(float resolution, float offset, int accuracy, int hold, int smoothing, int mode, int scale, int post, int speed, int windowing, int view, int freeze);
73 ~analyzer();
74 bool do_fft(int subindex, int points) const;
75 void draw(int subindex, float *data, int points, bool fftdone) const;
76 bool get_graph(int subindex, int phase, float *data, int points, cairo_iface *context, int *mode) const;
77 bool get_moving(int subindex, int &direction, float *data, int x, int y, int &offset, uint32_t &color) const;
78 bool get_gridline(int subindex, int phase, float &pos, bool &vertical, std::string &legend, cairo_iface *context) const;
79 bool get_layers(int generation, unsigned int &layers) const;
80protected:
82 float *fft_buffer;
84 int fpos;
85 mutable bool sanitize, recreate_plan;
86 static const int MAX_FFT_ORDER = 15;
89 static const int max_fft_cache_size = 32768;
91 float *fft_inL, *fft_outL;
92 float *fft_inR, *fft_outR;
97 mutable int lintrans;
99};
100
101};
102#endif
int _smooth
Definition analyzer.h:48
float _offset
Definition analyzer.h:55
static const int max_fft_cache_size
Definition analyzer.h:89
int _acc
Definition analyzer.h:44
bool sanitize
Definition analyzer.h:85
bool set_mode(int mode)
float _resolution
Definition analyzer.h:54
int _post
Definition analyzer.h:46
float * fft_buffer
Definition analyzer.h:82
bool get_graph(int subindex, int phase, float *data, int points, cairo_iface *context, int *mode) const
Definition analyzer.cpp:787
int fft_buffer_size
Definition analyzer.h:81
int _mode
Definition analyzer.h:53
int * spline_buffer
Definition analyzer.h:83
dsp::fft< float, MAX_FFT_ORDER > fft
Definition analyzer.h:87
int _windowing
Definition analyzer.h:50
float * fft_smoothL
Definition analyzer.h:93
float * fft_freezeR
Definition analyzer.h:96
bool do_fft(int subindex, int points) const
Definition analyzer.cpp:152
void set_sample_rate(uint32_t sr)
Definition analyzer.cpp:102
bool get_layers(int generation, unsigned int &layers) const
Definition analyzer.cpp:1052
void process(float L, float R)
Definition analyzer.cpp:145
float * fft_outL
Definition analyzer.h:91
uint32_t srate
Definition analyzer.h:66
analyzer()
Definition analyzer.cpp:43
float * fft_holdL
Definition analyzer.h:95
float * fft_freezeL
Definition analyzer.h:96
int _scale
Definition analyzer.h:45
float * fft_smoothR
Definition analyzer.h:93
float * fft_deltaR
Definition analyzer.h:94
int _view
Definition analyzer.h:51
void set_params(float resolution, float offset, int accuracy, int hold, int smoothing, int mode, int scale, int post, int speed, int windowing, int view, int freeze)
Definition analyzer.cpp:106
float * fft_inR
Definition analyzer.h:92
bool get_moving(int subindex, int &direction, float *data, int x, int y, int &offset, uint32_t &color) const
Definition analyzer.cpp:892
int lintrans
Definition analyzer.h:97
int analyzer_phase_drawn
Definition analyzer.h:98
bool recreate_plan
Definition analyzer.h:85
~analyzer()
Definition analyzer.cpp:85
int _speed
Definition analyzer.h:49
void draw(int subindex, float *data, int points, bool fftdone) const
Definition analyzer.cpp:368
bool _falling
Definition analyzer.h:56
dsp::fft< float, MAX_FFT_ORDER >::complex fft_temp[1<< MAX_FFT_ORDER]
Definition analyzer.h:88
int fpos
Definition analyzer.h:84
static const int max_fft_buffer_size
Definition analyzer.h:90
float * fft_deltaL
Definition analyzer.h:94
float * fft_inL
Definition analyzer.h:91
int _accuracy
Definition analyzer.h:43
bool get_gridline(int subindex, int phase, float &pos, bool &vertical, std::string &legend, cairo_iface *context) const
Definition analyzer.cpp:910
float * fft_holdR
Definition analyzer.h:95
int _hold
Definition analyzer.h:47
int _freeze
Definition analyzer.h:52
int _draw_upper
Definition analyzer.h:57
static const int MAX_FFT_ORDER
Definition analyzer.h:86
float * fft_outR
Definition analyzer.h:92
Line graph interface implementation for frequency response graphs.
Definition giface.h:777
virtual bool get_graph(int index, int subindex, int phase, float *data, int points, cairo_iface *context, int *mode) const
Definition giface.cpp:434
virtual bool get_gridline(int index, int subindex, int phase, float &pos, bool &vertical, std::string &legend, cairo_iface *context) const
Definition giface.cpp:440
virtual bool get_layers(int index, int generation, unsigned int &layers) const
Definition giface.cpp:446
Definition fft.h:34
std::complex< T > complex
Definition fft.h:36
int y
Definition inflate.c:1588
unsigned x[BMAX+1]
Definition inflate.c:1586
JSAMPIMAGE data
Definition jpeglib.h:945
unsigned int uint32_t
Definition mid.cpp:100
Definition benchmark.cpp:53
png_structrp int mode
Definition png.h:1139
Definition giface.h:160
virtual bool get_moving(int index, int subindex, int &direction, float *data, int x, int y, int &offset, uint32_t &color) const
Definition giface.h:217
ZCONST char * post
Definition fileio.c:2493