add compability mode dialog
This commit is contained in:
1
TODO
1
TODO
@@ -4,3 +4,4 @@
|
|||||||
-buildsystem (install knob.png to share dir, don't use inline knob pixbuf)
|
-buildsystem (install knob.png to share dir, don't use inline knob pixbuf)
|
||||||
-add expression pedal settings to gui
|
-add expression pedal settings to gui
|
||||||
-read asynchronously from MIDI IN
|
-read asynchronously from MIDI IN
|
||||||
|
-guess device port when user doesn't explicitly provide it (don't use hardcoded "hw:1,0,0")
|
||||||
|
|||||||
23
effects.c
23
effects.c
@@ -1262,7 +1262,7 @@ static Effect rp500_eq_effect[] = {
|
|||||||
{"Enable Equalizer", EQ_ON_OFF, EQ_POSITION, rp500_eq_group, G_N_ELEMENTS(rp500_eq_group)},
|
{"Enable Equalizer", EQ_ON_OFF, EQ_POSITION, rp500_eq_group, G_N_ELEMENTS(rp500_eq_group)},
|
||||||
};
|
};
|
||||||
|
|
||||||
EffectList rp250_effects[] = {
|
static EffectList rp250_effects[] = {
|
||||||
{"Wah", wah_effect, G_N_ELEMENTS(wah_effect)},
|
{"Wah", wah_effect, G_N_ELEMENTS(wah_effect)},
|
||||||
{"Amplifier", rp250_amp_effect, G_N_ELEMENTS(rp250_amp_effect)},
|
{"Amplifier", rp250_amp_effect, G_N_ELEMENTS(rp250_amp_effect)},
|
||||||
{"Equalizer", rp250_eq_effect, G_N_ELEMENTS(rp250_eq_effect)},
|
{"Equalizer", rp250_eq_effect, G_N_ELEMENTS(rp250_eq_effect)},
|
||||||
@@ -1274,9 +1274,9 @@ EffectList rp250_effects[] = {
|
|||||||
{"Reverb", reverb_effect, G_N_ELEMENTS(reverb_effect)},
|
{"Reverb", reverb_effect, G_N_ELEMENTS(reverb_effect)},
|
||||||
};
|
};
|
||||||
|
|
||||||
int n_rp250_effects = G_N_ELEMENTS(rp250_effects);
|
static int n_rp250_effects = G_N_ELEMENTS(rp250_effects);
|
||||||
|
|
||||||
EffectList rp500_effects[] = {
|
static EffectList rp500_effects[] = {
|
||||||
{"Wah", wah_effect, G_N_ELEMENTS(wah_effect)},
|
{"Wah", wah_effect, G_N_ELEMENTS(wah_effect)},
|
||||||
{"Amplifier", rp500_amp_effect, G_N_ELEMENTS(rp500_amp_effect)},
|
{"Amplifier", rp500_amp_effect, G_N_ELEMENTS(rp500_amp_effect)},
|
||||||
{"Equalizer", rp500_eq_effect, G_N_ELEMENTS(rp500_eq_effect)},
|
{"Equalizer", rp500_eq_effect, G_N_ELEMENTS(rp500_eq_effect)},
|
||||||
@@ -1288,7 +1288,14 @@ EffectList rp500_effects[] = {
|
|||||||
{"Reverb", reverb_effect, G_N_ELEMENTS(reverb_effect)},
|
{"Reverb", reverb_effect, G_N_ELEMENTS(reverb_effect)},
|
||||||
};
|
};
|
||||||
|
|
||||||
int n_rp500_effects = G_N_ELEMENTS(rp500_effects);
|
static int n_rp500_effects = G_N_ELEMENTS(rp500_effects);
|
||||||
|
|
||||||
|
SupportedDevices supported_devices[] = {
|
||||||
|
{"DigiTech RP250", rp250_effects, G_N_ELEMENTS(rp250_effects)},
|
||||||
|
{"DigiTech RP500", rp500_effects, G_N_ELEMENTS(rp500_effects)},
|
||||||
|
};
|
||||||
|
|
||||||
|
int n_supported_devices = G_N_ELEMENTS(supported_devices);
|
||||||
|
|
||||||
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
|
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
|
||||||
|
|
||||||
@@ -1598,13 +1605,11 @@ gboolean get_effect_list(unsigned char device_id, unsigned char family_id,
|
|||||||
*n_list = n_rp500_effects;
|
*n_list = n_rp500_effects;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
default:
|
default:
|
||||||
g_warning("Unsupported RP model. Using RP250-compability mode!");
|
g_message("Unsupported RP model!");
|
||||||
*list = rp250_effects;
|
return FALSE;
|
||||||
*n_list = n_rp250_effects;
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
g_error("Unsupported device family!");
|
g_message("Unsupported device family!");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,6 +60,12 @@ typedef struct {
|
|||||||
gint group_amt;
|
gint group_amt;
|
||||||
} ModifierGroup;
|
} ModifierGroup;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
gchar *name;
|
||||||
|
EffectList *list;
|
||||||
|
int n_list;
|
||||||
|
} SupportedDevices;
|
||||||
|
|
||||||
ModifierGroup *modifier_linkable_list();
|
ModifierGroup *modifier_linkable_list();
|
||||||
void modifier_group_free(ModifierGroup *modifier_group);
|
void modifier_group_free(ModifierGroup *modifier_group);
|
||||||
gboolean get_effect_list(unsigned char device_id, unsigned char family_id,
|
gboolean get_effect_list(unsigned char device_id, unsigned char family_id,
|
||||||
|
|||||||
13
gdigi.c
13
gdigi.c
@@ -566,11 +566,16 @@ int main(int argc, char *argv[]) {
|
|||||||
if (request_who_am_i(&device_id, &family_id, &product_id) == FALSE) {
|
if (request_who_am_i(&device_id, &family_id, &product_id) == FALSE) {
|
||||||
show_error_message(NULL, "No suitable reply from device");
|
show_error_message(NULL, "No suitable reply from device");
|
||||||
} else {
|
} else {
|
||||||
EffectList *list;
|
EffectList *list = NULL;
|
||||||
int n_list;
|
int n_list = -1;
|
||||||
|
|
||||||
if (get_effect_list(device_id, family_id, product_id, &list, &n_list) == FALSE) {
|
if (get_effect_list(device_id, family_id, product_id, &list, &n_list) == FALSE) {
|
||||||
show_error_message(NULL, "Unsupported hardware. Please check HACKING file.");
|
if (unsupported_device_dialog(&list, &n_list) == FALSE) {
|
||||||
} else {
|
g_message("Shutting down");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (list != NULL && n_list != -1) {
|
||||||
gui_create(list, n_list);
|
gui_create(list, n_list);
|
||||||
gtk_main();
|
gtk_main();
|
||||||
gui_free();
|
gui_free();
|
||||||
|
|||||||
61
gui.c
61
gui.c
@@ -22,13 +22,6 @@
|
|||||||
#include "gtkknob.h"
|
#include "gtkknob.h"
|
||||||
#include "knob.h"
|
#include "knob.h"
|
||||||
|
|
||||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
|
||||||
|
|
||||||
extern EffectList effects[];
|
|
||||||
extern int n_effects;
|
|
||||||
|
|
||||||
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
GtkObject *widget;
|
GtkObject *widget;
|
||||||
gint id;
|
gint id;
|
||||||
@@ -908,3 +901,57 @@ void gui_free()
|
|||||||
gtk_knob_animation_free(knob_anim);
|
gtk_knob_animation_free(knob_anim);
|
||||||
knob_anim = NULL;
|
knob_anim = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \param list Variable to hold effect list
|
||||||
|
* \param n_list Variable to hold length of effect list
|
||||||
|
*
|
||||||
|
* Displays dialogbox stating that device is unsupported.
|
||||||
|
*
|
||||||
|
* \return TRUE if user selects "compability mode", otherwise FALSE.
|
||||||
|
**/
|
||||||
|
gboolean unsupported_device_dialog(EffectList **list, int *n_list)
|
||||||
|
{
|
||||||
|
extern SupportedDevices supported_devices[];
|
||||||
|
extern int n_supported_devices;
|
||||||
|
|
||||||
|
GtkWidget *dialog;
|
||||||
|
GtkWidget *label;
|
||||||
|
GtkWidget *combo_box;
|
||||||
|
int x;
|
||||||
|
|
||||||
|
dialog = gtk_dialog_new_with_buttons("Unsupported device",
|
||||||
|
NULL, GTK_DIALOG_MODAL,
|
||||||
|
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||||
|
GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
|
||||||
|
label = gtk_label_new("Your device appears to be unsupported by gdigi.\n"
|
||||||
|
"As some of the settings may be common between different devices,\n"
|
||||||
|
"you can now select compability mode with one of the supported devices.\n"
|
||||||
|
"Please take a look at gdigi's HACKING file.");
|
||||||
|
gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), label);
|
||||||
|
|
||||||
|
combo_box = gtk_combo_box_new_text();
|
||||||
|
for (x=0; x<n_supported_devices; x++) {
|
||||||
|
gtk_combo_box_append_text(GTK_COMBO_BOX(combo_box), supported_devices[x].name);
|
||||||
|
}
|
||||||
|
|
||||||
|
gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), combo_box);
|
||||||
|
|
||||||
|
gtk_widget_show_all(GTK_DIALOG(dialog)->vbox);
|
||||||
|
if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) {
|
||||||
|
gint number = gtk_combo_box_get_active(GTK_COMBO_BOX(combo_box));
|
||||||
|
if (number != -1 && number <n_supported_devices) {
|
||||||
|
g_message("Starting %s compability mode", supported_devices[number].name);
|
||||||
|
*list = supported_devices[number].list;
|
||||||
|
*n_list = supported_devices[number].n_list;
|
||||||
|
gtk_widget_destroy(dialog);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
gtk_widget_destroy(dialog);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|||||||
2
gui.h
2
gui.h
@@ -17,10 +17,12 @@
|
|||||||
#ifndef GDIGI_GUI_H
|
#ifndef GDIGI_GUI_H
|
||||||
#define GDIGI_GUI_H
|
#define GDIGI_GUI_H
|
||||||
|
|
||||||
|
#include <glib.h>
|
||||||
#include "effects.h"
|
#include "effects.h"
|
||||||
|
|
||||||
void show_error_message(GtkWidget *parent, gchar *message);
|
void show_error_message(GtkWidget *parent, gchar *message);
|
||||||
void gui_create(EffectList *list, int n_list);
|
void gui_create(EffectList *list, int n_list);
|
||||||
void gui_free();
|
void gui_free();
|
||||||
|
gboolean unsupported_device_dialog(EffectList **list, int *n_list);
|
||||||
|
|
||||||
#endif /* GDIGI_GUI_H */
|
#endif /* GDIGI_GUI_H */
|
||||||
|
|||||||
Reference in New Issue
Block a user