aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHanspeter Portner <dev@open-music-kontrollers.ch>2016-01-07 17:59:49 +0100
committerDavid Robillard <d@drobilla.net>2016-01-07 15:42:56 -0500
commit1ed0a8483153f8afaf753cf1212be48cff653aa9 (patch)
tree3f823c56dcb6a9f60905a04cd65897e587a84e62
parent0bb0b753c62c900027def66288489442cb69f336 (diff)
downloadjalv-1ed0a8483153f8afaf753cf1212be48cff653aa9.tar.gz
jalv-1ed0a8483153f8afaf753cf1212be48cff653aa9.tar.bz2
jalv-1ed0a8483153f8afaf753cf1212be48cff653aa9.zip
Fix patch:Put handling
(Property, Value) pairs are expected to be embedded in a patch:body property object, not direcly in the patch:Put object.
-rw-r--r--src/jalv.c1
-rw-r--r--src/jalv_gtk.c26
-rw-r--r--src/jalv_internal.h1
3 files changed, 26 insertions, 2 deletions
diff --git a/src/jalv.c b/src/jalv.c
index 3235120..6a300b2 100644
--- a/src/jalv.c
+++ b/src/jalv.c
@@ -1003,6 +1003,7 @@ main(int argc, char** argv)
jalv.urids.patch_Get = symap_map(jalv.symap, LV2_PATCH__Get);
jalv.urids.patch_Put = symap_map(jalv.symap, LV2_PATCH__Put);
jalv.urids.patch_Set = symap_map(jalv.symap, LV2_PATCH__Set);
+ jalv.urids.patch_body = symap_map(jalv.symap, LV2_PATCH__body);
jalv.urids.patch_property = symap_map(jalv.symap, LV2_PATCH__property);
jalv.urids.patch_value = symap_map(jalv.symap, LV2_PATCH__value);
jalv.urids.time_Position = symap_map(jalv.symap, LV2_TIME__Position);
diff --git a/src/jalv_gtk.c b/src/jalv_gtk.c
index 104d7a2..f3e1fef 100644
--- a/src/jalv_gtk.c
+++ b/src/jalv_gtk.c
@@ -622,6 +622,25 @@ patch_set_get(Jalv* jalv,
return 0;
}
+static int
+patch_put_get(Jalv* jalv,
+ const LV2_Atom_Object* obj,
+ const LV2_Atom_Object** body)
+{
+ lv2_atom_object_get(obj,
+ jalv->urids.patch_body, (const LV2_Atom*)body,
+ 0);
+ if (!*body) {
+ fprintf(stderr, "patch:Put message with no body\n");
+ return 1;
+ } else if (!lv2_atom_forge_is_object_type(&jalv->forge, (*body)->atom.type)) {
+ fprintf(stderr, "patch:Put body is not an object\n");
+ return 1;
+ }
+
+ return 0;
+}
+
static void
property_changed(Jalv* jalv, LV2_URID key, const LV2_Atom* value)
{
@@ -663,8 +682,11 @@ jalv_ui_port_event(Jalv* jalv,
property_changed(jalv, property->body, value);
}
} else if (obj->body.otype == jalv->urids.patch_Put) {
- LV2_ATOM_OBJECT_FOREACH(obj, prop) {
- property_changed(jalv, prop->key, &prop->value);
+ const LV2_Atom_Object* body = NULL;
+ if (!patch_put_get(jalv, obj, &body)) {
+ LV2_ATOM_OBJECT_FOREACH(body, prop) {
+ property_changed(jalv, prop->key, &prop->value);
+ }
}
} else {
printf("Unknown object type?\n");
diff --git a/src/jalv_internal.h b/src/jalv_internal.h
index bea236c..0f9f7f3 100644
--- a/src/jalv_internal.h
+++ b/src/jalv_internal.h
@@ -176,6 +176,7 @@ typedef struct {
LV2_URID patch_Get;
LV2_URID patch_Put;
LV2_URID patch_Set;
+ LV2_URID patch_body;
LV2_URID patch_property;
LV2_URID patch_value;
LV2_URID time_Position;