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 "pbd/signals.h"
26 #include "ardour/buffer_set.h"
28 #include <gtkmm/table.h>
29 #include <gtkmm/drawingarea.h>
30 #include <gtkmm/combobox.h>
31 #include <gtkmm/liststore.h>
42 class PluginEqGui : public Gtk::Table
45 PluginEqGui (boost::shared_ptr<ARDOUR::PluginInsert>);
48 void start_listening ();
49 void stop_listening ();
53 void set_buffer_size (uint32_t, uint32_t);
54 void change_dB_scale ();
57 void run_impulse_analysis ();
58 void signal_collect_callback (ARDOUR::BufferSet *, ARDOUR::BufferSet *);
59 float _signal_analysis_running;
62 virtual void on_hide ();
63 virtual void on_show ();
65 void stop_updating ();
66 void start_updating ();
68 void resize_analysis_area (Gtk::Allocation&);
69 void redraw_analysis_area ();
71 void draw_analysis_scales (cairo_t *);
72 bool expose_analysis_area (GdkEventExpose *);
74 void draw_scales_power (Gtk::Widget *, cairo_t *);
75 void plot_impulse_amplitude (Gtk::Widget *,cairo_t *);
77 void draw_scales_phase (Gtk::Widget *,cairo_t *);
78 void plot_impulse_phase (Gtk::Widget *,cairo_t *);
80 void plot_signal_amplitude_difference (Gtk::Widget *,cairo_t *);
82 void update_pointer_info(float);
83 bool analysis_area_mouseover(GdkEventMotion *);
84 bool analysis_area_mouseexit(GdkEventCrossing *);
87 bool timeout_callback ();
88 void redraw_scales ();
92 // analysis parameters
102 ARDOUR::samplecnt_t _buffer_size;
103 ARDOUR::samplecnt_t _signal_buffer_size;
106 ARDOUR::BufferSet _bufferset;
107 ARDOUR::BufferSet _collect_bufferset;
111 float _analysis_width;
112 float _analysis_height;
115 GTKArdour::FFT *_impulse_fft;
116 GTKArdour::FFT *_signal_input_fft;
117 GTKArdour::FFT *_signal_output_fft;
118 boost::shared_ptr<ARDOUR::Plugin> _plugin;
119 boost::shared_ptr<ARDOUR::PluginInsert> _plugin_insert;
122 Gtk::DrawingArea *_analysis_area;
123 cairo_surface_t *_analysis_scale_surface;
124 Gtk::Label *_pointer_info;
125 int _pointer_in_area_xpos;
126 int _pointer_in_area_freq;
128 // dB scale selection:
129 class dBSelectionColumns : public Gtk::TreeModel::ColumnRecord
133 { add(dBMin); add(dBMax); add(dBStep); add(name); }
135 Gtk::TreeModelColumn<float> dBMin;
136 Gtk::TreeModelColumn<float> dBMax;
137 Gtk::TreeModelColumn<float> dBStep;
138 Gtk::TreeModelColumn<std::string> name;
141 dBSelectionColumns dBColumns;
143 Gtk::ComboBox *dBScaleCombo;
144 Glib::RefPtr<Gtk::ListStore> dBScaleModel;
146 Gtk::CheckButton *_signal_button;
147 Gtk::CheckButton *_phase_button;
149 // signals and connections
150 sigc::connection _update_connection;
151 sigc::connection _window_unmap_connection;
152 sigc::connection _window_map_connection;
154 PBD::ScopedConnection analysis_connection;