Implement the LFO1 and LFO2 effects.
For now, this is just for rp355, though the code should work for other
devices with minimal modification.
1) The EffectValues for values_*_assign need to be VALUE_TYPE_POSID.
2) Disabmiguate "Delay Tape" for a couple of EffectSettings. This fixed
some bugs in the creation of the global modifier group.
3) Remove #if 0's around the definition of the lfo2_settings.
4) Define proper lfo1 and lfo2 groups arrays.
5) Define the lfo2_effect[] array.
6) Add the lfo1 and lfo2 effects to the rp355_effects array.
7) Disambiguate "EQ B" from "Eq" for some effedts in the modifiers array.
8) In push_message(), after we receive the RECEIVE_MODIFIER_LINKABLE_LIST
message, kick off the creation of the EXP, LFO1, and LFO2 effects.
9) Generalize the function used for the pedal1_assign effect and make it work
for lfo1 and lfo2 as well. Convert printf's to debug_msg().
10) Since we're destroying the association of the grid with the placeholder
combo box entry, steal the data so the child widget isn't destroyed.
11) Silence warning on exit about 0 unread messages in queue.
This commit is contained in:
62
gui.c
62
gui.c
@@ -22,6 +22,7 @@
|
||||
#include "effects.h"
|
||||
#include "preset.h"
|
||||
#include "gtkknob.h"
|
||||
#include "gdigi_xml.h"
|
||||
|
||||
|
||||
static gchar* MessageID_names[] = {
|
||||
@@ -370,8 +371,9 @@ static void apply_widget_setting(WidgetTreeElem *el, SettingParam *param)
|
||||
else if (GTK_IS_ADJUSTMENT(el->widget))
|
||||
gtk_adjustment_set_value(GTK_ADJUSTMENT(el->widget), (gdouble)param->value);
|
||||
} else { /* combo box */
|
||||
if (el->value == param->value)
|
||||
if (el->value == param->value) {
|
||||
gtk_combo_box_set_active(GTK_COMBO_BOX(el->widget), el->x);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -538,8 +540,9 @@ void effect_settings_group_free(EffectSettingsGroup *group)
|
||||
{
|
||||
if (group->child != NULL) {
|
||||
/* destroy widget without parent */
|
||||
if (gtk_widget_get_parent(group->child) == NULL)
|
||||
if (gtk_widget_get_parent(group->child) == NULL) {
|
||||
gtk_widget_destroy(group->child);
|
||||
}
|
||||
|
||||
g_object_unref(group->child);
|
||||
}
|
||||
@@ -656,58 +659,85 @@ GtkWidget *create_widget_container(EffectGroup *group, gint amt, gint id, gint p
|
||||
return vbox;
|
||||
}
|
||||
|
||||
/* This should take ID and POSITION of Pedal1Assign, LFO1, or LFO2 */
|
||||
/**
|
||||
* Given a linkable effect, build the combo box for the linkable parameters.
|
||||
*
|
||||
* @param[in] pos Position
|
||||
* @param[in] id Id
|
||||
*/
|
||||
void
|
||||
create_pedal1_assign (void)
|
||||
create_modifier_group (guint pos, guint id)
|
||||
{
|
||||
guint i;
|
||||
gpointer key;
|
||||
WidgetTreeElem *el;
|
||||
GList *list;
|
||||
EffectSettingsGroup *settings = NULL;
|
||||
EffectSettingsGroup *settings = NULL, *orig_settings = NULL;
|
||||
GObject *AssignComboBox;
|
||||
GtkWidget *child_widget = NULL;
|
||||
gchar *name = NULL;
|
||||
|
||||
key = GINT_TO_POINTER(EXP_ASSIGN1| (EXP_POSITION << 16));
|
||||
debug_msg(DEBUG_GROUP, "Building modifier group for position %d id %d \"%s\"",
|
||||
pos, id, get_xml_settings(id, pos)->label);
|
||||
|
||||
key = GINT_TO_POINTER((pos << 16) | id);
|
||||
list = g_tree_lookup(widget_tree, key);
|
||||
if (!list) {
|
||||
printf("NO PEDAL ASSIGN COMBO BOX!\n");
|
||||
g_warning("No widget tree entry for position %d id %d!\n",
|
||||
pos, id);
|
||||
return;
|
||||
}
|
||||
|
||||
/* The only element should be the one with the placeholder. */
|
||||
el = g_list_nth_data(list, 0);
|
||||
if (!el) {
|
||||
printf("NO LIST\n");
|
||||
g_warning("No effect settings group for position %d id %d!\n",
|
||||
pos, id);
|
||||
return;
|
||||
}
|
||||
|
||||
AssignComboBox = GTK_COMBO_BOX(el->widget);
|
||||
AssignComboBox = el->widget;
|
||||
|
||||
name = g_strdup_printf("SettingsGroup%d", 0);
|
||||
orig_settings = g_object_get_data(G_OBJECT(AssignComboBox), name);
|
||||
if (orig_settings) {
|
||||
child_widget = orig_settings->child;
|
||||
/* Steal the data so we don't trigger the destroy method on the grid. */
|
||||
g_object_steal_data(AssignComboBox, name);
|
||||
}
|
||||
/* Remove the placeholder. */
|
||||
gtk_combo_box_text_remove(GTK_COMBO_BOX_TEXT(AssignComboBox), 0);
|
||||
|
||||
|
||||
for (i = 0; i < ModifierLinkableList->group_amt; i++) {
|
||||
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(AssignComboBox),
|
||||
NULL,
|
||||
ModifierLinkableList->group[i].label);
|
||||
|
||||
printf("Added label %s\n", ModifierLinkableList->group[i].label);
|
||||
|
||||
settings = g_slice_new(EffectSettingsGroup);
|
||||
settings->id = EXP_ASSIGN1;
|
||||
settings->type = ModifierLinkableList->group[i].type;
|
||||
settings->position = EXP_POSITION;
|
||||
settings->id = id;
|
||||
settings->position = pos;
|
||||
settings->child = NULL;
|
||||
if (child_widget) {
|
||||
settings->child = child_widget;
|
||||
g_object_ref_sink(settings->child);
|
||||
}
|
||||
|
||||
name = g_strdup_printf("SettingsGroup%d", i);
|
||||
|
||||
widget_tree_add(G_OBJECT(AssignComboBox), EXP_ASSIGN1, EXP_POSITION,
|
||||
debug_msg(DEBUG_GROUP, "%d: \"%s\"",
|
||||
i,
|
||||
ModifierLinkableList->group[i].label);
|
||||
|
||||
widget_tree_add(G_OBJECT(AssignComboBox), id, pos,
|
||||
ModifierLinkableList->group[i].type, i);
|
||||
g_object_set_data_full(G_OBJECT(AssignComboBox), name, settings,
|
||||
((GDestroyNotify)effect_settings_group_free));
|
||||
}
|
||||
|
||||
// Get the current setting.
|
||||
get_option(EXP_ASSIGN1,EXP_POSITION);
|
||||
get_option(id, pos);
|
||||
}
|
||||
|
||||
|
||||
@@ -1168,8 +1198,6 @@ static void action_save_preset_cb(GtkAction *action)
|
||||
GError *error = NULL;
|
||||
gchar *filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
|
||||
|
||||
|
||||
|
||||
if (error) {
|
||||
show_error_message(window, error->message);
|
||||
g_error_free(error);
|
||||
|
||||
Reference in New Issue
Block a user