diff options
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | src/state.c | 15 |
2 files changed, 12 insertions, 4 deletions
@@ -3,6 +3,7 @@ jalv (9999) unstable; * Tune UI update rate and ring size based on JACK rate and MIDI buffer size to handle the handle the maximum message rate the plugin can send. * Support lv2:sampleRate control ports. + * Tolerate loading presets with port values that aren't xsd:decimal -- David Robillard <d@drobilla.net> diff --git a/src/state.c b/src/state.c index aff7e13..965ed15 100644 --- a/src/state.c +++ b/src/state.c @@ -132,14 +132,21 @@ set_port_value(const char* port_symbol, return; } - if (type != jalv->forge.Float) { - fprintf(stderr, "error: Preset port `%s' value is a <%s>, not float\n", + float fvalue; + if (type == jalv->forge.Float) { + fvalue = *(float*)value; + } else if (type == jalv->forge.Double) { + fvalue = *(double*)value; + } else if (type == jalv->forge.Int) { + fvalue = *(int32_t*)value; + } else if (type == jalv->forge.Long) { + fvalue = *(int64_t*)value; + } else { + fprintf(stderr, "error: Preset `%s' value has bad type <%s>\n", port_symbol, jalv->unmap.unmap(jalv->unmap.handle, type)); return; } - const float fvalue = *(float*)value; - // Send value to plugin jalv_ui_write(jalv, port->index, sizeof(fvalue), 0, &fvalue); |