aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/eg-sampler.lv2/uris.h
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-02-13 02:34:41 +0000
committerDavid Robillard <d@drobilla.net>2012-02-13 02:34:41 +0000
commit432035026d8a74e550a41a0d811a0f089a97dcc1 (patch)
tree336353eacf7f6f1a0c0cd47791667fe70b33002e /plugins/eg-sampler.lv2/uris.h
parent806dd3218ab67efcc68e25bfe3a68fddfec029b6 (diff)
downloadlv2-432035026d8a74e550a41a0d811a0f089a97dcc1.tar.xz
Centralize URI map cache and use in both plugin and UI.
Diffstat (limited to 'plugins/eg-sampler.lv2/uris.h')
-rw-r--r--plugins/eg-sampler.lv2/uris.h31
1 files changed, 29 insertions, 2 deletions
diff --git a/plugins/eg-sampler.lv2/uris.h b/plugins/eg-sampler.lv2/uris.h
index 87b16cc..e1c6edd 100644
--- a/plugins/eg-sampler.lv2/uris.h
+++ b/plugins/eg-sampler.lv2/uris.h
@@ -15,11 +15,38 @@
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#ifndef SAMPLER_URIS_H
+#define SAMPLER_URIS_H
+
+#include "lv2/lv2plug.in/ns/ext/state/state.h"
+
#define NS_ATOM "http://lv2plug.in/ns/ext/atom#"
#define NS_RDF "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
#define SAMPLER_URI "http://lv2plug.in/plugins/eg-sampler"
#define MIDI_EVENT_URI "http://lv2plug.in/ns/ext/midi#MidiEvent"
#define FILENAME_URI SAMPLER_URI "#filename"
-#define ATOM_BLANK_URI NS_ATOM "Blank"
-#define ATOM_RESOURCE_URI NS_ATOM "Resource"
+
+typedef struct {
+ LV2_URID atom_Blank;
+ LV2_URID atom_Resource;
+ LV2_URID eg_filename;
+ LV2_URID midi_Event;
+ LV2_URID msg_Set;
+ LV2_URID msg_body;
+ LV2_URID state_Path;
+} SamplerURIs;
+
+static inline void
+map_sampler_uris(LV2_URID_Map* map, SamplerURIs* uris)
+{
+ uris->atom_Blank = map->map(map->handle, NS_ATOM "Blank");
+ uris->atom_Resource = map->map(map->handle, NS_ATOM "Resource");
+ uris->eg_filename = map->map(map->handle, FILENAME_URI);
+ uris->midi_Event = map->map(map->handle, MIDI_EVENT_URI);
+ uris->msg_Set = map->map(map->handle, LV2_MESSAGE_Set);
+ uris->msg_body = map->map(map->handle, LV2_MESSAGE_body);
+ uris->state_Path = map->map(map->handle, LV2_STATE_PATH_URI);
+}
+
+#endif /* SAMPLER_URIS_H */