aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ext/atom.lv2/forge.h8
-rw-r--r--ext/urid.lv2/urid.h50
-rw-r--r--ext/urid.lv2/urid.ttl14
-rw-r--r--plugins/eg-sampler.lv2/sampler.c30
-rw-r--r--plugins/eg-sampler.lv2/sampler_ui.c14
5 files changed, 59 insertions, 57 deletions
diff --git a/ext/atom.lv2/forge.h b/ext/atom.lv2/forge.h
index b42b384..e8f5d40 100644
--- a/ext/atom.lv2/forge.h
+++ b/ext/atom.lv2/forge.h
@@ -35,12 +35,12 @@ typedef struct {
} LV2_Atom_Forge;
static inline LV2_Atom_Forge*
-lv2_atom_forge_new(LV2_URID_Mapper* mapper)
+lv2_atom_forge_new(LV2_URID_Map* map)
{
LV2_Atom_Forge* forge = (LV2_Atom_Forge*)malloc(sizeof(LV2_Atom_Forge));
- forge->ID = mapper->map_uri(mapper->handle, LV2_ATOM_URI "#ID");
- forge->Message = mapper->map_uri(mapper->handle, LV2_ATOM_URI "#Message");
- forge->Property = mapper->map_uri(mapper->handle, LV2_ATOM_URI "#Property");
+ forge->ID = map->map(map->handle, LV2_ATOM_URI "#ID");
+ forge->Message = map->map(map->handle, LV2_ATOM_URI "#Message");
+ forge->Property = map->map(map->handle, LV2_ATOM_URI "#Property");
return forge;
}
diff --git a/ext/urid.lv2/urid.h b/ext/urid.lv2/urid.h
index 0a01aeb..d36d0dd 100644
--- a/ext/urid.lv2/urid.h
+++ b/ext/urid.lv2/urid.h
@@ -28,14 +28,14 @@
#include <stdint.h>
/**
- Opaque pointer to host data for LV2_URID_Mapper.
+ Opaque pointer to host data for LV2_URID_Map.
*/
-typedef void* LV2_URID_Mapper_Handle;
+typedef void* LV2_URID_Map_Handle;
/**
- Opaque pointer to host data for LV2_URID_Unmapper.
+ Opaque pointer to host data for LV2_URID_Unmap.
*/
-typedef void* LV2_URID_Unmapper_Handle;
+typedef void* LV2_URID_Unmap_Handle;
/**
URI mapped to an integer.
@@ -43,7 +43,7 @@ typedef void* LV2_URID_Unmapper_Handle;
typedef uint32_t LV2_URID;
/**
- URI Mapper (http://lv2plug.in/ns/ext/urid#Mapper).
+ URI Map (http://lv2plug.in/ns/ext/urid#map).
*/
typedef struct {
/**
@@ -52,7 +52,7 @@ typedef struct {
This MUST be passed to map_uri() whenever it is called.
Otherwise, it must not be interpreted in any way.
*/
- LV2_URID_Mapper_Handle handle;
+ LV2_URID_Map_Handle handle;
/**
Get the numeric ID of a URI.
@@ -61,9 +61,11 @@ typedef struct {
This function is referentially transparent; any number of calls with the
same arguments is guaranteed to return the same value over the life of a
- plugin instance. However, this function is not necessarily very
- fast or RT-safe: plugins SHOULD cache any IDs they might need in
- performance critical situations.
+ plugin instance. Note, however, that several URIs MAY resolve to the
+ same ID if the host considers those URIs equivalent.
+
+ This function is not necessarily very fast or RT-safe: plugins SHOULD
+ cache any IDs they might need in performance critical situations.
The return value 0 is reserved and indicates that an ID for that URI
could not be created for whatever reason. However, hosts SHOULD NOT
@@ -73,39 +75,39 @@ typedef struct {
@param handle Must be the callback_data member of this struct.
@param uri The URI to be mapped to an integer ID.
*/
- LV2_URID (*map_uri)(LV2_URID_Mapper_Handle handle,
- const char* uri);
-} LV2_URID_Mapper;
+ LV2_URID (*map)(LV2_URID_Map_Handle handle,
+ const char* uri);
+} LV2_URID_Map;
/**
- URI Unmapper (http://lv2plug.in/ns/ext/urid#Unmapper).
+ URI Unmap (http://lv2plug.in/ns/ext/urid#unmap).
*/
typedef struct {
/**
Opaque pointer to host data.
- This MUST be passed to unmap_uri() whenever it is called.
+ This MUST be passed to unmap() whenever it is called.
Otherwise, it must not be interpreted in any way.
*/
- LV2_URID_Unmapper_Handle handle;
+ LV2_URID_Unmap_Handle handle;
/**
Get the URI for a previously mapped numeric ID.
Returns NULL if @c urid is not yet mapped. Otherwise, the corresponding
URI is returned in a canonical form. This MAY not be the exact same
- string that was originally passed to map_uri(), but it MUST be an
- identical URI according to the URI spec. A non-NULL return for a given
- @c urid will always be the same for the life of the plugin. Plugins
- that intend to perform string comparison on unmapped URIs SHOULD first
- canonicalise URI strings with a call to map_uri() followed by a call to
- unmap_uri().
+ string that was originally passed to LV2_URID_Map::map(), but it MUST be
+ an identical URI according to the URI syntax specification (RFC3986). A
+ non-NULL return for a given @c urid will always be the same for the life
+ of the plugin. Plugins that intend to perform string comparison on
+ unmapped URIs SHOULD first canonicalise URI strings with a call to
+ map_uri() followed by a call to unmap_uri().
@param handle Must be the callback_data member of this struct.
@param urid The ID to be mapped back to the URI string.
*/
- const char* (*unmap_uri)(LV2_URID_Unmapper_Handle handle,
- LV2_URID urid);
-} LV2_URID_Unmapper;
+ const char* (*unmap)(LV2_URID_Unmap_Handle handle,
+ LV2_URID urid);
+} LV2_URID_Unmap;
#endif /* LV2_URID_H */
diff --git a/ext/urid.lv2/urid.ttl b/ext/urid.lv2/urid.ttl
index 85af5c4..6b05071 100644
--- a/ext/urid.lv2/urid.ttl
+++ b/ext/urid.lv2/urid.ttl
@@ -47,21 +47,21 @@ This extension is intended as an improved and simpler replacement for the
<q>map</q> context parameter has been found problematic.
""" .
-urid:Mapper
+urid:map
a lv2:Feature ;
lv2:documentation """
A feature which is used to map URIs to integers. To support this feature, the
host must pass an LV2_Feature to LV2_Descriptor::instantiate() with
-<em>URI</em> <q>http://lv2plug.in/ns/ext/urid#Mapper</q> and <em>data</em>
-pointed to an instance of LV2_URID_Mapper.
+<em>URI</em> <q>http://lv2plug.in/ns/ext/urid#map</q> and <em>data</em>
+pointed to an instance of LV2_URID_Map.
""" .
-urid:Unmapper
+urid:unmap
a lv2:Feature ;
lv2:documentation """
A feature which is used to unmap URIs previously mapped to integers by
-urid:Mapper. To support this feature, the host must pass an LV2_Feature to
+urid:map. To support this feature, the host must pass an LV2_Feature to
LV2_Descriptor::instantiate() with <em>URI</em>
-<q>http://lv2plug.in/ns/ext/urid#Unmapper</q> and <em>data</em> pointed to an
-instance of LV2_URID_Unmapper.
+<q>http://lv2plug.in/ns/ext/urid#unmap</q> and <em>data</em> pointed to an
+instance of LV2_URID_Unmap.
""" .
diff --git a/plugins/eg-sampler.lv2/sampler.c b/plugins/eg-sampler.lv2/sampler.c
index ecebc12..062cf66 100644
--- a/plugins/eg-sampler.lv2/sampler.c
+++ b/plugins/eg-sampler.lv2/sampler.c
@@ -66,7 +66,7 @@ typedef struct {
typedef struct {
/* Features */
- LV2_URID_Mapper* mapper;
+ LV2_URID_Map* map;
/* Sample */
SampleFile* samp;
@@ -220,23 +220,23 @@ instantiate(const LV2_Descriptor* descriptor,
goto fail;
}
- /* Scan host features for uri mapper */
+ /* Scan host features for URID map */
for (int i = 0; features[i]; ++i) {
- if (!strcmp(features[i]->URI, LV2_URID_URI "#Mapper")) {
- plugin->mapper = (LV2_URID_Mapper*)features[i]->data;
- plugin->midi_event_id = plugin->mapper->map_uri(
- plugin->mapper->handle, MIDI_EVENT_URI);
- plugin->atom_message_id = plugin->mapper->map_uri(
- plugin->mapper->handle, ATOM_MESSAGE_URI);
- plugin->set_message_id = plugin->mapper->map_uri(
- plugin->mapper->handle, SET_MESSAGE_URI);
- plugin->filename_key_id = plugin->mapper->map_uri(
- plugin->mapper->handle, FILENAME_URI);
+ if (!strcmp(features[i]->URI, LV2_URID_URI "#map")) {
+ plugin->map = (LV2_URID_Map*)features[i]->data;
+ plugin->midi_event_id = plugin->map->map(
+ plugin->map->handle, MIDI_EVENT_URI);
+ plugin->atom_message_id = plugin->map->map(
+ plugin->map->handle, ATOM_MESSAGE_URI);
+ plugin->set_message_id = plugin->map->map(
+ plugin->map->handle, SET_MESSAGE_URI);
+ plugin->filename_key_id = plugin->map->map(
+ plugin->map->handle, FILENAME_URI);
}
}
- if (!plugin->mapper) {
- fprintf(stderr, "Host does not support urid:Mapper.\n");
+ if (!plugin->map) {
+ fprintf(stderr, "Host does not support urid:map.\n");
goto fail;
}
@@ -348,7 +348,7 @@ run(LV2_Handle instance,
static uint32_t
map_uri(Sampler* plugin, const char* uri)
{
- return plugin->mapper->map_uri(plugin->mapper->handle, uri);
+ return plugin->map->map(plugin->map->handle, uri);
}
static void
diff --git a/plugins/eg-sampler.lv2/sampler_ui.c b/plugins/eg-sampler.lv2/sampler_ui.c
index f8cc560..c2aa301 100644
--- a/plugins/eg-sampler.lv2/sampler_ui.c
+++ b/plugins/eg-sampler.lv2/sampler_ui.c
@@ -34,7 +34,7 @@
#define SAMPLER_UI_URI "http://lv2plug.in/plugins/eg-sampler#ui"
typedef struct {
- LV2_URID_Mapper* mapper;
+ LV2_URID_Map* map;
LV2_Atom_Forge* forge;
LV2UI_Write_Function write;
@@ -46,7 +46,7 @@ typedef struct {
static LV2_URID
uri_to_id(SamplerUI* ui, const char* uri)
{
- return ui->mapper->map_uri(ui->mapper->handle, uri);
+ return ui->map->map(ui->map->handle, uri);
}
static void
@@ -98,7 +98,7 @@ instantiate(const LV2UI_Descriptor* descriptor,
const LV2_Feature* const* features)
{
SamplerUI* ui = (SamplerUI*)malloc(sizeof(SamplerUI));
- ui->mapper = NULL;
+ ui->map = NULL;
ui->write = write_function;
ui->controller = controller;
ui->button = NULL;
@@ -106,18 +106,18 @@ instantiate(const LV2UI_Descriptor* descriptor,
*widget = NULL;
for (int i = 0; features[i]; ++i) {
- if (!strcmp(features[i]->URI, LV2_URID_URI "#Mapper")) {
- ui->mapper = (LV2_URID_Mapper*)features[i]->data;
+ if (!strcmp(features[i]->URI, LV2_URID_URI "#Map")) {
+ ui->map = (LV2_URID_Map*)features[i]->data;
}
}
- if (!ui->mapper) {
+ if (!ui->map) {
fprintf(stderr, "sampler_ui: Host does not support uri-map\n");
free(ui);
return NULL;
}
- ui->forge = lv2_atom_forge_new(ui->mapper);
+ ui->forge = lv2_atom_forge_new(ui->map);
ui->button = gtk_button_new_with_label("Load Sample");
g_signal_connect(ui->button, "clicked",