Guitarix
gx_jconv_settings.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2009, 2010 Hermann Meyer, James Warden, Andreas Degert
3 * Copyright (C) 2011 Pete Shorthose
4 *
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.
9 *
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.
14 *
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20#pragma once
21
22#ifndef SRC_HEADERS_GX_JCONV_SETTINGS_H_
23#define SRC_HEADERS_GX_JCONV_SETTINGS_H_
24
25#include <gxwmm/gainline.h>
26#include <gxwmm/radiobutton.h>
27#include <gxwmm/iredit.h>
28
29#include <string>
30
31namespace gx_jconv {
32
33/****************************************************************
34 ** Convolver Parameter Window
35 */
36
37class IRWindow: public sigc::trackable {
38 private:
40 Glib::RefPtr<gx_gui::GxBuilder> builder;
41 Glib::ustring filename;
42 double ms; // samples per millisecond
44 unsigned int audio_size;
47 Gtk::Window* gtk_window;
48 sigc::connection autogain_conn;
49 int nchan;
50
51 // helper functions
52 int set_val(Gxw::ControlParameter *sample_display, Gxw::ControlParameter *ms_display,
53 double value, int fs);
54 inline int get_ms(Gxw::ControlParameter *w) {
55 return static_cast<int>(round(w->cp_get_value()*ms));
56 }
57 void file_changed(Glib::ustring filename, int rate, int length,
58 int channels, Glib::ustring format);
59 static Gainline gain0;
60 bool load_data(Glib::ustring filename, int offset = 0, int delay = 0, int length = 0, const Gainline& gain = gain0);
63 void save_state();
65 double calc_normalized_gain(int offset, int length, const Gainline& points);
67
68 // signal functions and widget pointers
70
71 Gxw::IREdit *wIredit;
72 void on_delay_changed(int delay, int fs);
73 void on_offset_changed(int offset, int fs);
74 void on_length_changed(int length, int fs);
77
78 Gxw::RadioButton *wLeft, *wRight, *wSum;
79 void on_left();
80 void on_right();
81 void on_sum();
82
83 Gxw::RadioButton *wLinear, *wLog;
84 void on_linear();
85
86 Gxw::ValueDisplay *wDelay, *wDelay_ms, *wOffset, *wOffset_ms, *wLength, *wLength_ms;
93
94 Gxw::Regler *wDelay_delta;
95 Glib::ustring on_delay_delta_format_value(double v);
96
97 Gtk::Button *wHome, *wJump_zoom_mark, *wIncr, *wDecr;
98 void on_home();
100 void on_decr();
101 void on_incr();
102
103 Gtk::Button *wReset, *wOpen;
105 void on_open();
106
107 Gtk::Button *wOk, *wApply, *wCancel;
111
112 Gtk::ToggleButton *wGain_correction;
114
116 Gtk::Widget *wChannelbox;
117
119 Gtk::Window *wHelp;
120
123 void on_enumerate(const std::string& path, const std::vector<gx_system::FileName>& l);
124 bool on_key_press_event(GdkEventKey *event);
125
127 IRWindow(const Glib::RefPtr<gx_gui::GxBuilder>& builder, gx_engine::JConvParameter *jcp,
128 Glib::RefPtr<Gdk::Pixbuf> icon, gx_engine::GxMachineBase& machine,
129 Glib::RefPtr<Gtk::AccelGroup> accels, int nchan);
130
131 class ModelColumns : public Gtk::TreeModel::ColumnRecord {
132 public:
134 Gtk::TreeModelColumn<Glib::ustring> displayname;
135 Gtk::TreeModelColumn<std::string> filename;
136 };
137 Gtk::ComboBox *wcombo;
139 Glib::RefPtr<Gtk::TreeStore> model;
140 std::string current_combo_dir;
143 Gtk::ComboBox *dircombo;
144public:
146 static IRWindow *create(const std::string& unit_id,
147 Glib::RefPtr<Gdk::Pixbuf> icon, gx_engine::GxMachineBase& machine,
148 Glib::RefPtr<Gtk::AccelGroup> accels, int nchan);
150};
151
152} /* end of gx_jconv namespace*/
153#endif // SRC_HEADERS_GX_JCONV_SETTINGS_H_
Gtk::TreeModelColumn< Glib::ustring > displayname
Gtk::TreeModelColumn< std::string > filename
unsigned int audio_size
Gxw::RadioButton * wLeft
Gxw::RadioButton * wLinear
gx_engine::JConvParameter * jcp
Gxw::RadioButton * wSum
Glib::ustring on_delay_delta_format_value(double v)
void on_ms_length_changed()
bool on_key_press_event(GdkEventKey *event)
Gxw::ValueDisplay * wOffset
Gxw::ValueDisplay * wOffset_ms
Gxw::RadioButton * wRight
gx_engine::GxMachineBase & machine
void on_dircombo_changed()
void load_state(const gx_engine::GxJConvSettings *jcp)
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)
Glib::RefPtr< Gtk::TreeStore > model
void on_enumerate(const std::string &path, const std::vector< gx_system::FileName > &l)
void file_changed(Glib::ustring filename, int rate, int length, int channels, Glib::ustring format)
Gtk::ToggleButton * wGain_correction
void on_offset_changed(int offset, int fs)
Glib::ustring filename
int get_ms(Gxw::ControlParameter *w)
Gxw::Regler * wDelay_delta
Gxw::ValueDisplay * wDelay
void on_max_scale_reached(bool v)
Gtk::Widget * wChannelbox
sigc::connection autogain_conn
void on_delay_changed(int delay, int fs)
void make_state(gx_engine::GxJConvSettings &jc)
Gxw::ValueDisplay * wDelay_ms
void on_gain_button_toggled()
void on_ok_button_clicked()
Gtk::Window * gtk_window
Gxw::ValueDisplay * wLength_ms
void on_length_changed(int length, int fs)
static Gainline gain0
void on_ms_offset_changed()
Gtk::ComboBox * dircombo
void on_cancel_button_clicked()
void reload_impresp_list()
int set_val(Gxw::ControlParameter *sample_display, Gxw::ControlParameter *ms_display, double value, int fs)
std::string current_combo_dir
static IRWindow * create(const std::string &unit_id, Glib::RefPtr< Gdk::Pixbuf > icon, gx_engine::GxMachineBase &machine, Glib::RefPtr< Gtk::AccelGroup > accels, int nchan)
Gxw::RadioButton * wLog
void on_ms_delay_changed()
Gtk::Button * wJump_zoom_mark
bool load_data(Glib::ustring filename, int offset=0, int delay=0, int length=0, const Gainline &gain=gain0)
double calc_normalized_gain(int offset, int length, const Gainline &points)
Glib::RefPtr< gx_gui::GxBuilder > builder
Gxw::ValueDisplay * wLength
void on_apply_button_clicked()
Gtk::ComboBox * wcombo
Gxw::IREdit * wIredit
void on_min_scale_reached(bool v)
Gtk::Label * wSampleRate
void on_m_length_changed()
void on_preset_popup_clicked()
void on_m_offset_changed()