diff options
Diffstat (limited to 'plugins/eg-sampler.lv2')
-rw-r--r-- | plugins/eg-sampler.lv2/sampler.c | 40 | ||||
-rw-r--r-- | plugins/eg-sampler.lv2/sampler.ttl | 5 | ||||
-rw-r--r-- | plugins/eg-sampler.lv2/wscript | 11 |
3 files changed, 32 insertions, 24 deletions
diff --git a/plugins/eg-sampler.lv2/sampler.c b/plugins/eg-sampler.lv2/sampler.c index 33e8e3e..449aad1 100644 --- a/plugins/eg-sampler.lv2/sampler.c +++ b/plugins/eg-sampler.lv2/sampler.c @@ -42,7 +42,7 @@ #include <sndfile.h> #include "lv2/lv2plug.in/ns/ext/atom/atom-buffer.h" -#include "lv2/lv2plug.in/ns/ext/persist/persist.h" +#include "lv2/lv2plug.in/ns/ext/state/state.h" #include "lv2/lv2plug.in/ns/ext/urid/urid.h" #include "lv2/lv2plug.in/ns/lv2core/lv2.h" @@ -185,15 +185,17 @@ instantiate(const LV2_Descriptor* descriptor, const char* path, const LV2_Feature* const* features) { - Sampler* plugin = (Sampler*)malloc(sizeof(Sampler)); + Sampler* plugin = (Sampler*)malloc(sizeof(Sampler)); + if (!plugin) { + return NULL; + } + plugin->samp = (SampleFile*)malloc(sizeof(SampleFile)); plugin->pending_samp = (SampleFile*)malloc(sizeof(SampleFile)); - - if (!plugin || !plugin->samp || !plugin->pending_samp) { + if (!plugin->samp || !plugin->pending_samp) { return NULL; } - memset(plugin, 0, sizeof(Sampler)); memset(plugin->samp, 0, sizeof(SampleFile)); memset(plugin->pending_samp, 0, sizeof(SampleFile)); @@ -326,9 +328,11 @@ map_uri(Sampler* plugin, const char* uri) } static void -save(LV2_Handle instance, - LV2_Persist_Store_Function store, - void* callback_data) +save(LV2_Handle instance, + LV2_State_Store_Function store, + void* callback_data, + uint32_t flags, + const LV2_Feature* const* features) { Sampler* plugin = (Sampler*)instance; store(callback_data, @@ -336,24 +340,26 @@ save(LV2_Handle instance, plugin->samp->filepath, strlen(plugin->samp->filepath) + 1, map_uri(plugin, NS_ATOM "String"), - LV2_PERSIST_IS_POD | LV2_PERSIST_IS_PORTABLE); + LV2_STATE_IS_POD | LV2_STATE_IS_PORTABLE); } static void -restore(LV2_Handle instance, - LV2_Persist_Retrieve_Function retrieve, - void* callback_data) +restore(LV2_Handle instance, + LV2_State_Retrieve_Function retrieve, + void* callback_data, + uint32_t flags, + const LV2_Feature* const* features) { Sampler* plugin = (Sampler*)instance; size_t size; uint32_t type; - uint32_t flags; + uint32_t valflags; const void* value = retrieve( callback_data, map_uri(plugin, FILENAME_URI), - &size, &type, &flags); + &size, &type, &valflags); if (value) { printf("Restored filename %s\n", (const char*)value); @@ -363,9 +369,9 @@ restore(LV2_Handle instance, const void* extension_data(const char* uri) { - static const LV2_Persist persist = { save, restore }; - if (!strcmp(uri, LV2_PERSIST_URI)) { - return &persist; + static const LV2_State_Interface state = { save, restore }; + if (!strcmp(uri, LV2_STATE_URI)) { + return &state; } return NULL; } diff --git a/plugins/eg-sampler.lv2/sampler.ttl b/plugins/eg-sampler.lv2/sampler.ttl index a7cf6e4..51c6c28 100644 --- a/plugins/eg-sampler.lv2/sampler.ttl +++ b/plugins/eg-sampler.lv2/sampler.ttl @@ -26,9 +26,8 @@ doap:name "Example Sampler" ; doap:license <http://opensource.org/licenses/isc-license> ; lv2:requiredFeature <http://lv2plug.in/ns/ext/urid#Mapper> ; - lv2:optionalFeature lv2:hardRtCapable , - <http://lv2plug.in/ns/ext/event> , - <http://lv2plug.in/ns/ext/state> ; + lv2:optionalFeature lv2:hardRtCapable ; + lv2:extensionData <http://lv2plug.in/ns/ext/state#Interface> ; ui:ui <http://lv2plug.in/plugins/eg-sampler#ui> ; lv2:port [ a lv2:InputPort , diff --git a/plugins/eg-sampler.lv2/wscript b/plugins/eg-sampler.lv2/wscript index 70273c3..0e93cf3 100644 --- a/plugins/eg-sampler.lv2/wscript +++ b/plugins/eg-sampler.lv2/wscript @@ -22,10 +22,13 @@ def configure(conf): autowaf.configure(conf) autowaf.display_header('Sampler Configuration') - autowaf.check_header(conf, 'c', 'lv2/lv2plug.in/ns/lv2core/lv2.h') - autowaf.check_header(conf, 'c', 'lv2/lv2plug.in/ns/ext/atom/atom-buffer.h') - autowaf.check_header(conf, 'c', 'lv2/lv2plug.in/ns/ext/urid/urid.h') - autowaf.check_header(conf, 'c', 'lv2/lv2plug.in/ns/ext/persist/persist.h') + autowaf.check_pkg(conf, 'lv2core', uselib_store='LV2CORE') + autowaf.check_pkg(conf, 'lv2-lv2plug.in-ns-ext-urid', + uselib_store='LV2_URID') + autowaf.check_pkg(conf, 'lv2-lv2plug.in-ns-ext-atom', + uselib_store='LV2_ATOM') + autowaf.check_pkg(conf, 'lv2-lv2plug.in-ns-ext-state', + uselib_store='LV2_STATE') autowaf.check_pkg(conf, 'sndfile', uselib_store='SNDFILE', atleast_version='1.0.0', mandatory=True) autowaf.check_pkg(conf, 'gtk+-2.0', uselib_store='GTK2', |