Human readable debug

Leverage the code that writes a preset to XML so that messages
can be displayed in a human readable format.

E.g.,

(6, 2432, 1280)  Distortion: Dist Type: Screamer

The 3-tuple is position, id, value, which is followed by the
colon separated decode of the position, id, and the mapped value.
This commit is contained in:
Tim LaBerge
2012-04-06 08:57:08 -07:00
parent 1205a1639d
commit ea80320531
7 changed files with 177 additions and 36 deletions

View File

@@ -52,7 +52,7 @@ XmlSettings *get_xml_settings (guint id, guint position)
}
gchar *
map_xml_value(XmlSettings *xml, gint value)
map_xml_value (XmlSettings *xml, gint value)
{
switch (xml->values->type) {
case VALUE_TYPE_LABEL:
@@ -84,10 +84,9 @@ map_xml_value(XmlSettings *xml, gint value)
return NULL;
}
gboolean value_is_extra (EffectValues *val, SettingParam *param)
gboolean value_is_extra (EffectValues *val, int value)
{
if ((param->value < val->min) || (param->value > val->max)) {
if ((value < val->min) || (value > val->max)) {
return TRUE;
}
return FALSE;
@@ -97,7 +96,6 @@ gboolean value_is_extra (EffectValues *val, SettingParam *param)
void
write_preset_to_xml(Preset *preset, gchar *filename)
{
int rc;
xmlTextWriterPtr writer;
GList *iter_params = preset->params;
@@ -178,7 +176,7 @@ write_preset_to_xml(Preset *preset, gchar *filename)
BAD_CAST xml->label);
values = xml->values;
type = values->type;
while ((type & VALUE_TYPE_EXTRA) && value_is_extra(values, param)) {
while ((type & VALUE_TYPE_EXTRA) && value_is_extra(values, param->value)) {
values = values->extra;
type = values->type;
}
@@ -248,11 +246,7 @@ write_preset_to_xml(Preset *preset, gchar *filename)
iter_params = iter_params->next;
}
/* Here we could close the elements ORDER and EXAMPLE using the
* function xmlTextWriterEndElement, but since we do not want to
* write any other elements, we simply call xmlTextWriterEndDocument,
* which will do all the work. */
rc = xmlTextWriterEndDocument(writer);
if (rc < 0) {
printf("testXmlwriterFilename: Error at xmlTextWriterEndDocument\n");