Skip to content
Browse files

Expose impulse file parameter so it can be displayed in host UI (curr…

…ently works in Jalv).

Update for latest LV2 patch extension (compact patch:Set message).
Fix broken channel designations (now passes sord_validate).
  • Loading branch information...
1 parent 1b88a89 commit e4a26302c15ad1a0eec33cce45f30838680aadcb @drobilla drobilla committed Jan 10, 2013
Showing with 89 additions and 75 deletions.
  1. +38 −22 convoLV2.ttl
  2. +2 −2 lv2.c
  3. +49 −51 uris.h
View
60 convoLV2.ttl
@@ -1,8 +1,10 @@
@prefix atom: <http://lv2plug.in/ns/ext/atom#> .
@prefix bufsz: <http://lv2plug.in/ns/ext/buf-size#> .
+@prefix clv2: <http://gareus.org/oss/lv2/convoLV2#> .
@prefix doap: <http://usefulinc.com/ns/doap#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix lv2: <http://lv2plug.in/ns/lv2core#> .
+@prefix patch: <http://lv2plug.in/ns/ext/patch#> .
@prefix pg: <http://lv2plug.in/ns/ext/port-groups#> .
@prefix state: <http://lv2plug.in/ns/ext/state#> .
@prefix ui: <http://lv2plug.in/ns/extensions/ui#> .
@@ -20,7 +22,12 @@
doap:maintainer <http://gareus.org/rgareus#me> ;
doap:name "LV2 Convolution" .
-<http://gareus.org/oss/lv2/convoLV2#Mono>
+clv2:impulse
+ a lv2:Parameter ;
+ rdfs:label "impulse" ;
+ rdfs:range atom:Path .
+
+clv2:Mono
a lv2:Plugin ;
doap:name "LV2 Convolution Mono" ;
doap:license <http://usefulinc.com/doap/licenses/gpl> ;
@@ -35,20 +42,23 @@
lv2:extensionData work:interface ,
state:interface ;
lv2:optionalFeature lv2:hardRTCapable ;
- ui:ui <http://gareus.org/oss/lv2/convoLV2#ui> ;
+ ui:ui clv2:ui ;
+ patch:writable clv2:impulse ;
lv2:port [
a atom:AtomPort ,
lv2:InputPort ;
atom:bufferType atom:Sequence ;
- atom:supports <http://lv2plug.in/ns/ext/patch#Message> ;
+ atom:supports patch:Message ;
+ lv2:designation lv2:control ;
lv2:index 0 ;
lv2:symbol "control" ;
lv2:name "Control"
] , [
a atom:AtomPort ,
lv2:OutputPort ;
atom:bufferType atom:Sequence ;
- atom:supports <http://lv2plug.in/ns/ext/patch#Message> ;
+ atom:supports patch:Message ;
+ lv2:designation lv2:control ;
lv2:index 1 ;
lv2:symbol "notify" ;
lv2:name "Notify"
@@ -66,7 +76,7 @@
lv2:name "In"
] .
-<http://gareus.org/oss/lv2/convoLV2#Stereo>
+clv2:Stereo
a lv2:Plugin ;
doap:name "LV2 Convolution Stereo" ;
doap:license <http://usefulinc.com/doap/licenses/gpl> ;
@@ -79,20 +89,23 @@
lv2:extensionData work:interface ,
state:interface ;
lv2:optionalFeature lv2:hardRTCapable ;
- ui:ui <http://gareus.org/oss/lv2/convoLV2#ui> ;
+ ui:ui clv2:ui ;
+ patch:writable clv2:impulse ;
lv2:port [
a atom:AtomPort ,
lv2:InputPort ;
atom:bufferType atom:Sequence ;
- atom:supports <http://lv2plug.in/ns/ext/patch#Message> ;
+ atom:supports patch:Message ;
+ lv2:designation lv2:control ;
lv2:index 0 ;
lv2:symbol "control" ;
lv2:name "Control"
] , [
a atom:AtomPort ,
lv2:OutputPort ;
atom:bufferType atom:Sequence ;
- atom:supports <http://lv2plug.in/ns/ext/patch#Message> ;
+ atom:supports patch:Message ;
+ lv2:designation lv2:control ;
lv2:index 1 ;
lv2:symbol "notify" ;
lv2:name "Notify"
@@ -102,31 +115,31 @@
lv2:index 2 ;
lv2:symbol "out_1" ;
lv2:name "OutL" ;
- lv2:designation pg:leftChannel
+ lv2:designation pg:left
] , [
a lv2:AudioPort ,
lv2:InputPort ;
lv2:index 3 ;
lv2:symbol "in_1" ;
lv2:name "InL" ;
- lv2:designation pg:leftChannel
+ lv2:designation pg:left
] , [
a lv2:AudioPort ,
lv2:OutputPort ;
lv2:index 4 ;
lv2:symbol "out_2" ;
lv2:name "OutR" ;
- lv2:designation pg:rightChannel
+ lv2:designation pg:right
] , [
a lv2:AudioPort ,
lv2:InputPort ;
lv2:index 5 ;
lv2:symbol "in_2" ;
lv2:name "InR" ;
- lv2:designation pg:rightChannel
+ lv2:designation pg:right
] .
-<http://gareus.org/oss/lv2/convoLV2#MonoToStereo>
+clv2:MonoToStereo
a lv2:Plugin ;
doap:name "LV2 Convolution Mono=>Stereo" ;
doap:license <http://usefulinc.com/doap/licenses/gpl> ;
@@ -139,20 +152,23 @@
lv2:extensionData work:interface ,
state:interface ;
lv2:optionalFeature lv2:hardRTCapable ;
- ui:ui <http://gareus.org/oss/lv2/convoLV2#ui> ;
+ ui:ui clv2:ui ;
+ patch:writable clv2:impulse ;
lv2:port [
a atom:AtomPort ,
lv2:InputPort ;
atom:bufferType atom:Sequence ;
- atom:supports <http://lv2plug.in/ns/ext/patch#Message> ;
+ atom:supports patch:Message ;
+ lv2:designation lv2:control ;
lv2:index 0 ;
lv2:symbol "control" ;
lv2:name "Control"
] , [
a atom:AtomPort ,
lv2:OutputPort ;
atom:bufferType atom:Sequence ;
- atom:supports <http://lv2plug.in/ns/ext/patch#Message> ;
+ atom:supports patch:Message ;
+ lv2:designation lv2:control ;
lv2:index 1 ;
lv2:symbol "notify" ;
lv2:name "Notify"
@@ -162,7 +178,7 @@
lv2:index 2 ;
lv2:symbol "out_1" ;
lv2:name "OutL" ;
- lv2:designation pg:leftChannel
+ lv2:designation pg:left
] , [
a lv2:AudioPort ,
lv2:InputPort ;
@@ -175,22 +191,22 @@
lv2:index 4 ;
lv2:symbol "out_2" ;
lv2:name "OutR" ;
- lv2:designation pg:rightChannel
+ lv2:designation pg:right
] .
-<http://gareus.org/oss/lv2/convoLV2#ui>
+clv2:ui
a ui:GtkUI ;
lv2:requiredFeature urid:map ;
ui:portNotification [
- ui:plugin <http://gareus.org/oss/lv2/convoLV2#Mono> ;
+ ui:plugin clv2:Mono ;
lv2:symbol "notify" ;
ui:notifyType atom:Blank
] , [
- ui:plugin <http://gareus.org/oss/lv2/convoLV2#Stereo> ;
+ ui:plugin clv2:Stereo ;
lv2:symbol "notify" ;
ui:notifyType atom:Blank
] , [
- ui:plugin <http://gareus.org/oss/lv2/convoLV2#MonoToStereo> ;
+ ui:plugin clv2:MonoToStereo ;
lv2:symbol "notify" ;
ui:notifyType atom:Blank
] .
View
4 lv2.c
@@ -421,7 +421,7 @@ save(LV2_Handle instance,
char fn[1024]; // PATH_MAX
if (clv_query_setting(self->clv_online, "convolution.ir.file", fn, 1024) > 0 ) {
char* apath = map_path->abstract_path(map_path->handle, fn);
- store(handle, self->uris.clv2_ir_file,
+ store(handle, self->uris.clv2_impulse,
apath, strlen(apath) + 1,
self->uris.atom_Path,
LV2_STATE_IS_POD | LV2_STATE_IS_PORTABLE);
@@ -472,7 +472,7 @@ restore(LV2_Handle instance,
}
}
- value = retrieve(handle, self->uris.clv2_ir_file, &size, &type, &valflags);
+ value = retrieve(handle, self->uris.clv2_impulse, &size, &type, &valflags);
if (value) {
const char* path = (const char*)value;
View
100 uris.h
@@ -18,32 +18,33 @@
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifndef CONVOLV2_URIS_H
-#define CONVOLV2_URIS_H
+#ifndef CLV2_URIS_H
+#define CLV2_URIS_H
#include "lv2/lv2plug.in/ns/ext/atom/atom.h"
#include "lv2/lv2plug.in/ns/ext/atom/forge.h"
#include "lv2/lv2plug.in/ns/ext/urid/urid.h"
#include "lv2/lv2plug.in/ns/ext/patch/patch.h"
-#define CONVOLV2_URI "http://gareus.org/oss/lv2/convoLV2"
-#define CONVOLV2__file CONVOLV2_URI "#file"
-#define CONVOLV2__load CONVOLV2_URI "#load"
-#define CONVOLV2__state CONVOLV2_URI "#state"
-#define CONVOLV2__uiinit CONVOLV2_URI "#uiinit"
+#define CONVOLV2_URI "http://gareus.org/oss/lv2/convoLV2"
+
+#define CLV2__impulse CONVOLV2_URI "#impulse"
+#define CLV2__load CONVOLV2_URI "#load"
+#define CLV2__state CONVOLV2_URI "#state"
+#define CLV2__uiinit CONVOLV2_URI "#uiinit"
typedef struct {
LV2_URID atom_Blank;
LV2_URID atom_Path;
LV2_URID atom_String;
+ LV2_URID atom_URID;
LV2_URID atom_eventTransfer;
-
- LV2_URID patch_Set;
- LV2_URID patch_body;
-
- LV2_URID clv2_ir_file;
+ LV2_URID clv2_impulse;
LV2_URID clv2_state;
LV2_URID clv2_uiinit;
+ LV2_URID patch_Set;
+ LV2_URID patch_property;
+ LV2_URID patch_value;
} ConvoLV2URIs;
static inline void
@@ -52,17 +53,16 @@ map_convolv2_uris(LV2_URID_Map* map, ConvoLV2URIs* uris)
uris->atom_Blank = map->map(map->handle, LV2_ATOM__Blank);
uris->atom_Path = map->map(map->handle, LV2_ATOM__Path);
uris->atom_String = map->map(map->handle, LV2_ATOM__String);
+ uris->atom_URID = map->map(map->handle, LV2_ATOM__URID);
uris->atom_eventTransfer = map->map(map->handle, LV2_ATOM__eventTransfer);
-
+ uris->clv2_impulse = map->map(map->handle, CLV2__impulse);
+ uris->clv2_state = map->map(map->handle, CLV2__state);
+ uris->clv2_uiinit = map->map(map->handle, CLV2__uiinit);
uris->patch_Set = map->map(map->handle, LV2_PATCH__Set);
- uris->patch_body = map->map(map->handle, LV2_PATCH__body);
-
- uris->clv2_ir_file = map->map(map->handle, CONVOLV2__file);
- uris->clv2_state = map->map(map->handle, CONVOLV2__state);
- uris->clv2_uiinit = map->map(map->handle, CONVOLV2__uiinit);
+ uris->patch_property = map->map(map->handle, LV2_PATCH__property);
+ uris->patch_value = map->map(map->handle, LV2_PATCH__value);
}
-
static inline bool
is_object_type(const ConvoLV2URIs* uris, LV2_URID type)
{
@@ -71,70 +71,68 @@ is_object_type(const ConvoLV2URIs* uris, LV2_URID type)
/**
* Write a message like the following to @p forge:
- * [
+ * []
* a patch:Set ;
- * patch:body [
- * clv2_ir_file </home/me/foo.wav> ;
- * ] ;
- * ]
+ * patch:property convolv2:impulse ;
+ * patch:value </home/me/foo.wav> .
*/
static inline LV2_Atom*
-write_set_file(LV2_Atom_Forge* forge,
+write_set_file(LV2_Atom_Forge* forge,
const ConvoLV2URIs* uris,
- const char* filename)
+ const char* filename)
{
- LV2_Atom_Forge_Frame set_frame;
+ LV2_Atom_Forge_Frame frame;
LV2_Atom* set = (LV2_Atom*)lv2_atom_forge_blank(
- forge, &set_frame, 1, uris->patch_Set);
-
- lv2_atom_forge_property_head(forge, uris->patch_body, 0);
- LV2_Atom_Forge_Frame body_frame;
- lv2_atom_forge_blank(forge, &body_frame, 2, 0);
+ forge, &frame, 1, uris->patch_Set);
- lv2_atom_forge_property_head(forge, uris->clv2_ir_file, 0);
+ lv2_atom_forge_property_head(forge, uris->patch_property, 0);
+ lv2_atom_forge_urid(forge, uris->clv2_impulse);
+ lv2_atom_forge_property_head(forge, uris->patch_value, 0);
lv2_atom_forge_path(forge, filename, strlen(filename));
- lv2_atom_forge_pop(forge, &body_frame);
- lv2_atom_forge_pop(forge, &set_frame);
+ lv2_atom_forge_pop(forge, &frame);
return set;
}
/**
* Get the file path from a message like:
- * [
+ * []
* a patch:Set ;
- * patch:body [
- * clv2_ir_file </home/me/foo.wav> ;
- * ] ;
- * ]
+ * patch:property convolv2:impulse ;
+ * patch:value </home/me/foo.wav> .
*/
static inline const LV2_Atom*
-read_set_file(const ConvoLV2URIs* uris,
+read_set_file(const ConvoLV2URIs* uris,
const LV2_Atom_Object* obj)
{
if (obj->body.otype != uris->patch_Set) {
fprintf(stderr, "Ignoring unknown message type %d\n", obj->body.otype);
return NULL;
}
- /* Get body of message. */
- const LV2_Atom_Object* body = NULL;
- lv2_atom_object_get(obj, uris->patch_body, &body, 0);
- if (!body) {
+ /* Get property URI. */
+ const LV2_Atom* property = NULL;
+ lv2_atom_object_get(obj, uris->patch_property, &property, 0);
+ if (!property) {
fprintf(stderr, "Malformed set message has no body.\n");
return NULL;
- }
- if (!is_object_type(uris, body->atom.type)) {
- fprintf(stderr, "Malformed set message has non-object body.\n");
+ } else if (property->type != uris->atom_URID) {
+ fprintf(stderr, "Malformed set message has non-URID property.\n");
+ return NULL;
+ } else if (((LV2_Atom_URID*)property)->body != uris->clv2_impulse) {
+ fprintf(stderr, "Set message for unknown property.\n");
return NULL;
}
- /* Get file path from body. */
+ /* Get value. */
const LV2_Atom* file_path = NULL;
- lv2_atom_object_get(body, uris->clv2_ir_file, &file_path, 0);
+ lv2_atom_object_get(obj, uris->patch_value, &file_path, 0);
if (!file_path) {
- fprintf(stderr, "Ignored set message with no file path.\n");
+ fprintf(stderr, "Malformed set message has no value.\n");
+ return NULL;
+ } else if (file_path->type != uris->atom_Path) {
+ fprintf(stderr, "Set message value is not a Path.\n");
return NULL;
}

0 comments on commit e4a2630

Please sign in to comment.
Something went wrong with that request. Please try again.