aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2014-07-15 19:49:15 +0000
committerDavid Robillard <d@drobilla.net>2014-07-15 19:49:15 +0000
commitc651bff4be13834ad3be14eca9737c563fdf7d1f (patch)
tree78a59c15814aa5d6706bf294b1584095e8793e95 /src
parent712f209ee60da9ed61f58353b05b6b025d9321c0 (diff)
downloadjalv-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
Diffstat (limited to 'src')
-rw-r--r--src/jalv_gtk.c9
-rw-r--r--src/jalv_internal.h3
-rw-r--r--src/state.c15
3 files changed, 26 insertions, 1 deletions
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,