diff options
author | David Robillard <d@drobilla.net> | 2013-01-10 06:20:39 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2013-01-10 06:20:39 +0000 |
commit | 4b480bf87cd496446491e3880d867d7fa92c6c49 (patch) | |
tree | 1e67b31180eb6125b3704914c7acd7d248af69d0 | |
parent | 67067320cb53f3c84bb7901e446f3d1798667e57 (diff) | |
download | ingen-4b480bf87cd496446491e3880d867d7fa92c6c49.tar.gz ingen-4b480bf87cd496446491e3880d867d7fa92c6c49.tar.bz2 ingen-4b480bf87cd496446491e3880d867d7fa92c6c49.zip |
Update for latest changes to LV2 patch extension (compact patch:Set message).
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4911 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r-- | ingen/URIs.hpp | 2 | ||||
-rw-r--r-- | src/AtomReader.cpp | 30 | ||||
-rw-r--r-- | src/AtomWriter.cpp | 9 | ||||
-rw-r--r-- | src/URIs.cpp | 2 | ||||
-rw-r--r-- | wscript | 2 |
5 files changed, 27 insertions, 18 deletions
diff --git a/ingen/URIs.hpp b/ingen/URIs.hpp index 77dc00d3..a09037e6 100644 --- a/ingen/URIs.hpp +++ b/ingen/URIs.hpp @@ -141,9 +141,11 @@ public: const Quark patch_add; const Quark patch_body; const Quark patch_destination; + const Quark patch_property; const Quark patch_remove; const Quark patch_request; const Quark patch_subject; + const Quark patch_value; const Quark pprops_logarithmic; const Quark rdf_type; const Quark rdfs_seeAlso; diff --git a/src/AtomReader.cpp b/src/AtomReader.cpp index 63f493a7..55e88427 100644 --- a/src/AtomReader.cpp +++ b/src/AtomReader.cpp @@ -199,22 +199,30 @@ AtomReader::write(const LV2_Atom* msg) _iface.put(Raul::URI(subject_uri), props); } } else if (obj->body.otype == _uris.patch_Set) { - const LV2_Atom_Object* body = NULL; - lv2_atom_object_get(obj, (LV2_URID)_uris.patch_body, &body, 0); - if (!body) { - _log.warn("Set message has no body\n"); - return false; - } else if (!subject_uri) { + if (!subject_uri) { _log.warn("Set message has no subject\n"); return false; } - LV2_ATOM_OBJECT_FOREACH(body, p) { - Raul::Atom val; - get_atom(&p->value, val); - _iface.set_property(Raul::URI(subject_uri), - Raul::URI(_map.unmap_uri(p->key)), val); + const LV2_Atom_URID* prop = NULL; + lv2_atom_object_get(obj, (LV2_URID)_uris.patch_property, &prop, 0); + if (!prop || ((LV2_Atom*)prop)->type != _uris.atom_URID) { + _log.warn("Set message missing property\n"); + return false; } + + const LV2_Atom* value = NULL; + lv2_atom_object_get(obj, (LV2_URID)_uris.patch_value, &value, 0); + if (!value) { + _log.warn("Set message missing value\n"); + return false; + } + + Raul::Atom atom; + get_atom(value, atom); + _iface.set_property(Raul::URI(subject_uri), + Raul::URI(_map.unmap_uri(prop->body)), + atom); } else if (obj->body.otype == _uris.patch_Patch) { if (!subject) { _log.warn("Patch message has no subject\n"); diff --git a/src/AtomWriter.cpp b/src/AtomWriter.cpp index 05e5d64d..2e24e8cc 100644 --- a/src/AtomWriter.cpp +++ b/src/AtomWriter.cpp @@ -242,14 +242,11 @@ AtomWriter::set_property(const Raul::URI& subject, lv2_atom_forge_blank(&_forge, &msg, next_id(), _uris.patch_Set); lv2_atom_forge_property_head(&_forge, _uris.patch_subject, 0); forge_uri(subject); - lv2_atom_forge_property_head(&_forge, _uris.patch_body, 0); - - LV2_Atom_Forge_Frame body; - lv2_atom_forge_blank(&_forge, &body, 0, 0); - lv2_atom_forge_property_head(&_forge, _map.map_uri(predicate.c_str()), 0); + lv2_atom_forge_property_head(&_forge, _uris.patch_property, 0); + lv2_atom_forge_urid(&_forge, _map.map_uri(predicate.c_str())); + lv2_atom_forge_property_head(&_forge, _uris.patch_value, 0); lv2_atom_forge_atom(&_forge, value.size(), value.type()); lv2_atom_forge_write(&_forge, value.get_body(), value.size()); - lv2_atom_forge_pop(&_forge, &body); lv2_atom_forge_pop(&_forge, &msg); finish_msg(); diff --git a/src/URIs.cpp b/src/URIs.cpp index a3ee8874..d2d3d9fa 100644 --- a/src/URIs.cpp +++ b/src/URIs.cpp @@ -129,9 +129,11 @@ URIs::URIs(Forge& f, URIMap* map) , patch_add (forge, map, LV2_PATCH__add) , patch_body (forge, map, LV2_PATCH__body) , patch_destination (forge, map, LV2_PATCH__destination) + , patch_property (forge, map, LV2_PATCH__property) , patch_remove (forge, map, LV2_PATCH__remove) , patch_request (forge, map, LV2_PATCH__request) , patch_subject (forge, map, LV2_PATCH__subject) + , patch_value (forge, map, LV2_PATCH__value) , pprops_logarithmic (forge, map, LV2_PORT_PROPS__logarithmic) , rdf_type (forge, map, NS_RDF "type") , rdfs_seeAlso (forge, map, NS_RDFS "seeAlso") @@ -39,7 +39,7 @@ def configure(conf): autowaf.display_header('Ingen Configuration') conf.check_python_version((2,4,0), mandatory=False) autowaf.check_pkg(conf, 'lv2', uselib_store='LV2', - atleast_version='1.0.15', mandatory=True) + atleast_version='1.3.0', mandatory=True) autowaf.check_pkg(conf, 'glibmm-2.4', uselib_store='GLIBMM', atleast_version='2.14.0', mandatory=True) autowaf.check_pkg(conf, 'gthread-2.0', uselib_store='GTHREAD', |