2 * Copyright (C) 2008-2009 Sampo Savolainen <v2@iki.fi>
3 * Copyright (C) 2009-2012 David Robillard <d@drobilla.net>
4 * Copyright (C) 2009-2017 Paul Davis <paul@linuxaudiosystems.com>
5 * Copyright (C) 2010 Carl Hetherington <carl@carlh.net>
6 * Copyright (C) 2018-2019 Robin Gareus <robin@gareus.org>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 #ifndef __ardour_plugin_eq_gui_h
24 #define __ardour_plugin_eq_gui_h
26 #include "pbd/signals.h"
28 #include "ardour/buffer_set.h"
30 #include <gtkmm/table.h>
31 #include <gtkmm/drawingarea.h>
32 #include <gtkmm/combobox.h>
33 #include <gtkmm/comboboxtext.h>
34 #include <gtkmm/liststore.h>
45 class PluginEqGui : public Gtk::Table
48 PluginEqGui (boost::shared_ptr<ARDOUR::PluginInsert>);
51 void start_listening ();
52 void stop_listening ();
56 void set_buffer_size (uint32_t, uint32_t);
57 void change_dB_scale ();
60 void run_impulse_analysis ();
61 void signal_collect_callback (ARDOUR::BufferSet *, ARDOUR::BufferSet *);
62 float _signal_analysis_running;
65 virtual void on_hide ();
66 virtual void on_show ();
68 void stop_updating ();
69 void start_updating ();
71 void resize_analysis_area (Gtk::Allocation&);
72 void redraw_analysis_area ();
74 void draw_analysis_scales (cairo_t *);
75 bool expose_analysis_area (GdkEventExpose *);
77 void draw_scales_power (Gtk::Widget *, cairo_t *);
78 void plot_impulse_amplitude (Gtk::Widget *,cairo_t *);
80 void draw_scales_phase (Gtk::Widget *,cairo_t *);
81 void plot_impulse_phase (Gtk::Widget *,cairo_t *);
83 void plot_signal_amplitude_difference (Gtk::Widget *,cairo_t *);
85 void update_pointer_info(float);
86 bool analysis_area_mouseover(GdkEventMotion *);
87 bool analysis_area_mouseexit(GdkEventCrossing *);
90 bool timeout_callback ();
91 void redraw_scales ();
95 // analysis parameters
105 ARDOUR::samplecnt_t _block_size;
106 ARDOUR::samplecnt_t _buffer_size;
107 ARDOUR::samplecnt_t _signal_buffer_size;
110 ARDOUR::BufferSet _bufferset;
111 ARDOUR::BufferSet _collect_bufferset;
114 float _analysis_width;
115 float _analysis_height;
118 GTKArdour::FFT *_impulse_fft;
119 GTKArdour::FFT *_signal_input_fft;
120 GTKArdour::FFT *_signal_output_fft;
121 boost::shared_ptr<ARDOUR::Plugin> _plugin;
122 boost::shared_ptr<ARDOUR::PluginInsert> _plugin_insert;
125 Gtk::DrawingArea *_analysis_area;
126 cairo_surface_t *_analysis_scale_surface;
127 Gtk::Label *_pointer_info;
128 int _pointer_in_area_xpos;
129 int _pointer_in_area_freq;
131 // dB scale selection:
132 class dBSelectionColumns : public Gtk::TreeModel::ColumnRecord
136 { add(dBMin); add(dBMax); add(dBStep); add(name); }
138 Gtk::TreeModelColumn<float> dBMin;
139 Gtk::TreeModelColumn<float> dBMax;
140 Gtk::TreeModelColumn<float> dBStep;
141 Gtk::TreeModelColumn<std::string> name;
144 dBSelectionColumns dBColumns;
146 Gtk::ComboBox *dBScaleCombo;
147 Glib::RefPtr<Gtk::ListStore> dBScaleModel;
149 Gtk::ComboBoxText* _live_signal_combo;
151 Gtk::CheckButton *_phase_button;
153 // signals and connections
154 sigc::connection _update_connection;
155 sigc::connection _window_unmap_connection;
156 sigc::connection _window_map_connection;
158 PBD::ScopedConnection analysis_connection;