2008-10-13 15:45:20 -04:00
|
|
|
/*
|
|
|
|
Copyright (C) 2008 Paul Davis
|
|
|
|
Author: Sampo Savolainen
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2008-10-15 15:21:26 -04:00
|
|
|
#ifndef __ardour_plugin_eq_gui_h
|
|
|
|
#define __ardour_plugin_eq_gui_h
|
2008-10-13 15:45:20 -04:00
|
|
|
|
2009-02-25 13:26:51 -05:00
|
|
|
#include "ardour/buffer_set.h"
|
|
|
|
#include "ardour/plugin_insert.h"
|
|
|
|
#include "ardour/plugin.h"
|
2008-10-13 15:45:20 -04:00
|
|
|
|
|
|
|
#include <gtkmm/table.h>
|
|
|
|
#include <gtkmm/drawingarea.h>
|
|
|
|
#include <gtkmm/combobox.h>
|
|
|
|
#include <gtkmm/liststore.h>
|
|
|
|
|
|
|
|
class FFT;
|
|
|
|
|
|
|
|
class PluginEqGui : public Gtk::Table
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
PluginEqGui(boost::shared_ptr<ARDOUR::PluginInsert>);
|
|
|
|
~PluginEqGui();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
// Setup
|
2008-10-20 14:57:34 -04:00
|
|
|
void set_buffer_size(uint32_t, uint32_t);
|
2008-10-15 15:21:26 -04:00
|
|
|
void change_dB_scale();
|
2008-10-13 15:45:20 -04:00
|
|
|
|
|
|
|
// Analysis
|
2008-10-20 14:57:34 -04:00
|
|
|
void run_impulse_analysis();
|
|
|
|
void signal_collect_callback(ARDOUR::BufferSet *, ARDOUR::BufferSet *);
|
|
|
|
float _signal_analysis_running;
|
2008-10-13 15:45:20 -04:00
|
|
|
|
|
|
|
// Drawing
|
|
|
|
virtual void on_hide();
|
|
|
|
virtual void on_show();
|
|
|
|
|
2008-10-15 15:21:26 -04:00
|
|
|
void stop_updating();
|
|
|
|
void start_updating();
|
2008-10-13 15:45:20 -04:00
|
|
|
|
2008-10-15 15:21:26 -04:00
|
|
|
void resize_analysis_area(Gtk::Allocation&);
|
|
|
|
void redraw_analysis_area();
|
2008-10-13 15:45:20 -04:00
|
|
|
|
2008-10-15 15:21:26 -04:00
|
|
|
void draw_analysis_scales(cairo_t *);
|
|
|
|
bool expose_analysis_area(GdkEventExpose *);
|
2008-10-13 15:45:20 -04:00
|
|
|
|
2008-10-15 15:21:26 -04:00
|
|
|
void draw_scales_power(Gtk::Widget *, cairo_t *);
|
2008-10-20 14:57:34 -04:00
|
|
|
void plot_impulse_amplitude(Gtk::Widget *,cairo_t *);
|
2008-10-15 15:21:26 -04:00
|
|
|
|
|
|
|
void draw_scales_phase(Gtk::Widget *,cairo_t *);
|
2008-10-20 14:57:34 -04:00
|
|
|
void plot_impulse_phase(Gtk::Widget *,cairo_t *);
|
|
|
|
|
|
|
|
void plot_signal_amplitude_difference(Gtk::Widget *,cairo_t *);
|
2008-10-13 15:45:20 -04:00
|
|
|
|
|
|
|
// Helpers
|
2008-10-15 15:21:26 -04:00
|
|
|
bool timeout_callback();
|
|
|
|
void redraw_scales();
|
2008-10-13 15:45:20 -04:00
|
|
|
|
|
|
|
|
|
|
|
// Fields:
|
|
|
|
|
|
|
|
// analysis parameters
|
|
|
|
float _samplerate;
|
|
|
|
|
2008-10-15 15:21:26 -04:00
|
|
|
float _min_dB;
|
|
|
|
float _max_dB;
|
|
|
|
float _step_dB;
|
2008-10-13 15:45:20 -04:00
|
|
|
|
|
|
|
|
2008-10-15 15:21:26 -04:00
|
|
|
float _log_coeff;
|
|
|
|
float _log_max;
|
2008-10-13 15:45:20 -04:00
|
|
|
|
2008-10-15 15:21:26 -04:00
|
|
|
nframes_t _buffer_size;
|
2008-10-20 14:57:34 -04:00
|
|
|
nframes_t _signal_buffer_size;
|
2008-10-13 15:45:20 -04:00
|
|
|
|
|
|
|
// buffers
|
|
|
|
ARDOUR::BufferSet _bufferset;
|
2009-03-07 06:17:06 -05:00
|
|
|
ARDOUR::BufferSet _collect_bufferset;
|
2008-10-13 15:45:20 -04:00
|
|
|
|
|
|
|
|
|
|
|
// dimensions
|
2008-10-15 15:21:26 -04:00
|
|
|
float _analysis_width;
|
|
|
|
float _analysis_height;
|
2008-10-13 15:45:20 -04:00
|
|
|
|
|
|
|
// My objects
|
2008-10-15 15:21:26 -04:00
|
|
|
FFT *_impulse_fft;
|
2008-10-20 14:57:34 -04:00
|
|
|
FFT *_signal_input_fft;
|
|
|
|
FFT *_signal_output_fft;
|
2008-10-13 15:45:20 -04:00
|
|
|
boost::shared_ptr<ARDOUR::Plugin> _plugin;
|
2008-10-20 14:57:34 -04:00
|
|
|
boost::shared_ptr<ARDOUR::PluginInsert> _plugin_insert;
|
2008-10-13 15:45:20 -04:00
|
|
|
|
|
|
|
// gui objects
|
2008-10-15 15:21:26 -04:00
|
|
|
Gtk::DrawingArea *_analysis_area;
|
|
|
|
cairo_surface_t *_analysis_scale_surface;
|
2008-10-13 15:45:20 -04:00
|
|
|
|
|
|
|
|
|
|
|
// dB scale selection:
|
|
|
|
class dBSelectionColumns : public Gtk::TreeModel::ColumnRecord
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
dBSelectionColumns()
|
|
|
|
{ add(dBMin); add(dBMax); add(dBStep); add(name); }
|
|
|
|
|
|
|
|
Gtk::TreeModelColumn<float> dBMin;
|
|
|
|
Gtk::TreeModelColumn<float> dBMax;
|
|
|
|
Gtk::TreeModelColumn<float> dBStep;
|
|
|
|
Gtk::TreeModelColumn<Glib::ustring> name;
|
|
|
|
};
|
|
|
|
|
|
|
|
dBSelectionColumns dBColumns;
|
|
|
|
|
|
|
|
Gtk::ComboBox *dBScaleCombo;
|
|
|
|
Glib::RefPtr<Gtk::ListStore> dBScaleModel;
|
|
|
|
|
2008-10-15 15:21:26 -04:00
|
|
|
Gtk::CheckButton *_phase_button;
|
2008-10-13 15:45:20 -04:00
|
|
|
|
|
|
|
// signals and connections
|
2008-10-15 15:21:26 -04:00
|
|
|
sigc::connection _update_connection;
|
|
|
|
sigc::connection _window_unmap_connection;
|
|
|
|
sigc::connection _window_map_connection;
|
2008-10-13 15:45:20 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|