Implement parameter linking to expression pedal.

This commit is contained in:
Tim LaBerge
2012-12-01 15:30:56 -08:00
parent 88819a795b
commit cf239da94c
5 changed files with 111 additions and 13 deletions

View File

@@ -562,6 +562,10 @@ EffectValues values_on_off = {
.labels = on_off_labels, .labels = on_off_labels,
}; };
EffectValues values_posid = {
.type = VALUE_TYPE_POSID,
};
static EffectValues values_odd_even = { static EffectValues values_odd_even = {
.min = 0.0, .max = 1.0, .min = 0.0, .max = 1.0,
.type = VALUE_TYPE_LABEL, .type = VALUE_TYPE_LABEL,
@@ -643,8 +647,8 @@ static EffectValues values_wah_type = {
}; };
static EffectValues values_exp_assign = { static EffectValues values_exp_assign = {
.min = 0.0, .max = 1.0, .min = 0.0, .max = 0x7fffffff,
.type = VALUE_TYPE_LABEL, .type = VALUE_TYPE_POSID,
}; };
static EffectValues values_vswitch_pedal_assign = { static EffectValues values_vswitch_pedal_assign = {
@@ -1205,6 +1209,12 @@ static EffectSettings chorusfx_ce_settings[] = {
{"Depth", CHORUS_DEPTH, CHORUSFX_POSITION, &values_0_to_99}, {"Depth", CHORUS_DEPTH, CHORUSFX_POSITION, &values_0_to_99},
}; };
#if 0
static EffectSettings pickup_enable_settings[] = {
{"Pickup", PICKUP_ON_OFF, PICKUP_POSITION, &values_on_off},
};
#endif
static EffectSettings chorusfx_tc_settings[] = { static EffectSettings chorusfx_tc_settings[] = {
{"Speed", CHORUS_SPEED, CHORUSFX_POSITION, &values_0_to_99}, {"Speed", CHORUS_SPEED, CHORUSFX_POSITION, &values_0_to_99},
{"Width", CHORUS_WIDTH, CHORUSFX_POSITION, &values_0_to_99}, {"Width", CHORUS_WIDTH, CHORUSFX_POSITION, &values_0_to_99},
@@ -1576,12 +1586,14 @@ static EffectSettings lfo1_settings[] = {
{"Speed(HZ)", LFO_SPEED, LFO1_POSITION, &values_lfo_speed}, {"Speed(HZ)", LFO_SPEED, LFO1_POSITION, &values_lfo_speed},
}; };
#if 0
static EffectSettings lfo2_settings[] = { static EffectSettings lfo2_settings[] = {
{"Heel", LFO_MIN, REVERB_POSITION, &values_0_to_99}, {"Heel", LFO_MIN, REVERB_POSITION, &values_0_to_99},
{"Toe", LFO_MAX, REVERB_POSITION, &values_0_to_99}, {"Toe", LFO_MAX, REVERB_POSITION, &values_0_to_99},
{"Waveform", LFO_WAVEFORM, REVERB_POSITION, &values_waveform}, {"Waveform", LFO_WAVEFORM, REVERB_POSITION, &values_waveform},
{"Speed(HZ)", LFO_SPEED, REVERB_POSITION, &values_lfo_speed}, {"Speed(HZ)", LFO_SPEED, REVERB_POSITION, &values_lfo_speed},
}; };
#endif
static EffectSettings reverb_lex_settings[] = { static EffectSettings reverb_lex_settings[] = {
{"Predelay", REVERB_PREDELAY, REVERB_POSITION, &values_0_to_15}, {"Predelay", REVERB_PREDELAY, REVERB_POSITION, &values_0_to_15},
@@ -1942,6 +1954,10 @@ static EffectGroup rp355_chorusfx_group[] = {
{CHORUS_TYPE_OCTAVER, "Octaver", chorusfx_octaver_settings, G_N_ELEMENTS(chorusfx_octaver_settings)}, {CHORUS_TYPE_OCTAVER, "Octaver", chorusfx_octaver_settings, G_N_ELEMENTS(chorusfx_octaver_settings)},
}; };
static EffectGroup rp355_pedal1_assign_group[] = {
{ 0, "Placeholder", NULL, 0},
};
#define LFO_POSID_TO_TYPE(_a, _b) ((_a << 16) | (_b)) #define LFO_POSID_TO_TYPE(_a, _b) ((_a << 16) | (_b))
static EffectGroup rp355_lfo1_group[] = { 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(CHORUSFX_POSITION, CHORUS_LEVEL), "Chorus Level", lfo1_settings, G_N_ELEMENTS(lfo1_settings)},
@@ -1954,7 +1970,6 @@ static EffectGroup rp355_lfo1_group[] = {
{LFO_POSID_TO_TYPE(DIST_POSITION, DIST_808_LVL), "Distortion 808 Level", 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)},
}; };
static EffectGroup rp500_chorusfx_group[] = { static EffectGroup rp500_chorusfx_group[] = {
{CHORUS_TYPE_CE, "CE Chorus", chorusfx_ce_settings, G_N_ELEMENTS(chorusfx_ce_settings)}, {CHORUS_TYPE_CE, "CE Chorus", chorusfx_ce_settings, G_N_ELEMENTS(chorusfx_ce_settings)},
{CHORUS_TYPE_TC, "TC Chorus", chorusfx_tc_settings, G_N_ELEMENTS(chorusfx_tc_settings)}, {CHORUS_TYPE_TC, "TC Chorus", chorusfx_tc_settings, G_N_ELEMENTS(chorusfx_tc_settings)},
@@ -2820,14 +2835,22 @@ static Effect rp255_chorusfx_effect[] = {
}; };
static Effect rp355_chorusfx_effect[] = { static Effect rp355_chorusfx_effect[] = {
{"Position",-1, CHORUSFX_PRE_POST,CHORUSFX_POSITION, pre_post_group,G_N_ELEMENTS(pre_post_group)},
{NULL, CHORUSFX_ON_OFF,CHORUSFX_TYPE, CHORUSFX_POSITION, rp355_chorusfx_group, G_N_ELEMENTS(rp355_chorusfx_group)}, {NULL, CHORUSFX_ON_OFF,CHORUSFX_TYPE, CHORUSFX_POSITION, rp355_chorusfx_group, G_N_ELEMENTS(rp355_chorusfx_group)},
{"Position",-1, CHORUSFX_PRE_POST,CHORUSFX_POSITION, pre_post_group,G_N_ELEMENTS(pre_post_group)},
}; };
static Effect rp355_lfo1_effect[] = { static Effect rp355_lfo1_effect[] = {
{NULL, -1, LFO_TYPE, LFO1_POSITION, rp355_lfo1_group, G_N_ELEMENTS(rp355_lfo1_group)}, {NULL, -1, LFO_TYPE, LFO1_POSITION, rp355_lfo1_group, G_N_ELEMENTS(rp355_lfo1_group)},
}; };
/*
* The elements of this group are discovered dynamically from the
* MODIFIER_LINKABLE_LIST message.
*/
static Effect rp355_pedal1_assign_effect[] = {
{NULL, -1, EXP_TYPE, EXP_POSITION, rp355_pedal1_assign_group, G_N_ELEMENTS(rp355_pedal1_assign_group)},
};
static Effect rp500_chorusfx_effect[] = { static Effect rp500_chorusfx_effect[] = {
{NULL, CHORUSFX_ON_OFF, CHORUSFX_TYPE, CHORUSFX_POSITION, rp500_chorusfx_group, G_N_ELEMENTS(rp500_chorusfx_group)}, {NULL, CHORUSFX_ON_OFF, CHORUSFX_TYPE, CHORUSFX_POSITION, rp500_chorusfx_group, G_N_ELEMENTS(rp500_chorusfx_group)},
}; };
@@ -3032,6 +3055,7 @@ static EffectList rp355_effects[] = {
{"Reverb", reverb_effect, G_N_ELEMENTS(reverb_effect)}, {"Reverb", reverb_effect, G_N_ELEMENTS(reverb_effect)},
{"Global Settings", global_effect, G_N_ELEMENTS(global_effect)}, {"Global Settings", global_effect, G_N_ELEMENTS(global_effect)},
{"LFO1", rp355_lfo1_effect, G_N_ELEMENTS(rp355_lfo1_effect)}, {"LFO1", rp355_lfo1_effect, G_N_ELEMENTS(rp355_lfo1_effect)},
{"Pedal1 Assign", rp355_pedal1_assign_effect, G_N_ELEMENTS(rp355_pedal1_assign_effect)},
}; };
static EffectList rp500_effects[] = { static EffectList rp500_effects[] = {
@@ -3267,6 +3291,8 @@ static Modifier modifiers[] = {
{"Compressor Tone", COMP_TONE, COMP_POSITION, &values_0_to_99}, {"Compressor Tone", COMP_TONE, COMP_POSITION, &values_0_to_99},
{"Compressor Level", COMP_LEVEL, COMP_POSITION, &values_0_to_99}, {"Compressor Level", COMP_LEVEL, COMP_POSITION, &values_0_to_99},
{"Compressor Attack", COMP_ATTACK, COMP_POSITION, &values_0_to_99}, {"Compressor Attack", COMP_ATTACK, COMP_POSITION, &values_0_to_99},
{"Compressor Sensitivity", COMP_SENSITIVITY, COMP_POSITION, &values_0_to_99},
{"Compressor Output", COMP_OUTPUT, COMP_POSITION, &values_0_to_99},
{"Dist Enable", DIST_ON_OFF, DIST_POSITION, &values_on_off}, {"Dist Enable", DIST_ON_OFF, DIST_POSITION, &values_on_off},
{"Dist Drive", DIST_SCREAMER_DRIVE, DIST_POSITION, &values_0_to_99}, {"Dist Drive", DIST_SCREAMER_DRIVE, DIST_POSITION, &values_0_to_99},
{"Dist Tone", DIST_SCREAMER_TONE, DIST_POSITION, &values_0_to_99}, {"Dist Tone", DIST_SCREAMER_TONE, DIST_POSITION, &values_0_to_99},
@@ -3309,12 +3335,12 @@ static Modifier modifiers[] = {
{"Dist Sustain", DIST_MP_SUSTAIN, DIST_POSITION, &values_0_to_99}, {"Dist Sustain", DIST_MP_SUSTAIN, DIST_POSITION, &values_0_to_99},
{"Dist Tone", DIST_MP_TONE, DIST_POSITION, &values_0_to_99}, {"Dist Tone", DIST_MP_TONE, DIST_POSITION, &values_0_to_99},
{"Dist Volume", DIST_MP_VOLUME, DIST_POSITION, &values_0_to_99}, {"Dist Volume", DIST_MP_VOLUME, DIST_POSITION, &values_0_to_99},
{"Amp Channel Enable", AMP_ON_OFF, AMP_A_POSITION, &values_on_off}, {"Amp Enable", AMP_ON_OFF, AMP_A_POSITION, &values_on_off},
{"Amp Gain", AMP_GAIN, AMP_A_POSITION, &values_0_to_99}, {"Amp Gain", AMP_GAIN, AMP_A_POSITION, &values_0_to_99},
{"Amp Level", AMP_LEVEL, AMP_A_POSITION, &values_0_to_99}, {"Amp Level", AMP_LEVEL, AMP_A_POSITION, &values_0_to_99},
{"Amp Channel Enable", AMP_ON_OFF, AMP_B_POSITION, &values_on_off}, {"Amp B Enable", AMP_ON_OFF, AMP_B_POSITION, &values_on_off},
{"Amp Gain", AMP_GAIN, AMP_B_POSITION, &values_0_to_99}, {"Amp B Gain", AMP_GAIN, AMP_B_POSITION, &values_0_to_99},
{"Amp Level", AMP_LEVEL, AMP_B_POSITION, &values_0_to_99}, {"Amp B Level", AMP_LEVEL, AMP_B_POSITION, &values_0_to_99},
{"EQ Enable", EQ_ENABLE, EQ_A_POSITION, &values_on_off}, {"EQ Enable", EQ_ENABLE, EQ_A_POSITION, &values_on_off},
{"EQ Bass", EQ_BASS, EQ_A_POSITION, &values_eq_db}, {"EQ Bass", EQ_BASS, EQ_A_POSITION, &values_eq_db},
{"EQ Mid", EQ_MID, EQ_A_POSITION, &values_eq_db}, {"EQ Mid", EQ_MID, EQ_A_POSITION, &values_eq_db},
@@ -3399,8 +3425,8 @@ static Modifier modifiers[] = {
{"Reverb Liveliness", REVERB_LIVELINESS, REVERB_POSITION, &values_0_to_99}, {"Reverb Liveliness", REVERB_LIVELINESS, REVERB_POSITION, &values_0_to_99},
{"Reverb Level", REVERB_LEVEL, REVERB_POSITION, &values_0_to_99}, {"Reverb Level", REVERB_LEVEL, REVERB_POSITION, &values_0_to_99},
{"Reverb Predelay", REVERB_PREDELAY, REVERB_POSITION, &values_0_to_15}, {"Reverb Predelay", REVERB_PREDELAY, REVERB_POSITION, &values_0_to_15},
{"Volume Pre FX", 2626, 13, &values_0_to_99}, {"Volume Pre FX", PRESET_LEVEL, VOLUME_PRE_FX_POSITION, &values_0_to_99},
{"Volume Post FX", 2626, 17, &values_0_to_99}, {"Volume Post FX", PRESET_LEVEL, VOLUME_POST_FX_POSITION, &values_0_to_99},
}; };
int n_modifiers = G_N_ELEMENTS(modifiers); int n_modifiers = G_N_ELEMENTS(modifiers);
@@ -4195,6 +4221,12 @@ static void effect_settings_free(EffectSettings *settings)
g_slice_free1(2 * sizeof(EffectSettings), settings); g_slice_free1(2 * sizeof(EffectSettings), settings);
} }
/**
* Global holding the list of linkable parameters.
*
* Used for Pedal Assignment and the LFO's.
*/
ModifierGroup *ModifierLinkableList;
/** /**
* Retrieves modifier linkable group from device. * Retrieves modifier linkable group from device.
* *
@@ -4244,13 +4276,14 @@ ModifierGroup *modifier_linkable_list(GString *msg)
group[i].settings_amt = 0; group[i].settings_amt = 0;
debug_msg(DEBUG_MSG2HOST|DEBUG_GROUP, debug_msg(DEBUG_MSG2HOST|DEBUG_GROUP,
"ID: %4d Position: %2d: %s", "Position : %d\nID : %d\nName : %s\n",
id, position, modifier ? modifier->label : NULL); position, id, modifier ? modifier->label : NULL);
} }
modifier_group->group = group; modifier_group->group = group;
modifier_group->group_amt = count; modifier_group->group_amt = count;
ModifierLinkableList = modifier_group;
return modifier_group; return modifier_group;
} }

View File

@@ -27,7 +27,8 @@ typedef enum {
VALUE_TYPE_LABEL = 1 << 3, /**< use value labels (overrides any other option) */ VALUE_TYPE_LABEL = 1 << 3, /**< use value labels (overrides any other option) */
VALUE_TYPE_EXTRA = 1 << 4, /**< use extra values */ VALUE_TYPE_EXTRA = 1 << 4, /**< use extra values */
VALUE_TYPE_DECIMAL= 1 << 5, /**< display decimal places */ VALUE_TYPE_DECIMAL= 1 << 5, /**< display decimal places */
VALUE_TYPE_NONE = 1 << 6, /**< no value displayed */ VALUE_TYPE_POSID = 1 << 6, /**< Packed Position/ID: (pos << 16) | id */
VALUE_TYPE_NONE = 1 << 7, /**< no value displayed */
} ValueType; } ValueType;
typedef struct _EffectValues { typedef struct _EffectValues {
@@ -118,6 +119,7 @@ typedef struct {
gchar *get_position(guint position); gchar *get_position(guint position);
ModifierGroup *modifier_linkable_list(); ModifierGroup *modifier_linkable_list();
ModifierGroup *ModifierLinkableList;
void modifier_group_free(ModifierGroup *modifier_group); void modifier_group_free(ModifierGroup *modifier_group);
void get_values_info(EffectValues *values, void get_values_info(EffectValues *values,
gdouble *min, gdouble *max, gboolean *custom); gdouble *min, gdouble *max, gboolean *custom);
@@ -125,4 +127,5 @@ gboolean get_device_info(unsigned char device_id, unsigned char family_id,
unsigned char product_id, unsigned char product_id,
Device **device); Device **device);
#endif /* GDIGI_EFFECTS_H */ #endif /* GDIGI_EFFECTS_H */

View File

@@ -166,6 +166,10 @@ format_value (XmlSettings *xml, guint value)
g_string_printf(buf, "%s", ""); g_string_printf(buf, "%s", "");
break; break;
case VALUE_TYPE_POSID:
g_string_printf(buf, "%d", value);
break;
default: default:
g_warning("Unhandled value type %d", vtype); g_warning("Unhandled value type %d", vtype);
break; break;
@@ -521,6 +525,8 @@ void push_message (GString *msg)
modifier_linkable_list(msg); modifier_linkable_list(msg);
g_string_free(msg, TRUE); g_string_free(msg, TRUE);
create_pedal1_assign();
return; return;

55
gui.c
View File

@@ -656,6 +656,61 @@ GtkWidget *create_widget_container(EffectGroup *group, gint amt, gint id, gint p
return vbox; return vbox;
} }
/* This should take ID and POSITION of Pedal1Assign, LFO1, or LFO2 */
void
create_pedal1_assign (void)
{
guint i;
gpointer key;
WidgetTreeElem *el;
GList *list;
EffectSettingsGroup *settings = NULL;
GObject *AssignComboBox;
gchar *name = NULL;
key = GINT_TO_POINTER(EXP_ASSIGN1| (EXP_POSITION << 16));
list = g_tree_lookup(widget_tree, key);
if (!list) {
printf("NO PEDAL ASSIGN COMBO BOX!\n");
return;
}
/* The only element should be the one with the placeholder. */
el = g_list_nth_data(list, 0);
if (!el) {
printf("NO LIST\n");
return;
}
AssignComboBox = GTK_COMBO_BOX(el->widget);
/* 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->child = NULL;
name = g_strdup_printf("SettingsGroup%d", i);
widget_tree_add(G_OBJECT(AssignComboBox), EXP_ASSIGN1, EXP_POSITION,
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);
}
/** /**
* \param widgets Effect descriptions * \param widgets Effect descriptions
* \param amt amount of effect descriptions * \param amt amount of effect descriptions

1
gui.h
View File

@@ -29,5 +29,6 @@ void gui_create(Device *device);
void gui_free(); void gui_free();
gboolean unsupported_device_dialog(Device **device); gboolean unsupported_device_dialog(Device **device);
const gchar* get_message_name(MessageID msgid); const gchar* get_message_name(MessageID msgid);
void create_pedal1_assign(void);
#endif /* GDIGI_GUI_H */ #endif /* GDIGI_GUI_H */