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:
59
effects.c
59
effects.c
@@ -652,13 +652,13 @@ static EffectValues values_exp_assign = {
|
||||
};
|
||||
|
||||
static EffectValues values_vswitch_pedal_assign = {
|
||||
.min = 0.0, .max = 1.0,
|
||||
.type = VALUE_TYPE_LABEL,
|
||||
.min = 0.0, .max = 0x7fffffff,
|
||||
.type = VALUE_TYPE_POSID,
|
||||
};
|
||||
|
||||
static EffectValues values_vswitch_assign = {
|
||||
.min = 0.0, .max = 1.0,
|
||||
.type = VALUE_TYPE_LABEL,
|
||||
.min = 0.0, .max = 0x7fffffff,
|
||||
.type = VALUE_TYPE_POSID,
|
||||
};
|
||||
|
||||
static EffectValues values_vswitch_type = {
|
||||
@@ -667,8 +667,8 @@ static EffectValues values_vswitch_type = {
|
||||
};
|
||||
|
||||
static EffectValues values_lfo_assign = {
|
||||
.min = 0.0, .max = 1.0,
|
||||
.type = VALUE_TYPE_LABEL,
|
||||
.min = 0.0, .max = 0x7fffffff,
|
||||
.type = VALUE_TYPE_POSID,
|
||||
};
|
||||
|
||||
static EffectValues values_lfo_none = {
|
||||
@@ -1489,7 +1489,7 @@ static EffectSettings delay_tape_settings[] = {
|
||||
{"Time", DELAY_TIME, DELAY_POSITION, &values_delay_time},
|
||||
{"Level", DELAY_LEVEL, DELAY_POSITION, &values_0_to_99},
|
||||
{"Repeats", DELAY_REPEATS, DELAY_POSITION, &values_delay_repeats},
|
||||
{"Wow", DELAY_TAPE_WOW, DELAY_POSITION, &values_0_to_99},
|
||||
{"Delay Tape Wow", DELAY_TAPE_WOW, DELAY_POSITION, &values_0_to_99},
|
||||
{"Flutter", DELAY_TAPE_FLUTTER, DELAY_POSITION, &values_0_to_99},
|
||||
};
|
||||
|
||||
@@ -1550,8 +1550,8 @@ static EffectSettings rp500_delay_tape_settings[] = {
|
||||
{"Tap Time", DELAY_TAP_TIME_0_4990, DELAY_POSITION, &values_delay_time_0_4990},
|
||||
{"Repeats", DELAY_REPEATS, DELAY_POSITION, &values_delay_repeats},
|
||||
{"Level", DELAY_LEVEL, DELAY_POSITION, &values_0_to_99},
|
||||
{"Tape Wow", DELAY_TAPE_WOW, DELAY_POSITION, &values_0_to_99},
|
||||
{"Tape Flutter", DELAY_TAPE_FLUTTER, DELAY_POSITION, &values_0_to_99},
|
||||
{"Delay Tape Wow", DELAY_TAPE_WOW, DELAY_POSITION, &values_0_to_99},
|
||||
{"Delay Tape Flutter", DELAY_TAPE_FLUTTER, DELAY_POSITION, &values_0_to_99},
|
||||
};
|
||||
|
||||
static EffectSettings rp1000_delay_lo_fi_settings[] = {
|
||||
@@ -1586,14 +1586,12 @@ static EffectSettings lfo1_settings[] = {
|
||||
{"Speed(HZ)", LFO_SPEED, LFO1_POSITION, &values_lfo_speed},
|
||||
};
|
||||
|
||||
#if 0
|
||||
static EffectSettings lfo2_settings[] = {
|
||||
{"Heel", LFO_MIN, REVERB_POSITION, &values_0_to_99},
|
||||
{"Toe", LFO_MAX, REVERB_POSITION, &values_0_to_99},
|
||||
{"Waveform", LFO_WAVEFORM, REVERB_POSITION, &values_waveform},
|
||||
{"Speed(HZ)", LFO_SPEED, REVERB_POSITION, &values_lfo_speed},
|
||||
{"Heel", LFO_MIN, LFO2_POSITION, &values_0_to_99},
|
||||
{"Toe", LFO_MAX, LFO2_POSITION, &values_0_to_99},
|
||||
{"Waveform", LFO_WAVEFORM, LFO2_POSITION, &values_waveform},
|
||||
{"Speed(HZ)", LFO_SPEED, LFO2_POSITION, &values_lfo_speed},
|
||||
};
|
||||
#endif
|
||||
|
||||
static EffectSettings reverb_lex_settings[] = {
|
||||
{"Predelay", REVERB_PREDELAY, REVERB_POSITION, &values_0_to_15},
|
||||
@@ -1958,16 +1956,12 @@ static EffectGroup rp355_pedal1_assign_group[] = {
|
||||
{ 0, "Placeholder", NULL, 0},
|
||||
};
|
||||
|
||||
#define LFO_POSID_TO_TYPE(_a, _b) ((_a << 16) | (_b))
|
||||
static EffectGroup rp355_lfo2_group[] = {
|
||||
{ 0, "Placeholder", lfo2_settings, G_N_ELEMENTS(lfo2_settings)},
|
||||
};
|
||||
|
||||
static EffectGroup rp355_lfo1_group[] = {
|
||||
{LFO_POSID_TO_TYPE(CHORUSFX_POSITION, CHORUS_LEVEL), "Chorus Level", lfo1_settings, G_N_ELEMENTS(lfo1_settings)},
|
||||
{LFO_POSID_TO_TYPE(DIST_POSITION, DIST_ON_OFF), "Distortion On/Off", lfo1_settings, G_N_ELEMENTS(lfo1_settings)},
|
||||
{LFO_POSID_TO_TYPE(DIST_POSITION, DIST_SCREAMER_DRIVE), "Distortion Screamer Drive", lfo1_settings, G_N_ELEMENTS(lfo1_settings)},
|
||||
{LFO_POSID_TO_TYPE(DIST_POSITION, DIST_SCREAMER_TONE), "Distortion Screamer Tone", lfo1_settings, G_N_ELEMENTS(lfo1_settings)},
|
||||
{LFO_POSID_TO_TYPE(DIST_POSITION, DIST_SCREAMER_LVL), "Distortion Screamer Level", lfo1_settings, G_N_ELEMENTS(lfo1_settings)},
|
||||
{LFO_POSID_TO_TYPE(DIST_POSITION, DIST_808_OVERDRIVE), "Distortion 808 Overdrive", lfo1_settings, G_N_ELEMENTS(lfo1_settings)},
|
||||
{LFO_POSID_TO_TYPE(DIST_POSITION, DIST_808_TONE), "Distortion 808 Tone", lfo1_settings, G_N_ELEMENTS(lfo1_settings)},
|
||||
{LFO_POSID_TO_TYPE(DIST_POSITION, DIST_808_LVL), "Distortion 808 Level", lfo1_settings, G_N_ELEMENTS(lfo1_settings)},
|
||||
{ 0, "Placeholder", lfo1_settings, G_N_ELEMENTS(lfo1_settings)},
|
||||
};
|
||||
|
||||
static EffectGroup rp500_chorusfx_group[] = {
|
||||
@@ -2843,6 +2837,10 @@ static Effect rp355_lfo1_effect[] = {
|
||||
{NULL, -1, LFO_TYPE, LFO1_POSITION, rp355_lfo1_group, G_N_ELEMENTS(rp355_lfo1_group)},
|
||||
};
|
||||
|
||||
static Effect rp355_lfo2_effect[] = {
|
||||
{NULL, -1, LFO_TYPE, LFO2_POSITION, rp355_lfo2_group, G_N_ELEMENTS(rp355_lfo2_group)},
|
||||
};
|
||||
|
||||
/*
|
||||
* The elements of this group are discovered dynamically from the
|
||||
* MODIFIER_LINKABLE_LIST message.
|
||||
@@ -3054,8 +3052,9 @@ static EffectList rp355_effects[] = {
|
||||
{"Delay", rp355_delay_effect, G_N_ELEMENTS(rp355_delay_effect)},
|
||||
{"Reverb", reverb_effect, G_N_ELEMENTS(reverb_effect)},
|
||||
{"Global Settings", global_effect, G_N_ELEMENTS(global_effect)},
|
||||
{"LFO1", rp355_lfo1_effect, G_N_ELEMENTS(rp355_lfo1_effect)},
|
||||
{"Pedal1 Assign", rp355_pedal1_assign_effect, G_N_ELEMENTS(rp355_pedal1_assign_effect)},
|
||||
{"LFO1", rp355_lfo1_effect, G_N_ELEMENTS(rp355_lfo1_effect)},
|
||||
{"LFO2", rp355_lfo2_effect, G_N_ELEMENTS(rp355_lfo2_effect)},
|
||||
};
|
||||
|
||||
static EffectList rp500_effects[] = {
|
||||
@@ -3346,11 +3345,11 @@ static Modifier modifiers[] = {
|
||||
{"EQ Mid", EQ_MID, EQ_A_POSITION, &values_eq_db},
|
||||
{"EQ Treb", EQ_TREB, EQ_A_POSITION, &values_eq_db},
|
||||
{"EQ Treb", EQ_PRESENCE, EQ_A_POSITION, &values_eq_db},
|
||||
{"EQ Enable", EQ_ENABLE, EQ_B_POSITION, &values_on_off},
|
||||
{"EQ Bass", EQ_BASS, EQ_B_POSITION, &values_eq_db},
|
||||
{"EQ Mid", EQ_MID, EQ_B_POSITION, &values_eq_db},
|
||||
{"EQ Treb", EQ_TREB, EQ_B_POSITION, &values_eq_db},
|
||||
{"EQ Treb", EQ_PRESENCE, EQ_B_POSITION, &values_eq_db},
|
||||
{"EQ B Enable", EQ_ENABLE, EQ_B_POSITION, &values_on_off},
|
||||
{"EQ B Bass", EQ_BASS, EQ_B_POSITION, &values_eq_db},
|
||||
{"EQ B Mid", EQ_MID, EQ_B_POSITION, &values_eq_db},
|
||||
{"EQ B Treb", EQ_TREB, EQ_B_POSITION, &values_eq_db},
|
||||
{"EQ B Treb", EQ_PRESENCE, EQ_B_POSITION, &values_eq_db},
|
||||
{"Gate Enable", NOISEGATE_ON_OFF, NOISEGATE_POSITION, &values_on_off},
|
||||
{"Gate Pluck Sens", NOISEGATE_SWELL_SENS, NOISEGATE_POSITION, &values_0_to_99},
|
||||
{"Gate Threshold", NOISEGATE_GATE_TRESHOLD, NOISEGATE_POSITION, &values_0_to_99},
|
||||
|
||||
6
gdigi.c
6
gdigi.c
@@ -526,7 +526,9 @@ void push_message (GString *msg)
|
||||
|
||||
g_string_free(msg, TRUE);
|
||||
|
||||
create_pedal1_assign();
|
||||
create_modifier_group(EXP_POSITION, EXP_ASSIGN1);
|
||||
create_modifier_group(LFO1_POSITION, LFO_TYPE);
|
||||
create_modifier_group(LFO2_POSITION, LFO_TYPE);
|
||||
return;
|
||||
|
||||
|
||||
@@ -1505,7 +1507,7 @@ int main(int argc, char *argv[]) {
|
||||
g_mutex_free(message_queue_mutex);
|
||||
}
|
||||
|
||||
if (message_queue != NULL) {
|
||||
if (message_queue != NULL && g_queue_get_length(message_queue)) {
|
||||
g_warning("%d unread messages in queue",
|
||||
g_queue_get_length(message_queue));
|
||||
g_queue_foreach(message_queue, (GFunc) message_free_func, NULL);
|
||||
|
||||
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