ardour
fft_graph.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2006 Paul Davis
3  Author: Sampo Savoleinen
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (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
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program; if not, write to the Free Software
17  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 
19 */
20 
21 #ifndef __ardour_fft_graph_h
22 #define __ardour_fft_graph_h
23 
24 #include "ardour/types.h"
25 #include <fftw3.h>
26 
27 #include <gtkmm/drawingarea.h>
28 #include <gtkmm/treemodel.h>
29 #include <gdkmm/color.h>
30 
31 #include <glibmm/refptr.h>
32 
33 #include <string>
34 
35 #include "fft_result.h"
36 
37 class AnalysisWindow;
38 
39 class FFTGraph : public Gtk::DrawingArea
40 {
41  public:
42 
43  FFTGraph(int windowSize);
44  ~FFTGraph();
45 
46  void set_analysis_window(AnalysisWindow *a_window);
47 
48  int windowSize() const { return _windowSize; }
49  void setWindowSize(int windowSize);
50 
51  void redraw();
52  bool on_expose_event (GdkEventExpose* event);
53 
54  void on_size_request(Gtk::Requisition* requisition);
55  void on_size_allocate(Gtk::Allocation & alloc);
56  FFTResult *prepareResult(Gdk::Color color, std::string trackname);
57 
58  void set_show_minmax (bool v) { _show_minmax = v; redraw(); }
59  void set_show_normalized (bool v) { _show_normalized = v; redraw(); }
60 
61  private:
62 
63  void update_size();
64 
65  void setWindowSize_internal(int windowSize);
66 
67  void draw_scales(Glib::RefPtr<Gdk::Window> window);
68 
69  static const int minScaleWidth = 512;
70  static const int minScaleHeight = 420;
71 
74 
75  static const int h_margin = 20;
76  static const int v_margin = 20;
77  Glib::RefPtr<Gdk::GC> graph_gc;
78 
79  int width;
80  int height;
81 
83  int _dataSize;
84 
85  Glib::RefPtr<Pango::Layout> layout;
87 
88  fftwf_plan _plan;
89 
90  float *_out;
91  float *_in;
92  float *_hanning;
93  int *_logScale;
94 
97 
98  friend class FFTResult;
99 };
100 
101 #endif /* __ardour_fft_graph_h */
static const int minScaleHeight
Definition: fft_graph.h:70
bool _show_minmax
Definition: fft_graph.h:95
int * _logScale
Definition: fft_graph.h:93
int currentScaleHeight
Definition: fft_graph.h:73
void draw_scales(Glib::RefPtr< Gdk::Window > window)
Definition: fft_graph.cc:170
int _dataSize
Definition: fft_graph.h:83
float * _in
Definition: fft_graph.h:91
int width
Definition: fft_graph.h:79
Glib::RefPtr< Pango::Layout > layout
Definition: fft_graph.h:85
FFTGraph(int windowSize)
Definition: fft_graph.cc:48
void set_show_normalized(bool v)
Definition: fft_graph.h:59
float * _out
Definition: fft_graph.h:90
AnalysisWindow * _a_window
Definition: fft_graph.h:86
void on_size_request(Gtk::Requisition *requisition)
Definition: fft_graph.cc:443
fftwf_plan _plan
Definition: fft_graph.h:88
void set_analysis_window(AnalysisWindow *a_window)
Definition: fft_graph.cc:164
static const int h_margin
Definition: fft_graph.h:75
void setWindowSize_internal(int windowSize)
Definition: fft_graph.cc:77
void update_size()
Definition: fft_graph.cc:466
float * _hanning
Definition: fft_graph.h:92
FFTResult * prepareResult(Gdk::Color color, std::string trackname)
Definition: fft_graph.cc:155
void redraw()
Definition: fft_graph.cc:274
int height
Definition: fft_graph.h:80
int windowSize() const
Definition: fft_graph.h:48
int currentScaleWidth
Definition: fft_graph.h:72
bool on_expose_event(GdkEventExpose *event)
Definition: fft_graph.cc:148
void on_size_allocate(Gtk::Allocation &alloc)
Definition: fft_graph.cc:455
static const int v_margin
Definition: fft_graph.h:76
static const int minScaleWidth
Definition: fft_graph.h:69
void setWindowSize(int windowSize)
Definition: fft_graph.cc:66
Glib::RefPtr< Gdk::GC > graph_gc
Definition: fft_graph.h:77
void set_show_minmax(bool v)
Definition: fft_graph.h:58
bool _show_normalized
Definition: fft_graph.h:96
int _windowSize
Definition: fft_graph.h:82
LIBARDOUR_API PBD::PropertyDescriptor< bool > color
Definition: route_group.cc:50