clean up & extend handling of various AU Component types & subtypes - makes AU NetSen...
[ardour2.git] / gtk2_ardour / fft_graph.h
blobbbf777474199fd92503a5b72aac54f1fca2da3f2
1 /*
2 Copyright (C) 2006 Paul Davis
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.
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.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #ifndef __ardour_fft_graph_h
21 #define __ardour_fft_graph_h
23 #include <ardour/types.h>
24 #include <fftw3.h>
26 #include <gtkmm/drawingarea.h>
27 #include <gtkmm/treemodel.h>
28 #include <gdkmm/color.h>
30 #include <glibmm/refptr.h>
32 #include <string>
34 #include "fft_result.h"
36 class AnalysisWindow;
38 class FFTGraph : public Gtk::DrawingArea
40 public:
42 FFTGraph(int windowSize);
43 ~FFTGraph();
45 void set_analysis_window(AnalysisWindow *a_window);
47 int windowSize() const { return _windowSize; }
48 void setWindowSize(int windowSize);
50 void redraw();
51 bool on_expose_event (GdkEventExpose* event);
53 void on_size_request(Gtk::Requisition* requisition);
54 void on_size_allocate(Gtk::Allocation & alloc);
55 FFTResult *prepareResult(Gdk::Color color, std::string trackname);
57 const void set_show_minmax (bool v) { _show_minmax = v; redraw(); };
58 const void set_show_normalized (bool v) { _show_normalized = v; redraw(); };
60 private:
62 void update_size();
64 void setWindowSize_internal(int windowSize);
66 void draw_scales(Glib::RefPtr<Gdk::Window> window);
68 static const int minScaleWidth = 512;
69 static const int minScaleHeight = 420;
71 int currentScaleWidth;
72 int currentScaleHeight;
74 static const int h_margin = 20;
75 static const int v_margin = 20;
76 Glib::RefPtr<Gdk::GC> graph_gc;
78 int width;
79 int height;
81 int _windowSize;
82 int _dataSize;
84 Glib::RefPtr<Pango::Layout> layout;
85 AnalysisWindow *_a_window;
87 fftwf_plan _plan;
89 float *_out;
90 float *_in;
91 float *_hanning;
92 int *_logScale;
94 bool _show_minmax;
95 bool _show_normalized;
97 friend class FFTResult;
100 #endif /* __ardour_fft_graph_h */