Fix RHold display for delay repeats.

This involved passing the EffectValue resulting from the resolution of
an VALUE_TYPE_EXTRA to map_xml_value() and some more careful range
checking.

Also, the delay repeats effect needed an xml_label for the special
'repeat forever' value 100, which maps to the string RHold.
This commit is contained in:
Tim LaBerge
2012-12-03 19:25:24 -08:00
parent b5aa30d599
commit f389caffbc
4 changed files with 13 additions and 10 deletions

View File

@@ -3875,6 +3875,9 @@ static XmlLabel xml_fx_lib_labels[] = {
{EFFECTS_LIB_ROTARY_TAPE, "Rotary + Tape Delay"},
};
static XmlLabel xml_rhold_labels[] = {
{100, "RHold"},
};
/* Array to map id/position pairs to labels and settings. */
XmlSettings xml_settings[] = {
{0, 0, "None", NULL,},
@@ -4027,12 +4030,10 @@ XmlSettings xml_settings[] = {
{SYNTH_TALK_VOX, CHORUSFX_POSITION, "Synth Talk Vox", &values_0_to_99,},
{SYNTH_TALK_BALANCE, CHORUSFX_POSITION, "Synth Talk Balance", &values_0_to_99,},
{DELAY_TYPE, DELAY_POSITION, "Delay Type", &values_delay_type, xml_delay_labels, G_N_ELEMENTS(xml_delay_labels)},
{DELAY_ON_OFF, DELAY_POSITION, "Delay Enable", &values_on_off, xml_on_off_labels, G_N_ELEMENTS(xml_on_off_labels)},
{DELAY_TIME, DELAY_POSITION, "Delay Time", &values_delay_time,},
{DELAY_REPEATS, DELAY_POSITION, "Delay Repeats", &values_delay_repeats,},
{DELAY_REPEATS, DELAY_POSITION, "Delay Repeats", &values_delay_repeats, xml_rhold_labels, G_N_ELEMENTS(xml_rhold_labels)},
{DELAY_LEVEL, DELAY_POSITION, "Delay Level", &values_0_to_99,},
{DELAY_DUCK_THRESH, DELAY_POSITION, "Delay Duck Thresh", &values_0_to_99,},
{DELAY_DUCK_LEVEL, DELAY_POSITION, "Delay Duck Level", &values_0_to_99,},

View File

@@ -142,7 +142,7 @@ format_value (XmlSettings *xml, guint value)
switch (vtype) {
case VALUE_TYPE_LABEL:
{
char *textp = map_xml_value(xml, value);
char *textp = map_xml_value(xml, values, value);
if (!textp) {
g_warning("Unable to map %s value %d for id %d position %d",
xml->label, value, xml->id, xml->position);

View File

@@ -35,7 +35,7 @@ typedef struct {
XmlSettings *get_xml_settings(guint id, guint position);
gboolean value_is_extra(EffectValues *val, int value);
gchar * map_xml_value(XmlSettings *xml, gint value);
gchar * map_xml_value(XmlSettings *xml, EffectValues *values, gint value);
// gchar *get_xml_label(guint id, guint position, gint type);
#endif /* GDIGI_XML_H */

View File

@@ -30,6 +30,7 @@
extern XmlSettings xml_settings[];
extern guint n_xml_settings;
extern EffectValues values_on_off;
/**
* \param id modifier ID
* \param position modifier position
@@ -52,15 +53,16 @@ XmlSettings *get_xml_settings (guint id, guint position)
}
gchar *
map_xml_value (XmlSettings *xml, gint value)
map_xml_value (XmlSettings *xml, EffectValues *values, gint value)
{
switch (xml->values->type) {
switch (values->type) {
case VALUE_TYPE_LABEL:
if ((xml->values == &values_on_off) && (value > 1)) {
if ((values == &values_on_off) && (value > 1)) {
g_warning("Skipping modifier->label %s\n", xml->label);
return NULL;
}
if (value > xml->values->max || value < xml->values->min) {
if (value > values->max || value < values->min) {
g_warning("%s value %d out of range %0.1f %0.1f",
xml->label, value, xml->values->min, xml->values->max);
}
@@ -205,7 +207,7 @@ write_preset_to_xml(Preset *preset, gchar *filename)
switch (type) {
case VALUE_TYPE_LABEL:
{
char *textp = map_xml_value(xml, param->value);
char *textp = map_xml_value(xml, values, param->value);
if (!textp) {
g_warning("Unable to map %s value %d for id %d position %d",
xml->label, param->value, param->id,