diff options
-rw-r--r-- | meson.build | 2 | ||||
-rw-r--r-- | src/jalv.c | 94 | ||||
-rw-r--r-- | src/nodes.c | 66 | ||||
-rw-r--r-- | src/nodes.h | 3 | ||||
-rw-r--r-- | src/urids.c | 54 | ||||
-rw-r--r-- | src/urids.h | 4 |
6 files changed, 129 insertions, 94 deletions
diff --git a/meson.build b/meson.build index 98a7066..bb5d053 100644 --- a/meson.build +++ b/meson.build @@ -419,10 +419,12 @@ common_sources = files( 'src/jalv.c', 'src/log.c', 'src/lv2_evbuf.c', + 'src/nodes.c', 'src/process.c', 'src/state.c', 'src/string_utils.c', 'src/symap.c', + 'src/urids.c', 'src/worker.c', ) @@ -26,14 +26,8 @@ #include "lv2/data-access/data-access.h" #include "lv2/instance-access/instance-access.h" #include "lv2/log/log.h" -#include "lv2/midi/midi.h" #include "lv2/options/options.h" -#include "lv2/parameters/parameters.h" #include "lv2/patch/patch.h" -#include "lv2/port-groups/port-groups.h" -#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/time/time.h" #include "lv2/ui/ui.h" @@ -785,94 +779,6 @@ jalv_select_custom_ui(const Jalv* const jalv) } static void -jalv_init_urids(Symap* const symap, JalvURIDs* const urids) -{ -#define MAP_URI(uri) symap_map(symap, (uri)) - - urids->atom_Float = MAP_URI(LV2_ATOM__Float); - urids->atom_Int = MAP_URI(LV2_ATOM__Int); - urids->atom_Object = MAP_URI(LV2_ATOM__Object); - urids->atom_Path = MAP_URI(LV2_ATOM__Path); - urids->atom_String = MAP_URI(LV2_ATOM__String); - urids->atom_eventTransfer = MAP_URI(LV2_ATOM__eventTransfer); - urids->bufsz_maxBlockLength = MAP_URI(LV2_BUF_SIZE__maxBlockLength); - urids->bufsz_minBlockLength = MAP_URI(LV2_BUF_SIZE__minBlockLength); - urids->bufsz_sequenceSize = MAP_URI(LV2_BUF_SIZE__sequenceSize); - urids->log_Error = MAP_URI(LV2_LOG__Error); - urids->log_Trace = MAP_URI(LV2_LOG__Trace); - urids->log_Warning = MAP_URI(LV2_LOG__Warning); - urids->midi_MidiEvent = MAP_URI(LV2_MIDI__MidiEvent); - urids->param_sampleRate = MAP_URI(LV2_PARAMETERS__sampleRate); - urids->patch_Get = MAP_URI(LV2_PATCH__Get); - urids->patch_Put = MAP_URI(LV2_PATCH__Put); - urids->patch_Set = MAP_URI(LV2_PATCH__Set); - urids->patch_body = MAP_URI(LV2_PATCH__body); - urids->patch_property = MAP_URI(LV2_PATCH__property); - urids->patch_value = MAP_URI(LV2_PATCH__value); - urids->time_Position = MAP_URI(LV2_TIME__Position); - urids->time_bar = MAP_URI(LV2_TIME__bar); - urids->time_barBeat = MAP_URI(LV2_TIME__barBeat); - urids->time_beatUnit = MAP_URI(LV2_TIME__beatUnit); - urids->time_beatsPerBar = MAP_URI(LV2_TIME__beatsPerBar); - urids->time_beatsPerMinute = MAP_URI(LV2_TIME__beatsPerMinute); - urids->time_frame = MAP_URI(LV2_TIME__frame); - urids->time_speed = MAP_URI(LV2_TIME__speed); - urids->ui_scaleFactor = MAP_URI(LV2_UI__scaleFactor); - urids->ui_updateRate = MAP_URI(LV2_UI__updateRate); - -#undef MAP_URI -} - -static void -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; - -#undef MAP_NODE -} - -static void jalv_init_env(SerdEnv* const env) { serd_env_set_prefix_from_strings( diff --git a/src/nodes.c b/src/nodes.c new file mode 100644 index 0000000..db6543f --- /dev/null +++ b/src/nodes.c @@ -0,0 +1,66 @@ +// Copyright 2022-2024 David Robillard <d@drobilla.net> +// SPDX-License-Identifier: ISC + +#include "nodes.h" + +#include "lilv/lilv.h" +#include "lv2/atom/atom.h" +#include "lv2/core/lv2.h" +#include "lv2/midi/midi.h" +#include "lv2/port-groups/port-groups.h" +#include "lv2/port-props/port-props.h" +#include "lv2/presets/presets.h" +#include "lv2/resize-port/resize-port.h" +#include "lv2/ui/ui.h" +#include "lv2/worker/worker.h" + +#include <stddef.h> + +void +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; + +#undef MAP_NODE +} diff --git a/src/nodes.h b/src/nodes.h index 4b9b25f..ee9a1a2 100644 --- a/src/nodes.h +++ b/src/nodes.h @@ -53,6 +53,9 @@ typedef struct { LilvNode* end; ///< NULL terminator for easy freeing of entire structure } JalvNodes; +void +jalv_init_nodes(LilvWorld* world, JalvNodes* nodes); + JALV_END_DECLS #endif // JALV_NODES_H diff --git a/src/urids.c b/src/urids.c new file mode 100644 index 0000000..7ca033b --- /dev/null +++ b/src/urids.c @@ -0,0 +1,54 @@ +// Copyright 2022-2024 David Robillard <d@drobilla.net> +// SPDX-License-Identifier: ISC + +#include "urids.h" + +#include "symap.h" + +#include "lv2/atom/atom.h" +#include "lv2/buf-size/buf-size.h" +#include "lv2/log/log.h" +#include "lv2/midi/midi.h" +#include "lv2/parameters/parameters.h" +#include "lv2/patch/patch.h" +#include "lv2/time/time.h" +#include "lv2/ui/ui.h" + +void +jalv_init_urids(Symap* const symap, JalvURIDs* const urids) +{ +#define MAP_URI(uri) symap_map(symap, (uri)) + + urids->atom_Float = MAP_URI(LV2_ATOM__Float); + urids->atom_Int = MAP_URI(LV2_ATOM__Int); + urids->atom_Object = MAP_URI(LV2_ATOM__Object); + urids->atom_Path = MAP_URI(LV2_ATOM__Path); + urids->atom_String = MAP_URI(LV2_ATOM__String); + urids->atom_eventTransfer = MAP_URI(LV2_ATOM__eventTransfer); + urids->bufsz_maxBlockLength = MAP_URI(LV2_BUF_SIZE__maxBlockLength); + urids->bufsz_minBlockLength = MAP_URI(LV2_BUF_SIZE__minBlockLength); + urids->bufsz_sequenceSize = MAP_URI(LV2_BUF_SIZE__sequenceSize); + urids->log_Error = MAP_URI(LV2_LOG__Error); + urids->log_Trace = MAP_URI(LV2_LOG__Trace); + urids->log_Warning = MAP_URI(LV2_LOG__Warning); + urids->midi_MidiEvent = MAP_URI(LV2_MIDI__MidiEvent); + urids->param_sampleRate = MAP_URI(LV2_PARAMETERS__sampleRate); + urids->patch_Get = MAP_URI(LV2_PATCH__Get); + urids->patch_Put = MAP_URI(LV2_PATCH__Put); + urids->patch_Set = MAP_URI(LV2_PATCH__Set); + urids->patch_body = MAP_URI(LV2_PATCH__body); + urids->patch_property = MAP_URI(LV2_PATCH__property); + urids->patch_value = MAP_URI(LV2_PATCH__value); + urids->time_Position = MAP_URI(LV2_TIME__Position); + urids->time_bar = MAP_URI(LV2_TIME__bar); + urids->time_barBeat = MAP_URI(LV2_TIME__barBeat); + urids->time_beatUnit = MAP_URI(LV2_TIME__beatUnit); + urids->time_beatsPerBar = MAP_URI(LV2_TIME__beatsPerBar); + urids->time_beatsPerMinute = MAP_URI(LV2_TIME__beatsPerMinute); + urids->time_frame = MAP_URI(LV2_TIME__frame); + urids->time_speed = MAP_URI(LV2_TIME__speed); + urids->ui_scaleFactor = MAP_URI(LV2_UI__scaleFactor); + urids->ui_updateRate = MAP_URI(LV2_UI__updateRate); + +#undef MAP_URI +} diff --git a/src/urids.h b/src/urids.h index 4dcbe20..bf8d7ad 100644 --- a/src/urids.h +++ b/src/urids.h @@ -5,6 +5,7 @@ #define JALV_URIDS_H #include "attributes.h" +#include "symap.h" #include "lv2/urid/urid.h" @@ -43,6 +44,9 @@ typedef struct { LV2_URID ui_updateRate; } JalvURIDs; +void +jalv_init_urids(Symap* symap, JalvURIDs* urids); + JALV_END_DECLS #endif // JALV_URIDS_H |