revise VBoxWidget
This commit is contained in:
16
effects.c
16
effects.c
@@ -440,35 +440,35 @@ static WidgetContainer eq_container[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static VBoxWidget wah_vbox[] = {
|
static VBoxWidget wah_vbox[] = {
|
||||||
{"Wah", FALSE, set_wah_on_off, wah_container, G_N_ELEMENTS(wah_container)},
|
{"Wah", FALSE, WAH_ON_OFF, WAH_POSITION, wah_container, G_N_ELEMENTS(wah_container)},
|
||||||
};
|
};
|
||||||
|
|
||||||
static VBoxWidget comp_vbox[] = {
|
static VBoxWidget comp_vbox[] = {
|
||||||
{"Compressor", FALSE, set_comp_on_off, comp_container, G_N_ELEMENTS(comp_container)},
|
{"Compressor", FALSE, COMP_ON_OFF, COMP_POSITION, comp_container, G_N_ELEMENTS(comp_container)},
|
||||||
};
|
};
|
||||||
|
|
||||||
static VBoxWidget dist_vbox[] = {
|
static VBoxWidget dist_vbox[] = {
|
||||||
{"Distortion", FALSE, set_dist_on_off, dist_container, G_N_ELEMENTS(dist_container)},
|
{"Distortion", FALSE, DIST_ON_OFF, DIST_POSITION, dist_container, G_N_ELEMENTS(dist_container)},
|
||||||
};
|
};
|
||||||
|
|
||||||
static VBoxWidget noisegate_vbox[] = {
|
static VBoxWidget noisegate_vbox[] = {
|
||||||
{"Noisegate", FALSE, set_noisegate_on_off, noisegate_container, G_N_ELEMENTS(noisegate_container)},
|
{"Noisegate", FALSE, NOISEGATE_ON_OFF, NOISEGATE_POSITION, noisegate_container, G_N_ELEMENTS(noisegate_container)},
|
||||||
};
|
};
|
||||||
|
|
||||||
static VBoxWidget chorusfx_vbox[] = {
|
static VBoxWidget chorusfx_vbox[] = {
|
||||||
{"Chorus/FX", FALSE, set_chorusfx_on_off, chorusfx_container, G_N_ELEMENTS(chorusfx_container)},
|
{"Chorus/FX", FALSE, CHORUSFX_ON_OFF, CHORUSFX_POSITION, chorusfx_container, G_N_ELEMENTS(chorusfx_container)},
|
||||||
};
|
};
|
||||||
|
|
||||||
static VBoxWidget delay_vbox[] = {
|
static VBoxWidget delay_vbox[] = {
|
||||||
{"Delay", FALSE, set_delay_on_off, delay_container, G_N_ELEMENTS(delay_container)},
|
{"Delay", FALSE, DELAY_ON_OFF, DELAY_POSITION, delay_container, G_N_ELEMENTS(delay_container)},
|
||||||
};
|
};
|
||||||
|
|
||||||
static VBoxWidget reverb_vbox[] = {
|
static VBoxWidget reverb_vbox[] = {
|
||||||
{"Reverb", FALSE, set_reverb_on_off, reverb_container, G_N_ELEMENTS(reverb_container)},
|
{"Reverb", FALSE, REVERB_ON_OFF, REVERB_POSITION, reverb_container, G_N_ELEMENTS(reverb_container)},
|
||||||
};
|
};
|
||||||
|
|
||||||
static VBoxWidget eq_vbox[] = {
|
static VBoxWidget eq_vbox[] = {
|
||||||
{"EQ", FALSE, set_eq_on_off, eq_container, G_N_ELEMENTS(eq_container)},
|
{"EQ", FALSE, EQ_ON_OFF, EQ_POSITION, eq_container, G_N_ELEMENTS(eq_container)},
|
||||||
};
|
};
|
||||||
|
|
||||||
VBoxes vboxes[] = {
|
VBoxes vboxes[] = {
|
||||||
|
|||||||
@@ -36,7 +36,8 @@ typedef struct {
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
char *label;
|
char *label;
|
||||||
gboolean value;
|
gboolean value;
|
||||||
void (*callback)(gboolean);
|
guint option;
|
||||||
|
guint position;
|
||||||
WidgetContainer *widgets;
|
WidgetContainer *widgets;
|
||||||
gint widgets_amt;
|
gint widgets_amt;
|
||||||
} VBoxWidget;
|
} VBoxWidget;
|
||||||
|
|||||||
46
gdigi.c
46
gdigi.c
@@ -154,7 +154,6 @@ void check_preset(struct usb_dev_handle *handle)
|
|||||||
*/
|
*/
|
||||||
void set_option(guint id, guint position, guint value)
|
void set_option(guint id, guint position, guint value)
|
||||||
{
|
{
|
||||||
sleep(3);
|
|
||||||
static char option[] = {0xF0, 0x00, 0x00, 0x10, 0x00, 0x5E, 0x02, 0x41,
|
static char option[] = {0xF0, 0x00, 0x00, 0x10, 0x00, 0x5E, 0x02, 0x41,
|
||||||
0x00, 0x00, 0x00, /* ID */
|
0x00, 0x00, 0x00, /* ID */
|
||||||
0x00, /* position */
|
0x00, /* position */
|
||||||
@@ -222,16 +221,6 @@ sleep(3);
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_wah_on_off(gboolean val)
|
|
||||||
{
|
|
||||||
set_option(WAH_ON_OFF, WAH_POSITION, (val == TRUE) ? 1 : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void set_comp_on_off(gboolean val)
|
|
||||||
{
|
|
||||||
set_option(COMP_ON_OFF, COMP_POSITION, (val == TRUE) ? 1 : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* x = 0 to 60 */
|
/* x = 0 to 60 */
|
||||||
void switch_user_preset(int x)
|
void switch_user_preset(int x)
|
||||||
{
|
{
|
||||||
@@ -254,47 +243,12 @@ void switch_system_preset(int x)
|
|||||||
send_data(switch_preset, sizeof(switch_preset));
|
send_data(switch_preset, sizeof(switch_preset));
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_pickup_on_off(gboolean val)
|
|
||||||
{
|
|
||||||
set_option(PICKUP_ON_OFF, PICKUP_POSITION, (val == TRUE) ? 1 : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void set_dist_on_off(gboolean val)
|
|
||||||
{
|
|
||||||
set_option(DIST_ON_OFF, DIST_POSITION, (val == TRUE) ? 1 : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* level = 0 to 99 */
|
/* level = 0 to 99 */
|
||||||
void set_preset_level(int level)
|
void set_preset_level(int level)
|
||||||
{
|
{
|
||||||
set_option(PRESET_LEVEL, PRESET_POSITION, level);
|
set_option(PRESET_LEVEL, PRESET_POSITION, level);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_eq_on_off(gboolean val)
|
|
||||||
{
|
|
||||||
set_option(EQ_ON_OFF, EQ_POSITION, (val == TRUE) ? 1 : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void set_noisegate_on_off(gboolean val)
|
|
||||||
{
|
|
||||||
set_option(NOISEGATE_ON_OFF, NOISEGATE_POSITION, (val == TRUE) ? 1 : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void set_chorusfx_on_off(gboolean val)
|
|
||||||
{
|
|
||||||
set_option(CHORUSFX_ON_OFF, CHORUSFX_POSITION, (val == TRUE) ? 1 : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void set_delay_on_off(gboolean val)
|
|
||||||
{
|
|
||||||
set_option(DELAY_ON_OFF, DELAY_POSITION, (val == TRUE) ? 1 : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void set_reverb_on_off(gboolean val)
|
|
||||||
{
|
|
||||||
set_option(REVERB_ON_OFF, REVERB_POSITION, (val == TRUE) ? 1 : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* x = 0 to 59 (preset number) */
|
/* x = 0 to 59 (preset number) */
|
||||||
void set_preset_name(int x, gchar *name)
|
void set_preset_name(int x, gchar *name)
|
||||||
{
|
{
|
||||||
|
|||||||
9
gdigi.h
9
gdigi.h
@@ -460,15 +460,6 @@ enum {
|
|||||||
#define USB_AUDIO_LEVEL 12307
|
#define USB_AUDIO_LEVEL 12307
|
||||||
|
|
||||||
void set_option(guint id, guint position, guint value);
|
void set_option(guint id, guint position, guint value);
|
||||||
void set_wah_on_off(gboolean val);
|
|
||||||
void set_comp_on_off(gboolean val);
|
|
||||||
void switch_user_preset(int x);
|
void switch_user_preset(int x);
|
||||||
void switch_system_preset(int x);
|
void switch_system_preset(int x);
|
||||||
void set_pickup_on_off(gboolean val);
|
|
||||||
void set_dist_on_off(gboolean val);
|
|
||||||
void set_preset_level(int level);
|
void set_preset_level(int level);
|
||||||
void set_eq_on_off(gboolean val);
|
|
||||||
void set_noisegate_on_off(gboolean val);
|
|
||||||
void set_chorusfx_on_off(gboolean val);
|
|
||||||
void set_delay_on_off(gboolean val);
|
|
||||||
void set_reverb_on_off(gboolean val);
|
|
||||||
|
|||||||
18
gui.c
18
gui.c
@@ -30,10 +30,12 @@ void value_changed_option_cb(GtkSpinButton *spinbutton, SettingsWidget *setting)
|
|||||||
set_option(setting->option, setting->position, val);
|
set_option(setting->option, setting->position, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
void toggled_cb(GtkToggleButton *button, void (*callback)(gboolean))
|
void toggled_cb(GtkToggleButton *button, VBoxWidget *widget)
|
||||||
{
|
{
|
||||||
gboolean val = gtk_toggle_button_get_active(button);
|
g_return_if_fail(widget != NULL);
|
||||||
callback(val);
|
|
||||||
|
guint val = gtk_toggle_button_get_active(button);
|
||||||
|
set_option(widget->option, widget->position, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget *create_table(SettingsWidget *widgets, gint amt)
|
GtkWidget *create_table(SettingsWidget *widgets, gint amt)
|
||||||
@@ -57,11 +59,11 @@ GtkWidget *create_table(SettingsWidget *widgets, gint amt)
|
|||||||
return table;
|
return table;
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget *create_on_off_button(const gchar *label, gboolean state, void (*callback)(int))
|
GtkWidget *create_on_off_button(VBoxWidget *widget)
|
||||||
{
|
{
|
||||||
GtkWidget *button = gtk_toggle_button_new_with_label(label);
|
GtkWidget *button = gtk_toggle_button_new_with_label(widget->label);
|
||||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), state);
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), widget->value);
|
||||||
g_signal_connect(G_OBJECT(button), "toggled", G_CALLBACK(toggled_cb), callback);
|
g_signal_connect(G_OBJECT(button), "toggled", G_CALLBACK(toggled_cb), widget);
|
||||||
return button;
|
return button;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,7 +171,7 @@ GtkWidget *create_vbox(VBoxWidget *widgets, gint amt)
|
|||||||
gtk_box_set_homogeneous(GTK_BOX(hbox), TRUE);
|
gtk_box_set_homogeneous(GTK_BOX(hbox), TRUE);
|
||||||
|
|
||||||
for (x = 0; x<amt; x++) {
|
for (x = 0; x<amt; x++) {
|
||||||
widget = create_on_off_button(widgets[x].label, widgets[x].value, widgets[x].callback);
|
widget = create_on_off_button(&widgets[x]);
|
||||||
gtk_box_pack_start(GTK_BOX(hbox), widget, TRUE, TRUE, 2);
|
gtk_box_pack_start(GTK_BOX(hbox), widget, TRUE, TRUE, 2);
|
||||||
|
|
||||||
table = create_widget_container(widgets[x].widgets, widgets[x].widgets_amt);
|
table = create_widget_container(widgets[x].widgets, widgets[x].widgets_amt);
|
||||||
|
|||||||
36
tests.c
36
tests.c
@@ -50,8 +50,8 @@ void test_wah()
|
|||||||
for (x=0; x<=12; x++)
|
for (x=0; x<=12; x++)
|
||||||
set_option(WAH_LEVEL, WAH_POSITION, x);
|
set_option(WAH_LEVEL, WAH_POSITION, x);
|
||||||
|
|
||||||
set_wah_on_off(TRUE);
|
set_option(WAH_ON_OFF, WAH_POSITION, 1);
|
||||||
set_wah_on_off(FALSE);
|
set_option(WAH_ON_OFF, WAH_POSITION, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_compressor()
|
void test_compressor()
|
||||||
@@ -81,8 +81,8 @@ void test_compressor()
|
|||||||
for (x=0; x<=99; x++)
|
for (x=0; x<=99; x++)
|
||||||
set_option(COMP_LEVEL, COMP_POSITION, x);
|
set_option(COMP_LEVEL, COMP_POSITION, x);
|
||||||
|
|
||||||
set_comp_on_off(TRUE);
|
set_option(COMP_ON_OFF, COMP_POSITION, 1);
|
||||||
set_comp_on_off(FALSE);
|
set_option(COMP_ON_OFF, COMP_POSITION, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_dist()
|
void test_dist()
|
||||||
@@ -197,8 +197,8 @@ void test_dist()
|
|||||||
for (x=0; x<=99; x++)
|
for (x=0; x<=99; x++)
|
||||||
set_option(DIST_MP_VOLUME, DIST_POSITION, x);
|
set_option(DIST_MP_VOLUME, DIST_POSITION, x);
|
||||||
|
|
||||||
set_dist_on_off(TRUE);
|
set_option(DIST_ON_OFF, DIST_POSITION, 1);
|
||||||
set_dist_on_off(FALSE);
|
set_option(DIST_ON_OFF, DIST_POSITION, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_presets()
|
void test_presets()
|
||||||
@@ -220,8 +220,8 @@ void test_pickups()
|
|||||||
set_option(PICKUP_TYPE, PICKUP_POSITION, PICKUP_TYPE_HB_SC);
|
set_option(PICKUP_TYPE, PICKUP_POSITION, PICKUP_TYPE_HB_SC);
|
||||||
set_option(PICKUP_TYPE, PICKUP_POSITION, PICKUP_TYPE_SC_HB);
|
set_option(PICKUP_TYPE, PICKUP_POSITION, PICKUP_TYPE_SC_HB);
|
||||||
|
|
||||||
set_pickup_on_off(TRUE);
|
set_option(PICKUP_ON_OFF, PICKUP_POSITION, 1);
|
||||||
set_pickup_on_off(FALSE);
|
set_option(PICKUP_ON_OFF, PICKUP_POSITION, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_eq()
|
void test_eq()
|
||||||
@@ -249,8 +249,8 @@ void test_eq()
|
|||||||
for (x=0; x<=7500; x++)
|
for (x=0; x<=7500; x++)
|
||||||
set_option(EQ_TREBLE_HZ, EQ_POSITION, x);
|
set_option(EQ_TREBLE_HZ, EQ_POSITION, x);
|
||||||
|
|
||||||
set_eq_on_off(TRUE);
|
set_option(EQ_ON_OFF, EQ_POSITION, 1);
|
||||||
set_eq_on_off(FALSE);
|
set_option(EQ_ON_OFF, EQ_POSITION, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_noisegate()
|
void test_noisegate()
|
||||||
@@ -277,8 +277,8 @@ void test_noisegate()
|
|||||||
for (x=0; x<=99; x++)
|
for (x=0; x<=99; x++)
|
||||||
set_option(NOISEGATE_ATTN, NOISEGATE_POSITION, x);
|
set_option(NOISEGATE_ATTN, NOISEGATE_POSITION, x);
|
||||||
|
|
||||||
set_noisegate_on_off(TRUE);
|
set_option(NOISEGATE_ON_OFF, NOISEGATE_POSITION, 1);
|
||||||
set_noisegate_on_off(FALSE);
|
set_option(NOISEGATE_ON_OFF, NOISEGATE_POSITION, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_chorusfx()
|
void test_chorusfx()
|
||||||
@@ -492,8 +492,8 @@ void test_chorusfx()
|
|||||||
for (x=0; x<=99; x++)
|
for (x=0; x<=99; x++)
|
||||||
set_option(IPS_LEVEL, CHORUSFX_POSITION, x);
|
set_option(IPS_LEVEL, CHORUSFX_POSITION, x);
|
||||||
|
|
||||||
set_chorusfx_on_off(TRUE);
|
set_option(CHORUSFX_ON_OFF, CHORUSFX_POSITION, 1);
|
||||||
set_chorusfx_on_off(FALSE);
|
set_option(CHORUSFX_ON_OFF, CHORUSFX_POSITION, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_delay()
|
void test_delay()
|
||||||
@@ -554,8 +554,8 @@ void test_delay()
|
|||||||
for (x=0; x<=99; x++)
|
for (x=0; x<=99; x++)
|
||||||
set_option(TAPE_FLUTTER, DELAY_POSITION, x);
|
set_option(TAPE_FLUTTER, DELAY_POSITION, x);
|
||||||
|
|
||||||
set_delay_on_off(TRUE);
|
set_option(DELAY_ON_OFF, DELAY_POSITION, 1);
|
||||||
set_delay_on_off(FALSE);
|
set_option(DELAY_ON_OFF, DELAY_POSITION, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_reverb()
|
void test_reverb()
|
||||||
@@ -616,8 +616,8 @@ void test_reverb()
|
|||||||
for (x=0; x<=99; x++)
|
for (x=0; x<=99; x++)
|
||||||
set_option(EMT240_PLATE_LEVEL, REVERB_POSITION, x);
|
set_option(EMT240_PLATE_LEVEL, REVERB_POSITION, x);
|
||||||
|
|
||||||
set_reverb_on_off(TRUE);
|
set_option(REVERB_ON_OFF, REVERB_POSITION, 1);
|
||||||
set_reverb_on_off(FALSE);
|
set_option(REVERB_ON_OFF, REVERB_POSITION, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_exp()
|
void test_exp()
|
||||||
|
|||||||
Reference in New Issue
Block a user