diff options
author | David Robillard <d@drobilla.net> | 2012-03-06 05:05:40 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-03-06 05:05:40 +0000 |
commit | c024819b9d8c452e970a8702e61c31bd8b319f38 (patch) | |
tree | 070809be8b5ddd1a6ccd25d24653cfc7847ec215 /src | |
parent | 3b305f4ce137072a4a48d4a3c670331d8a0c3cca (diff) | |
download | jalv-c024819b9d8c452e970a8702e61c31bd8b319f38.tar.gz jalv-c024819b9d8c452e970a8702e61c31bd8b319f38.tar.bz2 jalv-c024819b9d8c452e970a8702e61c31bd8b319f38.zip |
Use raw type/size/value instead of LilvNode for port values.
Remove use of half-baked node_to_serd() and use sratom for port values as well.
git-svn-id: http://svn.drobilla.net/lad/trunk/jalv@4023 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r-- | src/state.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/src/state.c b/src/state.c index 2b3be37..ea13007 100644 --- a/src/state.c +++ b/src/state.c @@ -61,15 +61,20 @@ jalv_make_path(LV2_State_Make_Path_Handle handle, return fullpath; } -LilvNode* +const void* get_port_value(const char* port_symbol, - void* user_data) + void* user_data, + uint32_t* size, + uint32_t* type) { Jalv* jalv = (Jalv*)user_data; struct Port* port = jalv_port_by_symbol(jalv, port_symbol); if (port && port->flow == FLOW_INPUT && port->type == TYPE_CONTROL) { - return lilv_new_float(jalv->world, port->control); + *size = sizeof(float); + *type = jalv->forge.Float; + return &port->control; } + *size = *type = 0; return NULL; } @@ -118,9 +123,11 @@ jalv_load_presets(Jalv* jalv, PresetSink sink, void* data) } static void -set_port_value(const char* port_symbol, - const LilvNode* value, - void* user_data) +set_port_value(const char* port_symbol, + void* user_data, + const void* value, + uint32_t size, + uint32_t type) { Jalv* jalv = (Jalv*)user_data; struct Port* port = jalv_port_by_symbol(jalv, port_symbol); @@ -129,13 +136,13 @@ set_port_value(const char* port_symbol, return; } - if (!lilv_node_is_float(value) && !lilv_node_is_int(value)) { - fprintf(stderr, "error: Preset port `%s' value is not a number\n", + if (type != jalv->forge.Float) { + fprintf(stderr, "error: Preset port `%s' value is not a float\n", port_symbol); return; } - const float fvalue = lilv_node_as_float(value); + const float fvalue = *(float*)value; // Send value to plugin jalv_ui_write(jalv, port->index, sizeof(fvalue), 0, &fvalue); |