po name changes, again?
[ardour2.git] / gtk2_ardour / plugin_eq_gui.h
blob5fc0af0fc0d3713ef9d6b9eb2bd696ae8783f580
1 /*
2 Copyright (C) 2008 Paul Davis
3 Author: Sampo Savolainen
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_plugin_eq_gui_h
22 #define __ardour_plugin_eq_gui_h
24 #include "ardour/buffer_set.h"
25 #include "ardour/plugin_insert.h"
26 #include "ardour/plugin.h"
28 #include <gtkmm/table.h>
29 #include <gtkmm/drawingarea.h>
30 #include <gtkmm/combobox.h>
31 #include <gtkmm/liststore.h>
33 class FFT;
35 class PluginEqGui : public Gtk::Table
37 public:
38 PluginEqGui (boost::shared_ptr<ARDOUR::PluginInsert>);
39 ~PluginEqGui ();
41 private:
42 // Setup
43 void set_buffer_size (uint32_t, uint32_t);
44 void change_dB_scale ();
46 // Analysis
47 void run_impulse_analysis ();
48 void signal_collect_callback (ARDOUR::BufferSet *, ARDOUR::BufferSet *);
49 float _signal_analysis_running;
51 // Drawing
52 virtual void on_hide ();
53 virtual void on_show ();
55 void stop_updating ();
56 void start_updating ();
58 void resize_analysis_area (Gtk::Allocation&);
59 void redraw_analysis_area ();
61 void draw_analysis_scales (cairo_t *);
62 bool expose_analysis_area (GdkEventExpose *);
64 void draw_scales_power (Gtk::Widget *, cairo_t *);
65 void plot_impulse_amplitude (Gtk::Widget *,cairo_t *);
67 void draw_scales_phase (Gtk::Widget *,cairo_t *);
68 void plot_impulse_phase (Gtk::Widget *,cairo_t *);
70 void plot_signal_amplitude_difference (Gtk::Widget *,cairo_t *);
72 // Helpers
73 bool timeout_callback ();
74 void redraw_scales ();
76 // Fields:
78 // analysis parameters
79 float _samplerate;
81 float _min_dB;
82 float _max_dB;
83 float _step_dB;
85 float _log_coeff;
86 float _log_max;
88 ARDOUR::framecnt_t _buffer_size;
89 ARDOUR::framecnt_t _signal_buffer_size;
91 // buffers
92 ARDOUR::BufferSet _bufferset;
93 ARDOUR::BufferSet _collect_bufferset;
96 // dimensions
97 float _analysis_width;
98 float _analysis_height;
100 // My objects
101 FFT *_impulse_fft;
102 FFT *_signal_input_fft;
103 FFT *_signal_output_fft;
104 boost::shared_ptr<ARDOUR::Plugin> _plugin;
105 boost::shared_ptr<ARDOUR::PluginInsert> _plugin_insert;
107 // gui objects
108 Gtk::DrawingArea *_analysis_area;
109 cairo_surface_t *_analysis_scale_surface;
111 // dB scale selection:
112 class dBSelectionColumns : public Gtk::TreeModel::ColumnRecord
114 public:
115 dBSelectionColumns()
116 { add(dBMin); add(dBMax); add(dBStep); add(name); }
118 Gtk::TreeModelColumn<float> dBMin;
119 Gtk::TreeModelColumn<float> dBMax;
120 Gtk::TreeModelColumn<float> dBStep;
121 Gtk::TreeModelColumn<std::string> name;
124 dBSelectionColumns dBColumns;
126 Gtk::ComboBox *dBScaleCombo;
127 Glib::RefPtr<Gtk::ListStore> dBScaleModel;
129 Gtk::CheckButton *_phase_button;
131 // signals and connections
132 sigc::connection _update_connection;
133 sigc::connection _window_unmap_connection;
134 sigc::connection _window_map_connection;
136 PBD::ScopedConnection analysis_connection;
139 #endif