Loading...
Searching...
No Matches
gx_jconv_settings.h
Go to the documentation of this file.
/*
* Copyright (C) 2009, 2010 Hermann Meyer, James Warden, Andreas Degert
* Copyright (C) 2011 Pete Shorthose
*
* 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.
*/
#pragma once
#ifndef SRC_HEADERS_GX_JCONV_SETTINGS_H_
#define SRC_HEADERS_GX_JCONV_SETTINGS_H_
#include <gxwmm/gainline.h>
#include <gxwmm/radiobutton.h>
#include <gxwmm/iredit.h>
#include <string>
namespace gx_jconv {
/****************************************************************
** Convolver Parameter Window
*/
class IRWindow: public sigc::trackable {
private:
gx_engine::GxMachineBase& machine;
Glib::RefPtr<gx_gui::GxBuilder> builder;
Glib::ustring filename;
double ms; // samples per millisecond
float *audio_buffer;
unsigned int audio_size;
int audio_chan;
gx_engine::JConvParameter *jcp;
Gtk::Window* gtk_window;
sigc::connection autogain_conn;
int nchan;
// helper functions
int set_val(Gxw::ControlParameter *sample_display, Gxw::ControlParameter *ms_display,
double value, int fs);
inline int get_ms(Gxw::ControlParameter *w) {
return static_cast<int>(round(w->cp_get_value()*ms));
}
void file_changed(Glib::ustring filename, int rate, int length,
int channels, Glib::ustring format);
static Gainline gain0;
bool load_data(Glib::ustring filename, int offset = 0, int delay = 0, int length = 0, const Gainline& gain = gain0);
void load_state(const gx_engine::GxJConvSettings* jcp);
void make_state(gx_engine::GxJConvSettings& jc);
void save_state();
void set_GainCor();
double calc_normalized_gain(int offset, int length, const Gainline& points);
void destroy_self();
// signal functions and widget pointers
void on_window_hide();
Gxw::IREdit *wIredit;
void on_delay_changed(int delay, int fs);
void on_offset_changed(int offset, int fs);
void on_length_changed(int length, int fs);
void on_max_scale_reached(bool v);
void on_min_scale_reached(bool v);
Gxw::RadioButton *wLeft, *wRight, *wSum;
void on_left();
void on_right();
void on_sum();
Gxw::RadioButton *wLinear, *wLog;
void on_linear();
Gxw::ValueDisplay *wDelay, *wDelay_ms, *wOffset, *wOffset_ms, *wLength, *wLength_ms;
void on_m_delay_changed();
void on_ms_delay_changed();
void on_m_offset_changed();
void on_ms_offset_changed();
void on_m_length_changed();
void on_ms_length_changed();
Gxw::Regler *wDelay_delta;
Glib::ustring on_delay_delta_format_value(double v);
Gtk::Button *wHome, *wJump_zoom_mark, *wIncr, *wDecr;
void on_home();
void on_jump_zoom_mark();
void on_decr();
void on_incr();
Gtk::Button *wReset, *wOpen;
void on_reset_clicked();
void on_open();
Gtk::Button *wOk, *wApply, *wCancel;
void on_apply_button_clicked();
void on_cancel_button_clicked();
void on_ok_button_clicked();
Gtk::ToggleButton *wGain_correction;
void on_gain_button_toggled();
Gtk::Label *wSamples, *wSampleRate, *wFormat, *wChan, *wFilename;
Gtk::Widget *wChannelbox;
void on_help_clicked();
Gtk::Window *wHelp;
void on_preset_popup_clicked();
void reload_impresp_list();
void on_enumerate(const std::string& path, const std::vector<gx_system::FileName>& l);
bool on_key_press_event(GdkEventKey *event);
void init_connect();
IRWindow(const Glib::RefPtr<gx_gui::GxBuilder>& builder, gx_engine::JConvParameter *jcp,
Glib::RefPtr<Gdk::Pixbuf> icon, gx_engine::GxMachineBase& machine,
Glib::RefPtr<Gtk::AccelGroup> accels, int nchan);
class ModelColumns : public Gtk::TreeModel::ColumnRecord {
public:
ModelColumns() { add(displayname); add(filename); }
Gtk::TreeModelColumn<Glib::ustring> displayname;
Gtk::TreeModelColumn<std::string> filename;
};
Gtk::ComboBox *wcombo;
ModelColumns columns;
Glib::RefPtr<Gtk::TreeStore> model;
std::string current_combo_dir;
void on_combo_changed();
void on_dircombo_changed();
Gtk::ComboBox *dircombo;
public:
void reload_and_show();
static IRWindow *create(const std::string& unit_id,
Glib::RefPtr<Gdk::Pixbuf> icon, gx_engine::GxMachineBase& machine,
Glib::RefPtr<Gtk::AccelGroup> accels, int nchan);
~IRWindow();
};
} /* end of gx_jconv namespace*/
#endif // SRC_HEADERS_GX_JCONV_SETTINGS_H_
gx_engine::GxJConvSettings
Definition gx_internal_plugins.h:279
gx_engine::GxMachineBase
Definition machine.h:59
gx_jconv::IRWindow::ModelColumns
Definition gx_jconv_settings.h:131
gx_jconv::IRWindow::ModelColumns::ModelColumns
ModelColumns()
Definition gx_jconv_settings.h:133
gx_jconv::IRWindow::ModelColumns::displayname
Gtk::TreeModelColumn< Glib::ustring > displayname
Definition gx_jconv_settings.h:134
gx_jconv::IRWindow::ModelColumns::filename
Gtk::TreeModelColumn< std::string > filename
Definition gx_jconv_settings.h:135
gx_jconv::IRWindow::destroy_self
void destroy_self()
gx_jconv::IRWindow::set_GainCor
void set_GainCor()
gx_jconv::IRWindow::audio_size
unsigned int audio_size
Definition gx_jconv_settings.h:44
gx_jconv::IRWindow::wLeft
Gxw::RadioButton * wLeft
Definition gx_jconv_settings.h:78
gx_jconv::IRWindow::wHome
Gtk::Button * wHome
Definition gx_jconv_settings.h:97
gx_jconv::IRWindow::wOpen
Gtk::Button * wOpen
Definition gx_jconv_settings.h:103
gx_jconv::IRWindow::wLinear
Gxw::RadioButton * wLinear
Definition gx_jconv_settings.h:83
gx_jconv::IRWindow::on_left
void on_left()
gx_jconv::IRWindow::jcp
gx_engine::JConvParameter * jcp
Definition gx_jconv_settings.h:46
gx_jconv::IRWindow::wSum
Gxw::RadioButton * wSum
Definition gx_jconv_settings.h:78
gx_jconv::IRWindow::on_delay_delta_format_value
Glib::ustring on_delay_delta_format_value(double v)
gx_jconv::IRWindow::on_jump_zoom_mark
void on_jump_zoom_mark()
gx_jconv::IRWindow::on_help_clicked
void on_help_clicked()
gx_jconv::IRWindow::on_ms_length_changed
void on_ms_length_changed()
gx_jconv::IRWindow::on_key_press_event
bool on_key_press_event(GdkEventKey *event)
gx_jconv::IRWindow::wOffset
Gxw::ValueDisplay * wOffset
Definition gx_jconv_settings.h:86
gx_jconv::IRWindow::wOffset_ms
Gxw::ValueDisplay * wOffset_ms
Definition gx_jconv_settings.h:86
gx_jconv::IRWindow::wRight
Gxw::RadioButton * wRight
Definition gx_jconv_settings.h:78
gx_jconv::IRWindow::nchan
int nchan
Definition gx_jconv_settings.h:49
gx_jconv::IRWindow::on_home
void on_home()
gx_jconv::IRWindow::on_m_delay_changed
void on_m_delay_changed()
gx_jconv::IRWindow::wDecr
Gtk::Button * wDecr
Definition gx_jconv_settings.h:97
gx_jconv::IRWindow::machine
gx_engine::GxMachineBase & machine
Definition gx_jconv_settings.h:39
gx_jconv::IRWindow::on_dircombo_changed
void on_dircombo_changed()
gx_jconv::IRWindow::init_connect
void init_connect()
gx_jconv::IRWindow::audio_chan
int audio_chan
Definition gx_jconv_settings.h:45
gx_jconv::IRWindow::on_open
void on_open()
gx_jconv::IRWindow::load_state
void load_state(const gx_engine::GxJConvSettings *jcp)
gx_jconv::IRWindow::IRWindow
IRWindow(const Glib::RefPtr< gx_gui::GxBuilder > &builder, gx_engine::JConvParameter *jcp, Glib::RefPtr< Gdk::Pixbuf > icon, gx_engine::GxMachineBase &machine, Glib::RefPtr< Gtk::AccelGroup > accels, int nchan)
gx_jconv::IRWindow::model
Glib::RefPtr< Gtk::TreeStore > model
Definition gx_jconv_settings.h:139
gx_jconv::IRWindow::wReset
Gtk::Button * wReset
Definition gx_jconv_settings.h:103
gx_jconv::IRWindow::on_enumerate
void on_enumerate(const std::string &path, const std::vector< gx_system::FileName > &l)
gx_jconv::IRWindow::file_changed
void file_changed(Glib::ustring filename, int rate, int length, int channels, Glib::ustring format)
gx_jconv::IRWindow::wHelp
Gtk::Window * wHelp
Definition gx_jconv_settings.h:119
gx_jconv::IRWindow::wGain_correction
Gtk::ToggleButton * wGain_correction
Definition gx_jconv_settings.h:112
gx_jconv::IRWindow::on_window_hide
void on_window_hide()
gx_jconv::IRWindow::on_offset_changed
void on_offset_changed(int offset, int fs)
gx_jconv::IRWindow::filename
Glib::ustring filename
Definition gx_jconv_settings.h:41
gx_jconv::IRWindow::on_combo_changed
void on_combo_changed()
gx_jconv::IRWindow::get_ms
int get_ms(Gxw::ControlParameter *w)
Definition gx_jconv_settings.h:54
gx_jconv::IRWindow::wDelay_delta
Gxw::Regler * wDelay_delta
Definition gx_jconv_settings.h:94
gx_jconv::IRWindow::wDelay
Gxw::ValueDisplay * wDelay
Definition gx_jconv_settings.h:86
gx_jconv::IRWindow::on_max_scale_reached
void on_max_scale_reached(bool v)
gx_jconv::IRWindow::columns
ModelColumns columns
Definition gx_jconv_settings.h:138
gx_jconv::IRWindow::wCancel
Gtk::Button * wCancel
Definition gx_jconv_settings.h:107
gx_jconv::IRWindow::wChannelbox
Gtk::Widget * wChannelbox
Definition gx_jconv_settings.h:116
gx_jconv::IRWindow::wOk
Gtk::Button * wOk
Definition gx_jconv_settings.h:107
gx_jconv::IRWindow::autogain_conn
sigc::connection autogain_conn
Definition gx_jconv_settings.h:48
gx_jconv::IRWindow::on_delay_changed
void on_delay_changed(int delay, int fs)
gx_jconv::IRWindow::make_state
void make_state(gx_engine::GxJConvSettings &jc)
gx_jconv::IRWindow::wDelay_ms
Gxw::ValueDisplay * wDelay_ms
Definition gx_jconv_settings.h:86
gx_jconv::IRWindow::on_gain_button_toggled
void on_gain_button_toggled()
gx_jconv::IRWindow::reload_and_show
void reload_and_show()
gx_jconv::IRWindow::on_ok_button_clicked
void on_ok_button_clicked()
gx_jconv::IRWindow::~IRWindow
~IRWindow()
gx_jconv::IRWindow::gtk_window
Gtk::Window * gtk_window
Definition gx_jconv_settings.h:47
gx_jconv::IRWindow::wApply
Gtk::Button * wApply
Definition gx_jconv_settings.h:107
gx_jconv::IRWindow::audio_buffer
float * audio_buffer
Definition gx_jconv_settings.h:43
gx_jconv::IRWindow::wLength_ms
Gxw::ValueDisplay * wLength_ms
Definition gx_jconv_settings.h:86
gx_jconv::IRWindow::on_length_changed
void on_length_changed(int length, int fs)
gx_jconv::IRWindow::gain0
static Gainline gain0
Definition gx_jconv_settings.h:59
gx_jconv::IRWindow::on_incr
void on_incr()
gx_jconv::IRWindow::on_ms_offset_changed
void on_ms_offset_changed()
gx_jconv::IRWindow::on_sum
void on_sum()
gx_jconv::IRWindow::dircombo
Gtk::ComboBox * dircombo
Definition gx_jconv_settings.h:143
gx_jconv::IRWindow::on_cancel_button_clicked
void on_cancel_button_clicked()
gx_jconv::IRWindow::reload_impresp_list
void reload_impresp_list()
gx_jconv::IRWindow::set_val
int set_val(Gxw::ControlParameter *sample_display, Gxw::ControlParameter *ms_display, double value, int fs)
gx_jconv::IRWindow::wFormat
Gtk::Label * wFormat
Definition gx_jconv_settings.h:115
gx_jconv::IRWindow::current_combo_dir
std::string current_combo_dir
Definition gx_jconv_settings.h:140
gx_jconv::IRWindow::create
static IRWindow * create(const std::string &unit_id, Glib::RefPtr< Gdk::Pixbuf > icon, gx_engine::GxMachineBase &machine, Glib::RefPtr< Gtk::AccelGroup > accels, int nchan)
gx_jconv::IRWindow::wLog
Gxw::RadioButton * wLog
Definition gx_jconv_settings.h:83
gx_jconv::IRWindow::save_state
void save_state()
gx_jconv::IRWindow::on_reset_clicked
void on_reset_clicked()
gx_jconv::IRWindow::on_ms_delay_changed
void on_ms_delay_changed()
gx_jconv::IRWindow::wJump_zoom_mark
Gtk::Button * wJump_zoom_mark
Definition gx_jconv_settings.h:97
gx_jconv::IRWindow::load_data
bool load_data(Glib::ustring filename, int offset=0, int delay=0, int length=0, const Gainline &gain=gain0)
gx_jconv::IRWindow::on_right
void on_right()
gx_jconv::IRWindow::calc_normalized_gain
double calc_normalized_gain(int offset, int length, const Gainline &points)
gx_jconv::IRWindow::builder
Glib::RefPtr< gx_gui::GxBuilder > builder
Definition gx_jconv_settings.h:40
gx_jconv::IRWindow::wLength
Gxw::ValueDisplay * wLength
Definition gx_jconv_settings.h:86
gx_jconv::IRWindow::on_apply_button_clicked
void on_apply_button_clicked()
gx_jconv::IRWindow::wcombo
Gtk::ComboBox * wcombo
Definition gx_jconv_settings.h:137
gx_jconv::IRWindow::wIredit
Gxw::IREdit * wIredit
Definition gx_jconv_settings.h:71
gx_jconv::IRWindow::on_min_scale_reached
void on_min_scale_reached(bool v)
gx_jconv::IRWindow::ms
double ms
Definition gx_jconv_settings.h:42
gx_jconv::IRWindow::wChan
Gtk::Label * wChan
Definition gx_jconv_settings.h:115
gx_jconv::IRWindow::on_decr
void on_decr()
gx_jconv::IRWindow::wSampleRate
Gtk::Label * wSampleRate
Definition gx_jconv_settings.h:115
gx_jconv::IRWindow::wFilename
Gtk::Label * wFilename
Definition gx_jconv_settings.h:115
gx_jconv::IRWindow::wSamples
Gtk::Label * wSamples
Definition gx_jconv_settings.h:115
gx_jconv::IRWindow::on_m_length_changed
void on_m_length_changed()
gx_jconv::IRWindow::on_linear
void on_linear()
gx_jconv::IRWindow::on_preset_popup_clicked
void on_preset_popup_clicked()
gx_jconv::IRWindow::wIncr
Gtk::Button * wIncr
Definition gx_jconv_settings.h:97
gx_jconv::IRWindow::on_m_offset_changed
void on_m_offset_changed()
gx_engine::JConvParameter
ParameterV< GxJConvSettings > JConvParameter
Definition gx_internal_plugins.h:351
gx_jconv
Definition gx_jconv_settings.h:31