Fix a couple of minor typos.
[ardour2.git] / gtk2_ardour / fft_graph.h
blobab05da348b4e6fef6e219c3b34b0898891fe64a7
1 /*
2 Copyright (C) 2006 Paul Davis
3 Author: Sampo Savoleinen
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.
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.
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.
21 #ifndef __ardour_fft_graph_h
22 #define __ardour_fft_graph_h
24 #include "ardour/types.h"
25 #include <fftw3.h>
27 #include <gtkmm/drawingarea.h>
28 #include <gtkmm/treemodel.h>
29 #include <gdkmm/color.h>
31 #include <glibmm/refptr.h>
33 #include <string>
35 #include "fft_result.h"
37 class AnalysisWindow;
39 class FFTGraph : public Gtk::DrawingArea
41 public:
43 FFTGraph(int windowSize);
44 ~FFTGraph();
46 void set_analysis_window(AnalysisWindow *a_window);
48 int windowSize() const { return _windowSize; }
49 void setWindowSize(int windowSize);
51 void redraw();
52 bool on_expose_event (GdkEventExpose* event);
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);
58 void set_show_minmax (bool v) { _show_minmax = v; redraw(); }
59 void set_show_normalized (bool v) { _show_normalized = v; redraw(); }
61 private:
63 void update_size();
65 void setWindowSize_internal(int windowSize);
67 void draw_scales(Glib::RefPtr<Gdk::Window> window);
69 static const int minScaleWidth = 512;
70 static const int minScaleHeight = 420;
72 int currentScaleWidth;
73 int currentScaleHeight;
75 static const int h_margin = 20;
76 static const int v_margin = 20;
77 Glib::RefPtr<Gdk::GC> graph_gc;
79 int width;
80 int height;
82 int _windowSize;
83 int _dataSize;
85 Glib::RefPtr<Pango::Layout> layout;
86 AnalysisWindow *_a_window;
88 fftwf_plan _plan;
90 float *_out;
91 float *_in;
92 float *_hanning;
93 int *_logScale;
95 bool _show_minmax;
96 bool _show_normalized;
98 friend class FFTResult;
101 #endif /* __ardour_fft_graph_h */