diff options
author | David Robillard <d@drobilla.net> | 2014-07-15 19:49:15 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2014-07-15 19:49:15 +0000 |
commit | c651bff4be13834ad3be14eca9737c563fdf7d1f (patch) | |
tree | 78a59c15814aa5d6706bf294b1584095e8793e95 | |
parent | 712f209ee60da9ed61f58353b05b6b025d9321c0 (diff) | |
download | jalv-c651bff4be13834ad3be14eca9737c563fdf7d1f.tar.gz jalv-c651bff4be13834ad3be14eca9737c563fdf7d1f.tar.bz2 jalv-c651bff4be13834ad3be14eca9737c563fdf7d1f.zip |
Support saving the same preset several times.
git-svn-id: http://svn.drobilla.net/lad/trunk/jalv@5414 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | src/jalv_gtk.c | 9 | ||||
-rw-r--r-- | src/jalv_internal.h | 3 | ||||
-rw-r--r-- | src/state.c | 15 | ||||
-rw-r--r-- | wscript | 2 |
5 files changed, 29 insertions, 3 deletions
@@ -7,9 +7,10 @@ jalv (1.4.5) unstable; * Add support for data-access extension (based on patch by Filipe Coelho) * Support new UI show/hide interface in console version * Add option to print control output changes to stdout + * Support saving the same preset several times * Update man pages and console jalv help output for new options - -- David Robillard <d@drobilla.net> Sun, 13 Jul 2014 17:21:51 -0400 + -- David Robillard <d@drobilla.net> Tue, 15 Jul 2014 15:15:17 -0400 jalv (1.4.4) stable; diff --git a/src/jalv_gtk.c b/src/jalv_gtk.c index 8e9259f..91dca45 100644 --- a/src/jalv_gtk.c +++ b/src/jalv_gtk.c @@ -257,9 +257,16 @@ on_save_preset_activate(GtkWidget* widget, void* ptr) jalv_save_preset(jalv, dir, (strlen(uri) ? uri : NULL), basename, file); - // Load preset so it is now known to LilvWorld SerdNode sdir = serd_node_new_file_uri((const uint8_t*)dir, 0, 0, 0); LilvNode* ldir = lilv_new_uri(jalv->world, (const char*)sdir.buf); + + // Unload all presets and any old information from this bundle + jalv_unload_presets(jalv); + printf("Unload bundle %s\n", lilv_node_as_string(ldir)); + lilv_world_unload_bundle(jalv->world, ldir); + + // Load preset so it is now known to LilvWorld + printf("Load bundle %s\n", lilv_node_as_string(ldir)); lilv_world_load_bundle(jalv->world, ldir); serd_node_free(&sdir); lilv_node_free(ldir); diff --git a/src/jalv_internal.h b/src/jalv_internal.h index 64b490a..af562f9 100644 --- a/src/jalv_internal.h +++ b/src/jalv_internal.h @@ -266,6 +266,9 @@ int jalv_load_presets(Jalv* jalv, PresetSink sink, void* data); int +jalv_unload_presets(Jalv* jalv); + +int jalv_apply_preset(Jalv* jalv, const LilvNode* preset); int diff --git a/src/state.c b/src/state.c index 4e9cdd7..108723d 100644 --- a/src/state.c +++ b/src/state.c @@ -101,6 +101,7 @@ jalv_load_presets(Jalv* jalv, PresetSink sink, void* data) jalv->nodes.pset_Preset); LILV_FOREACH(nodes, i, presets) { const LilvNode* preset = lilv_nodes_get(presets, i); + printf("Preset: %s\n", lilv_node_as_uri(preset)); lilv_world_load_resource(jalv->world, preset); LilvNodes* labels = lilv_world_find_nodes( jalv->world, preset, jalv->nodes.rdfs_label, NULL); @@ -118,6 +119,20 @@ jalv_load_presets(Jalv* jalv, PresetSink sink, void* data) return 0; } +int +jalv_unload_presets(Jalv* jalv) +{ + LilvNodes* presets = lilv_plugin_get_related(jalv->plugin, + jalv->nodes.pset_Preset); + LILV_FOREACH(nodes, i, presets) { + const LilvNode* preset = lilv_nodes_get(presets, i); + lilv_world_unload_resource(jalv->world, preset); + } + lilv_nodes_free(presets); + + return 0; +} + static void set_port_value(const char* port_symbol, void* user_data, @@ -35,7 +35,7 @@ def configure(conf): autowaf.check_pkg(conf, 'lv2', atleast_version='1.8.1', uselib_store='LV2') autowaf.check_pkg(conf, 'lilv-0', uselib_store='LILV', - atleast_version='0.15.1', mandatory=True) + atleast_version='0.19.2', mandatory=True) autowaf.check_pkg(conf, 'serd-0', uselib_store='SERD', atleast_version='0.14.0', mandatory=True) autowaf.check_pkg(conf, 'sord-0', uselib_store='SORD', |