summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-03-06 05:05:40 +0000
committerDavid Robillard <d@drobilla.net>2012-03-06 05:05:40 +0000
commite45691df6be3f9a14cab019437ce2f2e8a54427e (patch)
tree3c542658dde9db649bc2d99c984001702a6bc6e7 /test
parentfdd97c39ab73bd298e30884e3312c9672f99d79a (diff)
downloadlilv-e45691df6be3f9a14cab019437ce2f2e8a54427e.tar.gz
lilv-e45691df6be3f9a14cab019437ce2f2e8a54427e.tar.bz2
lilv-e45691df6be3f9a14cab019437ce2f2e8a54427e.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/lilv@4023 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'test')
-rw-r--r--test/lilv_test.c35
1 files changed, 24 insertions, 11 deletions
diff --git a/test/lilv_test.c b/test/lilv_test.c
index 2352150..db2dca5 100644
--- a/test/lilv_test.c
+++ b/test/lilv_test.c
@@ -1070,32 +1070,43 @@ test_ui(void)
/*****************************************************************************/
-float in = 1.0;
-float out = 42.0;
-
-LilvNode*
-get_port_value(const char* port_symbol, void* user_data)
+uint32_t atom_Float = 0;
+float in = 1.0;
+float out = 42.0;
+
+const void*
+get_port_value(const char* port_symbol,
+ void* user_data,
+ uint32_t* size,
+ uint32_t* type)
{
if (!strcmp(port_symbol, "input")) {
- return lilv_new_float((LilvWorld*)user_data, in);
+ *size = sizeof(float);
+ *type = atom_Float;
+ return &in;
} else if (!strcmp(port_symbol, "output")) {
- return lilv_new_float((LilvWorld*)user_data, out);
+ *size = sizeof(float);
+ *type = atom_Float;
+ return &out;
} else {
fprintf(stderr, "error: get_port_value for nonexistent port `%s'\n",
port_symbol);
+ *size = *type = 0;
return NULL;
}
}
void
set_port_value(const char* port_symbol,
- const LilvNode* value,
- void* user_data)
+ void* user_data,
+ const void* value,
+ uint32_t size,
+ uint32_t type)
{
if (!strcmp(port_symbol, "input")) {
- in = lilv_node_as_float(value);
+ in = *(float*)value;
} else if (!strcmp(port_symbol, "output")) {
- out = lilv_node_as_float(value);
+ out = *(float*)value;
} else {
fprintf(stderr, "error: set_port_value for nonexistent port `%s'\n",
port_symbol);
@@ -1158,6 +1169,8 @@ test_state(void)
LV2_Feature unmap_feature = { LV2_URID_UNMAP_URI, &unmap };
const LV2_Feature* features[] = { &map_feature, &unmap_feature, NULL };
+ atom_Float = map.map(map.handle, "http://lv2plug.in/ns/ext/atom#Float");
+
LilvNode* num = lilv_new_int(world, 5);
LilvState* nostate = lilv_state_new_from_file(world, &map, num, "/junk");
TEST_ASSERT(!nostate);