aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2024-11-17 11:13:38 -0500
committerDavid Robillard <d@drobilla.net>2024-11-24 19:05:11 -0500
commit2a5f7329f6544b54a9edf6d563e55e9c71e158ff (patch)
tree7dec895824813d1b20d3cb9be20a471cf3c6ce36
parent2d4ed5ff2a771ce1e19fa7e1ca4e9a436895c1ec (diff)
downloadjalv-2a5f7329f6544b54a9edf6d563e55e9c71e158ff.tar.gz
jalv-2a5f7329f6544b54a9edf6d563e55e9c71e158ff.tar.bz2
jalv-2a5f7329f6544b54a9edf6d563e55e9c71e158ff.zip
Add state_threadSafeRestore to nodes cache
-rw-r--r--src/jalv.c8
-rw-r--r--src/nodes.c82
-rw-r--r--src/nodes.h1
3 files changed, 45 insertions, 46 deletions
diff --git a/src/jalv.c b/src/jalv.c
index 714c984..bccec38 100644
--- a/src/jalv.c
+++ b/src/jalv.c
@@ -1024,12 +1024,8 @@ jalv_open(Jalv* const jalv, int* argc, char*** argv)
}
// Check for thread-safe state restore() method
- LilvNode* state_threadSafeRestore =
- lilv_new_uri(jalv->world, LV2_STATE__threadSafeRestore);
- if (lilv_plugin_has_feature(jalv->plugin, state_threadSafeRestore)) {
- jalv->safe_restore = true;
- }
- lilv_node_free(state_threadSafeRestore);
+ jalv->safe_restore =
+ lilv_plugin_has_feature(jalv->plugin, jalv->nodes.state_threadSafeRestore);
if (!state) {
// Not restoring state, load the plugin as a preset to get default
diff --git a/src/nodes.c b/src/nodes.c
index db6543f..8d6e409 100644
--- a/src/nodes.c
+++ b/src/nodes.c
@@ -11,6 +11,7 @@
#include "lv2/port-props/port-props.h"
#include "lv2/presets/presets.h"
#include "lv2/resize-port/resize-port.h"
+#include "lv2/state/state.h"
#include "lv2/ui/ui.h"
#include "lv2/worker/worker.h"
@@ -21,46 +22,47 @@ jalv_init_nodes(LilvWorld* const world, JalvNodes* const nodes)
{
#define MAP_NODE(uri) lilv_new_uri(world, (uri))
- nodes->atom_AtomPort = MAP_NODE(LV2_ATOM__AtomPort);
- nodes->atom_Chunk = MAP_NODE(LV2_ATOM__Chunk);
- nodes->atom_Float = MAP_NODE(LV2_ATOM__Float);
- nodes->atom_Path = MAP_NODE(LV2_ATOM__Path);
- nodes->atom_Sequence = MAP_NODE(LV2_ATOM__Sequence);
- nodes->lv2_AudioPort = MAP_NODE(LV2_CORE__AudioPort);
- nodes->lv2_CVPort = MAP_NODE(LV2_CORE__CVPort);
- nodes->lv2_ControlPort = MAP_NODE(LV2_CORE__ControlPort);
- nodes->lv2_InputPort = MAP_NODE(LV2_CORE__InputPort);
- nodes->lv2_OutputPort = MAP_NODE(LV2_CORE__OutputPort);
- nodes->lv2_connectionOptional = MAP_NODE(LV2_CORE__connectionOptional);
- nodes->lv2_control = MAP_NODE(LV2_CORE__control);
- nodes->lv2_default = MAP_NODE(LV2_CORE__default);
- nodes->lv2_designation = MAP_NODE(LV2_CORE__designation);
- nodes->lv2_enumeration = MAP_NODE(LV2_CORE__enumeration);
- nodes->lv2_extensionData = MAP_NODE(LV2_CORE__extensionData);
- nodes->lv2_integer = MAP_NODE(LV2_CORE__integer);
- nodes->lv2_latency = MAP_NODE(LV2_CORE__latency);
- nodes->lv2_maximum = MAP_NODE(LV2_CORE__maximum);
- nodes->lv2_minimum = MAP_NODE(LV2_CORE__minimum);
- nodes->lv2_name = MAP_NODE(LV2_CORE__name);
- nodes->lv2_reportsLatency = MAP_NODE(LV2_CORE__reportsLatency);
- nodes->lv2_sampleRate = MAP_NODE(LV2_CORE__sampleRate);
- nodes->lv2_symbol = MAP_NODE(LV2_CORE__symbol);
- nodes->lv2_toggled = MAP_NODE(LV2_CORE__toggled);
- nodes->midi_MidiEvent = MAP_NODE(LV2_MIDI__MidiEvent);
- nodes->pg_group = MAP_NODE(LV2_PORT_GROUPS__group);
- nodes->pprops_logarithmic = MAP_NODE(LV2_PORT_PROPS__logarithmic);
- nodes->pprops_notOnGUI = MAP_NODE(LV2_PORT_PROPS__notOnGUI);
- nodes->pprops_rangeSteps = MAP_NODE(LV2_PORT_PROPS__rangeSteps);
- nodes->pset_Preset = MAP_NODE(LV2_PRESETS__Preset);
- nodes->pset_bank = MAP_NODE(LV2_PRESETS__bank);
- nodes->rdfs_comment = MAP_NODE(LILV_NS_RDFS "comment");
- nodes->rdfs_label = MAP_NODE(LILV_NS_RDFS "label");
- nodes->rdfs_range = MAP_NODE(LILV_NS_RDFS "range");
- nodes->rsz_minimumSize = MAP_NODE(LV2_RESIZE_PORT__minimumSize);
- nodes->ui_showInterface = MAP_NODE(LV2_UI__showInterface);
- nodes->work_interface = MAP_NODE(LV2_WORKER__interface);
- nodes->work_schedule = MAP_NODE(LV2_WORKER__schedule);
- nodes->end = NULL;
+ nodes->atom_AtomPort = MAP_NODE(LV2_ATOM__AtomPort);
+ nodes->atom_Chunk = MAP_NODE(LV2_ATOM__Chunk);
+ nodes->atom_Float = MAP_NODE(LV2_ATOM__Float);
+ nodes->atom_Path = MAP_NODE(LV2_ATOM__Path);
+ nodes->atom_Sequence = MAP_NODE(LV2_ATOM__Sequence);
+ nodes->lv2_AudioPort = MAP_NODE(LV2_CORE__AudioPort);
+ nodes->lv2_CVPort = MAP_NODE(LV2_CORE__CVPort);
+ nodes->lv2_ControlPort = MAP_NODE(LV2_CORE__ControlPort);
+ nodes->lv2_InputPort = MAP_NODE(LV2_CORE__InputPort);
+ nodes->lv2_OutputPort = MAP_NODE(LV2_CORE__OutputPort);
+ nodes->lv2_connectionOptional = MAP_NODE(LV2_CORE__connectionOptional);
+ nodes->lv2_control = MAP_NODE(LV2_CORE__control);
+ nodes->lv2_default = MAP_NODE(LV2_CORE__default);
+ nodes->lv2_designation = MAP_NODE(LV2_CORE__designation);
+ nodes->lv2_enumeration = MAP_NODE(LV2_CORE__enumeration);
+ nodes->lv2_extensionData = MAP_NODE(LV2_CORE__extensionData);
+ nodes->lv2_integer = MAP_NODE(LV2_CORE__integer);
+ nodes->lv2_latency = MAP_NODE(LV2_CORE__latency);
+ nodes->lv2_maximum = MAP_NODE(LV2_CORE__maximum);
+ nodes->lv2_minimum = MAP_NODE(LV2_CORE__minimum);
+ nodes->lv2_name = MAP_NODE(LV2_CORE__name);
+ nodes->lv2_reportsLatency = MAP_NODE(LV2_CORE__reportsLatency);
+ nodes->lv2_sampleRate = MAP_NODE(LV2_CORE__sampleRate);
+ nodes->lv2_symbol = MAP_NODE(LV2_CORE__symbol);
+ nodes->lv2_toggled = MAP_NODE(LV2_CORE__toggled);
+ nodes->midi_MidiEvent = MAP_NODE(LV2_MIDI__MidiEvent);
+ nodes->pg_group = MAP_NODE(LV2_PORT_GROUPS__group);
+ nodes->pprops_logarithmic = MAP_NODE(LV2_PORT_PROPS__logarithmic);
+ nodes->pprops_notOnGUI = MAP_NODE(LV2_PORT_PROPS__notOnGUI);
+ nodes->pprops_rangeSteps = MAP_NODE(LV2_PORT_PROPS__rangeSteps);
+ nodes->pset_Preset = MAP_NODE(LV2_PRESETS__Preset);
+ nodes->pset_bank = MAP_NODE(LV2_PRESETS__bank);
+ nodes->rdfs_comment = MAP_NODE(LILV_NS_RDFS "comment");
+ nodes->rdfs_label = MAP_NODE(LILV_NS_RDFS "label");
+ nodes->rdfs_range = MAP_NODE(LILV_NS_RDFS "range");
+ nodes->rsz_minimumSize = MAP_NODE(LV2_RESIZE_PORT__minimumSize);
+ nodes->state_threadSafeRestore = MAP_NODE(LV2_STATE__threadSafeRestore);
+ nodes->ui_showInterface = MAP_NODE(LV2_UI__showInterface);
+ nodes->work_interface = MAP_NODE(LV2_WORKER__interface);
+ nodes->work_schedule = MAP_NODE(LV2_WORKER__schedule);
+ nodes->end = NULL;
#undef MAP_NODE
}
diff --git a/src/nodes.h b/src/nodes.h
index ee9a1a2..d9b4a97 100644
--- a/src/nodes.h
+++ b/src/nodes.h
@@ -47,6 +47,7 @@ typedef struct {
LilvNode* rdfs_label;
LilvNode* rdfs_range;
LilvNode* rsz_minimumSize;
+ LilvNode* state_threadSafeRestore;
LilvNode* ui_showInterface;
LilvNode* work_interface;
LilvNode* work_schedule;