Audacity 3.2.0
LV2Symbols.h
Go to the documentation of this file.
1/*!********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 @file LV2Symbols.h
6
7 @brief Declare URI identifiers used in calls to the lv2 library and a mapping
8 of them to integers
9
10 Paul Licameli split from LoadLV2.h
11
12*********************************************************************/
13
14#ifndef LV2SYMBOLS_H
15#define LV2SYMBOLS_H
16
17#include <vector>
18#include "LV2Utils.h"
19#include "MemoryX.h"
20
21#if !defined(LV2_CORE__MIDIPlugin)
22#define LV2_CORE__MIDIPlugin LV2_CORE_PREFIX "MIDIPlugin"
23#endif
24
25#if !defined(LV2_CORE__Enabled)
26#define LV2_CORE__enabled LV2_CORE_PREFIX "enabled"
27#endif
28
29#if !defined(LV2_UI__makeResident)
30#define LV2_UI__makeResident LV2_UI_PREFIX "makeResident"
31#endif
32
33#if !defined(LV2_BUF_SIZE__nominalBlockLength)
34#define LV2_BUF_SIZE__nominalBlockLength LV2_BUF_SIZE_PREFIX "nominalBlockLength"
35#endif
36
37// The "ll-plugin" package includes math functions that appear as plugins
38// and the best way to exclude them is by their class URI.
39#define LL_NAMESPACE "http://ll-plugins.nongnu.org/lv2/namespace#"
40#define LL_MATH_CONSTANTS LL_NAMESPACE "MathConstantPlugin"
41#define LL_MATH_FUNCTIONS LL_NAMESPACE "MathFunctionPlugin"
42
43// Define the list of URIs that need an LilvNode created
44#undef NODE
45#define NODE(n, u)
46
47#undef NODELIST
48#define NODELIST \
49 NODE( AtomPort, LV2_ATOM__AtomPort ) \
50 NODE( MaxBlockLength, LV2_BUF_SIZE__maxBlockLength ) \
51 NODE( MinBlockLength, LV2_BUF_SIZE__minBlockLength ) \
52 NODE( AudioPort, LV2_CORE__AudioPort ) \
53 NODE( ControlPort, LV2_CORE__ControlPort ) \
54 NODE( CVPort, LV2_CORE__CVPort ) \
55 NODE( Designation, LV2_CORE__designation ) \
56 NODE( InputPort, LV2_CORE__InputPort ) \
57 NODE( InstrumentPlugin, LV2_CORE__InstrumentPlugin ) \
58 NODE( MIDIPlugin, LV2_CORE__MIDIPlugin ) \
59 NODE( OutputPort, LV2_CORE__OutputPort ) \
60 NODE( Control, LV2_CORE__control ) \
61 NODE( Enumeration, LV2_CORE__enumeration ) \
62 NODE( Integer, LV2_CORE__integer ) \
63 NODE( Name, LV2_CORE__name ) \
64 NODE( OptionalFeature, LV2_CORE__optionalFeature ) \
65 NODE( RequiredFeature, LV2_CORE__requiredFeature ) \
66 NODE( SampleRate, LV2_CORE__sampleRate ) \
67 NODE( Toggled, LV2_CORE__toggled ) \
68 NODE( ExternalUI, LV2_EXTERNAL_UI__Widget ) \
69 NODE( ExternalUIOld, LV2_EXTERNAL_UI_DEPRECATED_URI ) \
70 NODE( MidiEvent, LV2_MIDI__MidiEvent ) \
71 NODE( SupportedOption, LV2_OPTIONS__supportedOption ) \
72 NODE( RequiredOption, LV2_OPTIONS__requiredOption ) \
73 NODE( Group, LV2_PORT_GROUPS__group ) \
74 NODE( Logarithmic, LV2_PORT_PROPS__logarithmic ) \
75 NODE( Trigger, LV2_PORT_PROPS__trigger ) \
76 NODE( Preset, LV2_PRESETS__Preset ) \
77 NODE( MinimumSize, LV2_RESIZE_PORT__minimumSize ) \
78 NODE( Position, LV2_TIME__Position ) \
79 NODE( Gtk, LV2_UI__GtkUI ) \
80 NODE( Gtk3, LV2_UI__Gtk3UI ) \
81 NODE( Unit, LV2_UNITS__unit ) \
82 NODE( Comment, LILV_NS_RDFS "comment" ) \
83 NODE( Label, LILV_NS_RDFS "label" ) \
84 NODE( MathConstants, LL_MATH_CONSTANTS ) \
85 NODE( MathFunctions, LL_MATH_FUNCTIONS )
86
87// Define the list of URIs that need a URID registered
88#undef URID
89#define URID(n, u)
90
91#undef URIDLIST
92#define URIDLIST \
93 URID( Blank, LV2_ATOM__Blank ) \
94 URID( Bool, LV2_ATOM__Bool ) \
95 URID( Chunk, LV2_ATOM__Chunk ) \
96 URID( Double, LV2_ATOM__Double ) \
97 URID( Float, LV2_ATOM__Float ) \
98 URID( Int, LV2_ATOM__Int ) \
99 URID( Literal, LV2_ATOM__Literal ) \
100 URID( Long, LV2_ATOM__Long ) \
101 URID( Object, LV2_ATOM__Object ) \
102 URID( Path, LV2_ATOM__Path ) \
103 URID( Property, LV2_ATOM__Property ) \
104 URID( Resource, LV2_ATOM__Resource ) \
105 URID( Sequence, LV2_ATOM__Sequence ) \
106 URID( String, LV2_ATOM__String ) \
107 URID( Tuple, LV2_ATOM__Tuple ) \
108 URID( Uri, LV2_ATOM__URI ) \
109 URID( Urid, LV2_ATOM__URID ) \
110 URID( Vector, LV2_ATOM__Vector ) \
111 URID( EventTransfer, LV2_ATOM__eventTransfer ) \
112 URID( AtomSupports, LV2_ATOM__supports ) \
113 URID( MaxBlockLength, LV2_BUF_SIZE__maxBlockLength ) \
114 URID( MinBlockLength, LV2_BUF_SIZE__minBlockLength ) \
115 URID( NominalBlockLength, LV2_BUF_SIZE__nominalBlockLength ) \
116 URID( SequenceSize, LV2_BUF_SIZE__sequenceSize ) \
117 URID( InstrumentPlugin, LV2_CORE__InstrumentPlugin ) \
118 URID( MIDIPlugin, LV2_CORE__MIDIPlugin ) \
119 URID( Toggled, LV2_CORE__toggled ) \
120 URID( ExternalUI, LV2_EXTERNAL_UI__Widget ) \
121 URID( ExternalUIOld, LV2_EXTERNAL_UI_DEPRECATED_URI ) \
122 URID( Error, LV2_LOG__Error ) \
123 URID( Note, LV2_LOG__Note ) \
124 URID( Trace, LV2_LOG__Trace ) \
125 URID( Warning, LV2_LOG__Warning ) \
126 URID( MidiEvent, LV2_MIDI__MidiEvent ) \
127 URID( RequiredOption, LV2_OPTIONS__requiredOption ) \
128 URID( SampleRate, LV2_PARAMETERS__sampleRate ) \
129 URID( RangeSteps, LV2_PORT_PROPS__rangeSteps ) \
130 URID( NotOnGUI, LV2_PORT_PROPS__notOnGUI ) \
131 URID( Expensive, LV2_PORT_PROPS__expensive ) \
132 URID( CausesArtifacts, LV2_PORT_PROPS__causesArtifacts ) \
133 URID( NotAutomatic, LV2_PORT_PROPS__notAutomatic ) \
134 URID( Position, LV2_TIME__Position ) \
135 URID( Speed, LV2_TIME__speed ) \
136 URID( Frame, LV2_TIME__frame )
137
138namespace LV2Symbols {
139
140extern LV2_API LilvWorld *gWorld;
141
142using URIDMap = std::vector<MallocString<>>;
143
145extern LV2_API URIDMap gURIDMap;
146
149LV2_API LV2_URID Lookup_URI(URIDMap & map, const char *uri, bool add = true);
150
151// Declare the static LILV URI nodes
152#undef NODE
153#define NODE(n, u) \
154 extern LV2_API LilvNode *node_##n; \
155 extern LilvNodePtr unode_##n;
157
158// Declare the static URIDs
159#undef URID
160#define URID(n, u) extern LV2_API LV2_URID urid_##n;
162
164LV2_API bool InitializeGWorld();
166LV2_API void FinalizeGWorld();
167
168}
169
170#endif
#define NODELIST
Definition: LV2Symbols.h:48
#define URIDLIST
Definition: LV2Symbols.h:92
RAII for lv2 resources.
void FinalizeGWorld()
Call at end of session.
Definition: LV2Symbols.cpp:71
URIDLIST bool InitializeGWorld()
Call before any use of the constants defined in this file.
Definition: LV2Symbols.cpp:48
std::vector< MallocString<> > URIDMap
Definition: LV2Symbols.h:142
LV2_URID Lookup_URI(URIDMap &map, const char *uri, bool add)
Definition: LV2Symbols.cpp:76
LilvWorld * gWorld
Definition: LV2Symbols.cpp:31
URIDMap gURIDMap
Declare the global map of positive integers to URIs.
Definition: LV2Symbols.cpp:34
void add(const T *src1, const T *src2, T *dst, int32_t n)
Definition: VectorOps.h:46