aboutsummaryrefslogtreecommitdiffstats
path: root/src/state.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-06-13 00:59:30 +0000
committerDavid Robillard <d@drobilla.net>2012-06-13 00:59:30 +0000
commitac68a26a30d9f6917da9c2cab29b6f612648c4d0 (patch)
tree70057487c5aa57b8645438cde65bd761a202880b /src/state.c
parentc04965a404e216b34844cce2c93e89f1f0045442 (diff)
downloadjalv-ac68a26a30d9f6917da9c2cab29b6f612648c4d0.tar.gz
jalv-ac68a26a30d9f6917da9c2cab29b6f612648c4d0.tar.bz2
jalv-ac68a26a30d9f6917da9c2cab29b6f612648c4d0.zip
Tolerate loading presets with port values that aren't xsd:decimal (fix #824).
git-svn-id: http://svn.drobilla.net/lad/trunk/jalv@4499 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/state.c')
-rw-r--r--src/state.c15
1 files changed, 11 insertions, 4 deletions
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);