2008-10-13 15:45:20 -04:00
|
|
|
/*
|
2019-08-02 17:26:43 -04:00
|
|
|
* Copyright (C) 2008-2009 Sampo Savolainen <v2@iki.fi>
|
|
|
|
* Copyright (C) 2009-2012 David Robillard <d@drobilla.net>
|
|
|
|
* Copyright (C) 2009-2017 Paul Davis <paul@linuxaudiosystems.com>
|
|
|
|
* Copyright (C) 2010 Carl Hetherington <carl@carlh.net>
|
|
|
|
* Copyright (C) 2018-2019 Robin Gareus <robin@gareus.org>
|
|
|
|
*
|
|
|
|
* 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.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
2008-10-13 15:45:20 -04:00
|
|
|
|
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
|
|
|
|
2012-05-24 02:09:29 -04:00
|
|
|
#include "pbd/signals.h"
|
|
|
|
|
2009-02-25 13:26:51 -05:00
|
|
|
#include "ardour/buffer_set.h"
|
2008-10-13 15:45:20 -04:00
|
|
|
|
|
|
|
#include <gtkmm/table.h>
|
|
|
|
#include <gtkmm/drawingarea.h>
|
|
|
|
#include <gtkmm/combobox.h>
|
2019-04-21 16:33:28 -04:00
|
|
|
#include <gtkmm/comboboxtext.h>
|
2008-10-13 15:45:20 -04:00
|
|
|
#include <gtkmm/liststore.h>
|
|
|
|
|
2012-05-24 02:09:29 -04:00
|
|
|
namespace ARDOUR {
|
|
|
|
class Plugin;
|
|
|
|
class PluginInsert;
|
|
|
|
}
|
|
|
|
|
2011-03-03 12:58:11 -05:00
|
|
|
namespace GTKArdour {
|
2017-07-01 12:42:24 -04:00
|
|
|
class FFT;
|
2011-03-03 12:58:11 -05:00
|
|
|
}
|
2008-10-13 15:45:20 -04:00
|
|
|
|
|
|
|
class PluginEqGui : public Gtk::Table
|
|
|
|
{
|
2010-12-03 17:27:40 -05:00
|
|
|
public:
|
2023-02-16 18:33:28 -05:00
|
|
|
PluginEqGui (std::shared_ptr<ARDOUR::PluginInsert>);
|
2010-12-03 17:27:40 -05:00
|
|
|
~PluginEqGui ();
|
|
|
|
|
|
|
|
private:
|
|
|
|
// Setup
|
|
|
|
void set_buffer_size (uint32_t, uint32_t);
|
|
|
|
void change_dB_scale ();
|
|
|
|
|
|
|
|
// Analysis
|
|
|
|
void run_impulse_analysis ();
|
|
|
|
void signal_collect_callback (ARDOUR::BufferSet *, ARDOUR::BufferSet *);
|
|
|
|
float _signal_analysis_running;
|
|
|
|
|
|
|
|
// Drawing
|
|
|
|
virtual void on_hide ();
|
|
|
|
virtual void on_show ();
|
|
|
|
|
|
|
|
void stop_updating ();
|
|
|
|
void start_updating ();
|
|
|
|
|
2020-10-05 13:30:54 -04:00
|
|
|
void start_listening ();
|
|
|
|
void stop_listening ();
|
|
|
|
|
2010-12-03 17:27:40 -05:00
|
|
|
void resize_analysis_area (Gtk::Allocation&);
|
|
|
|
void redraw_analysis_area ();
|
|
|
|
|
|
|
|
void draw_analysis_scales (cairo_t *);
|
|
|
|
bool expose_analysis_area (GdkEventExpose *);
|
|
|
|
|
|
|
|
void draw_scales_power (Gtk::Widget *, cairo_t *);
|
|
|
|
void plot_impulse_amplitude (Gtk::Widget *,cairo_t *);
|
|
|
|
|
|
|
|
void draw_scales_phase (Gtk::Widget *,cairo_t *);
|
|
|
|
void plot_impulse_phase (Gtk::Widget *,cairo_t *);
|
|
|
|
|
|
|
|
void plot_signal_amplitude_difference (Gtk::Widget *,cairo_t *);
|
|
|
|
|
2018-10-24 22:25:15 -04:00
|
|
|
void update_pointer_info(float);
|
2016-07-23 15:10:44 -04:00
|
|
|
bool analysis_area_mouseover(GdkEventMotion *);
|
|
|
|
bool analysis_area_mouseexit(GdkEventCrossing *);
|
|
|
|
|
2010-12-03 17:27:40 -05:00
|
|
|
// Helpers
|
|
|
|
bool timeout_callback ();
|
|
|
|
void redraw_scales ();
|
|
|
|
|
|
|
|
// Fields:
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2010-12-03 17:27:40 -05:00
|
|
|
// analysis parameters
|
|
|
|
float _samplerate;
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2010-12-03 17:27:40 -05:00
|
|
|
float _min_dB;
|
|
|
|
float _max_dB;
|
|
|
|
float _step_dB;
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2010-12-03 17:27:40 -05:00
|
|
|
float _log_coeff;
|
|
|
|
float _log_max;
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2019-02-27 19:26:21 -05:00
|
|
|
ARDOUR::samplecnt_t _block_size;
|
2017-09-18 12:39:17 -04:00
|
|
|
ARDOUR::samplecnt_t _buffer_size;
|
|
|
|
ARDOUR::samplecnt_t _signal_buffer_size;
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2010-12-03 17:27:40 -05:00
|
|
|
// buffers
|
|
|
|
ARDOUR::BufferSet _bufferset;
|
|
|
|
ARDOUR::BufferSet _collect_bufferset;
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2010-12-03 17:27:40 -05:00
|
|
|
// dimensions
|
|
|
|
float _analysis_width;
|
|
|
|
float _analysis_height;
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2010-12-03 17:27:40 -05:00
|
|
|
// My objects
|
2017-07-01 12:42:24 -04:00
|
|
|
GTKArdour::FFT *_impulse_fft;
|
|
|
|
GTKArdour::FFT *_signal_input_fft;
|
|
|
|
GTKArdour::FFT *_signal_output_fft;
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<ARDOUR::Plugin> _plugin;
|
|
|
|
std::shared_ptr<ARDOUR::PluginInsert> _plugin_insert;
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2010-12-03 17:27:40 -05:00
|
|
|
// gui objects
|
|
|
|
Gtk::DrawingArea *_analysis_area;
|
|
|
|
cairo_surface_t *_analysis_scale_surface;
|
2016-07-23 15:10:44 -04:00
|
|
|
Gtk::Label *_pointer_info;
|
2018-10-24 22:25:15 -04:00
|
|
|
int _pointer_in_area_xpos;
|
|
|
|
int _pointer_in_area_freq;
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2010-12-03 17:27:40 -05:00
|
|
|
// dB scale selection:
|
|
|
|
class dBSelectionColumns : public Gtk::TreeModel::ColumnRecord
|
|
|
|
{
|
2008-10-13 15:45:20 -04:00
|
|
|
public:
|
2010-12-03 17:27:40 -05:00
|
|
|
dBSelectionColumns()
|
|
|
|
{ add(dBMin); add(dBMax); add(dBStep); add(name); }
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2010-12-03 17:27:40 -05:00
|
|
|
Gtk::TreeModelColumn<float> dBMin;
|
|
|
|
Gtk::TreeModelColumn<float> dBMax;
|
|
|
|
Gtk::TreeModelColumn<float> dBStep;
|
|
|
|
Gtk::TreeModelColumn<std::string> name;
|
|
|
|
};
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2010-12-03 17:27:40 -05:00
|
|
|
dBSelectionColumns dBColumns;
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2010-12-03 17:27:40 -05:00
|
|
|
Gtk::ComboBox *dBScaleCombo;
|
|
|
|
Glib::RefPtr<Gtk::ListStore> dBScaleModel;
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2019-04-21 16:33:28 -04:00
|
|
|
Gtk::ComboBoxText* _live_signal_combo;
|
|
|
|
|
2010-12-03 17:27:40 -05:00
|
|
|
Gtk::CheckButton *_phase_button;
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2010-12-03 17:27:40 -05:00
|
|
|
// signals and connections
|
|
|
|
sigc::connection _update_connection;
|
|
|
|
sigc::connection _window_unmap_connection;
|
|
|
|
sigc::connection _window_map_connection;
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2010-12-03 17:27:40 -05:00
|
|
|
PBD::ScopedConnection analysis_connection;
|
2008-10-13 15:45:20 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|