From 3a1a4b93245adbe7dadfd4f4a5e217305483aa4d Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 4 Nov 2011 18:12:16 +0000 Subject: Clean up example code. --- ext/state.lv2/manifest.ttl | 2 +- ext/state.lv2/state.ttl | 22 ++++++++++------------ 2 files changed, 11 insertions(+), 13 deletions(-) (limited to 'ext') diff --git a/ext/state.lv2/manifest.ttl b/ext/state.lv2/manifest.ttl index ce76fd9..7894a22 100644 --- a/ext/state.lv2/manifest.ttl +++ b/ext/state.lv2/manifest.ttl @@ -4,6 +4,6 @@ a lv2:Specification ; lv2:minorVersion 0 ; - lv2:microVersion 1 ; + lv2:microVersion 2 ; rdfs:seeAlso . diff --git a/ext/state.lv2/state.ttl b/ext/state.lv2/state.ttl index 70b0b5d..ed132be 100644 --- a/ext/state.lv2/state.ttl +++ b/ext/state.lv2/state.ttl @@ -20,15 +20,14 @@ @prefix lv2: . @prefix rdf: . @prefix rdfs: . -@prefix xsd: . a lv2:Specification ; doap:name "LV2 State" ; doap:license ; doap:release [ - doap:revision "0.1" ; - doap:created "2011-11-12" + doap:revision "0.2" ; + doap:created "2011-11-14" ] ; doap:developer [ a foaf:Person ; @@ -82,11 +81,10 @@ should be addressed by a separate extension.

LV2_Handle my_instantiate(...) { - MyPlugin* plugin = ...; - LV2_URI_Map_Feature* map = ...; - plugin->uri_greeting_key = map->uri_to_id(..., NULL, NS_EG "greeting"); - plugin->uri_xsd_string = map->uri_to_id(..., NULL, NS_ATOM "String"); - plugin->state->greeting = strdup("Hello"); + MyPlugin* plugin = ...; + plugin->uris.atom_String = map_uri(NS_ATOM "String"); + plugin->uris.eg_greeting = map_uri(NS_EG "greeting"); + plugin->state.greeting = strdup("Hello"); return plugin; } @@ -96,13 +94,13 @@ void my_save(LV2_Handle instance, uint32_t flags) { MyPlugin* plugin = (MyPlugin*)instance; - const char* greeting = plugin->state->greeting; + const char* greeting = plugin->state.greeting; store(callback_data, - plugin->uri_greeting_key, + plugin->uris.eg_greeting, greeting, strlen(greeting) + 1, - plugin->uri_xsd_string, + plugin->uris.atom_String, LV2_STATE_IS_POD | LV2_STATE_IS_PORTABLE); } @@ -117,7 +115,7 @@ void my_restore(LV2_Handle instance, uint32_t type; uint32_t flags; const char* greeting = retrieve(callback_data, - plugin->uri_greeting_key, + plugin->uris.eg_greeting, &size, &type, &flags); -- cgit v1.2.1