summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-03-14 23:38:53 +0000
committerDavid Robillard <d@drobilla.net>2012-03-14 23:38:53 +0000
commitf8ca7f3cf6f4a0e967eacfd2e1f9a8ae9625c015 (patch)
treea1e7bff65900df78c2283fec7093454a18340195
parent31f009967ea0a1664c05d38ea1c126e0c678b20a (diff)
downloadingen-f8ca7f3cf6f4a0e967eacfd2e1f9a8ae9625c015.tar.gz
ingen-f8ca7f3cf6f4a0e967eacfd2e1f9a8ae9625c015.tar.bz2
ingen-f8ca7f3cf6f4a0e967eacfd2e1f9a8ae9625c015.zip
Use the host URI map/unmap when running as a plugin.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4058 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--include/ingen/client/ClientStore.hpp2
-rw-r--r--include/ingen/shared/LV2URIMap.hpp71
-rw-r--r--include/ingen/shared/ResourceImpl.hpp6
-rw-r--r--include/ingen/shared/URIs.hpp3
-rw-r--r--include/ingen/shared/World.hpp9
-rw-r--r--src/client/NodeModel.cpp1
-rw-r--r--src/client/ObjectModel.cpp5
-rw-r--r--src/client/PatchModel.cpp1
-rw-r--r--src/client/PluginUI.cpp13
-rw-r--r--src/ingen/main.cpp2
-rw-r--r--src/serialisation/Parser.cpp1
-rw-r--r--src/serialisation/Serialiser.cpp3
-rw-r--r--src/server/BufferFactory.cpp1
-rw-r--r--src/server/ConnectionImpl.cpp1
-rw-r--r--src/server/DuplexPort.cpp1
-rw-r--r--src/server/Engine.cpp1
-rw-r--r--src/server/InputPort.cpp1
-rw-r--r--src/server/InternalPlugin.cpp1
-rw-r--r--src/server/LV2Node.cpp1
-rw-r--r--src/server/LV2Plugin.cpp4
-rw-r--r--src/server/Notification.cpp1
-rw-r--r--src/server/ObjectSender.cpp1
-rw-r--r--src/server/OutputPort.cpp1
-rw-r--r--src/server/PatchImpl.cpp5
-rw-r--r--src/server/PortImpl.cpp1
-rw-r--r--src/server/ServerInterfaceImpl.cpp2
-rw-r--r--src/server/events/CreateNode.cpp6
-rw-r--r--src/server/events/CreatePatch.cpp4
-rw-r--r--src/server/events/CreatePort.cpp1
-rw-r--r--src/server/events/RegisterClient.cpp4
-rw-r--r--src/server/events/SetMetadata.cpp4
-rw-r--r--src/server/events/SetPortValue.cpp11
-rw-r--r--src/server/ingen_lv2.cpp25
-rw-r--r--src/server/internals/Controller.cpp4
-rw-r--r--src/server/internals/Delay.cpp7
-rw-r--r--src/server/internals/Note.cpp7
-rw-r--r--src/server/internals/Trigger.cpp9
-rw-r--r--src/shared/Builder.cpp1
-rw-r--r--src/shared/LV2Atom.cpp1
-rw-r--r--src/shared/LV2URIMap.cpp69
-rw-r--r--src/shared/ResourceImpl.cpp1
-rw-r--r--src/shared/URIs.cpp12
-rw-r--r--src/shared/World.cpp23
43 files changed, 236 insertions, 92 deletions
diff --git a/include/ingen/client/ClientStore.hpp b/include/ingen/client/ClientStore.hpp
index 12392db6..b6042086 100644
--- a/include/ingen/client/ClientStore.hpp
+++ b/include/ingen/client/ClientStore.hpp
@@ -36,6 +36,8 @@ namespace Raul { class Atom; }
namespace Ingen {
+namespace Shared { class URIs; }
+
class GraphObject;
namespace Client {
diff --git a/include/ingen/shared/LV2URIMap.hpp b/include/ingen/shared/LV2URIMap.hpp
index 98508fd1..fc41f3bf 100644
--- a/include/ingen/shared/LV2URIMap.hpp
+++ b/include/ingen/shared/LV2URIMap.hpp
@@ -24,22 +24,62 @@
#include <boost/utility.hpp>
#include "ingen/shared/LV2Features.hpp"
-#include "ingen/shared/URIs.hpp"
#include "lv2/lv2plug.in/ns/ext/uri-map/uri-map.h"
+#include "lv2/lv2plug.in/ns/ext/urid/urid.h"
#include "raul/URI.hpp"
namespace Ingen {
namespace Shared {
-/** Implementation of the LV2 URI Map extension
- */
-class LV2URIMap : public boost::noncopyable, public LV2Features::Feature {
+/** URI to Integer Map */
+class LV2URIMap : public boost::noncopyable {
public:
- LV2URIMap(URIs& uris);
-
- SharedPtr<LV2_Feature> feature(Shared::World*, Node*) {
- return SharedPtr<LV2_Feature>(&uri_map_feature, NullDeleter<LV2_Feature>);
- }
+ LV2URIMap(LV2_URID_Map* map, LV2_URID_Unmap* unmap);
+ virtual ~LV2URIMap() {}
+
+ uint32_t map_uri(const char* uri);
+ const char* unmap_uri(uint32_t urid);
+
+ class Feature : public LV2Features::Feature {
+ public:
+ Feature(const char* URI, void* data) {
+ _feature.URI = URI;
+ _feature.data = data;
+ }
+
+ SharedPtr<LV2_Feature> feature(Shared::World*, Node*) {
+ return SharedPtr<LV2_Feature>(&_feature, NullDeleter<LV2_Feature>);
+ }
+
+ private:
+ LV2_Feature _feature;
+ };
+
+ class URIMapFeature : public Feature {
+ public:
+ URIMapFeature(LV2URIMap* map);
+
+ private:
+ LV2_URI_Map_Feature _feature_data;
+ };
+
+ class URIDMapFeature : public Feature {
+ public:
+ URIDMapFeature(LV2URIMap* map, LV2_URID_Map* urid_map);
+ private:
+ LV2_URID_Map _feature_data;
+ };
+
+ class URIDUnmapFeature : public Feature {
+ public:
+ URIDUnmapFeature(LV2URIMap* map, LV2_URID_Unmap* urid_unmap);
+ private:
+ LV2_URID_Unmap _feature_data;
+ };
+
+ SharedPtr<URIMapFeature> uri_map_feature() { return _uri_map_feature; }
+ SharedPtr<URIDMapFeature> urid_map_feature() { return _urid_map_feature; }
+ SharedPtr<URIDUnmapFeature> urid_unmap_feature() { return _urid_unmap_feature; }
virtual uint32_t uri_to_id(const char* map, const char* uri);
virtual const char* id_to_uri(const char* map, uint32_t id);
@@ -52,16 +92,17 @@ private:
const char* map,
const char* uri);
- LV2_Feature uri_map_feature;
- LV2_URI_Map_Feature uri_map_feature_data;
+ static LV2_URID urid_map(LV2_URID_Map_Handle handle, const char* uri);
+ static const char* urid_unmap(LV2_URID_Map_Handle handle, LV2_URID urid);
typedef std::map<uint16_t, uint32_t> EventToGlobal;
typedef std::map<uint32_t, uint16_t> GlobalToEvent;
- EventToGlobal _event_to_global;
- GlobalToEvent _global_to_event;
-
- URIs& _uris;
+ SharedPtr<URIMapFeature> _uri_map_feature;
+ SharedPtr<URIDMapFeature> _urid_map_feature;
+ SharedPtr<URIDUnmapFeature> _urid_unmap_feature;
+ EventToGlobal _event_to_global;
+ GlobalToEvent _global_to_event;
};
} // namespace Shared
diff --git a/include/ingen/shared/ResourceImpl.hpp b/include/ingen/shared/ResourceImpl.hpp
index fea21023..8069c480 100644
--- a/include/ingen/shared/ResourceImpl.hpp
+++ b/include/ingen/shared/ResourceImpl.hpp
@@ -18,10 +18,10 @@
#ifndef INGEN_SHARED_RESOURCEIMPL_HPP
#define INGEN_SHARED_RESOURCEIMPL_HPP
-#include "raul/URI.hpp"
-#include "raul/SharedPtr.hpp"
-
#include "ingen/Resource.hpp"
+#include "ingen/shared/URIs.hpp"
+#include "raul/SharedPtr.hpp"
+#include "raul/URI.hpp"
namespace Ingen {
namespace Shared {
diff --git a/include/ingen/shared/URIs.hpp b/include/ingen/shared/URIs.hpp
index 01464589..7490526d 100644
--- a/include/ingen/shared/URIs.hpp
+++ b/include/ingen/shared/URIs.hpp
@@ -33,9 +33,6 @@ class URIs : public boost::noncopyable {
public:
URIs(Raul::Forge& forge);
- uint32_t map_uri(const char* uri);
- const char* unmap_uri(uint32_t urid);
-
struct Quark : public Raul::URI {
Quark(const char* str);
const char* c_str() const;
diff --git a/include/ingen/shared/World.hpp b/include/ingen/shared/World.hpp
index fba565e5..e062dea6 100644
--- a/include/ingen/shared/World.hpp
+++ b/include/ingen/shared/World.hpp
@@ -23,6 +23,8 @@
#include <boost/shared_ptr.hpp>
#include <boost/utility.hpp>
+#include "lv2/lv2plug.in/ns/ext/urid/urid.h"
+
#include "raul/Configuration.hpp"
#include "raul/SharedPtr.hpp"
@@ -56,7 +58,12 @@ class Store;
*/
class World : public boost::noncopyable {
public:
- World(Raul::Configuration* conf, int& argc, char**& argv);
+ World(Raul::Configuration* conf,
+ int& argc,
+ char**& argv,
+ LV2_URID_Map* map,
+ LV2_URID_Unmap* unmap);
+
virtual ~World();
virtual bool load_module(const char* name);
diff --git a/src/client/NodeModel.cpp b/src/client/NodeModel.cpp
index f140057c..56ff1fdc 100644
--- a/src/client/NodeModel.cpp
+++ b/src/client/NodeModel.cpp
@@ -21,6 +21,7 @@
#include "ingen/Port.hpp"
#include "ingen/shared/World.hpp"
#include "ingen/shared/LV2URIMap.hpp"
+#include "ingen/shared/URIs.hpp"
#include "ingen/client/NodeModel.hpp"
using namespace std;
diff --git a/src/client/ObjectModel.cpp b/src/client/ObjectModel.cpp
index f8137a79..642df732 100644
--- a/src/client/ObjectModel.cpp
+++ b/src/client/ObjectModel.cpp
@@ -15,10 +15,11 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "raul/TableImpl.hpp"
#include "ingen/GraphObject.hpp"
-#include "ingen/shared/LV2URIMap.hpp"
#include "ingen/client/ObjectModel.hpp"
+#include "ingen/shared/LV2URIMap.hpp"
+#include "ingen/shared/URIs.hpp"
+#include "raul/TableImpl.hpp"
using namespace std;
using namespace Raul;
diff --git a/src/client/PatchModel.cpp b/src/client/PatchModel.cpp
index 0d2e74e3..d5cc2ebf 100644
--- a/src/client/PatchModel.cpp
+++ b/src/client/PatchModel.cpp
@@ -19,6 +19,7 @@
#include "raul/log.hpp"
#include "ingen/shared/LV2URIMap.hpp"
+#include "ingen/shared/URIs.hpp"
#include "ingen/client/PatchModel.hpp"
#include "ingen/client/NodeModel.hpp"
diff --git a/src/client/PluginUI.cpp b/src/client/PluginUI.cpp
index f69d189b..a3a2dabb 100644
--- a/src/client/PluginUI.cpp
+++ b/src/client/PluginUI.cpp
@@ -17,16 +17,15 @@
#include "raul/log.hpp"
-#include "lv2/lv2plug.in/ns/ext/atom/atom.h"
-#include "lv2/lv2plug.in/ns/ext/event/event.h"
-#include "lv2/lv2plug.in/ns/ext/event/event-helpers.h"
-
-#include "ingen/shared/LV2Atom.hpp"
-#include "ingen/shared/LV2URIMap.hpp"
-
#include "ingen/client/NodeModel.hpp"
#include "ingen/client/PluginUI.hpp"
#include "ingen/client/PortModel.hpp"
+#include "ingen/shared/LV2Atom.hpp"
+#include "ingen/shared/LV2URIMap.hpp"
+#include "ingen/shared/URIs.hpp"
+#include "lv2/lv2plug.in/ns/ext/atom/atom.h"
+#include "lv2/lv2plug.in/ns/ext/event/event-helpers.h"
+#include "lv2/lv2plug.in/ns/ext/event/event.h"
using namespace std;
using namespace Raul;
diff --git a/src/ingen/main.cpp b/src/ingen/main.cpp
index 57e7b658..61d8a90e 100644
--- a/src/ingen/main.cpp
+++ b/src/ingen/main.cpp
@@ -114,7 +114,7 @@ main(int argc, char** argv)
g_type_init();
#endif
- world = new Ingen::Shared::World(&conf, argc, argv);
+ world = new Ingen::Shared::World(&conf, argc, argv, NULL, NULL);
if (conf.option("uuid").get_string()) {
world->set_jack_uuid(conf.option("uuid").get_string());
diff --git a/src/serialisation/Parser.cpp b/src/serialisation/Parser.cpp
index b84bedae..120de4b1 100644
--- a/src/serialisation/Parser.cpp
+++ b/src/serialisation/Parser.cpp
@@ -36,6 +36,7 @@
#include "ingen/ServerInterface.hpp"
#include "ingen/shared/World.hpp"
#include "ingen/shared/LV2URIMap.hpp"
+#include "ingen/shared/URIs.hpp"
#include "ingen/serialisation/Parser.hpp"
diff --git a/src/serialisation/Serialiser.cpp b/src/serialisation/Serialiser.cpp
index 7f9b8cc3..f86c84a5 100644
--- a/src/serialisation/Serialiser.cpp
+++ b/src/serialisation/Serialiser.cpp
@@ -44,14 +44,15 @@
#include "sord/sordmm.hpp"
#include "ingen/Connection.hpp"
-#include "ingen/ServerInterface.hpp"
#include "ingen/Node.hpp"
#include "ingen/Patch.hpp"
#include "ingen/Plugin.hpp"
#include "ingen/Port.hpp"
+#include "ingen/ServerInterface.hpp"
#include "ingen/shared/LV2URIMap.hpp"
#include "ingen/shared/ResourceImpl.hpp"
#include "ingen/shared/Store.hpp"
+#include "ingen/shared/URIs.hpp"
#include "ingen/shared/World.hpp"
#include "ingen/serialisation/Serialiser.hpp"
diff --git a/src/server/BufferFactory.cpp b/src/server/BufferFactory.cpp
index 6e6474e9..f24f7270 100644
--- a/src/server/BufferFactory.cpp
+++ b/src/server/BufferFactory.cpp
@@ -18,6 +18,7 @@
#include <algorithm>
#include "raul/log.hpp"
#include "ingen/shared/LV2URIMap.hpp"
+#include "ingen/shared/URIs.hpp"
#include "AudioBuffer.hpp"
#include "EventBuffer.hpp"
#include "ObjectBuffer.hpp"
diff --git a/src/server/ConnectionImpl.cpp b/src/server/ConnectionImpl.cpp
index d752d4b2..bc0a5c53 100644
--- a/src/server/ConnectionImpl.cpp
+++ b/src/server/ConnectionImpl.cpp
@@ -20,6 +20,7 @@
#include "raul/log.hpp"
#include "raul/Maid.hpp"
#include "ingen/shared/LV2URIMap.hpp"
+#include "ingen/shared/URIs.hpp"
#include "AudioBuffer.hpp"
#include "BufferFactory.hpp"
#include "ConnectionImpl.hpp"
diff --git a/src/server/DuplexPort.cpp b/src/server/DuplexPort.cpp
index 8b8cf541..f2c2763b 100644
--- a/src/server/DuplexPort.cpp
+++ b/src/server/DuplexPort.cpp
@@ -20,6 +20,7 @@
#include <string>
#include "ingen/shared/LV2URIMap.hpp"
+#include "ingen/shared/URIs.hpp"
#include "ConnectionImpl.hpp"
#include "DuplexPort.hpp"
diff --git a/src/server/Engine.cpp b/src/server/Engine.cpp
index ebfd73b3..d9878bee 100644
--- a/src/server/Engine.cpp
+++ b/src/server/Engine.cpp
@@ -29,6 +29,7 @@
#include "ingen/shared/LV2Features.hpp"
#include "ingen/shared/LV2URIMap.hpp"
#include "ingen/shared/Store.hpp"
+#include "ingen/shared/URIs.hpp"
#include "BufferFactory.hpp"
#include "ClientBroadcaster.hpp"
#include "ControlBindings.hpp"
diff --git a/src/server/InputPort.cpp b/src/server/InputPort.cpp
index 9ab3692e..a07ef183 100644
--- a/src/server/InputPort.cpp
+++ b/src/server/InputPort.cpp
@@ -32,6 +32,7 @@
#include "ThreadManager.hpp"
#include "mix.hpp"
#include "ingen/shared/LV2URIMap.hpp"
+#include "ingen/shared/URIs.hpp"
#include "util.hpp"
using namespace std;
diff --git a/src/server/InternalPlugin.cpp b/src/server/InternalPlugin.cpp
index 2be57051..773a30c6 100644
--- a/src/server/InternalPlugin.cpp
+++ b/src/server/InternalPlugin.cpp
@@ -18,6 +18,7 @@
#include <cassert>
#include <string>
#include "ingen/shared/LV2URIMap.hpp"
+#include "ingen/shared/URIs.hpp"
#include "internals/Controller.hpp"
#include "internals/Delay.hpp"
#include "internals/Note.hpp"
diff --git a/src/server/LV2Node.cpp b/src/server/LV2Node.cpp
index ff886166..a22b0232 100644
--- a/src/server/LV2Node.cpp
+++ b/src/server/LV2Node.cpp
@@ -27,6 +27,7 @@
#include "raul/Array.hpp"
#include "ingen/shared/LV2URIMap.hpp"
+#include "ingen/shared/URIs.hpp"
#include "AudioBuffer.hpp"
#include "EventBuffer.hpp"
diff --git a/src/server/LV2Plugin.cpp b/src/server/LV2Plugin.cpp
index 59028cfc..87669417 100644
--- a/src/server/LV2Plugin.cpp
+++ b/src/server/LV2Plugin.cpp
@@ -19,11 +19,11 @@
#include <string>
#include <glibmm.h>
+#include "ingen/shared/LV2URIMap.hpp"
+#include "ingen/shared/URIs.hpp"
#include "raul/log.hpp"
-
#include "sord/sordmm.hpp"
-#include "ingen/shared/LV2URIMap.hpp"
#include "Driver.hpp"
#include "Engine.hpp"
#include "LV2Node.hpp"
diff --git a/src/server/Notification.cpp b/src/server/Notification.cpp
index c9ea9d00..7a44062f 100644
--- a/src/server/Notification.cpp
+++ b/src/server/Notification.cpp
@@ -16,6 +16,7 @@
*/
#include "ingen/shared/LV2URIMap.hpp"
+#include "ingen/shared/URIs.hpp"
#include "ClientBroadcaster.hpp"
#include "Notification.hpp"
diff --git a/src/server/ObjectSender.cpp b/src/server/ObjectSender.cpp
index 746e7642..9eac2911 100644
--- a/src/server/ObjectSender.cpp
+++ b/src/server/ObjectSender.cpp
@@ -18,6 +18,7 @@
#include "ObjectSender.hpp"
#include "ingen/ClientInterface.hpp"
#include "ingen/shared/LV2URIMap.hpp"
+#include "ingen/shared/URIs.hpp"
#include "EngineStore.hpp"
#include "PatchImpl.hpp"
#include "NodeImpl.hpp"
diff --git a/src/server/OutputPort.cpp b/src/server/OutputPort.cpp
index e2d8cd9c..11f637b3 100644
--- a/src/server/OutputPort.cpp
+++ b/src/server/OutputPort.cpp
@@ -22,6 +22,7 @@
#include "OutputPort.hpp"
#include "ProcessContext.hpp"
#include "ingen/shared/LV2URIMap.hpp"
+#include "ingen/shared/URIs.hpp"
using namespace std;
diff --git a/src/server/PatchImpl.cpp b/src/server/PatchImpl.cpp
index f43abf39..c2d97d41 100644
--- a/src/server/PatchImpl.cpp
+++ b/src/server/PatchImpl.cpp
@@ -19,6 +19,9 @@
#include <cmath>
#include <string>
+#include "ingen/shared/LV2URIMap.hpp"
+#include "ingen/shared/URIs.hpp"
+#include "ingen/shared/World.hpp"
#include "raul/log.hpp"
#include "ConnectionImpl.hpp"
@@ -31,8 +34,6 @@
#include "PortImpl.hpp"
#include "ProcessSlave.hpp"
#include "ThreadManager.hpp"
-#include "ingen/shared/LV2URIMap.hpp"
-#include "ingen/shared/World.hpp"
using namespace std;
using namespace Raul;
diff --git a/src/server/PortImpl.cpp b/src/server/PortImpl.cpp
index 03403a7a..67255e5f 100644
--- a/src/server/PortImpl.cpp
+++ b/src/server/PortImpl.cpp
@@ -22,6 +22,7 @@
#include "ingen/shared/LV2URIMap.hpp"
#include "ingen/shared/LV2Atom.hpp"
+#include "ingen/shared/URIs.hpp"
#include "AudioBuffer.hpp"
#include "BufferFactory.hpp"
diff --git a/src/server/ServerInterfaceImpl.cpp b/src/server/ServerInterfaceImpl.cpp
index cf08a8de..eb615e9a 100644
--- a/src/server/ServerInterfaceImpl.cpp
+++ b/src/server/ServerInterfaceImpl.cpp
@@ -19,6 +19,8 @@
#include "raul/log.hpp"
+#include "ingen/shared/URIs.hpp"
+
#include "Driver.hpp"
#include "Engine.hpp"
#include "EventSource.hpp"
diff --git a/src/server/events/CreateNode.cpp b/src/server/events/CreateNode.cpp
index 5fe7a86f..f043a321 100644
--- a/src/server/events/CreateNode.cpp
+++ b/src/server/events/CreateNode.cpp
@@ -15,11 +15,13 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "raul/log.hpp"
+#include "ingen/shared/LV2URIMap.hpp"
+#include "ingen/shared/URIs.hpp"
#include "raul/Maid.hpp"
#include "raul/Path.hpp"
+#include "raul/log.hpp"
#include "sord/sordmm.hpp"
-#include "ingen/shared/LV2URIMap.hpp"
+
#include "CreateNode.hpp"
#include "PatchImpl.hpp"
#include "NodeImpl.hpp"
diff --git a/src/server/events/CreatePatch.cpp b/src/server/events/CreatePatch.cpp
index 6e261755..4f85be8d 100644
--- a/src/server/events/CreatePatch.cpp
+++ b/src/server/events/CreatePatch.cpp
@@ -15,9 +15,11 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "ingen/shared/LV2URIMap.hpp"
+#include "ingen/shared/URIs.hpp"
#include "raul/Maid.hpp"
#include "raul/Path.hpp"
-#include "ingen/shared/LV2URIMap.hpp"
+
#include "events/CreatePatch.hpp"
#include "PatchImpl.hpp"
#include "NodeImpl.hpp"
diff --git a/src/server/events/CreatePort.cpp b/src/server/events/CreatePort.cpp
index 4f4753d3..39aed9d2 100644
--- a/src/server/events/CreatePort.cpp
+++ b/src/server/events/CreatePort.cpp
@@ -20,6 +20,7 @@
#include "raul/Maid.hpp"
#include "raul/Path.hpp"
#include "ingen/shared/LV2URIMap.hpp"
+#include "ingen/shared/URIs.hpp"
#include "ClientBroadcaster.hpp"
#include "ControlBindings.hpp"
#include "CreatePort.hpp"
diff --git a/src/server/events/RegisterClient.cpp b/src/server/events/RegisterClient.cpp
index d95cc19c..088cf296 100644
--- a/src/server/events/RegisterClient.cpp
+++ b/src/server/events/RegisterClient.cpp
@@ -15,11 +15,13 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "ingen/shared/LV2URIMap.hpp"
+#include "ingen/shared/URIs.hpp"
+
#include "ClientBroadcaster.hpp"
#include "Driver.hpp"
#include "Engine.hpp"
#include "events/RegisterClient.hpp"
-#include "ingen/shared/LV2URIMap.hpp"
using namespace Raul;
diff --git a/src/server/events/SetMetadata.cpp b/src/server/events/SetMetadata.cpp
index 0603a150..5b2391bd 100644
--- a/src/server/events/SetMetadata.cpp
+++ b/src/server/events/SetMetadata.cpp
@@ -22,6 +22,9 @@
#include "raul/log.hpp"
#include "raul/Maid.hpp"
+#include "ingen/shared/LV2URIMap.hpp"
+#include "ingen/shared/URIs.hpp"
+
#include "ClientBroadcaster.hpp"
#include "ControlBindings.hpp"
#include "CreateNode.hpp"
@@ -37,7 +40,6 @@
#include "PortType.hpp"
#include "SetMetadata.hpp"
#include "SetPortValue.hpp"
-#include "ingen/shared/LV2URIMap.hpp"
#define LOG(s) s << "[SetMetadata] "
diff --git a/src/server/events/SetPortValue.cpp b/src/server/events/SetPortValue.cpp
index bc4cd9bf..30478f5f 100644
--- a/src/server/events/SetPortValue.cpp
+++ b/src/server/events/SetPortValue.cpp
@@ -16,12 +16,15 @@
*/
#include <sstream>
-#include "raul/log.hpp"
-#include "lv2/lv2plug.in/ns/ext/event/event.h"
-#include "ingen/shared/LV2URIMap.hpp"
-#include "ingen/shared/LV2Features.hpp"
+
#include "ingen/shared/LV2Atom.hpp"
+#include "ingen/shared/LV2Features.hpp"
+#include "ingen/shared/LV2URIMap.hpp"
+#include "ingen/shared/URIs.hpp"
#include "ingen/shared/World.hpp"
+#include "lv2/lv2plug.in/ns/ext/event/event.h"
+#include "raul/log.hpp"
+
#include "AudioBuffer.hpp"
#include "ClientBroadcaster.hpp"
#include "ControlBindings.hpp"
diff --git a/src/server/ingen_lv2.cpp b/src/server/ingen_lv2.cpp
index db8a642e..23aa3715 100644
--- a/src/server/ingen_lv2.cpp
+++ b/src/server/ingen_lv2.cpp
@@ -278,24 +278,27 @@ ingen_instantiate(const LV2_Descriptor* descriptor,
return NULL;
}
- IngenPlugin* plugin = (IngenPlugin*)malloc(sizeof(IngenPlugin));
- plugin->conf = new Ingen::Shared::Configuration(&plugin->forge);
- plugin->world = new Ingen::Shared::World(plugin->conf,
- plugin->argc,
- plugin->argv);
- if (!plugin->world->load_module("serialisation")) {
- delete plugin->world;
- return NULL;
- }
- plugin->main = NULL;
- plugin->map = NULL;
+ IngenPlugin* plugin = (IngenPlugin*)malloc(sizeof(IngenPlugin));
+ plugin->conf = new Ingen::Shared::Configuration(&plugin->forge);
+ plugin->main = NULL;
+ plugin->map = NULL;
+ LV2_URID_Unmap* unmap = NULL;
for (int i = 0; features[i]; ++i) {
if (!strcmp(features[i]->URI, LV2_URID_URI "#map")) {
plugin->map = (LV2_URID_Map*)features[i]->data;
+ } else if (!strcmp(features[i]->URI, LV2_URID_URI "#unmap")) {
+ unmap = (LV2_URID_Unmap*)features[i]->data;
}
}
+ plugin->world = new Ingen::Shared::World(
+ plugin->conf, plugin->argc, plugin->argv, plugin->map, unmap);
+ if (!plugin->world->load_module("serialisation")) {
+ delete plugin->world;
+ return NULL;
+ }
+
SharedPtr<Server::Engine> engine(new Server::Engine(plugin->world));
plugin->world->set_local_engine(engine);
plugin->main = new MainThread(engine);
diff --git a/src/server/internals/Controller.cpp b/src/server/internals/Controller.cpp
index f29951c8..e93d5f27 100644
--- a/src/server/internals/Controller.cpp
+++ b/src/server/internals/Controller.cpp
@@ -16,9 +16,11 @@
*/
#include <math.h>
-#include "raul/midi_events.h"
+
#include "ingen/shared/LV2URIMap.hpp"
+#include "ingen/shared/URIs.hpp"
#include "internals/Controller.hpp"
+#include "raul/midi_events.h"
#include "AudioBuffer.hpp"
#include "EventBuffer.hpp"
diff --git a/src/server/internals/Delay.cpp b/src/server/internals/Delay.cpp
index e3be103a..21cc23d5 100644
--- a/src/server/internals/Delay.cpp
+++ b/src/server/internals/Delay.cpp
@@ -17,11 +17,14 @@
#include <cmath>
#include <limits.h>
-#include "raul/log.hpp"
+
+#include "ingen/shared/LV2URIMap.hpp"
+#include "ingen/shared/URIs.hpp"
#include "raul/Array.hpp"
#include "raul/Maid.hpp"
+#include "raul/log.hpp"
#include "raul/midi_events.h"
-#include "ingen/shared/LV2URIMap.hpp"
+
#include "internals/Delay.hpp"
#include "AudioBuffer.hpp"
#include "Driver.hpp"
diff --git a/src/server/internals/Note.cpp b/src/server/internals/Note.cpp
index fc88038b..a44c0c36 100644
--- a/src/server/internals/Note.cpp
+++ b/src/server/internals/Note.cpp
@@ -16,11 +16,14 @@
*/
#include <cmath>
-#include "raul/log.hpp"
+
+#include "ingen/shared/LV2URIMap.hpp"
+#include "ingen/shared/URIs.hpp"
#include "raul/Array.hpp"
#include "raul/Maid.hpp"
+#include "raul/log.hpp"
#include "raul/midi_events.h"
-#include "ingen/shared/LV2URIMap.hpp"
+
#include "internals/Note.hpp"
#include "AudioBuffer.hpp"
#include "Driver.hpp"
diff --git a/src/server/internals/Trigger.cpp b/src/server/internals/Trigger.cpp
index ccab41f2..885144fe 100644
--- a/src/server/internals/Trigger.cpp
+++ b/src/server/internals/Trigger.cpp
@@ -16,18 +16,21 @@
*/
#include <cmath>
+
+#include "ingen/shared/LV2URIMap.hpp"
+#include "ingen/shared/URIs.hpp"
#include "raul/log.hpp"
#include "raul/midi_events.h"
-#include "ingen/shared/LV2URIMap.hpp"
-#include "internals/Trigger.hpp"
+
#include "AudioBuffer.hpp"
#include "EventBuffer.hpp"
#include "InputPort.hpp"
#include "InternalPlugin.hpp"
#include "OutputPort.hpp"
#include "ProcessContext.hpp"
-#include "util.hpp"
#include "ingen_config.h"
+#include "internals/Trigger.hpp"
+#include "util.hpp"
#define LOG(s) s << "[TriggerNode] "
diff --git a/src/shared/Builder.cpp b/src/shared/Builder.cpp
index 3672e388..9dea08f0 100644
--- a/src/shared/Builder.cpp
+++ b/src/shared/Builder.cpp
@@ -26,6 +26,7 @@
#include "ingen/Port.hpp"
#include "ingen/shared/Builder.hpp"
#include "ingen/shared/LV2URIMap.hpp"
+#include "ingen/shared/URIs.hpp"
using namespace std;
using namespace Raul;
diff --git a/src/shared/LV2Atom.cpp b/src/shared/LV2Atom.cpp
index 991c4f7c..63686bf5 100644
--- a/src/shared/LV2Atom.cpp
+++ b/src/shared/LV2Atom.cpp
@@ -18,6 +18,7 @@
#include "ingen/shared/LV2Atom.hpp"
#include "ingen/shared/LV2Features.hpp"
#include "ingen/shared/LV2URIMap.hpp"
+#include "ingen/shared/URIs.hpp"
#include "lv2/lv2plug.in/ns/ext/atom/atom.h"
#include "lv2/lv2plug.in/ns/ext/uri-map/uri-map.h"
#include "raul/Atom.hpp"
diff --git a/src/shared/LV2URIMap.cpp b/src/shared/LV2URIMap.cpp
index d39f0b88..43a949a8 100644
--- a/src/shared/LV2URIMap.cpp
+++ b/src/shared/LV2URIMap.cpp
@@ -35,20 +35,45 @@ using namespace Raul;
namespace Ingen {
namespace Shared {
-LV2URIMap::LV2URIMap(URIs& uris)
- : _uris(uris)
+LV2URIMap::LV2URIMap(LV2_URID_Map* map, LV2_URID_Unmap* unmap)
+ : _uri_map_feature(new URIMapFeature(this))
+ , _urid_map_feature(new URIDMapFeature(this, map))
+ , _urid_unmap_feature(new URIDUnmapFeature(this, unmap))
{
- uri_map_feature_data.uri_to_id = &LV2URIMap::uri_map_uri_to_id;
- uri_map_feature_data.callback_data = this;
- uri_map_feature.URI = LV2_URI_MAP_URI;
- uri_map_feature.data = &uri_map_feature_data;
+}
+
+LV2URIMap::URIMapFeature::URIMapFeature(LV2URIMap* map)
+ : Feature(LV2_URI_MAP_URI, &_feature_data)
+{
+ _feature_data.uri_to_id = &LV2URIMap::uri_map_uri_to_id;
+ _feature_data.callback_data = map;
+}
+
+LV2URIMap::URIDMapFeature::URIDMapFeature(LV2URIMap* map,
+ LV2_URID_Map* urid_map)
+ : Feature(LV2_URID__map, urid_map ? urid_map : &_feature_data)
+{
+ if (!urid_map) {
+ _feature_data.map = &LV2URIMap::urid_map;
+ _feature_data.handle = map;
+ }
+}
+
+LV2URIMap::URIDUnmapFeature::URIDUnmapFeature(LV2URIMap* map,
+ LV2_URID_Unmap* urid_unmap)
+ : Feature(LV2_URID__unmap, urid_unmap ? urid_unmap : &_feature_data)
+{
+ if (!urid_unmap) {
+ _feature_data.unmap = &LV2URIMap::urid_unmap;
+ _feature_data.handle = map;
+ }
}
uint32_t
LV2URIMap::uri_to_id(const char* map,
const char* uri)
{
- const uint32_t id = _uris.map_uri(uri);
+ const uint32_t id = map_uri(uri);
if (map && !strcmp(map, LV2_EVENT_URI)) {
GlobalToEvent::iterator i = _global_to_event.find(id);
if (i != _global_to_event.end()) {
@@ -79,9 +104,9 @@ LV2URIMap::id_to_uri(const char* map,
error << "Failed to unmap event URI " << id << endl;
return NULL;
}
- return _uris.unmap_uri(i->second);
+ return unmap_uri(i->second);
} else {
- return _uris.unmap_uri(id);
+ return unmap_uri(id);
}
}
@@ -114,5 +139,31 @@ LV2URIMap::uri_map_uri_to_id(LV2_URI_Map_Callback_Data callback_data,
return me->uri_to_id(map, uri);
}
+LV2_URID
+LV2URIMap::urid_map(LV2_URID_Map_Handle handle, const char* uri)
+{
+ LV2URIMap* me = (LV2URIMap*)handle;
+ return me->uri_to_id(NULL, uri);
+}
+
+const char*
+LV2URIMap::urid_unmap(LV2_URID_Map_Handle handle, LV2_URID urid)
+{
+ LV2URIMap* me = (LV2URIMap*)handle;
+ return me->id_to_uri(NULL, urid);
+}
+
+uint32_t
+LV2URIMap::map_uri(const char* uri)
+{
+ return static_cast<uint32_t>(g_quark_from_string(uri));
+}
+
+const char*
+LV2URIMap::unmap_uri(uint32_t urid)
+{
+ return g_quark_to_string(urid);
+}
+
} // namespace Shared
} // namespace Ingen
diff --git a/src/shared/ResourceImpl.cpp b/src/shared/ResourceImpl.cpp
index fb50ac54..de3eae17 100644
--- a/src/shared/ResourceImpl.cpp
+++ b/src/shared/ResourceImpl.cpp
@@ -19,6 +19,7 @@
#include "raul/Atom.hpp"
#include "ingen/shared/LV2URIMap.hpp"
#include "ingen/shared/ResourceImpl.hpp"
+#include "ingen/shared/URIs.hpp"
using namespace std;
using namespace Raul;
diff --git a/src/shared/URIs.cpp b/src/shared/URIs.cpp
index bb2142e1..058049df 100644
--- a/src/shared/URIs.cpp
+++ b/src/shared/URIs.cpp
@@ -119,17 +119,5 @@ URIs::URIs(Raul::Forge& f)
{
}
-uint32_t
-URIs::map_uri(const char* uri)
-{
- return static_cast<uint32_t>(g_quark_from_string(uri));
-}
-
-const char*
-URIs::unmap_uri(uint32_t urid)
-{
- return g_quark_to_string(urid);
-}
-
} // namespace Shared
} // namespace Ingen
diff --git a/src/shared/World.cpp b/src/shared/World.cpp
index cf21cd44..140dd688 100644
--- a/src/shared/World.cpp
+++ b/src/shared/World.cpp
@@ -32,6 +32,7 @@
#include "ingen/shared/runtime_paths.hpp"
#include "ingen/shared/LV2Features.hpp"
#include "ingen/shared/LV2URIMap.hpp"
+#include "ingen/shared/URIs.hpp"
#define LOG(s) s << "[Module] "
@@ -98,19 +99,25 @@ ingen_load_module(const string& name)
class World::Pimpl {
public:
- Pimpl(Raul::Configuration* conf, int& a_argc, char**& a_argv)
+ Pimpl(Raul::Configuration* conf,
+ int& a_argc,
+ char**& a_argv,
+ LV2_URID_Map* map,
+ LV2_URID_Unmap* unmap)
: argc(a_argc)
, argv(a_argv)
, conf(conf)
, lv2_features(NULL)
, forge(new Raul::Forge())
, rdf_world(new Sord::World())
+ , lv2_uri_map(new Ingen::Shared::LV2URIMap(map, unmap))
, uris(new Shared::URIs(*forge))
- , lv2_uri_map(new Ingen::Shared::LV2URIMap(*uris.get()))
, lilv_world(lilv_world_new())
{
lv2_features = new Ingen::Shared::LV2Features();
- lv2_features->add_feature(lv2_uri_map);
+ lv2_features->add_feature(lv2_uri_map->uri_map_feature());
+ lv2_features->add_feature(lv2_uri_map->urid_map_feature());
+ lv2_features->add_feature(lv2_uri_map->urid_unmap_feature());
lilv_world_load_all(lilv_world);
// Set up RDF namespaces
@@ -167,8 +174,8 @@ public:
LV2Features* lv2_features;
Raul::Forge* forge;
Sord::World* rdf_world;
- SharedPtr<URIs> uris;
SharedPtr<LV2URIMap> lv2_uri_map;
+ SharedPtr<URIs> uris;
SharedPtr<ServerInterface> engine;
SharedPtr<EngineBase> local_engine;
SharedPtr<Serialisation::Serialiser> serialiser;
@@ -178,8 +185,12 @@ public:
std::string jack_uuid;
};
-World::World(Raul::Configuration* conf, int& argc, char**& argv)
- : _impl(new Pimpl(conf, argc, argv))
+World::World(Raul::Configuration* conf,
+ int& argc,
+ char**& argv,
+ LV2_URID_Map* map,
+ LV2_URID_Unmap* unmap)
+ : _impl(new Pimpl(conf, argc, argv, map, unmap))
{
}