some more gui work
This commit is contained in:
1
TODO
1
TODO
@@ -10,3 +10,4 @@
|
||||
-effects level
|
||||
-handling presets (loading, saving, exporting/importing to/from xml patches)
|
||||
-buildsystem
|
||||
-figure out how to get current device settings, start gui with proper values
|
||||
|
||||
119
gui.c
119
gui.c
@@ -438,6 +438,70 @@ static WidgetContainer comp_container[] = {
|
||||
{COMP_TYPE_CS, "CS compressor", set_comp_type, comp_cs_widgets, G_N_ELEMENTS(comp_cs_widgets), NULL},
|
||||
};
|
||||
|
||||
static WidgetContainer dist_container[] = {
|
||||
{DIST_TYPE_SCREAMER, "Screamer", set_dist_type, dist_screamer_widgets, G_N_ELEMENTS(dist_screamer_widgets), NULL},
|
||||
{DIST_TYPE_808, "808", set_dist_type, dist_808_widgets, G_N_ELEMENTS(dist_808_widgets), NULL},
|
||||
{DIST_TYPE_GUYOD, "GuyOD", set_dist_type, dist_guyod_widgets, G_N_ELEMENTS(dist_guyod_widgets), NULL},
|
||||
{DIST_TYPE_DOD250, "DOD250", set_dist_type, dist_dod250_widgets, G_N_ELEMENTS(dist_dod250_widgets), NULL},
|
||||
{DIST_TYPE_RODENT, "Rodent", set_dist_type, dist_rodent_widgets, G_N_ELEMENTS(dist_rodent_widgets), NULL},
|
||||
{DIST_TYPE_MX, "MX", set_dist_type, dist_mx_widgets, G_N_ELEMENTS(dist_mx_widgets), NULL},
|
||||
{DIST_TYPE_DS, "DS", set_dist_type, dist_ds_widgets, G_N_ELEMENTS(dist_ds_widgets), NULL},
|
||||
{DIST_TYPE_GRUNGE, "Grunge", set_dist_type, dist_grunge_widgets, G_N_ELEMENTS(dist_grunge_widgets), NULL},
|
||||
{DIST_TYPE_ZONE, "Zone", set_dist_type, dist_zone_widgets, G_N_ELEMENTS(dist_zone_widgets), NULL},
|
||||
{DIST_TYPE_DEATH, "Death", set_dist_type, dist_death_widgets, G_N_ELEMENTS(dist_death_widgets), NULL},
|
||||
{DIST_TYPE_GONK, "Gonk", set_dist_type, dist_gonk_widgets, G_N_ELEMENTS(dist_gonk_widgets), NULL},
|
||||
{DIST_TYPE_FUZZY, "Fuzzy", set_dist_type, dist_fuzzy_widgets, G_N_ELEMENTS(dist_fuzzy_widgets), NULL},
|
||||
{DIST_TYPE_MP, "MP", set_dist_type, dist_mp_widgets, G_N_ELEMENTS(dist_mp_widgets), NULL},
|
||||
};
|
||||
|
||||
static WidgetContainer noisegate_container[] = {
|
||||
{NOISEGATE_GATE, "Gate", set_noisegate_type, noisegate_gate_widgets, G_N_ELEMENTS(noisegate_gate_widgets), NULL},
|
||||
{NOISEGATE_SWELL, "Swell", set_noisegate_type, noisegate_swell_widgets, G_N_ELEMENTS(noisegate_swell_widgets), NULL},
|
||||
};
|
||||
|
||||
static WidgetContainer chorusfx_container[] = {
|
||||
{CHORUS_TYPE_CE, "CE Chorus", set_chorusfx_type, chorusfx_ce_widgets, G_N_ELEMENTS(chorusfx_ce_widgets), NULL},
|
||||
{CHORUS_TYPE_DUAL, "Dual Chorus", set_chorusfx_type, chorusfx_dual_widgets, G_N_ELEMENTS(chorusfx_dual_widgets), NULL},
|
||||
{CHORUS_TYPE_MULTI, "Multi Chorus", set_chorusfx_type, chorusfx_multi_widgets, G_N_ELEMENTS(chorusfx_multi_widgets), NULL},
|
||||
{CHORUS_TYPE_FLANGER, "Flanger", set_chorusfx_type, chorusfx_flanger_widgets, G_N_ELEMENTS(chorusfx_flanger_widgets), NULL},
|
||||
{CHORUS_TYPE_MXR_FLANGER, "MXR FLANGER", set_chorusfx_type, chorusfx_mxr_flanger_widgets, G_N_ELEMENTS(chorusfx_mxr_flanger_widgets), NULL},
|
||||
{CHORUS_TYPE_PHASER, "Phaser", set_chorusfx_type, chorusfx_phaser_widgets, G_N_ELEMENTS(chorusfx_phaser_widgets), NULL},
|
||||
{CHORUS_TYPE_VIBRATO, "Vibrato", set_chorusfx_type, chorusfx_vibrato_widgets, G_N_ELEMENTS(chorusfx_vibrato_widgets), NULL},
|
||||
{CHORUS_TYPE_ROTARY, "Rotary", set_chorusfx_type, chorusfx_rotary_widgets, G_N_ELEMENTS(chorusfx_rotary_widgets), NULL},
|
||||
{CHORUS_TYPE_VIBROPAN, "Vibropan", set_chorusfx_type, chorusfx_vibropan_widgets, G_N_ELEMENTS(chorusfx_vibropan_widgets), NULL},
|
||||
{CHORUS_TYPE_TREMOLO, "Tremolo", set_chorusfx_type, chorusfx_tremolo_widgets, G_N_ELEMENTS(chorusfx_tremolo_widgets), NULL},
|
||||
{CHORUS_TYPE_PANNER, "Panner", set_chorusfx_type, chorusfx_panner_widgets, G_N_ELEMENTS(chorusfx_panner_widgets), NULL},
|
||||
{CHORUS_TYPE_ENVELOPE, "Envelope", set_chorusfx_type, chorusfx_envelope_widgets, G_N_ELEMENTS(chorusfx_envelope_widgets), NULL},
|
||||
{CHORUS_TYPE_AUTOYA, "AutoYa", set_chorusfx_type, chorusfx_autoya_widgets, G_N_ELEMENTS(chorusfx_autoya_widgets), NULL},
|
||||
{CHORUS_TYPE_YAYA, "YaYa", set_chorusfx_type, chorusfx_yaya_widgets, G_N_ELEMENTS(chorusfx_yaya_widgets), NULL},
|
||||
{CHORUS_TYPE_STEP_FILTER, "Step Filter", set_chorusfx_type, chorusfx_step_filter_widgets, G_N_ELEMENTS(chorusfx_step_filter_widgets), NULL},
|
||||
{CHORUS_TYPE_WHAMMY, "Whammy", set_chorusfx_type, chorusfx_whammy_widgets, G_N_ELEMENTS(chorusfx_whammy_widgets), NULL},
|
||||
{CHORUS_TYPE_PITCH_SHIFT, "Pitch Shift", set_chorusfx_type, chorusfx_pitch_shift_widgets, G_N_ELEMENTS(chorusfx_pitch_shift_widgets), NULL},
|
||||
{CHORUS_TYPE_DETUNE, "Detune", set_chorusfx_type, chorusfx_detune_widgets, G_N_ELEMENTS(chorusfx_detune_widgets), NULL},
|
||||
{CHORUS_TYPE_IPS, "IPS", set_chorusfx_type, chorusfx_ips_widgets, G_N_ELEMENTS(chorusfx_ips_widgets), NULL},
|
||||
};
|
||||
|
||||
static WidgetContainer delay_container[] = {
|
||||
{DELAY_TYPE_ANALOG, "Analog", set_delay_type, delay_analog_widgets, G_N_ELEMENTS(delay_analog_widgets), NULL},
|
||||
{DELAY_TYPE_DIGITAL, "Digital", set_delay_type, delay_digital_widgets, G_N_ELEMENTS(delay_digital_widgets), NULL},
|
||||
{DELAY_TYPE_MODULATED, "Modulated", set_delay_type, delay_modulated_widgets, G_N_ELEMENTS(delay_modulated_widgets), NULL},
|
||||
{DELAY_TYPE_PONG, "Pong", set_delay_type, delay_pong_widgets, G_N_ELEMENTS(delay_pong_widgets), NULL},
|
||||
{DELAY_TYPE_TAPE, "Tape", set_delay_type, delay_tape_widgets, G_N_ELEMENTS(delay_tape_widgets), NULL},
|
||||
};
|
||||
|
||||
static WidgetContainer reverb_container[] = {
|
||||
{REVERB_TYPE_TWIN, "Twin", set_reverb_type, reverb_twin_widgets, G_N_ELEMENTS(reverb_twin_widgets), NULL},
|
||||
{REVERB_TYPE_LEX_AMBIENCE, "Lexicon ambience", set_reverb_type, reverb_lex_ambience_widgets, G_N_ELEMENTS(reverb_lex_ambience_widgets), NULL},
|
||||
{REVERB_TYPE_LEX_STUDIO, "Lexicon studio", set_reverb_type, reverb_lex_studio_widgets, G_N_ELEMENTS(reverb_lex_studio_widgets), NULL},
|
||||
{REVERB_TYPE_LEX_ROOM, "Lexicon room", set_reverb_type, reverb_lex_room_widgets, G_N_ELEMENTS(reverb_lex_room_widgets), NULL},
|
||||
{REVERB_TYPE_LEX_HALL, "Lexicon hall", set_reverb_type, reverb_lex_hall_widgets, G_N_ELEMENTS(reverb_lex_hall_widgets), NULL},
|
||||
{REVERB_TYPE_EMT240_PLATE, "EMT240 Plate", set_reverb_type, reverb_emt240_plate_widgets, G_N_ELEMENTS(reverb_emt240_plate_widgets), NULL},
|
||||
};
|
||||
|
||||
static WidgetContainer eq_container[] = {
|
||||
{-1, NULL, NULL, eq_widgets, G_N_ELEMENTS(eq_widgets), NULL},
|
||||
};
|
||||
|
||||
void combo_box_changed_cb(GtkComboBox *widget, WidgetContainer *widgets)
|
||||
{
|
||||
GtkWidget *child;
|
||||
@@ -451,10 +515,10 @@ void combo_box_changed_cb(GtkComboBox *widget, WidgetContainer *widgets)
|
||||
widgets[x].callback(handle, widgets[x].id);
|
||||
child = g_object_get_data(G_OBJECT(widget), "active_child");
|
||||
if (child != NULL) {
|
||||
gtk_container_remove(GTK_CONTAINER(vbox), child);
|
||||
gtk_container_remove(GTK_CONTAINER(gtk_widget_get_parent(gtk_widget_get_parent(vbox))), child);
|
||||
}
|
||||
gtk_container_add(GTK_CONTAINER(vbox), widgets[x].child);
|
||||
gtk_widget_show_all(vbox);
|
||||
gtk_container_add(GTK_CONTAINER(gtk_widget_get_parent(gtk_widget_get_parent(vbox))), widgets[x].child);
|
||||
gtk_widget_show_all(gtk_widget_get_parent(gtk_widget_get_parent(vbox)));
|
||||
g_object_set_data(G_OBJECT(widget), "active_child", widgets[x].child);
|
||||
}
|
||||
}
|
||||
@@ -476,7 +540,7 @@ GtkWidget *create_widget_container(WidgetContainer *widgets, gint amt)
|
||||
g_signal_connect(G_OBJECT(combo_box), "changed", G_CALLBACK(combo_box_changed_cb), widgets);
|
||||
g_object_set_data(G_OBJECT(combo_box), "vbox", vbox);
|
||||
}
|
||||
gtk_combo_box_append_text(combo_box, widgets[x].label);
|
||||
gtk_combo_box_append_text(GTK_COMBO_BOX(combo_box), widgets[x].label);
|
||||
}
|
||||
widget = create_table(widgets[x].widgets, widgets[x].widgets_amt);
|
||||
widgets[x].child = widget;
|
||||
@@ -505,22 +569,50 @@ static VBoxWidget comp_vbox[] = {
|
||||
{"Compressor", FALSE, set_comp_on_off, comp_container, G_N_ELEMENTS(comp_container)},
|
||||
};
|
||||
|
||||
static VBoxWidget dist_vbox[] = {
|
||||
{"Distortion", FALSE, set_dist_on_off, dist_container, G_N_ELEMENTS(dist_container)},
|
||||
};
|
||||
|
||||
static VBoxWidget noisegate_vbox[] = {
|
||||
{"Noisegate", FALSE, set_noisegate_on_off, noisegate_container, G_N_ELEMENTS(noisegate_container)},
|
||||
};
|
||||
|
||||
static VBoxWidget chorusfx_vbox[] = {
|
||||
{"Chorus/FX", FALSE, set_chorusfx_on_off, chorusfx_container, G_N_ELEMENTS(chorusfx_container)},
|
||||
};
|
||||
|
||||
static VBoxWidget delay_vbox[] = {
|
||||
{"Delay", FALSE, set_delay_on_off, delay_container, G_N_ELEMENTS(delay_container)},
|
||||
};
|
||||
|
||||
static VBoxWidget reverb_vbox[] = {
|
||||
{"Reverb", FALSE, set_reverb_on_off, reverb_container, G_N_ELEMENTS(reverb_container)},
|
||||
};
|
||||
|
||||
static VBoxWidget eq_vbox[] = {
|
||||
{"EQ", FALSE, set_eq_on_off, eq_container, G_N_ELEMENTS(eq_container)},
|
||||
};
|
||||
|
||||
GtkWidget *create_vbox(VBoxWidget *widgets, gint amt)
|
||||
{
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *widget;
|
||||
GtkWidget *table;
|
||||
int x;
|
||||
|
||||
vbox = gtk_vbox_new(FALSE, 0);
|
||||
hbox = gtk_hbox_new(FALSE, 0);
|
||||
|
||||
for (x = 0; x<amt; x++) {
|
||||
widget = create_on_off_button(widgets[x].label, widgets[x].value, widgets[x].callback);
|
||||
gtk_container_add(GTK_CONTAINER(vbox), widget);
|
||||
gtk_container_add(GTK_CONTAINER(hbox), widget);
|
||||
|
||||
table = create_widget_container(widgets[x].widgets, widgets[x].widgets_amt);
|
||||
gtk_container_add(GTK_CONTAINER(vbox), table);
|
||||
gtk_container_add(GTK_CONTAINER(hbox), table);
|
||||
}
|
||||
|
||||
gtk_container_add(GTK_CONTAINER(vbox), hbox);
|
||||
return vbox;
|
||||
}
|
||||
|
||||
@@ -532,22 +624,35 @@ typedef struct {
|
||||
static VBoxes vboxes[] = {
|
||||
{wah_vbox, G_N_ELEMENTS(wah_vbox)},
|
||||
{comp_vbox, G_N_ELEMENTS(comp_vbox)},
|
||||
{dist_vbox, G_N_ELEMENTS(dist_vbox)},
|
||||
{noisegate_vbox, G_N_ELEMENTS(noisegate_vbox)},
|
||||
{chorusfx_vbox, G_N_ELEMENTS(chorusfx_vbox)},
|
||||
{delay_vbox, G_N_ELEMENTS(delay_vbox)},
|
||||
{reverb_vbox, G_N_ELEMENTS(reverb_vbox)},
|
||||
{eq_vbox, G_N_ELEMENTS(eq_vbox)},
|
||||
};
|
||||
|
||||
void create_window()
|
||||
{
|
||||
GtkWidget *window;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *widget;
|
||||
gint x, amt;
|
||||
|
||||
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
|
||||
hbox = gtk_hbox_new(FALSE, 0);
|
||||
vbox = gtk_vbox_new(FALSE, 0);
|
||||
gtk_container_add(GTK_CONTAINER(window), vbox);
|
||||
gtk_container_add(GTK_CONTAINER(hbox), vbox);
|
||||
gtk_container_add(GTK_CONTAINER(window), hbox);
|
||||
|
||||
amt = G_N_ELEMENTS(vboxes);
|
||||
for (x = 0; x<amt; x++) {
|
||||
if ((x % 4) == 0) {
|
||||
vbox = gtk_vbox_new(FALSE, 0);
|
||||
gtk_container_add(GTK_CONTAINER(hbox), vbox);
|
||||
}
|
||||
widget = create_vbox(vboxes[x].widget, vboxes[x].amt);
|
||||
gtk_container_add(GTK_CONTAINER(vbox), widget);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user