Add proper min/max settings to pedal assign effect.
1) Delete definition of pedal1_assign_settings since it should be calculated at runtime from the modifier list. 2) Delete the pedal1_assign_settings EffectSetting from rp355_pedal1_assign_group. 3) Add "None" entries to the tone_lib_group[] and effect_lib_group[]. Otherwise, once a library tone or effect is selected, it can't be deselected. 4) Fix up some tracing of effect values that was displaying incorrect values. 5) Change 'update_modifier_combo_box()' to 'update_modifier_vbox()' and for the expression pedal let it handle instantiating per combo box entry settings. 6) Don't forget to free the links we remove from the list when we're cleaning the combo box. If there are per-combo box entry settings, free them using the usual destructor. 7) Poll the device for the appropriate settings for EXP_MIN/MAX after we we update the modifier list.
This commit is contained in:
@@ -1575,11 +1575,6 @@ static EffectSettings gnx3k_reverb_settings[] = {
|
|||||||
{"Level", REVERB_LEVEL, REVERB_POSITION, &values_0_to_99},
|
{"Level", REVERB_LEVEL, REVERB_POSITION, &values_0_to_99},
|
||||||
};
|
};
|
||||||
|
|
||||||
static EffectSettings pedal1_assign_settings[] = {
|
|
||||||
{"Pedal Min 1", EXP_MIN, EXP_POSITION, &values_0_to_99,},
|
|
||||||
{"Pedal Max 1", EXP_MAX, EXP_POSITION, &values_0_to_99,},
|
|
||||||
};
|
|
||||||
|
|
||||||
static EffectSettings lfo1_settings[] = {
|
static EffectSettings lfo1_settings[] = {
|
||||||
{"Heel", LFO_MIN, LFO1_POSITION, &values_0_to_99},
|
{"Heel", LFO_MIN, LFO1_POSITION, &values_0_to_99},
|
||||||
{"Toe", LFO_MAX, LFO1_POSITION, &values_0_to_99},
|
{"Toe", LFO_MAX, LFO1_POSITION, &values_0_to_99},
|
||||||
@@ -1974,7 +1969,6 @@ static EffectGroup rp355_chorusfx_group[] = {
|
|||||||
* effect changes.
|
* effect changes.
|
||||||
*/
|
*/
|
||||||
static EffectGroup rp355_pedal1_assign_group[] = {
|
static EffectGroup rp355_pedal1_assign_group[] = {
|
||||||
{ 0, NULL, pedal1_assign_settings, G_N_ELEMENTS(pedal1_assign_settings)},
|
|
||||||
{ 0, "None", NULL, 0},
|
{ 0, "None", NULL, 0},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -2676,6 +2670,7 @@ static EffectGroup gnx3k_ch2_amp_eq_group[] = {
|
|||||||
|
|
||||||
/* LIBRARY_TONE, LIBRARY_POSITION */
|
/* LIBRARY_TONE, LIBRARY_POSITION */
|
||||||
static EffectGroup tone_lib_group[] = {
|
static EffectGroup tone_lib_group[] = {
|
||||||
|
{TONE_LIB_CUSTOM, "None", NULL, -1},
|
||||||
{TONE_LIB_OVERDRIVE, "Overdrive", NULL, -1},
|
{TONE_LIB_OVERDRIVE, "Overdrive", NULL, -1},
|
||||||
{TONE_LIB_ROCK1, "Rock 1", NULL, -1},
|
{TONE_LIB_ROCK1, "Rock 1", NULL, -1},
|
||||||
{TONE_LIB_ROCK2, "Rock 2", NULL, -1},
|
{TONE_LIB_ROCK2, "Rock 2", NULL, -1},
|
||||||
@@ -2710,6 +2705,7 @@ static EffectGroup tone_lib_group[] = {
|
|||||||
|
|
||||||
/* LIBRARY_EFFECTS, LIBRARY_POSITION */
|
/* LIBRARY_EFFECTS, LIBRARY_POSITION */
|
||||||
static EffectGroup effects_lib_group[] = {
|
static EffectGroup effects_lib_group[] = {
|
||||||
|
{EFFECTS_LIB_CUSTOM, "None", NULL, -1},
|
||||||
{EFFECTS_LIB_CHORUS, "Chorus", NULL, -1},
|
{EFFECTS_LIB_CHORUS, "Chorus", NULL, -1},
|
||||||
{EFFECTS_LIB_PHASER, "Phaser", NULL, -1},
|
{EFFECTS_LIB_PHASER, "Phaser", NULL, -1},
|
||||||
{EFFECTS_LIB_FLANGER, "Flanger", NULL, -1},
|
{EFFECTS_LIB_FLANGER, "Flanger", NULL, -1},
|
||||||
|
|||||||
4
gdigi.c
4
gdigi.c
@@ -154,10 +154,10 @@ format_value (XmlSettings *xml, guint value)
|
|||||||
case VALUE_TYPE_PLAIN:
|
case VALUE_TYPE_PLAIN:
|
||||||
{
|
{
|
||||||
if (decimal) {
|
if (decimal) {
|
||||||
double dvalue = (value + offset) * step;
|
double dvalue = ((gint)value + offset) * step;
|
||||||
g_string_printf(buf, "%0.2f%s", dvalue, suffix);
|
g_string_printf(buf, "%0.2f%s", dvalue, suffix);
|
||||||
} else {
|
} else {
|
||||||
gint ivalue = (value + offset) * step;
|
gint ivalue = ((gint)value + offset) * step;
|
||||||
g_string_printf(buf, "%d%s", ivalue, suffix);
|
g_string_printf(buf, "%d%s", ivalue, suffix);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
46
gui.c
46
gui.c
@@ -681,14 +681,24 @@ GtkWidget *create_widget_container(EffectGroup *group, gint amt, gint id, gint p
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Populate a combo box with text entries from the modifier group.
|
* Populate the vbox for an effect dependent on the modifier list.
|
||||||
|
*
|
||||||
|
* \param vbox The vbox for the effect.
|
||||||
|
* \param combo_box The combo box to repopulate.
|
||||||
|
* \param id The id of the effect.
|
||||||
|
* \param position The position of the effect.
|
||||||
*/
|
*/
|
||||||
void update_modifier_combo_box(GObject *combo_box, gint id, gint position)
|
static void update_modifier_vbox(GtkWidget *vbox, GObject *combo_box, gint id, gint position)
|
||||||
{
|
{
|
||||||
gint x;
|
gint x;
|
||||||
EffectSettingsGroup *settings = NULL;
|
EffectSettingsGroup *settings = NULL;
|
||||||
EffectGroup *group = get_modifier_group();
|
EffectGroup *group = get_modifier_group();
|
||||||
guint amt = get_modifier_amt();
|
guint amt = get_modifier_amt();
|
||||||
|
GtkWidget *child = NULL;
|
||||||
|
GHashTable *widget_table;
|
||||||
|
guint needs_settings = (position == EXP_POSITION);
|
||||||
|
|
||||||
|
widget_table = g_hash_table_new(g_direct_hash, g_direct_equal);
|
||||||
|
|
||||||
for (x = 0; x<amt; x++) {
|
for (x = 0; x<amt; x++) {
|
||||||
gchar *name;
|
gchar *name;
|
||||||
@@ -698,7 +708,17 @@ void update_modifier_combo_box(GObject *combo_box, gint id, gint position)
|
|||||||
settings->id = id;
|
settings->id = id;
|
||||||
settings->type = group[x].type;
|
settings->type = group[x].type;
|
||||||
settings->position = position;
|
settings->position = position;
|
||||||
|
|
||||||
|
if (needs_settings) {
|
||||||
|
/* EXP_ASSIGN has unique settings per combo box entry. */
|
||||||
|
child = create_grid(group[x].settings, group[x].settings_amt,
|
||||||
|
widget_table);
|
||||||
|
g_object_ref_sink(child);
|
||||||
|
settings->child = child;
|
||||||
|
} else {
|
||||||
|
/* LFO has one settings group.*/
|
||||||
settings->child = NULL;
|
settings->child = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
name = g_strdup_printf("SettingsGroup%d", x);
|
name = g_strdup_printf("SettingsGroup%d", x);
|
||||||
g_object_set_data(G_OBJECT(combo_box), name, settings);
|
g_object_set_data(G_OBJECT(combo_box), name, settings);
|
||||||
@@ -708,12 +728,14 @@ void update_modifier_combo_box(GObject *combo_box, gint id, gint position)
|
|||||||
widget_tree_add(combo_box, id, position, group[x].type, x);
|
widget_tree_add(combo_box, id, position, group[x].type, x);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_hash_table_destroy(widget_table);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void widget_tree_elem_free(GList *);
|
static void widget_tree_elem_free(GList *);
|
||||||
|
|
||||||
static void clean_modifier_combo_box (GObject *combo_box, GList *list)
|
static void clean_modifier_combo_box(GObject *combo_box, GList *list)
|
||||||
{
|
{
|
||||||
EffectSettingsGroup *settings = NULL;
|
EffectSettingsGroup *settings = NULL;
|
||||||
WidgetTreeElem *el;
|
WidgetTreeElem *el;
|
||||||
@@ -726,17 +748,20 @@ static void clean_modifier_combo_box (GObject *combo_box, GList *list)
|
|||||||
next = link->next;
|
next = link->next;
|
||||||
el = link->data;
|
el = link->data;
|
||||||
if (el->value != -1) {
|
if (el->value != -1) {
|
||||||
/* Useless assignment, but silences compiler warning. */
|
|
||||||
link = g_list_remove_link(list, link);
|
link = g_list_remove_link(list, link);
|
||||||
|
|
||||||
g_assert(combo_box == el->widget);
|
g_assert(combo_box == el->widget);
|
||||||
name = g_strdup_printf("SettingsGroup%d", el->x);
|
name = g_strdup_printf("SettingsGroup%d", el->x);
|
||||||
settings = g_object_steal_data(G_OBJECT(combo_box), name);
|
settings = g_object_steal_data(G_OBJECT(combo_box), name);
|
||||||
|
|
||||||
g_free(name);
|
if (settings) {
|
||||||
g_slice_free(EffectSettingsGroup, settings);
|
effect_settings_group_free(settings);
|
||||||
g_slice_free(WidgetTreeElem, el);
|
|
||||||
}
|
}
|
||||||
|
g_free(name);
|
||||||
|
g_slice_free(WidgetTreeElem, el);
|
||||||
|
g_list_free_1(link);
|
||||||
|
}
|
||||||
|
|
||||||
link = next;
|
link = next;
|
||||||
}
|
}
|
||||||
gtk_combo_box_text_remove_all(GTK_COMBO_BOX_TEXT(combo_box));
|
gtk_combo_box_text_remove_all(GTK_COMBO_BOX_TEXT(combo_box));
|
||||||
@@ -790,9 +815,14 @@ create_modifier_group (guint pos, guint id)
|
|||||||
|
|
||||||
clean_modifier_combo_box(modifier_combo_box, list);
|
clean_modifier_combo_box(modifier_combo_box, list);
|
||||||
|
|
||||||
update_modifier_combo_box(modifier_combo_box, id, pos);
|
update_modifier_vbox(vbox, modifier_combo_box, id, pos);
|
||||||
|
|
||||||
get_option(id, pos);
|
get_option(id, pos);
|
||||||
|
|
||||||
|
if (pos == EXP_POSITION) {
|
||||||
|
get_option(EXP_MIN, EXP_POSITION);
|
||||||
|
get_option(EXP_MAX, EXP_POSITION);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user