From 629fb50716083c71146340de97eb8651679ca9fb Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 31 Jul 2012 00:14:50 +0000 Subject: Merge Ingen::Shared namespace into Ingen namespace and core libingen library. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4579 a436a847-0d15-0410-975c-d299462d15a1 --- ingen/AtomReader.hpp | 60 +++++++ ingen/AtomSink.hpp | 40 +++++ ingen/AtomWriter.hpp | 98 +++++++++++ ingen/Builder.hpp | 49 ++++++ ingen/ClashAvoider.hpp | 108 ++++++++++++ ingen/Configuration.hpp | 35 ++++ ingen/Forge.hpp | 40 +++++ ingen/GraphObject.hpp | 7 +- ingen/LV2Features.hpp | 74 +++++++++ ingen/Module.hpp | 53 ++++++ ingen/Plugin.hpp | 2 +- ingen/Resource.hpp | 21 ++- ingen/Store.hpp | 60 +++++++ ingen/URIMap.hpp | 80 +++++++++ ingen/URIs.hpp | 143 ++++++++++++++++ ingen/World.hpp | 151 +++++++++++++++++ ingen/client/ClientStore.hpp | 12 +- ingen/client/NodeModel.hpp | 10 +- ingen/client/ObjectModel.hpp | 4 +- ingen/client/PatchModel.hpp | 2 +- ingen/client/PluginModel.hpp | 19 +-- ingen/client/PluginUI.hpp | 17 +- ingen/client/PortModel.hpp | 2 +- ingen/runtime_paths.hpp | 33 ++++ ingen/serialisation/Parser.hpp | 7 +- ingen/serialisation/Serialiser.hpp | 10 +- ingen/shared/AtomReader.hpp | 62 ------- ingen/shared/AtomSink.hpp | 42 ----- ingen/shared/AtomWriter.hpp | 100 ----------- ingen/shared/Builder.hpp | 51 ------ ingen/shared/ClashAvoider.hpp | 110 ------------ ingen/shared/Configuration.hpp | 37 ----- ingen/shared/Forge.hpp | 42 ----- ingen/shared/LV2Features.hpp | 78 --------- ingen/shared/Module.hpp | 55 ------ ingen/shared/Store.hpp | 62 ------- ingen/shared/URIMap.hpp | 82 --------- ingen/shared/URIs.hpp | 145 ---------------- ingen/shared/World.hpp | 154 ----------------- ingen/shared/runtime_paths.hpp | 35 ---- src/AtomReader.cpp | 274 ++++++++++++++++++++++++++++++ src/AtomWriter.cpp | 299 +++++++++++++++++++++++++++++++++ src/Builder.cpp | 53 ++++++ src/ClashAvoider.cpp | 204 +++++++++++++++++++++++ src/Configuration.cpp | 54 ++++++ src/Forge.cpp | 54 ++++++ src/LV2Features.cpp | 63 +++++++ src/Resource.cpp | 14 +- src/Store.cpp | 98 +++++++++++ src/URIMap.cpp | 95 +++++++++++ src/URIs.cpp | 126 ++++++++++++++ src/World.cpp | 320 +++++++++++++++++++++++++++++++++++ src/bindings/ingen.i | 19 +-- src/bindings/ingen_bindings.cpp | 12 +- src/bindings/ingen_bindings.hpp | 2 - src/client/ClientStore.cpp | 5 +- src/client/NodeModel.cpp | 8 +- src/client/ObjectModel.cpp | 4 +- src/client/PatchModel.cpp | 2 +- src/client/PluginModel.cpp | 4 +- src/client/PluginUI.cpp | 12 +- src/client/ingen_client.cpp | 10 +- src/client/wscript | 2 +- src/gui/App.cpp | 9 +- src/gui/App.hpp | 18 +- src/gui/Configuration.cpp | 2 +- src/gui/ConnectWindow.cpp | 8 +- src/gui/ConnectWindow.hpp | 2 +- src/gui/LoadPatchWindow.cpp | 5 +- src/gui/LoadPluginWindow.cpp | 1 - src/gui/NodeModule.cpp | 3 +- src/gui/ObjectMenu.cpp | 1 - src/gui/PatchBox.cpp | 2 +- src/gui/PatchCanvas.cpp | 7 +- src/gui/PatchPortModule.cpp | 1 - src/gui/PatchTreeWindow.cpp | 1 - src/gui/Port.cpp | 3 +- src/gui/PortMenu.cpp | 1 - src/gui/PortPropertiesWindow.cpp | 5 +- src/gui/PropertiesWindow.cpp | 24 +-- src/gui/RenameWindow.cpp | 3 +- src/gui/SubpatchModule.cpp | 2 +- src/gui/ThreadedLoader.cpp | 8 +- src/gui/WidgetFactory.cpp | 6 +- src/gui/ingen_gui.cpp | 10 +- src/gui/ingen_gui_lv2.cpp | 41 +++-- src/gui/wscript | 4 +- src/ingen/main.cpp | 14 +- src/runtime_paths.cpp | 114 +++++++++++++ src/serialisation/Parser.cpp | 65 ++++---- src/serialisation/Serialiser.cpp | 27 ++- src/serialisation/serialisation.cpp | 10 +- src/serialisation/wscript | 4 +- src/server/AudioBuffer.hpp | 2 +- src/server/Broadcaster.hpp | 2 - src/server/Buffer.cpp | 6 +- src/server/BufferFactory.cpp | 6 +- src/server/BufferFactory.hpp | 20 +-- src/server/Context.cpp | 4 +- src/server/Context.hpp | 2 +- src/server/ControlBindings.cpp | 24 +-- src/server/DuplexPort.cpp | 2 +- src/server/EdgeImpl.cpp | 6 +- src/server/Engine.cpp | 18 +- src/server/Engine.hpp | 10 +- src/server/EngineStore.hpp | 6 +- src/server/EventWriter.cpp | 2 +- src/server/GraphObjectImpl.cpp | 6 +- src/server/GraphObjectImpl.hpp | 6 +- src/server/InputPort.cpp | 4 +- src/server/InternalPlugin.cpp | 4 +- src/server/InternalPlugin.hpp | 2 +- src/server/JackDriver.cpp | 8 +- src/server/LV2Info.cpp | 8 +- src/server/LV2Info.hpp | 13 +- src/server/LV2Node.cpp | 22 +-- src/server/LV2Node.hpp | 22 +-- src/server/LV2Plugin.cpp | 2 +- src/server/LV2ResizeFeature.hpp | 6 +- src/server/NodeFactory.cpp | 6 +- src/server/NodeFactory.hpp | 12 +- src/server/OutputPort.cpp | 2 +- src/server/PatchImpl.cpp | 4 +- src/server/PatchPlugin.hpp | 2 +- src/server/PluginImpl.hpp | 8 +- src/server/PortImpl.cpp | 8 +- src/server/PortImpl.hpp | 2 +- src/server/Worker.cpp | 4 +- src/server/Worker.hpp | 6 +- src/server/events/CreateNode.cpp | 4 +- src/server/events/CreatePatch.cpp | 4 +- src/server/events/CreatePort.cpp | 8 +- src/server/events/Delta.cpp | 19 +-- src/server/events/DisconnectAll.cpp | 6 +- src/server/events/DisconnectAll.hpp | 6 +- src/server/events/Get.cpp | 2 +- src/server/events/Get.hpp | 2 +- src/server/events/SetPortValue.cpp | 10 +- src/server/ingen_engine.cpp | 10 +- src/server/ingen_jack.cpp | 12 +- src/server/ingen_lv2.cpp | 72 ++++---- src/server/internals/Controller.cpp | 6 +- src/server/internals/Controller.hpp | 2 +- src/server/internals/Delay.cpp | 6 +- src/server/internals/Delay.hpp | 2 +- src/server/internals/Note.cpp | 6 +- src/server/internals/Note.hpp | 2 +- src/server/internals/Trigger.cpp | 6 +- src/server/internals/Trigger.hpp | 2 +- src/server/mix.cpp | 6 +- src/server/mix.hpp | 4 +- src/server/wscript | 6 +- src/shared/AtomReader.cpp | 276 ------------------------------ src/shared/AtomWriter.cpp | 301 --------------------------------- src/shared/Builder.cpp | 55 ------ src/shared/ClashAvoider.cpp | 206 ----------------------- src/shared/Configuration.cpp | 56 ------- src/shared/Forge.cpp | 56 ------- src/shared/LV2Features.cpp | 65 -------- src/shared/Store.cpp | 101 ----------- src/shared/URIMap.cpp | 97 ----------- src/shared/URIs.cpp | 128 -------------- src/shared/World.cpp | 323 ------------------------------------ src/shared/runtime_paths.cpp | 116 ------------- src/shared/wscript | 44 ----- src/socket/SocketClient.hpp | 2 +- src/socket/SocketListener.cpp | 8 +- src/socket/SocketListener.hpp | 13 +- src/socket/SocketReader.cpp | 15 +- src/socket/SocketReader.hpp | 7 +- src/socket/SocketServer.hpp | 2 +- src/socket/SocketWriter.cpp | 6 +- src/socket/SocketWriter.hpp | 12 +- src/socket/ingen_socket_client.cpp | 12 +- src/socket/ingen_socket_server.cpp | 10 +- src/wscript | 43 +++++ tests/ingen_test.cpp | 26 +-- wscript | 9 +- 178 files changed, 3333 insertions(+), 3453 deletions(-) create mode 100644 ingen/AtomReader.hpp create mode 100644 ingen/AtomSink.hpp create mode 100644 ingen/AtomWriter.hpp create mode 100644 ingen/Builder.hpp create mode 100644 ingen/ClashAvoider.hpp create mode 100644 ingen/Configuration.hpp create mode 100644 ingen/Forge.hpp create mode 100644 ingen/LV2Features.hpp create mode 100644 ingen/Module.hpp create mode 100644 ingen/Store.hpp create mode 100644 ingen/URIMap.hpp create mode 100644 ingen/URIs.hpp create mode 100644 ingen/World.hpp create mode 100644 ingen/runtime_paths.hpp delete mode 100644 ingen/shared/AtomReader.hpp delete mode 100644 ingen/shared/AtomSink.hpp delete mode 100644 ingen/shared/AtomWriter.hpp delete mode 100644 ingen/shared/Builder.hpp delete mode 100644 ingen/shared/ClashAvoider.hpp delete mode 100644 ingen/shared/Configuration.hpp delete mode 100644 ingen/shared/Forge.hpp delete mode 100644 ingen/shared/LV2Features.hpp delete mode 100644 ingen/shared/Module.hpp delete mode 100644 ingen/shared/Store.hpp delete mode 100644 ingen/shared/URIMap.hpp delete mode 100644 ingen/shared/URIs.hpp delete mode 100644 ingen/shared/World.hpp delete mode 100644 ingen/shared/runtime_paths.hpp create mode 100644 src/AtomReader.cpp create mode 100644 src/AtomWriter.cpp create mode 100644 src/Builder.cpp create mode 100644 src/ClashAvoider.cpp create mode 100644 src/Configuration.cpp create mode 100644 src/Forge.cpp create mode 100644 src/LV2Features.cpp create mode 100644 src/Store.cpp create mode 100644 src/URIMap.cpp create mode 100644 src/URIs.cpp create mode 100644 src/World.cpp create mode 100644 src/runtime_paths.cpp delete mode 100644 src/shared/AtomReader.cpp delete mode 100644 src/shared/AtomWriter.cpp delete mode 100644 src/shared/Builder.cpp delete mode 100644 src/shared/ClashAvoider.cpp delete mode 100644 src/shared/Configuration.cpp delete mode 100644 src/shared/Forge.cpp delete mode 100644 src/shared/LV2Features.cpp delete mode 100644 src/shared/Store.cpp delete mode 100644 src/shared/URIMap.cpp delete mode 100644 src/shared/URIs.cpp delete mode 100644 src/shared/World.cpp delete mode 100644 src/shared/runtime_paths.cpp delete mode 100644 src/shared/wscript create mode 100644 src/wscript diff --git a/ingen/AtomReader.hpp b/ingen/AtomReader.hpp new file mode 100644 index 00000000..f14ebefd --- /dev/null +++ b/ingen/AtomReader.hpp @@ -0,0 +1,60 @@ +/* + This file is part of Ingen. + Copyright 2007-2012 David Robillard + + Ingen is free software: you can redistribute it and/or modify it under the + terms of the GNU Affero General Public License as published by the Free + Software Foundation, either version 3 of the License, or any later version. + + Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. + + You should have received a copy of the GNU Affero General Public License + along with Ingen. If not, see . +*/ + +#ifndef INGEN_ATOMREADER_HPP +#define INGEN_ATOMREADER_HPP + +#include "ingen/Interface.hpp" +#include "ingen/AtomSink.hpp" +#include "ingen/URIs.hpp" +#include "serd/serd.h" + +namespace Ingen { + +class AtomSink; +class Forge; +class URIMap; + +/** An AtomSink that calls methods on an Interface. + * @ingroup IngenShared + */ +class AtomReader : public AtomSink +{ +public: + AtomReader(URIMap& map, URIs& uris, Forge& forge, Interface& iface); + ~AtomReader() {} + + static bool is_message(URIs& uris, const LV2_Atom* msg); + + bool write(const LV2_Atom* msg); + +private: + void get_atom(const LV2_Atom* in, Raul::Atom& out); + const char* atom_to_uri(const LV2_Atom* atom); + + void get_props(const LV2_Atom_Object* obj, + Ingen::Resource::Properties& props); + + URIMap& _map; + URIs& _uris; + Forge& _forge; + Interface& _iface; +}; + +} // namespace Ingen + +#endif // INGEN_ATOMREADER_HPP + diff --git a/ingen/AtomSink.hpp b/ingen/AtomSink.hpp new file mode 100644 index 00000000..ae8fd07a --- /dev/null +++ b/ingen/AtomSink.hpp @@ -0,0 +1,40 @@ +/* + This file is part of Ingen. + Copyright 2007-2012 David Robillard + + Ingen is free software: you can redistribute it and/or modify it under the + terms of the GNU Affero General Public License as published by the Free + Software Foundation, either version 3 of the License, or any later version. + + Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. + + You should have received a copy of the GNU Affero General Public License + along with Ingen. If not, see . +*/ + +#ifndef INGEN_ATOMSINK_HPP +#define INGEN_ATOMSINK_HPP + +#include "lv2/lv2plug.in/ns/ext/atom/atom.h" + +namespace Ingen { + +/** A sink for LV2 Atoms. + * @ingroup IngenShared + */ +class AtomSink { +public: + virtual ~AtomSink() {} + + /** Write an Atom to the sink. + * @return True on success. + */ + virtual bool write(const LV2_Atom* msg) = 0; +}; + +} // namespace Ingen + +#endif // INGEN_ATOMSINK_HPP + diff --git a/ingen/AtomWriter.hpp b/ingen/AtomWriter.hpp new file mode 100644 index 00000000..31a3c099 --- /dev/null +++ b/ingen/AtomWriter.hpp @@ -0,0 +1,98 @@ +/* + This file is part of Ingen. + Copyright 2007-2012 David Robillard + + Ingen is free software: you can redistribute it and/or modify it under the + terms of the GNU Affero General Public License as published by the Free + Software Foundation, either version 3 of the License, or any later version. + + Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. + + You should have received a copy of the GNU Affero General Public License + along with Ingen. If not, see . +*/ + +#ifndef INGEN_ATOMWRITER_HPP +#define INGEN_ATOMWRITER_HPP + +#include + +#include "ingen/Interface.hpp" +#include "ingen/URIs.hpp" +#include "lv2/lv2plug.in/ns/ext/atom/forge.h" +#include "serd/serd.h" + +namespace Ingen { + +class AtomSink; +class URIMap; + +/** An Interface that writes LV2 atoms to an AtomSink. */ +class AtomWriter : public Interface +{ +public: + AtomWriter(URIMap& map, URIs& uris, AtomSink& sink); + ~AtomWriter() {} + + Raul::URI uri() const { return "http://drobilla.net/ns/ingen#AtomWriter"; } + + void bundle_begin(); + + void bundle_end(); + + void put(const Raul::URI& uri, + const Resource::Properties& properties, + Resource::Graph ctx = Resource::DEFAULT); + + void delta(const Raul::URI& uri, + const Resource::Properties& remove, + const Resource::Properties& add); + + void move(const Raul::Path& old_path, + const Raul::Path& new_path); + + void del(const Raul::URI& uri); + + void connect(const Raul::Path& tail, + const Raul::Path& head); + + void disconnect(const Raul::Path& tail, + const Raul::Path& head); + + void disconnect_all(const Raul::Path& parent_patch_path, + const Raul::Path& path); + + void set_property(const Raul::URI& subject, + const Raul::URI& predicate, + const Raul::Atom& value); + + void set_response_id(int32_t id); + + void get(const Raul::URI& uri); + + void response(int32_t id, Status status, const std::string& subject); + + void error(const std::string& msg); + +private: + void forge_uri(const Raul::URI& uri); + void forge_properties(const Resource::Properties& properties); + void forge_edge(const Raul::URI& tail, const Raul::URI& head); + + void finish_msg(); + int32_t next_id(); + + URIMap& _map; + URIs& _uris; + AtomSink& _sink; + SerdChunk _out; + LV2_Atom_Forge _forge; + int32_t _id; +}; + +} // namespace Ingen + +#endif // INGEN_ATOMWRITER_HPP + diff --git a/ingen/Builder.hpp b/ingen/Builder.hpp new file mode 100644 index 00000000..168ab841 --- /dev/null +++ b/ingen/Builder.hpp @@ -0,0 +1,49 @@ +/* + This file is part of Ingen. + Copyright 2007-2012 David Robillard + + Ingen is free software: you can redistribute it and/or modify it under the + terms of the GNU Affero General Public License as published by the Free + Software Foundation, either version 3 of the License, or any later version. + + Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. + + You should have received a copy of the GNU Affero General Public License + along with Ingen. If not, see . +*/ + +#ifndef INGEN_BUILDER_HPP +#define INGEN_BUILDER_HPP + +#include "raul/SharedPtr.hpp" + +namespace Ingen { + +class GraphObject; +class Interface; +class URIs; + +/** Wrapper for Interface to create existing objects/models. + * + * @ingroup IngenShared + */ +class Builder +{ +public: + Builder(URIs& uris, Interface& interface); + virtual ~Builder() {} + + void build(SharedPtr object); + void connect(SharedPtr object); + +private: + URIs& _uris; + Interface& _interface; +}; + +} // namespace Ingen + +#endif // INGEN_BUILDER_HPP + diff --git a/ingen/ClashAvoider.hpp b/ingen/ClashAvoider.hpp new file mode 100644 index 00000000..66b860c2 --- /dev/null +++ b/ingen/ClashAvoider.hpp @@ -0,0 +1,108 @@ +/* + This file is part of Ingen. + Copyright 2007-2012 David Robillard + + Ingen is free software: you can redistribute it and/or modify it under the + terms of the GNU Affero General Public License as published by the Free + Software Foundation, either version 3 of the License, or any later version. + + Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. + + You should have received a copy of the GNU Affero General Public License + along with Ingen. If not, see . +*/ + +#ifndef INGEN_CLASHAVOIDER_HPP +#define INGEN_CLASHAVOIDER_HPP + +#include + +#include +#include + +#include "ingen/Interface.hpp" + +namespace Raul { +class Atom; +class Path; +} + +namespace Ingen { + +class Store; + +/** A wrapper for an Interface that creates objects but possibly maps + * symbol names to avoid clashes with the existing objects in a store. + * + * @ingroup IngenShared + */ +class ClashAvoider : public Interface +{ +public: + ClashAvoider(Store& store, Interface& target, Store* also_avoid=NULL) + : _store(store), _target(target), _also_avoid(also_avoid) {} + + Raul::URI uri() const { return "ingen:ClientStore"; } + + void set_target(Interface& target) { _target = target; } + + // Bundles + void bundle_begin() { _target.bundle_begin(); } + void bundle_end() { _target.bundle_end(); } + + // Object commands + + virtual void put(const Raul::URI& path, + const Resource::Properties& properties, + Resource::Graph ctx=Resource::DEFAULT); + + virtual void delta(const Raul::URI& path, + const Resource::Properties& remove, + const Resource::Properties& add); + + virtual void move(const Raul::Path& old_path, + const Raul::Path& new_path); + + virtual void connect(const Raul::Path& tail, + const Raul::Path& head); + + virtual void disconnect(const Raul::Path& tail, + const Raul::Path& head); + + virtual void disconnect_all(const Raul::Path& parent_patch_path, + const Raul::Path& path); + + virtual void set_property(const Raul::URI& subject_path, + const Raul::URI& predicate, + const Raul::Atom& value); + + virtual void del(const Raul::URI& uri); + + virtual void set_response_id(int32_t id) {} + virtual void get(const Raul::URI& uri) {} + virtual void response(int32_t id, Status status, const std::string& subject) {} + virtual void error(const std::string& msg) {} + +private: + const Raul::URI map_uri(const Raul::URI& in); + const Raul::Path map_path(const Raul::Path& in); + + Store& _store; + Interface& _target; + + Store* _also_avoid; + bool exists(const Raul::Path& path) const; + + typedef std::map Offsets; + Offsets _offsets; + + typedef std::map SymbolMap; + SymbolMap _symbol_map; +}; + +} // namespace Ingen + +#endif // INGEN_CLASHAVOIDER_HPP + diff --git a/ingen/Configuration.hpp b/ingen/Configuration.hpp new file mode 100644 index 00000000..f45f3869 --- /dev/null +++ b/ingen/Configuration.hpp @@ -0,0 +1,35 @@ +/* + This file is part of Ingen. + Copyright 2007-2012 David Robillard + + Ingen is free software: you can redistribute it and/or modify it under the + terms of the GNU Affero General Public License as published by the Free + Software Foundation, either version 3 of the License, or any later version. + + Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. + + You should have received a copy of the GNU Affero General Public License + along with Ingen. If not, see . +*/ + +#ifndef INGEN_CONFIGURATION_HPP +#define INGEN_CONFIGURATION_HPP + +#include "raul/Configuration.hpp" + +namespace Ingen { + +/** Ingen configuration (command line options). + * @ingroup IngenShared + */ +class Configuration : public Raul::Configuration { +public: + Configuration(); +}; + +} // namespace Ingen + +#endif // INGEN_CONFIGURATION_HPP + diff --git a/ingen/Forge.hpp b/ingen/Forge.hpp new file mode 100644 index 00000000..8e7df926 --- /dev/null +++ b/ingen/Forge.hpp @@ -0,0 +1,40 @@ +/* + This file is part of Ingen. + Copyright 2007-2012 David Robillard + + Ingen is free software: you can redistribute it and/or modify it under the + terms of the GNU Affero General Public License as published by the Free + Software Foundation, either version 3 of the License, or any later version. + + Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. + + You should have received a copy of the GNU Affero General Public License + along with Ingen. If not, see . +*/ + +#ifndef INGEN_FORGE_HPP +#define INGEN_FORGE_HPP + +#include + +#include "raul/Atom.hpp" + +namespace Ingen { + +class URIMap; + +/** Forge for Raul Atoms. + * @ingroup IngenShared + */ +class Forge : public Raul::Forge { +public: + explicit Forge(URIMap& map); + + std::string str(const Raul::Atom& atom); +}; + +} // namespace Ingen + +#endif // INGEN_FORGE_HPP diff --git a/ingen/GraphObject.hpp b/ingen/GraphObject.hpp index a8bee0b0..80da116e 100644 --- a/ingen/GraphObject.hpp +++ b/ingen/GraphObject.hpp @@ -17,10 +17,9 @@ #ifndef INGEN_GRAPHOBJECT_HPP #define INGEN_GRAPHOBJECT_HPP -#include "ingen/Resource.hpp" -#include "raul/Deletable.hpp" #include "raul/Path.hpp" #include "raul/SharedPtr.hpp" +#include "ingen/Resource.hpp" namespace Raul { class Atom; @@ -40,8 +39,6 @@ class Plugin; class GraphObject : public Resource { public: - virtual void set_path(const Raul::Path& path) = 0; - enum GraphType { PATCH, NODE, @@ -67,7 +64,7 @@ public: virtual GraphObject* graph_parent() const = 0; protected: - GraphObject(Shared::URIs& uris, const Raul::Path& path) + GraphObject(URIs& uris, const Raul::Path& path) : Resource(uris, path) {} diff --git a/ingen/LV2Features.hpp b/ingen/LV2Features.hpp new file mode 100644 index 00000000..b7b1395c --- /dev/null +++ b/ingen/LV2Features.hpp @@ -0,0 +1,74 @@ +/* + This file is part of Ingen. + Copyright 2007-2012 David Robillard + + Ingen is free software: you can redistribute it and/or modify it under the + terms of the GNU Affero General Public License as published by the Free + Software Foundation, either version 3 of the License, or any later version. + + Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. + + You should have received a copy of the GNU Affero General Public License + along with Ingen. If not, see . +*/ + +#ifndef INGEN_LV2FEATURES_HPP +#define INGEN_LV2FEATURES_HPP + +#include + +#include "lv2/lv2plug.in/ns/lv2core/lv2.h" + +#include "raul/SharedPtr.hpp" +#include "raul/Noncopyable.hpp" + +namespace Ingen { + +class GraphObject; +class World; + +/** Features for use by LV2 plugins. + * @ingroup IngenShared + */ +class LV2Features { +public: + LV2Features(); + + class Feature { + public: + virtual ~Feature() {} + + virtual SharedPtr feature(World* world, + GraphObject* node) = 0; + }; + + class FeatureArray : public Raul::Noncopyable { + public: + typedef std::vector< SharedPtr > FeatureVector; + + explicit FeatureArray(FeatureVector& features); + + ~FeatureArray(); + + LV2_Feature** array() { return _array; } + + private: + FeatureVector _features; + LV2_Feature** _array; + }; + + void add_feature(SharedPtr feature); + + SharedPtr lv2_features(World* world, + GraphObject* node) const; + +private: + typedef std::vector< SharedPtr > Features; + Features _features; +}; + +} // namespace Ingen + +#endif // INGEN_LV2FEATURES_HPP diff --git a/ingen/Module.hpp b/ingen/Module.hpp new file mode 100644 index 00000000..3decc185 --- /dev/null +++ b/ingen/Module.hpp @@ -0,0 +1,53 @@ +/* + This file is part of Ingen. + Copyright 2007-2012 David Robillard + + Ingen is free software: you can redistribute it and/or modify it under the + terms of the GNU Affero General Public License as published by the Free + Software Foundation, either version 3 of the License, or any later version. + + Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. + + You should have received a copy of the GNU Affero General Public License + along with Ingen. If not, see . +*/ + +#ifndef INGEN_MODULE_HPP +#define INGEN_MODULE_HPP + +#include + +namespace Ingen { + +class World; + +/** A dynamically loaded Ingen module. + * + * All components of Ingen reside in one of these. + * @ingroup IngenShared + */ +struct Module { + Module() : library(NULL) {} + virtual ~Module() {} + + virtual void load(Ingen::World* world) = 0; + virtual void run(Ingen::World* world) {} + + /** Library implementing this module. + * + * This is managed by the World and not this class, since closing the library + * in this destructor could possibly reference code from the library + * afterwards and cause a segfault on exit. + */ + Glib::Module* library; + +private: + Module(const Module& noncopyable); + Module& operator=(const Module& noncopyable); +}; + +} // namespace Ingen + +#endif // INGEN_MODULE_HPP diff --git a/ingen/Plugin.hpp b/ingen/Plugin.hpp index 30c70963..544a2aad 100644 --- a/ingen/Plugin.hpp +++ b/ingen/Plugin.hpp @@ -31,7 +31,7 @@ namespace Ingen { class Plugin : public Resource { public: - Plugin(Shared::URIs& uris, const Raul::URI& uri) + Plugin(URIs& uris, const Raul::URI& uri) : Resource(uris, uri) {} diff --git a/ingen/Resource.hpp b/ingen/Resource.hpp index 4aed2f6d..1e94e1e8 100644 --- a/ingen/Resource.hpp +++ b/ingen/Resource.hpp @@ -20,13 +20,12 @@ #include #include +#include "ingen/URIs.hpp" #include "raul/Atom.hpp" #include "raul/Deletable.hpp" #include "raul/URI.hpp" #include "raul/log.hpp" -#include "ingen/shared/URIs.hpp" - #define NS_INGEN "http://drobilla.net/ns/ingen#" namespace Ingen { @@ -37,7 +36,7 @@ namespace Ingen { class Resource : public Raul::Deletable { public: - Resource(Shared::URIs& uris, const Raul::URI& uri) + Resource(URIs& uris, const Raul::URI& uri) : _uris(uris) , _uri(uri) {} @@ -94,7 +93,7 @@ public: virtual ~Resource() {} - Shared::URIs& uris() const { return _uris; } + URIs& uris() const { return _uris; } virtual void set_uri(const Raul::URI& uri) { _uri = uri; } virtual const Raul::URI& uri() const { return _uri; } @@ -137,17 +136,17 @@ public: * If some coherent ingen type is found, true is returned and the appropriate * output parameter set to true. Otherwise false is returned. */ - static bool type(const Shared::URIs& uris, - const Properties& properties, - bool& patch, - bool& node, - bool& port, - bool& is_output); + static bool type(const URIs& uris, + const Properties& properties, + bool& patch, + bool& node, + bool& port, + bool& is_output); protected: const Raul::Atom& set_property(const Raul::URI& uri, const Raul::Atom& value) const; - Shared::URIs& _uris; + URIs& _uris; private: Raul::URI _uri; diff --git a/ingen/Store.hpp b/ingen/Store.hpp new file mode 100644 index 00000000..2f5afa1e --- /dev/null +++ b/ingen/Store.hpp @@ -0,0 +1,60 @@ +/* + This file is part of Ingen. + Copyright 2007-2012 David Robillard + + Ingen is free software: you can redistribute it and/or modify it under the + terms of the GNU Affero General Public License as published by the Free + Software Foundation, either version 3 of the License, or any later version. + + Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. + + You should have received a copy of the GNU Affero General Public License + along with Ingen. If not, see . +*/ + +#ifndef INGEN_STORE_HPP +#define INGEN_STORE_HPP + +#include + +#undef nil +#include + +#include "raul/PathTable.hpp" + +#include "ingen/GraphObject.hpp" + +namespace Ingen { + +/** Store of objects in the patch hierarchy. + * @ingroup IngenShared + */ +class Store : public Raul::PathTable< SharedPtr > { +public: + virtual ~Store() {} + + virtual void add(GraphObject* o); + + typedef Raul::Table< Raul::Path, SharedPtr > Objects; + + const_iterator children_begin(SharedPtr o) const; + const_iterator children_end(SharedPtr o) const; + + SharedPtr find_child(SharedPtr parent, + const std::string& child_name) const; + + unsigned child_name_offset(const Raul::Path& parent, + const Raul::Symbol& symbol, + bool allow_zero=true); + + Glib::RWLock& lock() { return _lock; } + +private: + Glib::RWLock _lock; +}; + +} // namespace Ingen + +#endif // INGEN_STORE_HPP diff --git a/ingen/URIMap.hpp b/ingen/URIMap.hpp new file mode 100644 index 00000000..c46f4197 --- /dev/null +++ b/ingen/URIMap.hpp @@ -0,0 +1,80 @@ +/* + This file is part of Ingen. + Copyright 2007-2012 David Robillard + + Ingen is free software: you can redistribute it and/or modify it under the + terms of the GNU Affero General Public License as published by the Free + Software Foundation, either version 3 of the License, or any later version. + + Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. + + You should have received a copy of the GNU Affero General Public License + along with Ingen. If not, see . +*/ + +#ifndef INGEN_URIMAP_HPP +#define INGEN_URIMAP_HPP + +#include +#include + +#include "ingen/LV2Features.hpp" +#include "lv2/lv2plug.in/ns/ext/urid/urid.h" +#include "raul/URI.hpp" +#include "raul/Noncopyable.hpp" + +namespace Ingen { + +/** URI to integer map and implementation of LV2 URID extension. + * @ingroup IngenShared + */ +class URIMap : public Raul::Noncopyable { +public: + URIMap(LV2_URID_Map* map, LV2_URID_Unmap* unmap); + virtual ~URIMap() {} + + uint32_t map_uri(const char* uri); + const char* unmap_uri(uint32_t urid) const; + + class Feature : public LV2Features::Feature { + public: + Feature(const char* URI, void* data) { + _feature.URI = URI; + _feature.data = data; + } + + SharedPtr feature(World*, GraphObject*) { + return SharedPtr(&_feature, NullDeleter); + } + + private: + LV2_Feature _feature; + }; + + struct URIDMapFeature : public Feature { + URIDMapFeature(URIMap* map, LV2_URID_Map* urid_map); + LV2_URID map(const char* uri); + static LV2_URID default_map(LV2_URID_Map_Handle h, const char* uri); + LV2_URID_Map urid_map; + }; + + struct URIDUnmapFeature : public Feature { + URIDUnmapFeature(URIMap* map, LV2_URID_Unmap* urid_unmap); + const char* unmap(const LV2_URID urid); + static const char* default_unmap(LV2_URID_Map_Handle h, LV2_URID uri); + LV2_URID_Unmap urid_unmap; + }; + + SharedPtr urid_map_feature() { return _urid_map_feature; } + SharedPtr urid_unmap_feature() { return _urid_unmap_feature; } + +private: + SharedPtr _urid_map_feature; + SharedPtr _urid_unmap_feature; +}; + +} // namespace Ingen + +#endif // INGEN_URIMAP_HPP diff --git a/ingen/URIs.hpp b/ingen/URIs.hpp new file mode 100644 index 00000000..ace1652b --- /dev/null +++ b/ingen/URIs.hpp @@ -0,0 +1,143 @@ +/* + This file is part of Ingen. + Copyright 2007-2012 David Robillard + + Ingen is free software: you can redistribute it and/or modify it under the + terms of the GNU Affero General Public License as published by the Free + Software Foundation, either version 3 of the License, or any later version. + + Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. + + You should have received a copy of the GNU Affero General Public License + along with Ingen. If not, see . +*/ + +#ifndef INGEN_URIS_HPP +#define INGEN_URIS_HPP + +#include "ingen/Forge.hpp" +#include "lv2/lv2plug.in/ns/ext/urid/urid.h" +#include "raul/Atom.hpp" +#include "raul/Noncopyable.hpp" +#include "raul/URI.hpp" + +namespace Raul { + class Forge; +} + +namespace Ingen { + +class URIMap; + +/** Frequently used interned URIs. + * + * This class initially maps all the special URIs used throughout the code + * using the URIMap so they can be used quickly with the performance of + * integers, but still be dynamic. + * + * @ingroup ingen + */ +class URIs : public Raul::Noncopyable { +public: + URIs(Ingen::Forge& forge, URIMap* map); + + struct Quark : public Raul::URI { + Quark(Ingen::Forge& forge, URIMap* map, const char* str); + operator LV2_URID() const { return id; } + operator Raul::Atom() const { return atom; } + uint32_t id; + Raul::Atom atom; + }; + + Ingen::Forge& forge; + + const Quark atom_AtomPort; + const Quark atom_Blank; + const Quark atom_Bool; + const Quark atom_Chunk; + const Quark atom_Float; + const Quark atom_Int; + const Quark atom_Resource; + const Quark atom_Sequence; + const Quark atom_Sound; + const Quark atom_String; + const Quark atom_URI; + const Quark atom_URID; + const Quark atom_Vector; + const Quark atom_bufferType; + const Quark atom_eventTransfer; + const Quark atom_supports; + const Quark doap_name; + const Quark ingen_Edge; + const Quark ingen_Internal; + const Quark ingen_Node; + const Quark ingen_Patch; + const Quark ingen_activity; + const Quark ingen_broadcast; + const Quark ingen_canvasX; + const Quark ingen_canvasY; + const Quark ingen_controlBinding; + const Quark ingen_document; + const Quark ingen_enabled; + const Quark ingen_engine; + const Quark ingen_head; + const Quark ingen_incidentTo; + const Quark ingen_nil; + const Quark ingen_node; + const Quark ingen_polyphonic; + const Quark ingen_polyphony; + const Quark ingen_prototype; + const Quark ingen_sampleRate; + const Quark ingen_status; + const Quark ingen_tail; + const Quark ingen_uiEmbedded; + const Quark ingen_value; + const Quark lv2_AudioPort; + const Quark lv2_CVPort; + const Quark lv2_ControlPort; + const Quark lv2_InputPort; + const Quark lv2_OutputPort; + const Quark lv2_Plugin; + const Quark lv2_connectionOptional; + const Quark lv2_default; + const Quark lv2_index; + const Quark lv2_integer; + const Quark lv2_maximum; + const Quark lv2_minimum; + const Quark lv2_name; + const Quark lv2_portProperty; + const Quark lv2_sampleRate; + const Quark lv2_scalePoint; + const Quark lv2_symbol; + const Quark lv2_toggled; + const Quark midi_Bender; + const Quark midi_ChannelPressure; + const Quark midi_Controller; + const Quark midi_MidiEvent; + const Quark midi_NoteOn; + const Quark midi_controllerNumber; + const Quark midi_noteNumber; + const Quark patch_Delete; + const Quark patch_Get; + const Quark patch_Move; + const Quark patch_Patch; + const Quark patch_Put; + const Quark patch_Response; + const Quark patch_Set; + const Quark patch_add; + const Quark patch_body; + const Quark patch_destination; + const Quark patch_remove; + const Quark patch_request; + const Quark patch_subject; + const Quark pprops_logarithmic; + const Quark rdf_type; + const Quark rdfs_seeAlso; + const Quark wildcard; +}; + +} // namespace Ingen + +#endif // INGEN_LV2URIMAP_HPP diff --git a/ingen/World.hpp b/ingen/World.hpp new file mode 100644 index 00000000..5d2bddda --- /dev/null +++ b/ingen/World.hpp @@ -0,0 +1,151 @@ +/* + This file is part of Ingen. + Copyright 2007-2012 David Robillard + + Ingen is free software: you can redistribute it and/or modify it under the + terms of the GNU Affero General Public License as published by the Free + Software Foundation, either version 3 of the License, or any later version. + + Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. + + You should have received a copy of the GNU Affero General Public License + along with Ingen. If not, see . +*/ + +#ifndef INGEN_WORLD_HPP +#define INGEN_WORLD_HPP + +#include + +#include "lv2/lv2plug.in/ns/ext/urid/urid.h" +#include "raul/Noncopyable.hpp" +#include "raul/SharedPtr.hpp" + +typedef struct LilvWorldImpl LilvWorld; + +namespace Sord { class World; } + +namespace Ingen { + +class EngineBase; +class Interface; + +namespace Serialisation { +class Parser; +class Serialiser; +} + +class Configuration; +class Forge; +class LV2Features; +class Store; +class URIMap; +class URIs; + +/** The "world" all Ingen modules share. + * + * This is the root to which all components of Ingen are connected. It + * contains all necessary shared data (including the world for libraries like + * Sord and Lilv) and holds references to components. + * + * Most functionality in Ingen is implemented in dynamically loaded modules, + * which are loaded using this interface. When loaded, those modules add + * facilities to the World which can then be used throughout the code. For + * example loading the "ingen_serialisation" module will set World::serialiser + * and World::parser to valid objects. + * + * The world is used in any process which uses the Ingen as a library, both + * client and server (e.g. the world may not actually contain an Engine, since + * it maybe running in another process or even on a different machine). + * + * @ingroup IngenShared + */ +class World : public Raul::Noncopyable { +public: + /** Construct a new Ingen world. + * @param argc Argument count (as in C main()) + * @param argv Argument vector (as in C main()) + * @param map LV2 URID map implementation, or NULL to use internal. + * @param unmap LV2 URID unmap implementation, or NULL to use internal. + */ + World(int& argc, + char**& argv, + LV2_URID_Map* map, + LV2_URID_Unmap* unmap); + + virtual ~World(); + + /** Load an Ingen module by name (e.g. "server", "gui", etc.) + * @return True on success. + */ + virtual bool load_module(const char* name); + + /** Run a loaded module (modules that "run" only, e.g. gui). + * @return True on success. + */ + virtual bool run_module(const char* name); + + /** Unload all loaded Ingen modules. */ + virtual void unload_modules(); + + /** A function to create a new remote Interface. */ + typedef SharedPtr (*InterfaceFactory)( + World* world, + const std::string& engine_url, + SharedPtr respondee); + + /** Register an InterfaceFactory (for module implementations). */ + virtual void add_interface_factory(const std::string& scheme, + InterfaceFactory factory); + + /** Return a new Interface to control a server. + * @param engine_url The URL of the possibly remote server to control. + * @param respondee The Interface that will receive responses to commands + * and broadcasts, if applicable. + */ + virtual SharedPtr new_interface( + const std::string& engine_url, + SharedPtr respondee); + + /** Run a script. */ + virtual bool run(const std::string& mime_type, + const std::string& filename); + + virtual void set_engine(SharedPtr e); + virtual void set_interface(SharedPtr e); + virtual void set_parser(SharedPtr p); + virtual void set_serialiser(SharedPtr s); + virtual void set_store(SharedPtr s); + + virtual SharedPtr engine(); + virtual SharedPtr interface(); + virtual SharedPtr parser(); + virtual SharedPtr serialiser(); + virtual SharedPtr store(); + + virtual int& argc(); + virtual char**& argv(); + virtual Configuration& conf(); + + virtual Sord::World* rdf_world(); + virtual LilvWorld* lilv_world(); + + virtual LV2Features& lv2_features(); + virtual Ingen::Forge& forge(); + virtual URIMap& uri_map(); + virtual URIs& uris(); + + virtual void set_jack_uuid(const std::string& uuid); + virtual std::string jack_uuid(); + +private: + class Impl; + + Impl* _impl; +}; + +} // namespace Ingen + +#endif // INGEN_WORLD_HPP diff --git a/ingen/client/ClientStore.hpp b/ingen/client/ClientStore.hpp index b5a51a83..720164d0 100644 --- a/ingen/client/ClientStore.hpp +++ b/ingen/client/ClientStore.hpp @@ -23,7 +23,7 @@ #include "ingen/Interface.hpp" #include "ingen/client/signal.hpp" -#include "ingen/shared/Store.hpp" +#include "ingen/Store.hpp" #include "raul/Path.hpp" #include "raul/PathTable.hpp" #include "raul/SharedPtr.hpp" @@ -33,7 +33,7 @@ namespace Raul { class Atom; } namespace Ingen { -namespace Shared { class URIs; } +class URIs; class GraphObject; @@ -50,12 +50,12 @@ class SigClientInterface; * * @ingroup IngenClient */ -class ClientStore : public Shared::Store +class ClientStore : public Store , public Interface , public INGEN_TRACKABLE { public: ClientStore( - Shared::URIs& uris, + URIs& uris, SharedPtr engine = SharedPtr(), SharedPtr emitter = SharedPtr()); @@ -72,7 +72,7 @@ public: SharedPtr plugins() { return _plugins; } void set_plugins(SharedPtr p) { _plugins = p; } - Shared::URIs& uris() { return _uris; } + URIs& uris() { return _uris; } void put(const Raul::URI& uri, const Resource::Properties& properties, @@ -130,7 +130,7 @@ private: bool attempt_connection(const Raul::Path& tail_path, const Raul::Path& head_path); - Shared::URIs& _uris; + URIs& _uris; SharedPtr _engine; SharedPtr _emitter; diff --git a/ingen/client/NodeModel.hpp b/ingen/client/NodeModel.hpp index 07810eed..93a512f0 100644 --- a/ingen/client/NodeModel.hpp +++ b/ingen/client/NodeModel.hpp @@ -31,7 +31,7 @@ namespace Raul { class Path; } namespace Ingen { -namespace Shared { class URIs; } +class URIs; namespace Client { @@ -79,10 +79,10 @@ public: protected: friend class ClientStore; - NodeModel(Shared::URIs& uris, - const Raul::URI& plugin_uri, - const Raul::Path& path); - NodeModel(Shared::URIs& uris, + NodeModel(URIs& uris, + const Raul::URI& plugin_uri, + const Raul::Path& path); + NodeModel(URIs& uris, SharedPtr plugin, const Raul::Path& path); explicit NodeModel(const Raul::Path& path); diff --git a/ingen/client/ObjectModel.hpp b/ingen/client/ObjectModel.hpp index 2ff8f898..69ad3e22 100644 --- a/ingen/client/ObjectModel.hpp +++ b/ingen/client/ObjectModel.hpp @@ -35,7 +35,7 @@ namespace Ingen { -namespace Shared { class URIs; } +class URIs; namespace Client { @@ -80,7 +80,7 @@ public: protected: friend class ClientStore; - ObjectModel(Shared::URIs& uris, const Raul::Path& path); + ObjectModel(URIs& uris, const Raul::Path& path); ObjectModel(const ObjectModel& copy); virtual void set_path(const Raul::Path& p); diff --git a/ingen/client/PatchModel.hpp b/ingen/client/PatchModel.hpp index 1ad55c78..64ef3d18 100644 --- a/ingen/client/PatchModel.hpp +++ b/ingen/client/PatchModel.hpp @@ -53,7 +53,7 @@ public: private: friend class ClientStore; - PatchModel(Shared::URIs& uris, const Raul::Path& patch_path) + PatchModel(URIs& uris, const Raul::Path& patch_path) : NodeModel(uris, "http://drobilla.net/ns/ingen#Patch", patch_path) { } diff --git a/ingen/client/PluginModel.hpp b/ingen/client/PluginModel.hpp index 0449cb51..13375c95 100644 --- a/ingen/client/PluginModel.hpp +++ b/ingen/client/PluginModel.hpp @@ -21,20 +21,19 @@ #include #include +#include "ingen/Plugin.hpp" +#include "ingen/Resource.hpp" +#include "ingen/Resource.hpp" +#include "ingen/World.hpp" +#include "ingen/client/signal.hpp" #include "lilv/lilv.h" #include "raul/SharedPtr.hpp" #include "raul/Symbol.hpp" #include "sord/sordmm.hpp" -#include "ingen/Interface.hpp" -#include "ingen/Plugin.hpp" -#include "ingen/Resource.hpp" -#include "ingen/client/signal.hpp" -#include "ingen/shared/World.hpp" - namespace Ingen { -namespace Shared { class URIs; } +class URIs; namespace Client { @@ -49,7 +48,7 @@ class PluginUI; class PluginModel : public Ingen::Plugin { public: - PluginModel(Shared::URIs& uris, + PluginModel(URIs& uris, const Raul::URI& uri, const Raul::URI& type_uri, const Ingen::Resource::Properties& properties); @@ -75,8 +74,8 @@ public: bool has_ui() const; - SharedPtr ui(Ingen::Shared::World* world, - SharedPtr node) const; + SharedPtr ui(Ingen::World* world, + SharedPtr node) const; const std::string& icon_path() const; static std::string get_lv2_icon_path(const LilvPlugin* plugin); diff --git a/ingen/client/PluginUI.hpp b/ingen/client/PluginUI.hpp index 25422fe8..1c45bd56 100644 --- a/ingen/client/PluginUI.hpp +++ b/ingen/client/PluginUI.hpp @@ -23,13 +23,12 @@ #include "suil/suil.h" -#include "ingen/shared/LV2Features.hpp" +#include "ingen/LV2Features.hpp" namespace Ingen { class Interface; - -namespace Shared { class World; } +class World; namespace Client { @@ -43,7 +42,7 @@ class PluginUI { public: ~PluginUI(); - static SharedPtr create(Ingen::Shared::World* world, + static SharedPtr create(Ingen::World* world, SharedPtr node, const LilvPlugin* plugin); @@ -56,22 +55,22 @@ public: bool is_resizable() const; - Ingen::Shared::World* world() const { return _world; } - SharedPtr node() const { return _node; } + Ingen::World* world() const { return _world; } + SharedPtr node() const { return _node; } private: - PluginUI(Ingen::Shared::World* world, + PluginUI(Ingen::World* world, SharedPtr node, const LilvNode* ui_node); - Ingen::Shared::World* _world; + Ingen::World* _world; SharedPtr _node; SuilInstance* _instance; LilvNode* _ui_node; static SuilHost* ui_host; - SharedPtr _features; + SharedPtr _features; }; } // namespace Client diff --git a/ingen/client/PortModel.hpp b/ingen/client/PortModel.hpp index 99cd85be..1a5a31be 100644 --- a/ingen/client/PortModel.hpp +++ b/ingen/client/PortModel.hpp @@ -89,7 +89,7 @@ public: private: friend class ClientStore; - PortModel(Shared::URIs& uris, + PortModel(URIs& uris, const Raul::Path& path, uint32_t index, Direction dir) diff --git a/ingen/runtime_paths.hpp b/ingen/runtime_paths.hpp new file mode 100644 index 00000000..3d36e55e --- /dev/null +++ b/ingen/runtime_paths.hpp @@ -0,0 +1,33 @@ +/* + This file is part of Ingen. + Copyright 2007-2012 David Robillard + + Ingen is free software: you can redistribute it and/or modify it under the + terms of the GNU Affero General Public License as published by the Free + Software Foundation, either version 3 of the License, or any later version. + + Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. + + You should have received a copy of the GNU Affero General Public License + along with Ingen. If not, see . +*/ + +#ifndef INGEN_RUNTIME_PATHS_HPP +#define INGEN_RUNTIME_PATHS_HPP + +#include + +namespace Ingen { + +void set_bundle_path(const char* path); +void set_bundle_path_from_code(void* function); + +std::string bundle_file_path(const std::string& name); +std::string data_file_path(const std::string& name); +std::string module_path(const std::string& name, std::string dir=""); + +} // namespace Ingen + +#endif // INGEN_RUNTIME_PATHS_HPP diff --git a/ingen/serialisation/Parser.hpp b/ingen/serialisation/Parser.hpp index 0240dc9d..666d9acb 100644 --- a/ingen/serialisation/Parser.hpp +++ b/ingen/serialisation/Parser.hpp @@ -33,8 +33,7 @@ namespace Ingen { class Interface; - -namespace Shared { class World; } +class World; namespace Serialisation { @@ -52,7 +51,7 @@ public: typedef GraphObject::Properties Properties; virtual bool parse_file( - Shared::World* world, + World* world, Interface* target, Glib::ustring path, boost::optional parent = boost::optional(), @@ -60,7 +59,7 @@ public: boost::optional data = boost::optional()); virtual bool parse_string( - Shared::World* world, + World* world, Interface* target, const Glib::ustring& str, const Glib::ustring& base_uri, diff --git a/ingen/serialisation/Serialiser.hpp b/ingen/serialisation/Serialiser.hpp index 2dbc99b7..b4c0dfd3 100644 --- a/ingen/serialisation/Serialiser.hpp +++ b/ingen/serialisation/Serialiser.hpp @@ -29,14 +29,10 @@ namespace Ingen { -class Plugin; -class GraphObject; class Edge; - -namespace Shared { -class World; +class GraphObject; class Store; -} +class World; namespace Serialisation { @@ -48,7 +44,7 @@ namespace Serialisation { class Serialiser { public: - explicit Serialiser(Shared::World& world); + explicit Serialiser(World& world); virtual ~Serialiser(); typedef GraphObject::Properties Properties; diff --git a/ingen/shared/AtomReader.hpp b/ingen/shared/AtomReader.hpp deleted file mode 100644 index 38c89a2b..00000000 --- a/ingen/shared/AtomReader.hpp +++ /dev/null @@ -1,62 +0,0 @@ -/* - This file is part of Ingen. - Copyright 2007-2012 David Robillard - - Ingen is free software: you can redistribute it and/or modify it under the - terms of the GNU Affero General Public License as published by the Free - Software Foundation, either version 3 of the License, or any later version. - - Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. - - You should have received a copy of the GNU Affero General Public License - along with Ingen. If not, see . -*/ - -#ifndef INGEN_SHARED_ATOMREADER_HPP -#define INGEN_SHARED_ATOMREADER_HPP - -#include "ingen/Interface.hpp" -#include "ingen/shared/AtomSink.hpp" -#include "ingen/shared/URIs.hpp" -#include "serd/serd.h" - -namespace Ingen { -namespace Shared { - -class AtomSink; -class Forge; -class URIMap; - -/** An AtomSink that calls methods on an Interface. - * @ingroup IngenShared - */ -class AtomReader : public AtomSink -{ -public: - AtomReader(URIMap& map, URIs& uris, Forge& forge, Interface& iface); - ~AtomReader() {} - - static bool is_message(URIs& uris, const LV2_Atom* msg); - - bool write(const LV2_Atom* msg); - -private: - void get_atom(const LV2_Atom* in, Raul::Atom& out); - const char* atom_to_uri(const LV2_Atom* atom); - - void get_props(const LV2_Atom_Object* obj, - Ingen::Resource::Properties& props); - - URIMap& _map; - URIs& _uris; - Forge& _forge; - Interface& _iface; -}; - -} // namespace Shared -} // namespace Ingen - -#endif // INGEN_SHARED_ATOMREADER_HPP - diff --git a/ingen/shared/AtomSink.hpp b/ingen/shared/AtomSink.hpp deleted file mode 100644 index f25e6548..00000000 --- a/ingen/shared/AtomSink.hpp +++ /dev/null @@ -1,42 +0,0 @@ -/* - This file is part of Ingen. - Copyright 2007-2012 David Robillard - - Ingen is free software: you can redistribute it and/or modify it under the - terms of the GNU Affero General Public License as published by the Free - Software Foundation, either version 3 of the License, or any later version. - - Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. - - You should have received a copy of the GNU Affero General Public License - along with Ingen. If not, see . -*/ - -#ifndef INGEN_SHARED_ATOMSINK_HPP -#define INGEN_SHARED_ATOMSINK_HPP - -#include "lv2/lv2plug.in/ns/ext/atom/atom.h" - -namespace Ingen { -namespace Shared { - -/** A sink for LV2 Atoms. - * @ingroup IngenShared - */ -class AtomSink { -public: - virtual ~AtomSink() {} - - /** Write an Atom to the sink. - * @return True on success. - */ - virtual bool write(const LV2_Atom* msg) = 0; -}; - -} // namespace Shared -} // namespace Ingen - -#endif // INGEN_SHARED_ATOMSINK_HPP - diff --git a/ingen/shared/AtomWriter.hpp b/ingen/shared/AtomWriter.hpp deleted file mode 100644 index 7087bfd6..00000000 --- a/ingen/shared/AtomWriter.hpp +++ /dev/null @@ -1,100 +0,0 @@ -/* - This file is part of Ingen. - Copyright 2007-2012 David Robillard - - Ingen is free software: you can redistribute it and/or modify it under the - terms of the GNU Affero General Public License as published by the Free - Software Foundation, either version 3 of the License, or any later version. - - Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. - - You should have received a copy of the GNU Affero General Public License - along with Ingen. If not, see . -*/ - -#ifndef INGEN_SHARED_ATOMWRITER_HPP -#define INGEN_SHARED_ATOMWRITER_HPP - -#include - -#include "ingen/Interface.hpp" -#include "ingen/shared/URIs.hpp" -#include "lv2/lv2plug.in/ns/ext/atom/forge.h" -#include "serd/serd.h" - -namespace Ingen { -namespace Shared { - -class AtomSink; -class URIMap; - -/** An Interface that writes LV2 atoms to an AtomSink. */ -class AtomWriter : public Interface -{ -public: - AtomWriter(URIMap& map, URIs& uris, AtomSink& sink); - ~AtomWriter() {} - - Raul::URI uri() const { return "http://drobilla.net/ns/ingen#AtomWriter"; } - - void bundle_begin(); - - void bundle_end(); - - void put(const Raul::URI& uri, - const Resource::Properties& properties, - Resource::Graph ctx = Resource::DEFAULT); - - void delta(const Raul::URI& uri, - const Resource::Properties& remove, - const Resource::Properties& add); - - void move(const Raul::Path& old_path, - const Raul::Path& new_path); - - void del(const Raul::URI& uri); - - void connect(const Raul::Path& tail, - const Raul::Path& head); - - void disconnect(const Raul::Path& tail, - const Raul::Path& head); - - void disconnect_all(const Raul::Path& parent_patch_path, - const Raul::Path& path); - - void set_property(const Raul::URI& subject, - const Raul::URI& predicate, - const Raul::Atom& value); - - void set_response_id(int32_t id); - - void get(const Raul::URI& uri); - - void response(int32_t id, Status status, const std::string& subject); - - void error(const std::string& msg); - -private: - void forge_uri(const Raul::URI& uri); - void forge_properties(const Resource::Properties& properties); - void forge_edge(const Raul::URI& tail, const Raul::URI& head); - - void finish_msg(); - int32_t next_id(); - - URIMap& _map; - URIs& _uris; - AtomSink& _sink; - SerdChunk _out; - LV2_Atom_Forge _forge; - int32_t _id; -}; - -} // namespace Shared -} // namespace Ingen - -#endif // INGEN_SHARED_ATOMWRITER_HPP - diff --git a/ingen/shared/Builder.hpp b/ingen/shared/Builder.hpp deleted file mode 100644 index 1c57c871..00000000 --- a/ingen/shared/Builder.hpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - This file is part of Ingen. - Copyright 2007-2012 David Robillard - - Ingen is free software: you can redistribute it and/or modify it under the - terms of the GNU Affero General Public License as published by the Free - Software Foundation, either version 3 of the License, or any later version. - - Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. - - You should have received a copy of the GNU Affero General Public License - along with Ingen. If not, see . -*/ - -#ifndef INGEN_SHARED_BUILDER_HPP -#define INGEN_SHARED_BUILDER_HPP - -namespace Ingen { - -class Interface; -class GraphObject; - -namespace Shared { - -class URIs; - -/** Wrapper for Interface to create existing objects/models. - * - * @ingroup IngenShared - */ -class Builder -{ -public: - Builder(Shared::URIs& uris, Interface& interface); - virtual ~Builder() {} - - void build(SharedPtr object); - void connect(SharedPtr object); - -private: - Shared::URIs& _uris; - Interface& _interface; -}; - -} // namespace Shared -} // namespace Ingen - -#endif // INGEN_SHARED_BUILDER_HPP - diff --git a/ingen/shared/ClashAvoider.hpp b/ingen/shared/ClashAvoider.hpp deleted file mode 100644 index e3f4faaf..00000000 --- a/ingen/shared/ClashAvoider.hpp +++ /dev/null @@ -1,110 +0,0 @@ -/* - This file is part of Ingen. - Copyright 2007-2012 David Robillard - - Ingen is free software: you can redistribute it and/or modify it under the - terms of the GNU Affero General Public License as published by the Free - Software Foundation, either version 3 of the License, or any later version. - - Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. - - You should have received a copy of the GNU Affero General Public License - along with Ingen. If not, see . -*/ - -#ifndef INGEN_SHARED_CLASHAVOIDER_HPP -#define INGEN_SHARED_CLASHAVOIDER_HPP - -#include - -#include -#include - -#include "ingen/Interface.hpp" - -namespace Raul { -class Atom; -class Path; -} - -namespace Ingen { -namespace Shared { - -class Store; - -/** A wrapper for an Interface that creates objects but possibly maps - * symbol names to avoid clashes with the existing objects in a store. - * - * @ingroup IngenShared - */ -class ClashAvoider : public Interface -{ -public: - ClashAvoider(Store& store, Interface& target, Store* also_avoid=NULL) - : _store(store), _target(target), _also_avoid(also_avoid) {} - - Raul::URI uri() const { return "ingen:ClientStore"; } - - void set_target(Interface& target) { _target = target; } - - // Bundles - void bundle_begin() { _target.bundle_begin(); } - void bundle_end() { _target.bundle_end(); } - - // Object commands - - virtual void put(const Raul::URI& path, - const Resource::Properties& properties, - Resource::Graph ctx=Resource::DEFAULT); - - virtual void delta(const Raul::URI& path, - const Resource::Properties& remove, - const Resource::Properties& add); - - virtual void move(const Raul::Path& old_path, - const Raul::Path& new_path); - - virtual void connect(const Raul::Path& tail, - const Raul::Path& head); - - virtual void disconnect(const Raul::Path& tail, - const Raul::Path& head); - - virtual void disconnect_all(const Raul::Path& parent_patch_path, - const Raul::Path& path); - - virtual void set_property(const Raul::URI& subject_path, - const Raul::URI& predicate, - const Raul::Atom& value); - - virtual void del(const Raul::URI& uri); - - virtual void set_response_id(int32_t id) {} - virtual void get(const Raul::URI& uri) {} - virtual void response(int32_t id, Status status, const std::string& subject) {} - virtual void error(const std::string& msg) {} - -private: - const Raul::URI map_uri(const Raul::URI& in); - const Raul::Path map_path(const Raul::Path& in); - - Store& _store; - Interface& _target; - - Store* _also_avoid; - bool exists(const Raul::Path& path) const; - - typedef std::map Offsets; - Offsets _offsets; - - typedef std::map SymbolMap; - SymbolMap _symbol_map; -}; - -} // namespace Shared -} // namespace Ingen - -#endif // INGEN_SHARED_CLASHAVOIDER_HPP - diff --git a/ingen/shared/Configuration.hpp b/ingen/shared/Configuration.hpp deleted file mode 100644 index 211184d0..00000000 --- a/ingen/shared/Configuration.hpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - This file is part of Ingen. - Copyright 2007-2012 David Robillard - - Ingen is free software: you can redistribute it and/or modify it under the - terms of the GNU Affero General Public License as published by the Free - Software Foundation, either version 3 of the License, or any later version. - - Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. - - You should have received a copy of the GNU Affero General Public License - along with Ingen. If not, see . -*/ - -#ifndef INGEN_SHARED_CONFIGURATION_HPP -#define INGEN_SHARED_CONFIGURATION_HPP - -#include "raul/Configuration.hpp" - -namespace Ingen { -namespace Shared { - -/** Ingen configuration (command line options). - * @ingroup IngenShared - */ -class Configuration : public Raul::Configuration { -public: - Configuration(); -}; - -} // namespace Shared -} // namespace Ingen - -#endif // INGEN_SHARED_CONFIGURATION_HPP - diff --git a/ingen/shared/Forge.hpp b/ingen/shared/Forge.hpp deleted file mode 100644 index 1d820bc0..00000000 --- a/ingen/shared/Forge.hpp +++ /dev/null @@ -1,42 +0,0 @@ -/* - This file is part of Ingen. - Copyright 2007-2012 David Robillard - - Ingen is free software: you can redistribute it and/or modify it under the - terms of the GNU Affero General Public License as published by the Free - Software Foundation, either version 3 of the License, or any later version. - - Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. - - You should have received a copy of the GNU Affero General Public License - along with Ingen. If not, see . -*/ - -#ifndef INGEN_SHARED_FORGE_HPP -#define INGEN_SHARED_FORGE_HPP - -#include - -#include "raul/Atom.hpp" - -namespace Ingen { -namespace Shared { - -class URIMap; - -/** Forge for Raul Atoms. - * @ingroup IngenShared - */ -class Forge : public Raul::Forge { -public: - explicit Forge(Shared::URIMap& map); - - std::string str(const Raul::Atom& atom); -}; - -} // namespace Shared -} // namespace Ingen - -#endif // INGEN_SHARED_FORGE_HPP diff --git a/ingen/shared/LV2Features.hpp b/ingen/shared/LV2Features.hpp deleted file mode 100644 index 822df818..00000000 --- a/ingen/shared/LV2Features.hpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - This file is part of Ingen. - Copyright 2007-2012 David Robillard - - Ingen is free software: you can redistribute it and/or modify it under the - terms of the GNU Affero General Public License as published by the Free - Software Foundation, either version 3 of the License, or any later version. - - Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. - - You should have received a copy of the GNU Affero General Public License - along with Ingen. If not, see . -*/ - -#ifndef INGEN_SHARED_LV2FEATURES_HPP -#define INGEN_SHARED_LV2FEATURES_HPP - -#include - -#include "lv2/lv2plug.in/ns/lv2core/lv2.h" - -#include "raul/SharedPtr.hpp" -#include "raul/Noncopyable.hpp" - -namespace Ingen { - -class GraphObject; - -namespace Shared { - -class World; - -/** Features for use by LV2 plugins. - * @ingroup IngenShared - */ -class LV2Features { -public: - LV2Features(); - - class Feature { - public: - virtual ~Feature() {} - - virtual SharedPtr feature(Shared::World* world, - GraphObject* node) = 0; - }; - - class FeatureArray : public Raul::Noncopyable { - public: - typedef std::vector< SharedPtr > FeatureVector; - - explicit FeatureArray(FeatureVector& features); - - ~FeatureArray(); - - LV2_Feature** array() { return _array; } - - private: - FeatureVector _features; - LV2_Feature** _array; - }; - - void add_feature(SharedPtr feature); - - SharedPtr lv2_features(Shared::World* world, - GraphObject* node) const; - -private: - typedef std::vector< SharedPtr > Features; - Features _features; -}; - -} // namespace Shared -} // namespace Ingen - -#endif // INGEN_SHARED_LV2FEATURES_HPP diff --git a/ingen/shared/Module.hpp b/ingen/shared/Module.hpp deleted file mode 100644 index 81179426..00000000 --- a/ingen/shared/Module.hpp +++ /dev/null @@ -1,55 +0,0 @@ -/* - This file is part of Ingen. - Copyright 2007-2012 David Robillard - - Ingen is free software: you can redistribute it and/or modify it under the - terms of the GNU Affero General Public License as published by the Free - Software Foundation, either version 3 of the License, or any later version. - - Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. - - You should have received a copy of the GNU Affero General Public License - along with Ingen. If not, see . -*/ - -#ifndef INGEN_SHARED_MODULE_HPP -#define INGEN_SHARED_MODULE_HPP - -#include - -namespace Ingen { -namespace Shared { - -class World; - -/** A dynamically loaded Ingen module. - * - * All components of Ingen reside in one of these. - * @ingroup IngenShared - */ -struct Module { - Module() : library(NULL) {} - virtual ~Module() {} - - virtual void load(Ingen::Shared::World* world) = 0; - virtual void run(Ingen::Shared::World* world) {} - - /** Library implementing this module. - * - * This is managed by the World and not this class, since closing the library - * in this destructor could possibly reference code from the library - * afterwards and cause a segfault on exit. - */ - Glib::Module* library; - -private: - Module(const Module& noncopyable); - Module& operator=(const Module& noncopyable); -}; - -} // namespace Shared -} // namespace Ingen - -#endif // INGEN_SHARED_MODULE_HPP diff --git a/ingen/shared/Store.hpp b/ingen/shared/Store.hpp deleted file mode 100644 index af281b9a..00000000 --- a/ingen/shared/Store.hpp +++ /dev/null @@ -1,62 +0,0 @@ -/* - This file is part of Ingen. - Copyright 2007-2012 David Robillard - - Ingen is free software: you can redistribute it and/or modify it under the - terms of the GNU Affero General Public License as published by the Free - Software Foundation, either version 3 of the License, or any later version. - - Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. - - You should have received a copy of the GNU Affero General Public License - along with Ingen. If not, see . -*/ - -#ifndef INGEN_SHARED_STORE_HPP -#define INGEN_SHARED_STORE_HPP - -#include - -#undef nil -#include - -#include "raul/PathTable.hpp" - -#include "ingen/GraphObject.hpp" - -namespace Ingen { -namespace Shared { - -/** Store of objects in the patch hierarchy. - * @ingroup IngenShared - */ -class Store : public Raul::PathTable< SharedPtr > { -public: - virtual ~Store() {} - - virtual void add(GraphObject* o); - - typedef Raul::Table< Raul::Path, SharedPtr > Objects; - - const_iterator children_begin(SharedPtr o) const; - const_iterator children_end(SharedPtr o) const; - - SharedPtr find_child(SharedPtr parent, - const std::string& child_name) const; - - unsigned child_name_offset(const Raul::Path& parent, - const Raul::Symbol& symbol, - bool allow_zero=true); - - Glib::RWLock& lock() { return _lock; } - -private: - Glib::RWLock _lock; -}; - -} // namespace Shared -} // namespace Ingen - -#endif // INGEN_SHARED_STORE_HPP diff --git a/ingen/shared/URIMap.hpp b/ingen/shared/URIMap.hpp deleted file mode 100644 index d30b843d..00000000 --- a/ingen/shared/URIMap.hpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - This file is part of Ingen. - Copyright 2007-2012 David Robillard - - Ingen is free software: you can redistribute it and/or modify it under the - terms of the GNU Affero General Public License as published by the Free - Software Foundation, either version 3 of the License, or any later version. - - Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. - - You should have received a copy of the GNU Affero General Public License - along with Ingen. If not, see . -*/ - -#ifndef INGEN_SHARED_URIMAP_HPP -#define INGEN_SHARED_URIMAP_HPP - -#include -#include - -#include "ingen/shared/LV2Features.hpp" -#include "lv2/lv2plug.in/ns/ext/urid/urid.h" -#include "raul/URI.hpp" -#include "raul/Noncopyable.hpp" - -namespace Ingen { -namespace Shared { - -/** URI to integer map and implementation of LV2 URID extension. - * @ingroup IngenShared - */ -class URIMap : public Raul::Noncopyable { -public: - URIMap(LV2_URID_Map* map, LV2_URID_Unmap* unmap); - virtual ~URIMap() {} - - uint32_t map_uri(const char* uri); - const char* unmap_uri(uint32_t urid) const; - - class Feature : public LV2Features::Feature { - public: - Feature(const char* URI, void* data) { - _feature.URI = URI; - _feature.data = data; - } - - SharedPtr feature(Shared::World*, GraphObject*) { - return SharedPtr(&_feature, NullDeleter); - } - - private: - LV2_Feature _feature; - }; - - struct URIDMapFeature : public Feature { - URIDMapFeature(URIMap* map, LV2_URID_Map* urid_map); - LV2_URID map(const char* uri); - static LV2_URID default_map(LV2_URID_Map_Handle h, const char* uri); - LV2_URID_Map urid_map; - }; - - struct URIDUnmapFeature : public Feature { - URIDUnmapFeature(URIMap* map, LV2_URID_Unmap* urid_unmap); - const char* unmap(const LV2_URID urid); - static const char* default_unmap(LV2_URID_Map_Handle h, LV2_URID uri); - LV2_URID_Unmap urid_unmap; - }; - - SharedPtr urid_map_feature() { return _urid_map_feature; } - SharedPtr urid_unmap_feature() { return _urid_unmap_feature; } - -private: - SharedPtr _urid_map_feature; - SharedPtr _urid_unmap_feature; -}; - -} // namespace Shared -} // namespace Ingen - -#endif // INGEN_SHARED_URIMAP_HPP diff --git a/ingen/shared/URIs.hpp b/ingen/shared/URIs.hpp deleted file mode 100644 index 9e604841..00000000 --- a/ingen/shared/URIs.hpp +++ /dev/null @@ -1,145 +0,0 @@ -/* - This file is part of Ingen. - Copyright 2007-2012 David Robillard - - Ingen is free software: you can redistribute it and/or modify it under the - terms of the GNU Affero General Public License as published by the Free - Software Foundation, either version 3 of the License, or any later version. - - Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. - - You should have received a copy of the GNU Affero General Public License - along with Ingen. If not, see . -*/ - -#ifndef INGEN_SHARED_URIS_HPP -#define INGEN_SHARED_URIS_HPP - -#include "ingen/shared/Forge.hpp" -#include "lv2/lv2plug.in/ns/ext/urid/urid.h" -#include "raul/Atom.hpp" -#include "raul/Noncopyable.hpp" -#include "raul/URI.hpp" - -namespace Raul { - class Forge; -} - -namespace Ingen { -namespace Shared { - -class URIMap; - -/** Frequently used interned URIs. - * - * This class initially maps all the special URIs used throughout the code - * using the URIMap so they can be used quickly with the performance of - * integers, but still be dynamic. - * - * @ingroup IngenShared - */ -class URIs : public Raul::Noncopyable { -public: - URIs(Ingen::Shared::Forge& forge, URIMap* map); - - struct Quark : public Raul::URI { - Quark(Ingen::Shared::Forge& forge, URIMap* map, const char* str); - operator LV2_URID() const { return id; } - operator Raul::Atom() const { return atom; } - uint32_t id; - Raul::Atom atom; - }; - - Ingen::Shared::Forge& forge; - - const Quark atom_AtomPort; - const Quark atom_Blank; - const Quark atom_Bool; - const Quark atom_Chunk; - const Quark atom_Float; - const Quark atom_Int; - const Quark atom_Resource; - const Quark atom_Sequence; - const Quark atom_Sound; - const Quark atom_String; - const Quark atom_URI; - const Quark atom_URID; - const Quark atom_Vector; - const Quark atom_bufferType; - const Quark atom_eventTransfer; - const Quark atom_supports; - const Quark doap_name; - const Quark ingen_Edge; - const Quark ingen_Internal; - const Quark ingen_Node; - const Quark ingen_Patch; - const Quark ingen_activity; - const Quark ingen_broadcast; - const Quark ingen_canvasX; - const Quark ingen_canvasY; - const Quark ingen_controlBinding; - const Quark ingen_document; - const Quark ingen_enabled; - const Quark ingen_engine; - const Quark ingen_head; - const Quark ingen_incidentTo; - const Quark ingen_nil; - const Quark ingen_node; - const Quark ingen_polyphonic; - const Quark ingen_polyphony; - const Quark ingen_prototype; - const Quark ingen_sampleRate; - const Quark ingen_status; - const Quark ingen_tail; - const Quark ingen_uiEmbedded; - const Quark ingen_value; - const Quark lv2_AudioPort; - const Quark lv2_CVPort; - const Quark lv2_ControlPort; - const Quark lv2_InputPort; - const Quark lv2_OutputPort; - const Quark lv2_Plugin; - const Quark lv2_connectionOptional; - const Quark lv2_default; - const Quark lv2_index; - const Quark lv2_integer; - const Quark lv2_maximum; - const Quark lv2_minimum; - const Quark lv2_name; - const Quark lv2_portProperty; - const Quark lv2_sampleRate; - const Quark lv2_scalePoint; - const Quark lv2_symbol; - const Quark lv2_toggled; - const Quark midi_Bender; - const Quark midi_ChannelPressure; - const Quark midi_Controller; - const Quark midi_MidiEvent; - const Quark midi_NoteOn; - const Quark midi_controllerNumber; - const Quark midi_noteNumber; - const Quark patch_Delete; - const Quark patch_Get; - const Quark patch_Move; - const Quark patch_Patch; - const Quark patch_Put; - const Quark patch_Response; - const Quark patch_Set; - const Quark patch_add; - const Quark patch_body; - const Quark patch_destination; - const Quark patch_remove; - const Quark patch_request; - const Quark patch_subject; - const Quark pprops_logarithmic; - const Quark rdf_type; - const Quark rdfs_seeAlso; - const Quark wildcard; -}; - -} // namespace Shared -} // namespace Ingen - -#endif // INGEN_SHARED_LV2URIMAP_HPP diff --git a/ingen/shared/World.hpp b/ingen/shared/World.hpp deleted file mode 100644 index 9ac0188b..00000000 --- a/ingen/shared/World.hpp +++ /dev/null @@ -1,154 +0,0 @@ -/* - This file is part of Ingen. - Copyright 2007-2012 David Robillard - - Ingen is free software: you can redistribute it and/or modify it under the - terms of the GNU Affero General Public License as published by the Free - Software Foundation, either version 3 of the License, or any later version. - - Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. - - You should have received a copy of the GNU Affero General Public License - along with Ingen. If not, see . -*/ - -#ifndef INGEN_SHARED_WORLD_HPP -#define INGEN_SHARED_WORLD_HPP - -#include - -#include "lv2/lv2plug.in/ns/ext/urid/urid.h" -#include "raul/Noncopyable.hpp" -#include "raul/SharedPtr.hpp" - -typedef struct LilvWorldImpl LilvWorld; - -namespace Sord { class World; } - -namespace Ingen { - -class EngineBase; -class Interface; - -namespace Serialisation { -class Parser; -class Serialiser; -} - -namespace Shared { - -class Configuration; -class Forge; -class LV2Features; -class Store; -class URIMap; -class URIs; - -/** The "world" all Ingen modules share. - * - * This is the root to which all components of Ingen are connected. It - * contains all necessary shared data (including the world for libraries like - * Sord and Lilv) and holds references to components. - * - * Most functionality in Ingen is implemented in dynamically loaded modules, - * which are loaded using this interface. When loaded, those modules add - * facilities to the World which can then be used throughout the code. For - * example loading the "ingen_serialisation" module will set World::serialiser - * and World::parser to valid objects. - * - * The world is used in any process which uses the Ingen as a library, both - * client and server (e.g. the world may not actually contain an Engine, since - * it maybe running in another process or even on a different machine). - * - * @ingroup IngenShared - */ -class World : public Raul::Noncopyable { -public: - /** Construct a new Ingen world. - * @param argc Argument count (as in C main()) - * @param argv Argument vector (as in C main()) - * @param map LV2 URID map implementation, or NULL to use internal. - * @param unmap LV2 URID unmap implementation, or NULL to use internal. - */ - World(int& argc, - char**& argv, - LV2_URID_Map* map, - LV2_URID_Unmap* unmap); - - virtual ~World(); - - /** Load an Ingen module by name (e.g. "server", "gui", etc.) - * @return True on success. - */ - virtual bool load_module(const char* name); - - /** Run a loaded module (modules that "run" only, e.g. gui). - * @return True on success. - */ - virtual bool run_module(const char* name); - - /** Unload all loaded Ingen modules. */ - virtual void unload_modules(); - - /** A function to create a new remote Interface. */ - typedef SharedPtr (*InterfaceFactory)( - World* world, - const std::string& engine_url, - SharedPtr respondee); - - /** Register an InterfaceFactory (for module implementations). */ - virtual void add_interface_factory(const std::string& scheme, - InterfaceFactory factory); - - /** Return a new Interface to control a server. - * @param engine_url The URL of the possibly remote server to control. - * @param respondee The Interface that will receive responses to commands - * and broadcasts, if applicable. - */ - virtual SharedPtr new_interface( - const std::string& engine_url, - SharedPtr respondee); - - /** Run a script. */ - virtual bool run(const std::string& mime_type, - const std::string& filename); - - virtual void set_engine(SharedPtr e); - virtual void set_interface(SharedPtr e); - virtual void set_parser(SharedPtr p); - virtual void set_serialiser(SharedPtr s); - virtual void set_store(SharedPtr s); - - virtual SharedPtr engine(); - virtual SharedPtr interface(); - virtual SharedPtr parser(); - virtual SharedPtr serialiser(); - virtual SharedPtr store(); - - virtual int& argc(); - virtual char**& argv(); - virtual Configuration& conf(); - - virtual Sord::World* rdf_world(); - virtual LilvWorld* lilv_world(); - - virtual LV2Features& lv2_features(); - virtual Ingen::Shared::Forge& forge(); - virtual URIMap& uri_map(); - virtual URIs& uris(); - - virtual void set_jack_uuid(const std::string& uuid); - virtual std::string jack_uuid(); - -private: - class Impl; - - Impl* _impl; -}; - -} // namespace Shared -} // namespace Ingen - -#endif // INGEN_SHARED_WORLD_HPP diff --git a/ingen/shared/runtime_paths.hpp b/ingen/shared/runtime_paths.hpp deleted file mode 100644 index 5709370b..00000000 --- a/ingen/shared/runtime_paths.hpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - This file is part of Ingen. - Copyright 2007-2012 David Robillard - - Ingen is free software: you can redistribute it and/or modify it under the - terms of the GNU Affero General Public License as published by the Free - Software Foundation, either version 3 of the License, or any later version. - - Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. - - You should have received a copy of the GNU Affero General Public License - along with Ingen. If not, see . -*/ - -#ifndef INGEN_SHARED_RUNTIME_PATHS_HPP -#define INGEN_SHARED_RUNTIME_PATHS_HPP - -#include - -namespace Ingen { -namespace Shared { - -void set_bundle_path(const char* path); -void set_bundle_path_from_code(void* function); - -std::string bundle_file_path(const std::string& name); -std::string data_file_path(const std::string& name); -std::string module_path(const std::string& name, std::string dir=""); - -} // namespace Ingen -} // namespace Shared - -#endif // INGEN_SHARED_RUNTIME_PATHS_HPP diff --git a/src/AtomReader.cpp b/src/AtomReader.cpp new file mode 100644 index 00000000..0482cacd --- /dev/null +++ b/src/AtomReader.cpp @@ -0,0 +1,274 @@ +/* + This file is part of Ingen. + Copyright 2007-2012 David Robillard + + Ingen is free software: you can redistribute it and/or modify it under the + terms of the GNU Affero General Public License as published by the Free + Software Foundation, either version 3 of the License, or any later version. + + Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. + + You should have received a copy of the GNU Affero General Public License + along with Ingen. If not, see . +*/ + +#include + +#include "ingen/AtomReader.hpp" +#include "ingen/URIMap.hpp" +#include "lv2/lv2plug.in/ns/ext/atom/util.h" +#include "raul/Path.hpp" +#include "raul/log.hpp" + +namespace Ingen { + +AtomReader::AtomReader(URIMap& map, URIs& uris, Forge& forge, Interface& iface) + : _map(map) + , _uris(uris) + , _forge(forge) + , _iface(iface) +{ +} + +void +AtomReader::get_atom(const LV2_Atom* in, Raul::Atom& out) +{ + if (in) { + if (in->type == _uris.atom_URID) { + const LV2_Atom_URID* urid = (const LV2_Atom_URID*)in; + const char* uri = _map.unmap_uri(urid->body); + if (uri) { + out = _forge.alloc_uri(_map.unmap_uri(urid->body)); + } else { + Raul::error(Raul::fmt("Unable to unmap URID %1%\n") + % urid->body); + } + } else { + out = _forge.alloc(in->size, in->type, LV2_ATOM_BODY(in)); + } + } +} + +void +AtomReader::get_props(const LV2_Atom_Object* obj, + Ingen::Resource::Properties& props) +{ + if (obj->body.otype) { + props.insert( + std::make_pair(_uris.rdf_type, + _forge.alloc_uri(_map.unmap_uri(obj->body.otype)))); + } + LV2_ATOM_OBJECT_FOREACH(obj, p) { + Raul::Atom val; + get_atom(&p->value, val); + props.insert(std::make_pair(_map.unmap_uri(p->key), val)); + } +} + +const char* +AtomReader::atom_to_uri(const LV2_Atom* atom) +{ + if (atom && atom->type == _uris.atom_URI) { + return (const char*)LV2_ATOM_BODY(atom); + } else if (atom && atom->type == _uris.atom_URID) { + return _map.unmap_uri(((LV2_Atom_URID*)atom)->body); + } else { + return NULL; + } +} + +bool +AtomReader::is_message(URIs& uris, const LV2_Atom* msg) +{ + if (msg->type != uris.atom_Blank && msg->type != uris.atom_Resource) { + return false; + } + + const LV2_Atom_Object* obj = (const LV2_Atom_Object*)msg; + return (obj->body.otype == uris.patch_Get || + obj->body.otype == uris.patch_Delete || + obj->body.otype == uris.patch_Put || + obj->body.otype == uris.patch_Patch || + obj->body.otype == uris.patch_Move || + obj->body.otype == uris.patch_Response); +} + +bool +AtomReader::write(const LV2_Atom* msg) +{ + if (msg->type != _uris.atom_Blank && msg->type != _uris.atom_Resource) { + Raul::warn << (Raul::fmt("Unknown message type <%1%>\n") + % _map.unmap_uri(msg->type)).str(); + return false; + } + + const LV2_Atom_Object* obj = (const LV2_Atom_Object*)msg; + const LV2_Atom* subject = NULL; + + lv2_atom_object_get(obj, (LV2_URID)_uris.patch_subject, &subject, NULL); + const char* subject_uri = atom_to_uri(subject); + + if (obj->body.otype == _uris.patch_Get) { + _iface.set_response_id(obj->body.id); + _iface.get(subject_uri); + } else if (obj->body.otype == _uris.patch_Delete) { + const LV2_Atom_Object* body = NULL; + lv2_atom_object_get(obj, (LV2_URID)_uris.patch_body, &body, 0); + + if (subject_uri && !body) { + _iface.del(subject_uri); + return true; + } else if (body && body->body.otype == _uris.ingen_Edge) { + const LV2_Atom* tail = NULL; + const LV2_Atom* head = NULL; + const LV2_Atom* incidentTo = NULL; + lv2_atom_object_get(body, + (LV2_URID)_uris.ingen_tail, &tail, + (LV2_URID)_uris.ingen_head, &head, + (LV2_URID)_uris.ingen_incidentTo, &incidentTo, + NULL); + + Raul::Atom tail_atom; + Raul::Atom head_atom; + Raul::Atom incidentTo_atom; + get_atom(tail, tail_atom); + get_atom(head, head_atom); + get_atom(incidentTo, incidentTo_atom); + if (tail_atom.is_valid() && head_atom.is_valid()) { + _iface.disconnect(Raul::Path(tail_atom.get_uri()), + Raul::Path(head_atom.get_uri())); + } else if (incidentTo_atom.is_valid()) { + _iface.disconnect_all(subject_uri, + Raul::Path(incidentTo_atom.get_uri())); + } else { + Raul::warn << "Delete of unknown object." << std::endl; + return false; + } + } + } else if (obj->body.otype == _uris.patch_Put) { + const LV2_Atom_Object* body = NULL; + lv2_atom_object_get(obj, (LV2_URID)_uris.patch_body, &body, 0); + if (!body) { + Raul::warn << "Put message has no body" << std::endl; + return false; + } else if (!subject_uri) { + Raul::warn << "Put message has no subject" << std::endl; + return false; + } + + if (body->body.otype == _uris.ingen_Edge) { + LV2_Atom* tail = NULL; + LV2_Atom* head = NULL; + lv2_atom_object_get(body, + (LV2_URID)_uris.ingen_tail, &tail, + (LV2_URID)_uris.ingen_head, &head, + NULL); + if (!tail || !head) { + Raul::warn << "Edge has no tail or head" << std::endl; + return false; + } + + Raul::Atom tail_atom; + Raul::Atom head_atom; + get_atom(tail, tail_atom); + get_atom(head, head_atom); + _iface.connect(Raul::Path(tail_atom.get_uri()), + Raul::Path(head_atom.get_uri())); + } else { + Ingen::Resource::Properties props; + get_props(body, props); + _iface.set_response_id(obj->body.id); + _iface.put(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) { + Raul::warn << "Set message has no body" << std::endl; + return false; + } else if (!subject_uri) { + Raul::warn << "Set message has no subject" << std::endl; + return false; + } + + LV2_ATOM_OBJECT_FOREACH(body, p) { + Raul::Atom val; + get_atom(&p->value, val); + _iface.set_property(subject_uri, _map.unmap_uri(p->key), val); + } + } else if (obj->body.otype == _uris.patch_Patch) { + if (!subject_uri) { + Raul::warn << "Put message has no subject" << std::endl; + return false; + } + + const LV2_Atom_Object* remove = NULL; + lv2_atom_object_get(obj, (LV2_URID)_uris.patch_remove, &remove, 0); + if (!remove) { + Raul::warn << "Patch message has no remove" << std::endl; + return false; + } + + const LV2_Atom_Object* add = NULL; + lv2_atom_object_get(obj, (LV2_URID)_uris.patch_add, &add, 0); + if (!add) { + Raul::warn << "Patch message has no add" << std::endl; + return false; + } + + Ingen::Resource::Properties add_props; + get_props(remove, add_props); + + Ingen::Resource::Properties remove_props; + get_props(remove, remove_props); + + _iface.delta(subject_uri, remove_props, add_props); + } else if (obj->body.otype == _uris.patch_Move) { + if (!subject_uri) { + Raul::warn << "Move message has no subject" << std::endl; + return false; + } + + const LV2_Atom* dest = NULL; + lv2_atom_object_get(obj, (LV2_URID)_uris.patch_destination, &dest, 0); + if (!dest) { + Raul::warn << "Move message has no destination" << std::endl; + return false; + } + + const char* dest_uri = atom_to_uri(dest); + if (!dest_uri) { + Raul::warn << "Move message destination is not a URI" << std::endl; + return false; + } + + _iface.move(subject_uri, dest_uri); + } else if (obj->body.otype == _uris.patch_Response) { + const LV2_Atom* request = NULL; + const LV2_Atom* body = NULL; + lv2_atom_object_get(obj, + (LV2_URID)_uris.patch_request, &request, + (LV2_URID)_uris.patch_body, &body, + 0); + if (!request || request->type != _uris.atom_Int) { + Raul::warn << "Response message has no request" << std::endl; + return false; + } else if (!body || body->type != _uris.atom_Int) { + Raul::warn << "Response message body is not integer" << std::endl; + return false; + } + _iface.response(((LV2_Atom_Int*)request)->body, + (Ingen::Status)((LV2_Atom_Int*)body)->body, + subject_uri); + } else { + Raul::warn << "Unknown object type <" + << _map.unmap_uri(obj->body.otype) + << ">" << std::endl; + } + + return true; +} + +} // namespace Ingen diff --git a/src/AtomWriter.cpp b/src/AtomWriter.cpp new file mode 100644 index 00000000..f8156c89 --- /dev/null +++ b/src/AtomWriter.cpp @@ -0,0 +1,299 @@ +/* + This file is part of Ingen. + Copyright 2007-2012 David Robillard + + Ingen is free software: you can redistribute it and/or modify it under the + terms of the GNU Affero General Public License as published by the Free + Software Foundation, either version 3 of the License, or any later version. + + Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. + + You should have received a copy of the GNU Affero General Public License + along with Ingen. If not, see . +*/ + +#include + +#include "ingen/AtomSink.hpp" +#include "ingen/AtomWriter.hpp" +#include "ingen/URIMap.hpp" +#include "raul/Path.hpp" +#include "serd/serd.h" + +namespace Ingen { + +static LV2_Atom_Forge_Ref +forge_sink(LV2_Atom_Forge_Sink_Handle handle, + const void* buf, + uint32_t size) +{ + SerdChunk* chunk = (SerdChunk*)handle; + const LV2_Atom_Forge_Ref ref = chunk->len + 1; + serd_chunk_sink(buf, size, chunk); + return ref; +} + +static LV2_Atom* +forge_deref(LV2_Atom_Forge_Sink_Handle handle, LV2_Atom_Forge_Ref ref) +{ + SerdChunk* chunk = (SerdChunk*)handle; + return (LV2_Atom*)(chunk->buf + ref - 1); +} + +AtomWriter::AtomWriter(URIMap& map, URIs& uris, AtomSink& sink) + : _map(map) + , _uris(uris) + , _sink(sink) + , _id(1) +{ + _out.buf = NULL; + _out.len = 0; + lv2_atom_forge_init(&_forge, &map.urid_map_feature()->urid_map); + lv2_atom_forge_set_sink(&_forge, forge_sink, forge_deref, &_out); +} + +void +AtomWriter::finish_msg() +{ + _sink.write((LV2_Atom*)_out.buf); + _out.len = 0; +} + +int32_t +AtomWriter::next_id() +{ + if (_id == -1) { + return 0; + } else { + return ++_id; + } +} + +void +AtomWriter::bundle_begin() +{ +} + +void +AtomWriter::bundle_end() +{ +} + +void +AtomWriter::forge_uri(const Raul::URI& uri) +{ + if (serd_uri_string_has_scheme((const uint8_t*)uri.c_str())) { + lv2_atom_forge_urid(&_forge, _map.map_uri(uri.c_str())); + } else { + lv2_atom_forge_uri(&_forge, uri.c_str(), uri.length()); + } +} + +void +AtomWriter::forge_properties(const Resource::Properties& properties) +{ + for (Resource::Properties::const_iterator i = properties.begin(); + i != properties.end(); ++i) { + lv2_atom_forge_property_head(&_forge, _map.map_uri(i->first.c_str()), 0); + if (i->second.type() == _forge.URI) { + forge_uri(i->second.get_uri()); + } else { + lv2_atom_forge_atom(&_forge, i->second.size(), i->second.type()); + lv2_atom_forge_write(&_forge, i->second.get_body(), i->second.size()); + } + } +} + +void +AtomWriter::forge_edge(const Raul::URI& tail, const Raul::URI& head) +{ + LV2_Atom_Forge_Frame edge; + lv2_atom_forge_blank(&_forge, &edge, 0, _uris.ingen_Edge); + lv2_atom_forge_property_head(&_forge, _uris.ingen_tail, 0); + forge_uri(tail); + lv2_atom_forge_property_head(&_forge, _uris.ingen_head, 0); + forge_uri(head); + lv2_atom_forge_pop(&_forge, &edge); +} + +void +AtomWriter::put(const Raul::URI& uri, + const Resource::Properties& properties, + Resource::Graph ctx) +{ + LV2_Atom_Forge_Frame msg; + lv2_atom_forge_blank(&_forge, &msg, next_id(), _uris.patch_Put); + lv2_atom_forge_property_head(&_forge, _uris.patch_subject, 0); + forge_uri(uri); + lv2_atom_forge_property_head(&_forge, _uris.patch_body, 0); + + LV2_Atom_Forge_Frame body; + lv2_atom_forge_blank(&_forge, &body, 0, 0); + forge_properties(properties); + lv2_atom_forge_pop(&_forge, &body); + + lv2_atom_forge_pop(&_forge, &msg); + finish_msg(); +} + +void +AtomWriter::delta(const Raul::URI& uri, + const Resource::Properties& remove, + const Resource::Properties& add) +{ + LV2_Atom_Forge_Frame msg; + lv2_atom_forge_blank(&_forge, &msg, next_id(), _uris.patch_Patch); + lv2_atom_forge_property_head(&_forge, _uris.patch_subject, 0); + forge_uri(uri); + + lv2_atom_forge_property_head(&_forge, _uris.patch_remove, 0); + LV2_Atom_Forge_Frame remove_obj; + lv2_atom_forge_blank(&_forge, &remove_obj, 0, 0); + forge_properties(remove); + lv2_atom_forge_pop(&_forge, &remove_obj); + + lv2_atom_forge_property_head(&_forge, _uris.patch_add, 0); + LV2_Atom_Forge_Frame add_obj; + lv2_atom_forge_blank(&_forge, &add_obj, 0, 0); + forge_properties(add); + lv2_atom_forge_pop(&_forge, &add_obj); + + lv2_atom_forge_pop(&_forge, &msg); + finish_msg(); +} + +void +AtomWriter::move(const Raul::Path& old_path, + const Raul::Path& new_path) +{ + LV2_Atom_Forge_Frame msg; + lv2_atom_forge_blank(&_forge, &msg, next_id(), _uris.patch_Move); + lv2_atom_forge_property_head(&_forge, _uris.patch_subject, 0); + forge_uri(old_path); + lv2_atom_forge_property_head(&_forge, _uris.patch_destination, 0); + forge_uri(new_path); +} + +void +AtomWriter::del(const Raul::URI& uri) +{ + LV2_Atom_Forge_Frame msg; + lv2_atom_forge_blank(&_forge, &msg, next_id(), _uris.patch_Delete); + lv2_atom_forge_property_head(&_forge, _uris.patch_subject, 0); + forge_uri(uri); +} + +void +AtomWriter::connect(const Raul::Path& tail, + const Raul::Path& head) +{ + LV2_Atom_Forge_Frame msg; + lv2_atom_forge_blank(&_forge, &msg, next_id(), _uris.patch_Put); + lv2_atom_forge_property_head(&_forge, _uris.patch_subject, 0); + forge_uri(Raul::Path::lca(tail, head)); + lv2_atom_forge_property_head(&_forge, _uris.patch_body, 0); + forge_edge(tail, head); + lv2_atom_forge_pop(&_forge, &msg); + finish_msg(); +} + +void +AtomWriter::disconnect(const Raul::Path& tail, + const Raul::Path& head) +{ + LV2_Atom_Forge_Frame msg; + lv2_atom_forge_blank(&_forge, &msg, next_id(), _uris.patch_Delete); + lv2_atom_forge_property_head(&_forge, _uris.patch_body, 0); + forge_edge(tail, head); + lv2_atom_forge_pop(&_forge, &msg); + finish_msg(); +} + +void +AtomWriter::disconnect_all(const Raul::Path& parent_patch_path, + const Raul::Path& path) +{ + LV2_Atom_Forge_Frame msg; + lv2_atom_forge_blank(&_forge, &msg, next_id(), _uris.patch_Delete); + + lv2_atom_forge_property_head(&_forge, _uris.patch_subject, 0); + forge_uri(parent_patch_path); + + lv2_atom_forge_property_head(&_forge, _uris.patch_body, 0); + LV2_Atom_Forge_Frame edge; + lv2_atom_forge_blank(&_forge, &edge, 0, _uris.ingen_Edge); + lv2_atom_forge_property_head(&_forge, _uris.ingen_incidentTo, 0); + forge_uri(path); + lv2_atom_forge_pop(&_forge, &edge); + + lv2_atom_forge_pop(&_forge, &msg); + finish_msg(); +} + +void +AtomWriter::set_property(const Raul::URI& subject, + const Raul::URI& predicate, + const Raul::Atom& value) +{ + LV2_Atom_Forge_Frame msg; + 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_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(); +} + +void +AtomWriter::set_response_id(int32_t id) +{ +} + +void +AtomWriter::get(const Raul::URI& uri) +{ + LV2_Atom_Forge_Frame msg; + lv2_atom_forge_blank(&_forge, &msg, next_id(), _uris.patch_Get); + lv2_atom_forge_property_head(&_forge, _uris.patch_subject, 0); + forge_uri(uri); + lv2_atom_forge_pop(&_forge, &msg); + finish_msg(); +} + +void +AtomWriter::response(int32_t id, Status status, const std::string& subject) +{ + if (id == -1) { + return; + } + + LV2_Atom_Forge_Frame msg; + lv2_atom_forge_blank(&_forge, &msg, next_id(), _uris.patch_Response); + lv2_atom_forge_property_head(&_forge, _uris.patch_request, 0); + lv2_atom_forge_int(&_forge, id); + if (!subject.empty() && Raul::URI::is_valid(subject)) { + lv2_atom_forge_property_head(&_forge, _uris.patch_subject, 0); + lv2_atom_forge_uri(&_forge, subject.c_str(), subject.length()); + } + lv2_atom_forge_property_head(&_forge, _uris.patch_body, 0); + lv2_atom_forge_int(&_forge, status); + lv2_atom_forge_pop(&_forge, &msg); + finish_msg(); +} + +void +AtomWriter::error(const std::string& msg) +{ +} + +} // namespace Ingen diff --git a/src/Builder.cpp b/src/Builder.cpp new file mode 100644 index 00000000..eab33cdf --- /dev/null +++ b/src/Builder.cpp @@ -0,0 +1,53 @@ +/* + This file is part of Ingen. + Copyright 2007-2012 David Robillard + + Ingen is free software: you can redistribute it and/or modify it under the + terms of the GNU Affero General Public License as published by the Free + Software Foundation, either version 3 of the License, or any later version. + + Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. + + You should have received a copy of the GNU Affero General Public License + along with Ingen. If not, see . +*/ + +#include "ingen/Builder.hpp" +#include "ingen/Edge.hpp" +#include "ingen/GraphObject.hpp" +#include "ingen/Interface.hpp" +#include "ingen/URIs.hpp" +#include "raul/Atom.hpp" +#include "raul/Path.hpp" + +using namespace std; + +namespace Ingen { + +Builder::Builder(URIs& uris, Interface& interface) + : _uris(uris) + , _interface(interface) +{ +} + +void +Builder::build(SharedPtr object) +{ + _interface.put(object->path(), object->properties()); +} + +void +Builder::connect(SharedPtr object) +{ + if (object->graph_type() == GraphObject::PATCH) { + for (GraphObject::Edges::const_iterator i = object->edges().begin(); + i != object->edges().end(); ++i) { + _interface.connect(i->second->tail_path(), i->second->head_path()); + } + return; + } +} + +} // namespace Ingen diff --git a/src/ClashAvoider.cpp b/src/ClashAvoider.cpp new file mode 100644 index 00000000..b389f358 --- /dev/null +++ b/src/ClashAvoider.cpp @@ -0,0 +1,204 @@ +/* + This file is part of Ingen. + Copyright 2007-2012 David Robillard + + Ingen is free software: you can redistribute it and/or modify it under the + terms of the GNU Affero General Public License as published by the Free + Software Foundation, either version 3 of the License, or any later version. + + Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. + + You should have received a copy of the GNU Affero General Public License + along with Ingen. If not, see . +*/ + +#include +#include +#include +#include + +#include "raul/log.hpp" + +#include "ingen/ClashAvoider.hpp" +#include "ingen/Store.hpp" + +using namespace std; + +namespace Ingen { + +const Raul::URI +ClashAvoider::map_uri(const Raul::URI& in) +{ + if (Raul::Path::is_path(in)) + return map_path(in.str()); + else + return in; +} + +const Raul::Path +ClashAvoider::map_path(const Raul::Path& in) +{ + Raul::debug << "MAP PATH: " << in; + + unsigned offset = 0; + bool has_offset = false; + const size_t pos = in.find_last_of('_'); + if (pos != string::npos && pos != (in.length()-1)) { + const std::string trailing = in.substr(pos + 1); + has_offset = (sscanf(trailing.c_str(), "%u", &offset) > 0); + } + + Raul::debug << "OFFSET: " << offset << endl; + + // Path without _n suffix + Raul::Path base_path = in; + if (has_offset) + base_path = base_path.substr(0, base_path.find_last_of('_')); + + Raul::debug << "BASE: " << base_path << endl; + + SymbolMap::iterator m = _symbol_map.find(in); + if (m != _symbol_map.end()) { + Raul::debug << " (1) " << m->second << endl; + return m->second; + } else { + typedef std::pair InsertRecord; + + // See if parent is mapped + Raul::Path parent = in.parent(); + do { + Raul::debug << "CHECK: " << parent << endl; + SymbolMap::iterator p = _symbol_map.find(parent); + if (p != _symbol_map.end()) { + const Raul::Path mapped = p->second.base() + in.substr(parent.base().length()); + InsertRecord i = _symbol_map.insert(make_pair(in, mapped)); + Raul::debug << " (2) " << i.first->second << endl; + return i.first->second; + } + parent = parent.parent(); + } while (!parent.is_root()); + + // No clash, use symbol unmodified + if (!exists(in) && _symbol_map.find(in) == _symbol_map.end()) { + InsertRecord i = _symbol_map.insert(make_pair(in, in)); + assert(i.second); + Raul::debug << " (3) " << i.first->second << endl; + return i.first->second; + + // Append _2 _3 etc until an unused symbol is found + } else { + while (true) { + Offsets::iterator o = _offsets.find(base_path); + if (o != _offsets.end()) { + offset = ++o->second; + } else { + string parent_str = in.parent().base(); + parent_str = parent_str.substr(0, parent_str.find_last_of("/")); + if (parent_str.empty()) + parent_str = "/"; + Raul::debug << "PARENT: " << parent_str << endl; + } + + if (offset == 0) + offset = 2; + + std::stringstream ss; + ss << base_path << "_" << offset; + if (!exists(ss.str())) { + string name = base_path.symbol(); + if (name == "") + name = "_"; + string str = ss.str(); + InsertRecord i = _symbol_map.insert(make_pair(in, str)); + Raul::debug << "HIT: offset = " << offset << ", str = " << str << endl; + offset = _store.child_name_offset(in.parent(), name, false); + _offsets.insert(make_pair(base_path, offset)); + Raul::debug << " (4) " << i.first->second << endl; + return i.first->second; + } else { + Raul::debug << "MISSED OFFSET: " << in << " => " << ss.str() << endl; + if (o != _offsets.end()) + offset = ++o->second; + else + ++offset; + } + } + } + } +} + +bool +ClashAvoider::exists(const Raul::Path& path) const +{ + bool exists = (_store.find(path) != _store.end()); + if (exists) + return true; + + if (_also_avoid) + return (_also_avoid->find(path) != _also_avoid->end()); + else + return false; +} + +void +ClashAvoider::put(const Raul::URI& path, + const Resource::Properties& properties, + Resource::Graph ctx) +{ + _target.put(map_uri(path), properties, ctx); +} + +void +ClashAvoider::delta(const Raul::URI& path, + const Resource::Properties& remove, + const Resource::Properties& add) +{ + _target.delta(map_uri(path), remove, add); +} + +void +ClashAvoider::move(const Raul::Path& old_path, + const Raul::Path& new_path) +{ + _target.move(map_path(old_path), map_path(new_path)); +} + +void +ClashAvoider::connect(const Raul::Path& tail, + const Raul::Path& head) +{ + _target.connect(map_path(tail), map_path(head)); +} + +void +ClashAvoider::disconnect(const Raul::Path& tail, + const Raul::Path& head) +{ + _target.disconnect(map_path(tail), map_path(head)); +} + +void +ClashAvoider::disconnect_all(const Raul::Path& parent_patch, + const Raul::Path& path) +{ + _target.disconnect_all(map_path(parent_patch), map_path(path)); +} + +void +ClashAvoider::set_property(const Raul::URI& subject, + const Raul::URI& predicate, + const Raul::Atom& value) +{ + _target.set_property(map_uri(subject), predicate, value); +} + +void +ClashAvoider::del(const Raul::URI& uri) +{ + if (Raul::Path::is_path(uri)) + _target.del(map_path(Raul::Path(uri.str()))); +} + +} // namespace Ingen diff --git a/src/Configuration.cpp b/src/Configuration.cpp new file mode 100644 index 00000000..f3e57520 --- /dev/null +++ b/src/Configuration.cpp @@ -0,0 +1,54 @@ +/* + This file is part of Ingen. + Copyright 2007-2012 David Robillard + + Ingen is free software: you can redistribute it and/or modify it under the + terms of the GNU Affero General Public License as published by the Free + Software Foundation, either version 3 of the License, or any later version. + + Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. + + You should have received a copy of the GNU Affero General Public License + along with Ingen. If not, see . +*/ + +#include "ingen/Configuration.hpp" + +namespace Ingen { + +Configuration::Configuration() + : Raul::Configuration( + "A realtime modular audio processor.", + "Ingen is a flexible modular system that be used in various ways.\n" + "The engine can run as a stand-alone server controlled via network protocol,\n" + "or internal to another process (e.g. the GUI). The GUI, or other\n" + "clients, can communicate with the engine via any supported protocol, or host the\n" + "engine in the same process. Many clients can connect to an engine at once.\n\n" + "Examples:\n" + " ingen -e # Run an engine, listen for connections\n" + " ingen -g # Run a GUI, connect to running engine\n" + " ingen -eg # Run an engine and a GUI in one process\n" + " ingen -egl patch.ttl # Run an engine and a GUI and load a patch file\n" + " ingen -egl patch.ingen # Run an engine and a GUI and load a patch bundle") +{ + add("client-port", 'C', "Client port", INT, Value()); + add("connect", 'c', "Connect to engine URI", STRING, Value("unix:///tmp/ingen.sock")); + add("engine", 'e', "Run (JACK) engine", BOOL, Value(false)); + add("engine-port", 'E', "Engine listen port", INT, Value(16180)); + add("socket", 'S', "Engine socket path", STRING, Value("/tmp/ingen.sock")); + add("gui", 'g', "Launch the GTK graphical interface", BOOL, Value(false)); + add("help", 'h', "Print this help message", BOOL, Value(false)); + add("jack-client", 'n', "JACK client name", STRING, Value("ingen")); + add("jack-server", 's', "JACK server name", STRING, Value("")); + add("uuid", 'u', "JACK session UUID", STRING, Value()); + add("load", 'l', "Load patch", STRING, Value()); + add("packet-size", 'k', "Maximum UDP packet size", INT, Value(4096)); + add("parallelism", 'p', "Number of concurrent process threads", INT, Value(1)); + add("path", 'L', "Target path for loaded patch", STRING, Value()); + add("queue-size", 'q', "Event queue size", INT, Value(4096)); + add("run", 'r', "Run script", STRING, Value()); +} + +} // namespace Ingen diff --git a/src/Forge.cpp b/src/Forge.cpp new file mode 100644 index 00000000..6495fadc --- /dev/null +++ b/src/Forge.cpp @@ -0,0 +1,54 @@ +/* + This file is part of Ingen. + Copyright 2007-2012 David Robillard + + Ingen is free software: you can redistribute it and/or modify it under the + terms of the GNU Affero General Public License as published by the Free + Software Foundation, either version 3 of the License, or any later version. + + Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. + + You should have received a copy of the GNU Affero General Public License + along with Ingen. If not, see . +*/ + +#include +#include + +#include "ingen/Forge.hpp" +#include "ingen/URIMap.hpp" +#include "lv2/lv2plug.in/ns/ext/atom/atom.h" + +namespace Ingen { + +Forge::Forge(URIMap& map) +{ + Int = map.map_uri(LV2_ATOM__Int); + Float = map.map_uri(LV2_ATOM__Float); + Bool = map.map_uri(LV2_ATOM__Bool); + URI = map.map_uri(LV2_ATOM__URI); + URID = map.map_uri(LV2_ATOM__URID); + String = map.map_uri(LV2_ATOM__String); +} + +std::string +Forge::str(const Raul::Atom& atom) +{ + std::ostringstream ss; + if (atom.type() == Int) { + ss << atom.get_int32(); + } else if (atom.type() == Float) { + ss << atom.get_float(); + } else if (atom.type() == Bool) { + ss << (atom.get_bool() ? "true" : "false"); + } else if (atom.type() == URI) { + ss << "<" << atom.get_uri() << ">"; + } else if (atom.type() == String) { + ss << "\"" << atom.get_string() << "\""; + } + return ss.str(); +} + +} // namespace Ingen diff --git a/src/LV2Features.cpp b/src/LV2Features.cpp new file mode 100644 index 00000000..9846dd80 --- /dev/null +++ b/src/LV2Features.cpp @@ -0,0 +1,63 @@ +/* + This file is part of Ingen. + Copyright 2007-2012 David Robillard + + Ingen is free software: you can redistribute it and/or modify it under the + terms of the GNU Affero General Public License as published by the Free + Software Foundation, either version 3 of the License, or any later version. + + Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. + + You should have received a copy of the GNU Affero General Public License + along with Ingen. If not, see . +*/ + +#include + +#include "ingen/LV2Features.hpp" + +using namespace std; + +namespace Ingen { + +LV2Features::LV2Features() +{ +} + +void +LV2Features::add_feature(SharedPtr feature) +{ + _features.push_back(feature); +} + +LV2Features::FeatureArray::FeatureArray(FeatureVector& features) + : _features(features) +{ + _array = (LV2_Feature**)malloc(sizeof(LV2_Feature) * (features.size() + 1)); + _array[features.size()] = NULL; + for (size_t i = 0; i < features.size(); ++i) { + _array[i] = features[i].get(); + } +} + +LV2Features::FeatureArray::~FeatureArray() +{ + free(_array); +} + +SharedPtr +LV2Features::lv2_features(World* world, GraphObject* node) const +{ + FeatureArray::FeatureVector vec; + for (Features::const_iterator f = _features.begin(); f != _features.end(); ++f) { + SharedPtr fptr = (*f)->feature(world, node); + if (fptr) { + vec.push_back(fptr); + } + } + return SharedPtr(new FeatureArray(vec)); +} + +} // namespace Ingen diff --git a/src/Resource.cpp b/src/Resource.cpp index 13959a13..d8659596 100644 --- a/src/Resource.cpp +++ b/src/Resource.cpp @@ -17,7 +17,7 @@ #include #include "ingen/Resource.hpp" -#include "ingen/shared/URIs.hpp" +#include "ingen/URIs.hpp" #include "raul/Atom.hpp" #include "raul/log.hpp" @@ -108,12 +108,12 @@ Resource::get_property(const Raul::URI& uri) const } bool -Resource::type(const Shared::URIs& uris, - const Properties& properties, - bool& patch, - bool& node, - bool& port, - bool& is_output) +Resource::type(const URIs& uris, + const Properties& properties, + bool& patch, + bool& node, + bool& port, + bool& is_output) { typedef Resource::Properties::const_iterator iterator; const std::pair types_range = properties.equal_range(uris.rdf_type); diff --git a/src/Store.cpp b/src/Store.cpp new file mode 100644 index 00000000..7036312b --- /dev/null +++ b/src/Store.cpp @@ -0,0 +1,98 @@ +/* + This file is part of Ingen. + Copyright 2007-2012 David Robillard + + Ingen is free software: you can redistribute it and/or modify it under the + terms of the GNU Affero General Public License as published by the Free + Software Foundation, either version 3 of the License, or any later version. + + Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. + + You should have received a copy of the GNU Affero General Public License + along with Ingen. If not, see . +*/ + +#include +#include + +#include "ingen/Store.hpp" +#include "raul/PathTable.hpp" +#include "raul/TableImpl.hpp" +#include "raul/log.hpp" + +using namespace std; + +namespace Ingen { + +void +Store::add(GraphObject* o) +{ + if (find(o->path()) != end()) { + Raul::error << "[Store] Attempt to add duplicate object " << o->path() << endl; + return; + } + + insert(make_pair(o->path(), o)); + + for (uint32_t i = 0; i < o->num_ports(); ++i) { + add(o->port(i)); + } +} + +Store::const_iterator +Store::children_begin(SharedPtr o) const +{ + const_iterator parent = find(o->path()); + assert(parent != end()); + ++parent; + return parent; +} + +Store::const_iterator +Store::children_end(SharedPtr o) const +{ + const_iterator parent = find(o->path()); + assert(parent != end()); + return find_descendants_end(parent); +} + +SharedPtr +Store::find_child(SharedPtr parent, + const string& child_name) const +{ + const_iterator pi = find(parent->path()); + assert(pi != end()); + const_iterator children_end = find_descendants_end(pi); + const_iterator child = find(pi, children_end, parent->path().base() + child_name); + if (child != end()) + return child->second; + else + return SharedPtr(); +} + +unsigned +Store::child_name_offset(const Raul::Path& parent, + const Raul::Symbol& symbol, + bool allow_zero) +{ + unsigned offset = 0; + + while (true) { + std::stringstream ss; + ss << symbol; + if (offset > 0) + ss << "_" << offset; + if (find(parent.base() + ss.str()) == end() && (allow_zero || offset > 0)) + break; + else if (offset == 0) + offset = 2; + else + ++offset; + } + + return offset; +} + +} // namespace Ingen diff --git a/src/URIMap.cpp b/src/URIMap.cpp new file mode 100644 index 00000000..55a8d6a8 --- /dev/null +++ b/src/URIMap.cpp @@ -0,0 +1,95 @@ +/* + This file is part of Ingen. + Copyright 2007-2012 David Robillard + + Ingen is free software: you can redistribute it and/or modify it under the + terms of the GNU Affero General Public License as published by the Free + Software Foundation, either version 3 of the License, or any later version. + + Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. + + You should have received a copy of the GNU Affero General Public License + along with Ingen. If not, see . +*/ + +#include + +#include + +#include "ingen/URIMap.hpp" + +using namespace std; + +namespace Ingen { + +URIMap::URIMap(LV2_URID_Map* map, LV2_URID_Unmap* unmap) + : _urid_map_feature(new URIDMapFeature(this, map)) + , _urid_unmap_feature(new URIDUnmapFeature(this, unmap)) +{ +} + +URIMap::URIDMapFeature::URIDMapFeature(URIMap* map, + LV2_URID_Map* impl) + : Feature(LV2_URID__map, &urid_map) +{ + if (impl) { + urid_map = *impl; + } else { + urid_map.map = default_map; + urid_map.handle = NULL; + } +} + +LV2_URID +URIMap::URIDMapFeature::default_map(LV2_URID_Map_Handle handle, + const char* uri) +{ + return static_cast(g_quark_from_string(uri)); +} + +LV2_URID +URIMap::URIDMapFeature::map(const char* uri) +{ + return urid_map.map(urid_map.handle, uri); +} + +URIMap::URIDUnmapFeature::URIDUnmapFeature(URIMap* map, + LV2_URID_Unmap* impl) + : Feature(LV2_URID__unmap, &urid_unmap) +{ + if (impl) { + urid_unmap = *impl; + } else { + urid_unmap.unmap = default_unmap; + urid_unmap.handle = NULL; + } +} + +const char* +URIMap::URIDUnmapFeature::default_unmap(LV2_URID_Unmap_Handle handle, + LV2_URID urid) +{ + return g_quark_to_string(urid); +} + +const char* +URIMap::URIDUnmapFeature::unmap(LV2_URID urid) +{ + return urid_unmap.unmap(urid_unmap.handle, urid); +} + +uint32_t +URIMap::map_uri(const char* uri) +{ + return _urid_map_feature->map(uri); +} + +const char* +URIMap::unmap_uri(uint32_t urid) const +{ + return _urid_unmap_feature->unmap(urid); +} + +} // namespace Ingen diff --git a/src/URIs.cpp b/src/URIs.cpp new file mode 100644 index 00000000..f3e5c67d --- /dev/null +++ b/src/URIs.cpp @@ -0,0 +1,126 @@ +/* + This file is part of Ingen. + Copyright 2007-2012 David Robillard + + Ingen is free software: you can redistribute it and/or modify it under the + terms of the GNU Affero General Public License as published by the Free + Software Foundation, either version 3 of the License, or any later version. + + Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. + + You should have received a copy of the GNU Affero General Public License + along with Ingen. If not, see . +*/ + +#include "ingen/URIMap.hpp" +#include "ingen/URIs.hpp" +#include "lv2/lv2plug.in/ns/ext/atom/atom.h" +#include "lv2/lv2plug.in/ns/ext/midi/midi.h" +#include "lv2/lv2plug.in/ns/ext/patch/patch.h" +#include "lv2/lv2plug.in/ns/ext/port-props/port-props.h" +#include "lv2/lv2plug.in/ns/lv2core/lv2.h" + +namespace Ingen { + +URIs::Quark::Quark(Forge& forge, URIMap* map, const char* c_str) + : Raul::URI(c_str) + , id(map->map_uri(c_str)) + , atom(forge.alloc_uri(c_str)) +{ +} + +#define NS_INGEN "http://drobilla.net/ns/ingen#" +#define NS_RDF "http://www.w3.org/1999/02/22-rdf-syntax-ns#" +#define NS_RDFS "http://www.w3.org/2000/01/rdf-schema#" + +URIs::URIs(Forge& f, URIMap* map) + : forge(f) + , atom_AtomPort (forge, map, LV2_ATOM__AtomPort) + , atom_Blank (forge, map, LV2_ATOM__Blank) + , atom_Bool (forge, map, LV2_ATOM__Bool) + , atom_Chunk (forge, map, LV2_ATOM__Chunk) + , atom_Float (forge, map, LV2_ATOM__Float) + , atom_Int (forge, map, LV2_ATOM__Int) + , atom_Resource (forge, map, LV2_ATOM__Resource) + , atom_Sequence (forge, map, LV2_ATOM__Sequence) + , atom_Sound (forge, map, LV2_ATOM__Sound) + , atom_String (forge, map, LV2_ATOM__String) + , atom_URI (forge, map, LV2_ATOM__URI) + , atom_URID (forge, map, LV2_ATOM__URID) + , atom_Vector (forge, map, LV2_ATOM__Vector) + , atom_bufferType (forge, map, LV2_ATOM__bufferType) + , atom_eventTransfer (forge, map, LV2_ATOM__eventTransfer) + , atom_supports (forge, map, LV2_ATOM__supports) + , doap_name (forge, map, "http://usefulinc.com/ns/doap#name") + , ingen_Edge (forge, map, NS_INGEN "Edge") + , ingen_Internal (forge, map, NS_INGEN "Internal") + , ingen_Node (forge, map, NS_INGEN "Node") + , ingen_Patch (forge, map, NS_INGEN "Patch") + , ingen_activity (forge, map, NS_INGEN "activity") + , ingen_broadcast (forge, map, NS_INGEN "broadcast") + , ingen_canvasX (forge, map, NS_INGEN "canvasX") + , ingen_canvasY (forge, map, NS_INGEN "canvasY") + , ingen_controlBinding (forge, map, NS_INGEN "controlBinding") + , ingen_document (forge, map, NS_INGEN "document") + , ingen_enabled (forge, map, NS_INGEN "enabled") + , ingen_engine (forge, map, NS_INGEN "engine") + , ingen_head (forge, map, NS_INGEN "head") + , ingen_incidentTo (forge, map, NS_INGEN "incidentTo") + , ingen_nil (forge, map, NS_INGEN "nil") + , ingen_node (forge, map, NS_INGEN "node") + , ingen_polyphonic (forge, map, NS_INGEN "polyphonic") + , ingen_polyphony (forge, map, NS_INGEN "polyphony") + , ingen_prototype (forge, map, NS_INGEN "prototype") + , ingen_sampleRate (forge, map, NS_INGEN "sampleRate") + , ingen_status (forge, map, NS_INGEN "status") + , ingen_tail (forge, map, NS_INGEN "tail") + , ingen_uiEmbedded (forge, map, NS_INGEN "uiEmbedded") + , ingen_value (forge, map, NS_INGEN "value") + , lv2_AudioPort (forge, map, LV2_CORE__AudioPort) + , lv2_CVPort (forge, map, LV2_CORE__CVPort) + , lv2_ControlPort (forge, map, LV2_CORE__ControlPort) + , lv2_InputPort (forge, map, LV2_CORE__InputPort) + , lv2_OutputPort (forge, map, LV2_CORE__OutputPort) + , lv2_Plugin (forge, map, LV2_CORE__Plugin) + , lv2_connectionOptional(forge, map, LV2_CORE__connectionOptional) + , lv2_default (forge, map, LV2_CORE__default) + , lv2_index (forge, map, LV2_CORE__index) + , lv2_integer (forge, map, LV2_CORE__integer) + , lv2_maximum (forge, map, LV2_CORE__maximum) + , lv2_minimum (forge, map, LV2_CORE__minimum) + , lv2_name (forge, map, LV2_CORE__name) + , lv2_portProperty (forge, map, LV2_CORE__portProperty) + , lv2_sampleRate (forge, map, LV2_CORE__sampleRate) + , lv2_scalePoint (forge, map, LV2_CORE__scalePoint) + , lv2_symbol (forge, map, LV2_CORE__symbol) + , lv2_toggled (forge, map, LV2_CORE__toggled) + , midi_Bender (forge, map, LV2_MIDI__Bender) + , midi_ChannelPressure (forge, map, LV2_MIDI__ChannelPressure) + , midi_Controller (forge, map, LV2_MIDI__Controller) + , midi_MidiEvent (forge, map, LV2_MIDI__MidiEvent) + , midi_NoteOn (forge, map, LV2_MIDI__NoteOn) + , midi_controllerNumber (forge, map, LV2_MIDI__controllerNumber) + , midi_noteNumber (forge, map, LV2_MIDI__noteNumber) + , patch_Delete (forge, map, LV2_PATCH__Delete) + , patch_Get (forge, map, LV2_PATCH__Get) + , patch_Move (forge, map, LV2_PATCH__Move) + , patch_Patch (forge, map, LV2_PATCH__Patch) + , patch_Put (forge, map, LV2_PATCH__Put) + , patch_Response (forge, map, LV2_PATCH__Response) + , patch_Set (forge, map, LV2_PATCH__Set) + , patch_add (forge, map, LV2_PATCH__add) + , patch_body (forge, map, LV2_PATCH__body) + , patch_destination (forge, map, LV2_PATCH__destination) + , patch_remove (forge, map, LV2_PATCH__remove) + , patch_request (forge, map, LV2_PATCH__request) + , patch_subject (forge, map, LV2_PATCH__subject) + , pprops_logarithmic (forge, map, LV2_PORT_PROPS__logarithmic) + , rdf_type (forge, map, NS_RDF "type") + , rdfs_seeAlso (forge, map, NS_RDFS "seeAlso") + , wildcard (forge, map, NS_INGEN "wildcard") +{ +} + +} // namespace Ingen diff --git a/src/World.cpp b/src/World.cpp new file mode 100644 index 00000000..c7ce14ba --- /dev/null +++ b/src/World.cpp @@ -0,0 +1,320 @@ +/* + This file is part of Ingen. + Copyright 2007-2012 David Robillard + + Ingen is free software: you can redistribute it and/or modify it under the + terms of the GNU Affero General Public License as published by the Free + Software Foundation, either version 3 of the License, or any later version. + + Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. + + You should have received a copy of the GNU Affero General Public License + along with Ingen. If not, see . +*/ + +#include +#include + +#include +#include +#include + +#include "ingen/Configuration.hpp" +#include "ingen/LV2Features.hpp" +#include "ingen/Module.hpp" +#include "ingen/URIMap.hpp" +#include "ingen/URIs.hpp" +#include "ingen/World.hpp" +#include "ingen/runtime_paths.hpp" +#include "lilv/lilv.h" +#include "raul/log.hpp" +#include "sord/sordmm.hpp" + +#define LOG(s) (s("[World] ")) + +using namespace std; + +namespace Ingen { + +class EngineBase; +class Interface; +class Store; + +namespace Serialisation { class Parser; class Serialiser; } + + +/** Load a dynamic module from the default path. + * + * This will check in the directories specified in the environment variable + * INGEN_MODULE_PATH (typical colon delimited format), then the default module + * installation directory (ie /usr/local/lib/ingen), in that order. + * + * \param name The base name of the module, e.g. "ingen_serialisation" + */ +Glib::Module* +ingen_load_module(const string& name) +{ + Glib::Module* module = NULL; + + // Search INGEN_MODULE_PATH first + bool module_path_found; + string module_path = Glib::getenv("INGEN_MODULE_PATH", module_path_found); + if (module_path_found) { + string dir; + istringstream iss(module_path); + while (getline(iss, dir, G_SEARCHPATH_SEPARATOR)) { + string filename = Ingen::module_path(name, dir); + if (Glib::file_test(filename, Glib::FILE_TEST_EXISTS)) { + module = new Glib::Module(filename); + if (*module) { + LOG(Raul::info)(Raul::fmt("Loading %1%\n") % filename); + return module; + } else { + Raul::error << Glib::Module::get_last_error() << endl; + } + } + } + } + + // Try default directory if not found + module = new Glib::Module(Ingen::module_path(name)); + + if (*module) { + LOG(Raul::info)(Raul::fmt("Loading %1%\n") % Ingen::module_path(name)); + return module; + } else if (!module_path_found) { + LOG(Raul::error)(Raul::fmt("Unable to find %1% (%2%)\n") + % name % Glib::Module::get_last_error()); + return NULL; + } else { + LOG(Raul::error)(Raul::fmt("Unable to load %1% from %2% (%3%)\n") + % name % module_path % Glib::Module::get_last_error()); + LOG(Raul::error)("Is Ingen installed?\n"); + return NULL; + } +} + +class World::Impl { +public: + Impl(int& a_argc, + char**& a_argv, + LV2_URID_Map* map, + LV2_URID_Unmap* unmap) + : argc(a_argc) + , argv(a_argv) + , lv2_features(NULL) + , rdf_world(new Sord::World()) + , uri_map(new URIMap(map, unmap)) + , forge(new Forge(*uri_map)) + , uris(new URIs(*forge, uri_map)) + , lilv_world(lilv_world_new()) + { + conf.parse(argc, argv); + lv2_features = new LV2Features(); + lv2_features->add_feature(uri_map->urid_map_feature()); + lv2_features->add_feature(uri_map->urid_unmap_feature()); + lilv_world_load_all(lilv_world); + + // Set up RDF namespaces + rdf_world->add_prefix("atom", "http://lv2plug.in/ns/ext/atom#"); + rdf_world->add_prefix("patch", "http://lv2plug.in/ns/ext/patch#"); + rdf_world->add_prefix("doap", "http://usefulinc.com/ns/doap#"); + rdf_world->add_prefix("ingen", "http://drobilla.net/ns/ingen#"); + rdf_world->add_prefix("lv2", "http://lv2plug.in/ns/lv2core#"); + rdf_world->add_prefix("lv2ev", "http://lv2plug.in/ns/ext/event#"); + rdf_world->add_prefix("midi", "http://lv2plug.in/ns/ext/midi#"); + rdf_world->add_prefix("owl", "http://www.w3.org/2002/07/owl#"); + rdf_world->add_prefix("rdfs", "http://www.w3.org/2000/01/rdf-schema#"); + rdf_world->add_prefix("xsd", "http://www.w3.org/2001/XMLSchema#"); + } + + ~Impl() + { + serialiser.reset(); + parser.reset(); + interface.reset(); + engine.reset(); + store.reset(); + + interface_factories.clear(); + script_runners.clear(); + + delete rdf_world; + delete lv2_features; + delete uris; + delete forge; + delete uri_map; + + lilv_world_free(lilv_world); + + + for (Modules::iterator i = modules.begin(); i != modules.end(); ++i) { + // Keep a reference to the library + Glib::Module* lib = i->second->library; + + // Destroy the Ingen module + delete i->second; + + // Now all references to library code should be done, close it + delete lib; + } + } + + typedef std::map Modules; + Modules modules; + + typedef std::map InterfaceFactories; + InterfaceFactories interface_factories; + + typedef bool (*ScriptRunner)(World* world, const char* filename); + typedef std::map ScriptRunners; + ScriptRunners script_runners; + + int& argc; + char**& argv; + Configuration conf; + LV2Features* lv2_features; + Sord::World* rdf_world; + URIMap* uri_map; + Forge* forge; + URIs* uris; + SharedPtr interface; + SharedPtr engine; + SharedPtr serialiser; + SharedPtr parser; + SharedPtr store; + LilvWorld* lilv_world; + std::string jack_uuid; +}; + +World::World(int& argc, + char**& argv, + LV2_URID_Map* map, + LV2_URID_Unmap* unmap) + : _impl(new Impl(argc, argv, map, unmap)) +{ +} + +World::~World() +{ + delete _impl; +} + +void World::set_engine(SharedPtr e) { _impl->engine = e; } +void World::set_interface(SharedPtr i) { _impl->interface = i; } +void World::set_parser(SharedPtr p) { _impl->parser = p; } +void World::set_serialiser(SharedPtr s) { _impl->serialiser = s; } +void World::set_store(SharedPtr s) { _impl->store = s; } + +SharedPtr World::engine() { return _impl->engine; } +SharedPtr World::interface() { return _impl->interface; } +SharedPtr World::parser() { return _impl->parser; } +SharedPtr World::serialiser() { return _impl->serialiser; } +SharedPtr World::store() { return _impl->store; } + +int& World::argc() { return _impl->argc; } +char**& World::argv() { return _impl->argv; } +Configuration& World::conf() { return _impl->conf; } + +Sord::World* World::rdf_world() { return _impl->rdf_world; } +LilvWorld* World::lilv_world() { return _impl->lilv_world; } + +LV2Features& World::lv2_features() { return *_impl->lv2_features; } +Forge& World::forge() { return *_impl->forge; } +URIs& World::uris() { return *_impl->uris; } +URIMap& World::uri_map() { return *_impl->uri_map; } + +bool +World::load_module(const char* name) +{ + Impl::Modules::iterator i = _impl->modules.find(name); + if (i != _impl->modules.end()) { + LOG(Raul::info)(Raul::fmt("Module `%1%' already loaded\n") % name); + return true; + } + Glib::Module* lib = ingen_load_module(name); + Ingen::Module* (*module_load)() = NULL; + if (lib && lib->get_symbol("ingen_module_load", (void*&)module_load)) { + Module* module = module_load(); + if (module) { + module->library = lib; + module->load(this); + _impl->modules.insert(make_pair(string(name), module)); + return true; + } + } + + LOG(Raul::error)(Raul::fmt("Failed to load module `%1%'\n") % name); + delete lib; + return false; +} + +bool +World::run_module(const char* name) +{ + Impl::Modules::iterator i = _impl->modules.find(name); + if (i == _impl->modules.end()) { + LOG(Raul::error) << "Attempt to run unloaded module `" << name << "'" << endl; + return false; + } + + i->second->run(this); + return true; +} + +void +World::unload_modules() +{ + _impl->modules.clear(); +} + +/** Get an interface for a remote engine at @a url + */ +SharedPtr +World::new_interface(const std::string& engine_url, + SharedPtr respondee) +{ + const string scheme = engine_url.substr(0, engine_url.find(":")); + const Impl::InterfaceFactories::const_iterator i = _impl->interface_factories.find(scheme); + if (i == _impl->interface_factories.end()) { + Raul::warn << "Unknown URI scheme `" << scheme << "'" << endl; + return SharedPtr(); + } + + return i->second(this, engine_url, respondee); +} + +/** Run a script of type @a mime_type at filename @a filename */ +bool +World::run(const std::string& mime_type, const std::string& filename) +{ + const Impl::ScriptRunners::const_iterator i = _impl->script_runners.find(mime_type); + if (i == _impl->script_runners.end()) { + Raul::warn << "Unknown script MIME type `" << mime_type << "'" << endl; + return false; + } + + return i->second(this, filename.c_str()); +} + +void +World::add_interface_factory(const std::string& scheme, InterfaceFactory factory) +{ + _impl->interface_factories.insert(make_pair(scheme, factory)); +} + +void +World::set_jack_uuid(const std::string& uuid) +{ + _impl->jack_uuid = uuid; +} + +std::string +World::jack_uuid() +{ + return _impl->jack_uuid; +} + +} // namespace Ingen diff --git a/src/bindings/ingen.i b/src/bindings/ingen.i index 6b39eb33..b29a61ce 100644 --- a/src/bindings/ingen.i +++ b/src/bindings/ingen.i @@ -9,8 +9,6 @@ #include "Client.hpp" %} -/*%ignore Ingen::Shared::EngineInterface;*/ - %include "../../ingen/CommonInterface.hpp" %include "../../ingen/ClientInterface.hpp" %include "../../ingen/EngineInterface.hpp" @@ -21,34 +19,29 @@ // generate directors for all classes that have virtual methods %feature("director"); %feature("director") Ingen::ClientInterface; -//%feature("director") Ingen::Shared::EngineInterface; -typedef Ingen::Shared::World World; -namespace Ingen { namespace Shared { +typedef Ingen::World World; +namespace Ingen { %extend World { World() { - if (!Ingen::Shared::ingen_world) { + if (!Ingen::ingen_world) { fprintf(stderr, "ERROR: World uninitialized (running within Ingen?)\n"); abort(); } else { - return Ingen::Shared::ingen_world; + return Ingen::ingen_world; } } void iteration() { - Ingen::Shared::script_iteration($self); + Ingen::script_iteration($self); } /*LILVWorld lilv() { return $self->me->lilv_world; }*/ }; -} } +} %include "Client.hpp" %feature("director") Client; - - -/*SharedPtr engine() { return $self->me->engine; }*/ - diff --git a/src/bindings/ingen_bindings.cpp b/src/bindings/ingen_bindings.cpp index 6c92d7bb..39fd9fbf 100644 --- a/src/bindings/ingen_bindings.cpp +++ b/src/bindings/ingen_bindings.cpp @@ -18,10 +18,10 @@ #include "raul/log.hpp" #include "ingen_bindings.hpp" #include "server/Engine.hpp" -#include "ingen/shared/World.hpp" +#include "ingen/World.hpp" bool -run(Ingen::Shared::World* world, const char* filename) +run(Ingen::World* world, const char* filename) { ingen_world = world; @@ -38,22 +38,22 @@ run(Ingen::Shared::World* world, const char* filename) } } -struct IngenBindingsModule : public Ingen::Shared::Module { - void load(Ingen::Shared::World* world) { +struct IngenBindingsModule : public Ingen::Module { + void load(Ingen::World* world) { world->script_runners.insert(make_pair("application/x-python", &run)); } }; extern "C" { -Ingen::Shared::Module* +Ingen::Module* ingen_module_load() { return new IngenBindingsModule(); } void -script_iteration(Ingen::Shared::World* world) +script_iteration(Ingen::World* world) { if (world->engine()) world->engine()->main_iteration(); diff --git a/src/bindings/ingen_bindings.hpp b/src/bindings/ingen_bindings.hpp index 90ac4b0b..90358cd8 100644 --- a/src/bindings/ingen_bindings.hpp +++ b/src/bindings/ingen_bindings.hpp @@ -18,7 +18,6 @@ #define INGEN_BINDINGS_HPP namespace Ingen { -namespace Shared { class World; extern World* ingen_world; @@ -28,7 +27,6 @@ extern "C" { void script_iteration(World* world); } -} // namespace Shared } // namespace Ingen #endif // INGEN_BINDINGS_HPP diff --git a/src/client/ClientStore.cpp b/src/client/ClientStore.cpp index 56d94b2e..8844b320 100644 --- a/src/client/ClientStore.cpp +++ b/src/client/ClientStore.cpp @@ -32,12 +32,9 @@ using namespace std; namespace Ingen { - -using namespace Shared; - namespace Client { -ClientStore::ClientStore(Shared::URIs& uris, +ClientStore::ClientStore(URIs& uris, SharedPtr engine, SharedPtr emitter) : _uris(uris) diff --git a/src/client/NodeModel.cpp b/src/client/NodeModel.cpp index 2a88b4db..dbbb0258 100644 --- a/src/client/NodeModel.cpp +++ b/src/client/NodeModel.cpp @@ -19,13 +19,13 @@ #include #include "ingen/client/NodeModel.hpp" -#include "ingen/shared/URIs.hpp" -#include "ingen/shared/World.hpp" +#include "ingen/URIs.hpp" +#include "ingen/World.hpp" namespace Ingen { namespace Client { -NodeModel::NodeModel(Shared::URIs& uris, +NodeModel::NodeModel(URIs& uris, SharedPtr plugin, const Raul::Path& path) : ObjectModel(uris, path) @@ -37,7 +37,7 @@ NodeModel::NodeModel(Shared::URIs& uris, { } -NodeModel::NodeModel(Shared::URIs& uris, +NodeModel::NodeModel(URIs& uris, const Raul::URI& plugin_uri, const Raul::Path& path) : ObjectModel(uris, path) diff --git a/src/client/ObjectModel.cpp b/src/client/ObjectModel.cpp index 9a5009ba..2679186b 100644 --- a/src/client/ObjectModel.cpp +++ b/src/client/ObjectModel.cpp @@ -16,13 +16,13 @@ #include "ingen/GraphObject.hpp" #include "ingen/client/ObjectModel.hpp" -#include "ingen/shared/URIs.hpp" +#include "ingen/URIs.hpp" #include "raul/TableImpl.hpp" namespace Ingen { namespace Client { -ObjectModel::ObjectModel(Shared::URIs& uris, const Raul::Path& path) +ObjectModel::ObjectModel(URIs& uris, const Raul::Path& path) : GraphObject(uris, path) , _path(path) , _symbol((path == Raul::Path::root()) ? "root" : path.symbol()) diff --git a/src/client/PatchModel.cpp b/src/client/PatchModel.cpp index 7acb8aec..bd2547b0 100644 --- a/src/client/PatchModel.cpp +++ b/src/client/PatchModel.cpp @@ -22,7 +22,7 @@ #include "ingen/client/EdgeModel.hpp" #include "ingen/client/NodeModel.hpp" #include "ingen/client/PatchModel.hpp" -#include "ingen/shared/URIs.hpp" +#include "ingen/URIs.hpp" using namespace std; diff --git a/src/client/PluginModel.cpp b/src/client/PluginModel.cpp index f4df6d1c..ab1df485 100644 --- a/src/client/PluginModel.cpp +++ b/src/client/PluginModel.cpp @@ -40,7 +40,7 @@ const LilvPlugins* PluginModel::_lilv_plugins = NULL; Sord::World* PluginModel::_rdf_world = NULL; -PluginModel::PluginModel(Shared::URIs& uris, +PluginModel::PluginModel(URIs& uris, const Raul::URI& uri, const Raul::URI& type_uri, const Resource::Properties& properties) @@ -215,7 +215,7 @@ PluginModel::has_ui() const } SharedPtr -PluginModel::ui(Ingen::Shared::World* world, +PluginModel::ui(Ingen::World* world, SharedPtr node) const { if (!_lilv_plugin) { diff --git a/src/client/PluginUI.cpp b/src/client/PluginUI.cpp index 0c597490..0f61924a 100644 --- a/src/client/PluginUI.cpp +++ b/src/client/PluginUI.cpp @@ -14,14 +14,14 @@ along with Ingen. If not, see . */ -#include "raul/log.hpp" - +#include "ingen/Interface.hpp" +#include "ingen/URIs.hpp" #include "ingen/client/NodeModel.hpp" #include "ingen/client/PluginUI.hpp" #include "ingen/client/PortModel.hpp" -#include "ingen/shared/URIs.hpp" #include "lv2/lv2plug.in/ns/ext/atom/atom.h" #include "lv2/lv2plug.in/ns/extensions/ui/ui.h" +#include "raul/log.hpp" using namespace std; @@ -48,7 +48,7 @@ lv2_ui_write(SuilController controller, SharedPtr port = ports[port_index]; - const Shared::URIs& uris = ui->world()->uris(); + const URIs& uris = ui->world()->uris(); // float (special case, always 0) if (format == 0) { @@ -75,7 +75,7 @@ lv2_ui_write(SuilController controller, } } -PluginUI::PluginUI(Ingen::Shared::World* world, +PluginUI::PluginUI(Ingen::World* world, SharedPtr node, const LilvNode* ui_node) : _world(world) @@ -92,7 +92,7 @@ PluginUI::~PluginUI() } SharedPtr -PluginUI::create(Ingen::Shared::World* world, +PluginUI::create(Ingen::World* world, SharedPtr node, const LilvPlugin* plugin) { diff --git a/src/client/ingen_client.cpp b/src/client/ingen_client.cpp index 753917cf..46a14dc1 100644 --- a/src/client/ingen_client.cpp +++ b/src/client/ingen_client.cpp @@ -14,22 +14,22 @@ along with Ingen. If not, see . */ -#include "ingen/shared/Module.hpp" -#include "ingen/shared/World.hpp" +#include "ingen/Module.hpp" +#include "ingen/World.hpp" #include "raul/SharedPtr.hpp" #include "ingen_config.h" using namespace Ingen; -struct IngenClientModule : public Ingen::Shared::Module { - void load(Ingen::Shared::World* world) { +struct IngenClientModule : public Ingen::Module { + void load(Ingen::World* world) { } }; extern "C" { -Ingen::Shared::Module* +Ingen::Module* ingen_module_load() { return new IngenClientModule(); diff --git a/src/client/wscript b/src/client/wscript index c3830506..b0b0620e 100644 --- a/src/client/wscript +++ b/src/client/wscript @@ -8,7 +8,7 @@ def build(bld): name = 'libingen_client', target = 'ingen_client', install_path = '${LIBDIR}', - use = 'libingen_shared') + use = 'libingen') autowaf.use_lib(bld, obj, 'GLIBMM LV2 LILV SUIL RAUL SORD SIGCPP') obj.source = ''' diff --git a/src/gui/App.cpp b/src/gui/App.cpp index 1d6381fb..2c561dfc 100644 --- a/src/gui/App.cpp +++ b/src/gui/App.cpp @@ -29,8 +29,8 @@ #include "ingen/client/ObjectModel.hpp" #include "ingen/client/PatchModel.hpp" #include "ingen/client/SigClientInterface.hpp" -#include "ingen/shared/World.hpp" -#include "ingen/shared/runtime_paths.hpp" +#include "ingen/World.hpp" +#include "ingen/runtime_paths.hpp" #include "lilv/lilv.h" #include "raul/Path.hpp" #include "raul/log.hpp" @@ -62,7 +62,6 @@ namespace Ingen { namespace Client { class PluginModel; } using namespace Client; -using namespace Shared; namespace GUI { @@ -70,7 +69,7 @@ class Port; Gtk::Main* App::_main = 0; -App::App(Ingen::Shared::World* world) +App::App(Ingen::World* world) : _configuration(new Configuration(*this)) , _about_dialog(NULL) , _window_factory(new WindowFactory(*this)) @@ -102,7 +101,7 @@ App::~App() } SharedPtr -App::create(Ingen::Shared::World* world) +App::create(Ingen::World* world) { _main = new Gtk::Main(&world->argc(), &world->argv()); diff --git a/src/gui/App.hpp b/src/gui/App.hpp index 1f611a13..5d93c805 100644 --- a/src/gui/App.hpp +++ b/src/gui/App.hpp @@ -27,7 +27,7 @@ #include #include "ingen/Status.hpp" -#include "ingen/shared/World.hpp" +#include "ingen/World.hpp" #include "raul/Atom.hpp" #include "raul/Deletable.hpp" #include "raul/SharedPtr.hpp" @@ -36,9 +36,7 @@ namespace Ingen { class Interface; class Port; - namespace Shared { - class World; - } + class World; namespace Client { class ClientStore; class PatchModel; @@ -107,7 +105,7 @@ public: Glib::RefPtr icon_from_path(const std::string& path, int size); - Ingen::Shared::Forge& forge() const { return _world->forge(); } + Ingen::Forge& forge() const { return _world->forge(); } SharedPtr interface() const { return _world->interface(); } SharedPtr client() const { return _client; } SharedPtr store() const { return _store; } @@ -115,11 +113,11 @@ public: SharedPtr serialiser(); - static SharedPtr create(Ingen::Shared::World* world); + static SharedPtr create(Ingen::World* world); void run(); - inline Ingen::Shared::World* world() const { return _world; } - inline Ingen::Shared::URIs& uris() const { return _world->uris(); } + inline Ingen::World* world() const { return _world; } + inline Ingen::URIs& uris() const { return _world->uris(); } protected: @@ -137,7 +135,7 @@ protected: LexicalCompare > Icons; Icons _icons; - explicit App(Ingen::Shared::World* world); + explicit App(Ingen::World* world); bool animate(); void response(int32_t id, Ingen::Status status, const std::string& subject); @@ -162,7 +160,7 @@ protected: Gtk::AboutDialog* _about_dialog; WindowFactory* _window_factory; - Ingen::Shared::World* _world; + Ingen::World* _world; uint32_t _sample_rate; diff --git a/src/gui/Configuration.cpp b/src/gui/Configuration.cpp index f3b1351b..c6737fe7 100644 --- a/src/gui/Configuration.cpp +++ b/src/gui/Configuration.cpp @@ -85,7 +85,7 @@ uint32_t Configuration::get_port_color(const Client::PortModel* p) { assert(p != NULL); - const Shared::URIs& uris = _app.uris(); + const URIs& uris = _app.uris(); if (p->is_a(uris.lv2_AudioPort)) { return _audio_port_color; } else if (p->supports(uris.atom_String)) { diff --git a/src/gui/ConnectWindow.cpp b/src/gui/ConnectWindow.cpp index 0c3dde27..81426620 100644 --- a/src/gui/ConnectWindow.cpp +++ b/src/gui/ConnectWindow.cpp @@ -28,8 +28,8 @@ #include "ingen/client/ClientStore.hpp" #include "ingen/client/PatchModel.hpp" #include "ingen/client/ThreadedSigClientInterface.hpp" -#include "ingen/shared/Module.hpp" -#include "ingen/shared/World.hpp" +#include "ingen/Module.hpp" +#include "ingen/World.hpp" #include "App.hpp" #include "ConnectWindow.hpp" @@ -72,7 +72,7 @@ ConnectWindow::ConnectWindow(BaseObjectType* cobject, } void -ConnectWindow::start(App& app, Ingen::Shared::World* world) +ConnectWindow::start(App& app, Ingen::World* world) { _app = &app; @@ -160,7 +160,7 @@ ConnectWindow::connect(bool existing) _connect_stage = 0; set_connecting_widget_states(); - Ingen::Shared::World* world = _app->world(); + Ingen::World* world = _app->world(); #ifdef HAVE_SOCKET if (_mode == CONNECT_REMOTE) { diff --git a/src/gui/ConnectWindow.hpp b/src/gui/ConnectWindow.hpp index ca27787e..2f7a43e7 100644 --- a/src/gui/ConnectWindow.hpp +++ b/src/gui/ConnectWindow.hpp @@ -50,7 +50,7 @@ public: const Glib::RefPtr& xml); void set_connected_to(SharedPtr engine); - void start(App& app, Ingen::Shared::World* world); + void start(App& app, Ingen::World* world); void ingen_response(int32_t id, Status status, const std::string& subject) { _attached = true; } diff --git a/src/gui/LoadPatchWindow.cpp b/src/gui/LoadPatchWindow.cpp index 94142868..7d23f5d9 100644 --- a/src/gui/LoadPatchWindow.cpp +++ b/src/gui/LoadPatchWindow.cpp @@ -25,7 +25,7 @@ #include "ingen/client/ClientStore.hpp" #include "ingen/client/NodeModel.hpp" #include "ingen/client/PatchModel.hpp" -#include "ingen/shared/runtime_paths.hpp" +#include "ingen/runtime_paths.hpp" #include "App.hpp" #include "Configuration.hpp" @@ -39,7 +39,6 @@ using namespace Raul; namespace Ingen { using namespace Client; -using namespace Shared; namespace GUI { @@ -89,7 +88,7 @@ LoadPatchWindow::LoadPatchWindow(BaseObjectType* cobject, property_select_multiple() = true; // Add global examples directory to "shortcut folders" (bookmarks) - const string examples_dir = Shared::data_file_path("patches"); + const string examples_dir = Ingen::data_file_path("patches"); if (Glib::file_test(examples_dir, Glib::FILE_TEST_IS_DIR)) { add_shortcut_folder(examples_dir); } diff --git a/src/gui/LoadPluginWindow.cpp b/src/gui/LoadPluginWindow.cpp index 18d1a63c..cac404df 100644 --- a/src/gui/LoadPluginWindow.cpp +++ b/src/gui/LoadPluginWindow.cpp @@ -39,7 +39,6 @@ using namespace Raul; namespace Ingen { using namespace Client; -using namespace Shared; namespace GUI { diff --git a/src/gui/NodeModule.cpp b/src/gui/NodeModule.cpp index 1d3f6801..8e9f88e0 100644 --- a/src/gui/NodeModule.cpp +++ b/src/gui/NodeModule.cpp @@ -47,7 +47,6 @@ using namespace Raul; namespace Ingen { using namespace Client; -using namespace Shared; namespace GUI { @@ -405,7 +404,7 @@ NodeModule::store_location(double ax, double ay) void NodeModule::property_changed(const URI& key, const Atom& value) { - const Shared::URIs& uris = app().uris(); + const URIs& uris = app().uris(); if (value.type() == uris.forge.Float) { if (key == uris.ingen_canvasX) { move_to(value.get_float(), get_y()); diff --git a/src/gui/ObjectMenu.cpp b/src/gui/ObjectMenu.cpp index 5698bd7f..4fa99677 100644 --- a/src/gui/ObjectMenu.cpp +++ b/src/gui/ObjectMenu.cpp @@ -29,7 +29,6 @@ using namespace Raul; namespace Ingen { using namespace Client; -using namespace Shared; namespace GUI { diff --git a/src/gui/PatchBox.cpp b/src/gui/PatchBox.cpp index ce2d23db..7c9483f2 100644 --- a/src/gui/PatchBox.cpp +++ b/src/gui/PatchBox.cpp @@ -453,7 +453,7 @@ PatchBox::message_dialog(const Glib::ustring& message, void PatchBox::event_save_as() { - const Shared::URIs& uris = _app->uris(); + const URIs& uris = _app->uris(); while (true) { Gtk::FileChooserDialog dialog("Save Patch", Gtk::FILE_CHOOSER_ACTION_SAVE); if (_window) { diff --git a/src/gui/PatchCanvas.cpp b/src/gui/PatchCanvas.cpp index f9e65390..fbbe88b1 100644 --- a/src/gui/PatchCanvas.cpp +++ b/src/gui/PatchCanvas.cpp @@ -30,9 +30,9 @@ #include "ingen/client/PatchModel.hpp" #include "ingen/client/PluginModel.hpp" #include "ingen/serialisation/Serialiser.hpp" -#include "ingen/shared/Builder.hpp" -#include "ingen/shared/ClashAvoider.hpp" -#include "ingen/shared/World.hpp" +#include "ingen/Builder.hpp" +#include "ingen/ClashAvoider.hpp" +#include "ingen/World.hpp" #include "lv2/lv2plug.in/ns/ext/atom/atom.h" #include "raul/log.hpp" @@ -62,7 +62,6 @@ using namespace Raul; namespace Ingen { using namespace Client; -using namespace Shared; namespace GUI { diff --git a/src/gui/PatchPortModule.cpp b/src/gui/PatchPortModule.cpp index 3c04d29e..5e57adb5 100644 --- a/src/gui/PatchPortModule.cpp +++ b/src/gui/PatchPortModule.cpp @@ -39,7 +39,6 @@ using namespace Raul; namespace Ingen { using namespace Client; -using namespace Shared; namespace GUI { diff --git a/src/gui/PatchTreeWindow.cpp b/src/gui/PatchTreeWindow.cpp index 29dc3721..b6c67211 100644 --- a/src/gui/PatchTreeWindow.cpp +++ b/src/gui/PatchTreeWindow.cpp @@ -32,7 +32,6 @@ using namespace Raul; namespace Ingen { using namespace Client; -using namespace Shared; namespace GUI { diff --git a/src/gui/Port.cpp b/src/gui/Port.cpp index 5e847400..7a4ed0c8 100644 --- a/src/gui/Port.cpp +++ b/src/gui/Port.cpp @@ -36,7 +36,6 @@ using namespace std; using namespace Raul; namespace Ingen { -using namespace Shared; namespace GUI { Port* @@ -146,7 +145,7 @@ Port::on_value_changed(GVariant* value) const Raul::Atom atom = _app.forge().make(float(g_variant_get_double(value))); if (atom != model()->value()) { - Ingen::Shared::World* const world = _app.world(); + Ingen::World* const world = _app.world(); _app.interface()->set_property(model()->path(), world->uris().ingen_value, atom); diff --git a/src/gui/PortMenu.cpp b/src/gui/PortMenu.cpp index cd611199..9b1f8aa0 100644 --- a/src/gui/PortMenu.cpp +++ b/src/gui/PortMenu.cpp @@ -28,7 +28,6 @@ namespace Ingen { using namespace Client; -using namespace Shared; namespace GUI { diff --git a/src/gui/PortPropertiesWindow.cpp b/src/gui/PortPropertiesWindow.cpp index 668aaa88..56996011 100644 --- a/src/gui/PortPropertiesWindow.cpp +++ b/src/gui/PortPropertiesWindow.cpp @@ -96,8 +96,7 @@ PortPropertiesWindow::present(SharedPtr pm) void PortPropertiesWindow::property_changed(const URI& key, const Atom& value) { - const Shared::URIs& uris = _app->uris(); - + const URIs& uris = _app->uris(); if (value.type() == uris.forge.Float) { if (key == uris.lv2_minimum) _min_spinner->set_value(value.get_float()); @@ -151,7 +150,7 @@ PortPropertiesWindow::cancel() void PortPropertiesWindow::ok() { - const Shared::URIs& uris = _app->uris(); + const URIs& uris = _app->uris(); Resource::Properties props; props.insert( make_pair(uris.lv2_minimum, diff --git a/src/gui/PropertiesWindow.cpp b/src/gui/PropertiesWindow.cpp index 6f92d0d3..1a4228b8 100644 --- a/src/gui/PropertiesWindow.cpp +++ b/src/gui/PropertiesWindow.cpp @@ -22,12 +22,13 @@ #include #include -#include "raul/log.hpp" -#include "ingen/shared/World.hpp" -#include "ingen/client/NodeModel.hpp" -#include "ingen/client/PluginModel.hpp" #include "App.hpp" #include "PropertiesWindow.hpp" +#include "ingen/Interface.hpp" +#include "ingen/World.hpp" +#include "ingen/client/NodeModel.hpp" +#include "ingen/client/PluginModel.hpp" +#include "raul/log.hpp" #define LOG(s) s << "[PropertiesWindow] " @@ -37,7 +38,6 @@ using namespace Raul; namespace Ingen { using namespace Client; -using namespace Shared; namespace GUI { @@ -105,7 +105,7 @@ PropertiesWindow::present(SharedPtr model) /** Get all the types which this model is an instance of */ static URISet -get_types(Shared::World* world, SharedPtr model) +get_types(World* world, SharedPtr model) { typedef Resource::Properties::const_iterator PropIter; typedef std::pair PropRange; @@ -152,7 +152,7 @@ get_types(Shared::World* world, SharedPtr model) /** Get all the properties with domains appropriate to this model */ static URISet -get_properties(Shared::World* world, SharedPtr model) +get_properties(World* world, SharedPtr model) { URISet properties; URISet types = get_types(world, model); @@ -197,7 +197,7 @@ get_properties(Shared::World* world, SharedPtr model) } static Glib::ustring -get_label(Shared::World* world, const LilvNode* node) +get_label(World* world, const LilvNode* node) { LilvNode* rdfs_label = lilv_new_uri( world->lilv_world(), LILV_NS_RDFS "label"); @@ -215,7 +215,7 @@ get_label(Shared::World* world, const LilvNode* node) void PropertiesWindow::add_property(const Raul::URI& uri, const Raul::Atom& value) { - Shared::World* world = _app->world(); + World* world = _app->world(); const unsigned n_rows = _table->property_n_rows() + 1; _table->property_n_rows() = n_rows; @@ -256,7 +256,7 @@ PropertiesWindow::set_object(SharedPtr model) set_title(model->path().chop_scheme() + " Properties - Ingen"); - Shared::World* world = _app->world(); + World* world = _app->world(); LilvNode* rdfs_range = lilv_new_uri( world->lilv_world(), LILV_NS_RDFS "range"); @@ -308,7 +308,7 @@ PropertiesWindow::set_object(SharedPtr model) Gtk::Widget* PropertiesWindow::create_value_widget(const Raul::URI& uri, const Raul::Atom& value) { - Ingen::Shared::Forge& forge = _app->forge(); + Ingen::Forge& forge = _app->forge(); if (value.type() == forge.Int) { Gtk::SpinButton* widget = manage(new Gtk::SpinButton(0.0, 0)); widget->property_numeric() = true; @@ -449,7 +449,7 @@ bad_type: void PropertiesWindow::key_changed() { - Shared::World* world = _app->world(); + World* world = _app->world(); const Gtk::ListStore::Row row = *(_key_combo->get_active()); Glib::ustring prop_uri = row[_combo_columns.uri_col]; diff --git a/src/gui/RenameWindow.cpp b/src/gui/RenameWindow.cpp index 097b9aea..c8e72168 100644 --- a/src/gui/RenameWindow.cpp +++ b/src/gui/RenameWindow.cpp @@ -117,8 +117,7 @@ RenameWindow::cancel_clicked() void RenameWindow::ok_clicked() { - const Shared::URIs& uris = _app->uris(); - + const URIs& uris = _app->uris(); const string& symbol_str = _symbol_entry->get_text(); const string& label = _label_entry->get_text(); Path path = _object->path(); diff --git a/src/gui/SubpatchModule.cpp b/src/gui/SubpatchModule.cpp index dcc55e20..8b9dfe5e 100644 --- a/src/gui/SubpatchModule.cpp +++ b/src/gui/SubpatchModule.cpp @@ -66,7 +66,7 @@ SubpatchModule::store_location(double ax, double ay) const Atom x(app().forge().make(static_cast(ax))); const Atom y(app().forge().make(static_cast(ay))); - const Shared::URIs& uris = app().uris(); + const URIs& uris = app().uris(); const Atom& existing_x = _node->get_property(uris.ingen_canvasX); const Atom& existing_y = _node->get_property(uris.ingen_canvasY); diff --git a/src/gui/ThreadedLoader.cpp b/src/gui/ThreadedLoader.cpp index 1867b8d5..054838c6 100644 --- a/src/gui/ThreadedLoader.cpp +++ b/src/gui/ThreadedLoader.cpp @@ -16,8 +16,8 @@ #include #include "raul/log.hpp" -#include "ingen/shared/World.hpp" -#include "ingen/shared/Module.hpp" +#include "ingen/World.hpp" +#include "ingen/Module.hpp" #include "App.hpp" #include "ThreadedLoader.hpp" #include "ingen/client/PatchModel.hpp" @@ -43,7 +43,7 @@ ThreadedLoader::ThreadedLoader(App& app, SharedPtr engine) SharedPtr ThreadedLoader::parser() { - Ingen::Shared::World* world = _app.world(); + Ingen::World* world = _app.world(); if (!world->parser()) world->load_module("serialisation"); @@ -73,7 +73,7 @@ ThreadedLoader::load_patch(bool merge, { _mutex.lock(); - Ingen::Shared::World* world = _app.world(); + Ingen::World* world = _app.world(); Glib::ustring engine_base = ""; if (engine_parent) { diff --git a/src/gui/WidgetFactory.cpp b/src/gui/WidgetFactory.cpp index 572b3870..5e5b987a 100644 --- a/src/gui/WidgetFactory.cpp +++ b/src/gui/WidgetFactory.cpp @@ -19,7 +19,7 @@ #include "raul/log.hpp" -#include "ingen/shared/runtime_paths.hpp" +#include "ingen/runtime_paths.hpp" #include "WidgetFactory.hpp" @@ -44,7 +44,7 @@ void WidgetFactory::find_ui_file() { // Try file in bundle (directory where executable resides) - ui_filename = Shared::bundle_file_path("ingen_gui.ui"); + ui_filename = Ingen::bundle_file_path("ingen_gui.ui"); if (is_readable(ui_filename)) return; @@ -56,7 +56,7 @@ WidgetFactory::find_ui_file() } // Try the default system installed path - ui_filename = Shared::data_file_path("ingen_gui.ui"); + ui_filename = Ingen::data_file_path("ingen_gui.ui"); if (is_readable(ui_filename)) return; diff --git a/src/gui/ingen_gui.cpp b/src/gui/ingen_gui.cpp index a2aa906e..d5c15ca9 100644 --- a/src/gui/ingen_gui.cpp +++ b/src/gui/ingen_gui.cpp @@ -14,14 +14,14 @@ along with Ingen. If not, see . */ -#include "ingen/shared/Module.hpp" +#include "ingen/Module.hpp" #include "App.hpp" -struct IngenGUIModule : public Ingen::Shared::Module { - void load(Ingen::Shared::World* world) { +struct IngenGUIModule : public Ingen::Module { + void load(Ingen::World* world) { app = Ingen::GUI::App::create(world); } - void run(Ingen::Shared::World* world) { + void run(Ingen::World* world) { app->run(); } @@ -30,7 +30,7 @@ struct IngenGUIModule : public Ingen::Shared::Module { extern "C" { -Ingen::Shared::Module* +Ingen::Module* ingen_module_load() { return new IngenGUIModule(); diff --git a/src/gui/ingen_gui_lv2.cpp b/src/gui/ingen_gui_lv2.cpp index cead2acb..a9eff24d 100644 --- a/src/gui/ingen_gui_lv2.cpp +++ b/src/gui/ingen_gui_lv2.cpp @@ -17,11 +17,11 @@ #include "ingen/client/ClientStore.hpp" #include "ingen/client/PatchModel.hpp" #include "ingen/client/SigClientInterface.hpp" -#include "ingen/shared/AtomReader.hpp" -#include "ingen/shared/AtomSink.hpp" -#include "ingen/shared/AtomWriter.hpp" -#include "ingen/shared/World.hpp" -#include "ingen/shared/runtime_paths.hpp" +#include "ingen/AtomReader.hpp" +#include "ingen/AtomSink.hpp" +#include "ingen/AtomWriter.hpp" +#include "ingen/World.hpp" +#include "ingen/runtime_paths.hpp" #include "lv2/lv2plug.in/ns/extensions/ui/ui.h" #include "App.hpp" @@ -30,8 +30,8 @@ #define INGEN_LV2_UI_URI "http://drobilla.net/ns/ingen#PatchUIGtk2" /** A sink that writes atoms to a port via the UI extension. */ -struct IngenLV2AtomSink : public Ingen::Shared::AtomSink { - IngenLV2AtomSink(Ingen::Shared::URIs& uris, +struct IngenLV2AtomSink : public Ingen::AtomSink { + IngenLV2AtomSink(Ingen::URIs& uris, LV2UI_Write_Function ui_write, LV2UI_Controller ui_controller) : _uris(uris) @@ -48,7 +48,7 @@ struct IngenLV2AtomSink : public Ingen::Shared::AtomSink { return true; } - Ingen::Shared::URIs& _uris; + Ingen::URIs& _uris; LV2UI_Write_Function _ui_write; LV2UI_Controller _ui_controller; }; @@ -64,13 +64,13 @@ struct IngenLV2UI { int argc; char** argv; - Ingen::Shared::Forge* forge; - Ingen::Shared::World* world; + Ingen::Forge* forge; + Ingen::World* world; IngenLV2AtomSink* sink; SharedPtr app; SharedPtr view; SharedPtr engine; - SharedPtr reader; + SharedPtr reader; SharedPtr client; }; @@ -83,7 +83,7 @@ instantiate(const LV2UI_Descriptor* descriptor, LV2UI_Widget* widget, const LV2_Feature* const* features) { - Ingen::Shared::set_bundle_path(bundle_path); + Ingen::set_bundle_path(bundle_path); IngenLV2UI* ui = new IngenLV2UI(); @@ -97,10 +97,9 @@ instantiate(const LV2UI_Descriptor* descriptor, } } - ui->world = new Ingen::Shared::World( - ui->argc, ui->argv, map, unmap); + ui->world = new Ingen::World(ui->argc, ui->argv, map, unmap); - ui->forge = new Ingen::Shared::Forge(ui->world->uri_map()); + ui->forge = new Ingen::Forge(ui->world->uri_map()); if (!ui->world->load_module("client")) { delete ui; @@ -112,7 +111,7 @@ instantiate(const LV2UI_Descriptor* descriptor, // Set up an engine interface that writes LV2 atoms ui->engine = SharedPtr( - new Ingen::Shared::AtomWriter( + new Ingen::AtomWriter( ui->world->uri_map(), ui->world->uris(), *ui->sink)); ui->world->set_interface(ui->engine); @@ -123,11 +122,11 @@ instantiate(const LV2UI_Descriptor* descriptor, new Ingen::Client::SigClientInterface()); ui->app->attach(ui->client); - ui->reader = SharedPtr( - new Ingen::Shared::AtomReader(ui->world->uri_map(), - ui->world->uris(), - ui->world->forge(), - *ui->client.get())); + ui->reader = SharedPtr( + new Ingen::AtomReader(ui->world->uri_map(), + ui->world->uris(), + ui->world->forge(), + *ui->client.get())); // Create empty root patch model Ingen::Resource::Properties props; diff --git a/src/gui/wscript b/src/gui/wscript index 6aa80389..5b5ae362 100644 --- a/src/gui/wscript +++ b/src/gui/wscript @@ -9,7 +9,7 @@ def build(bld): name = 'libingen_gui', target = 'ingen_gui', install_path = '${LIBDIR}', - use = 'libingen_shared libingen_client libingen_serialisation') + use = 'libingen libingen_client libingen_serialisation') autowaf.use_lib(bld, obj, ''' GANV GLADEMM @@ -73,5 +73,5 @@ def build(bld): name = 'ingen_gui_lv2', target = 'ingen_gui_lv2', install_path = '${LV2DIR}/ingen.lv2/', - use = 'libingen_gui libingen_shared') + use = 'libingen libingen_gui') autowaf.use_lib(bld, obj, 'LV2') diff --git a/src/ingen/main.cpp b/src/ingen/main.cpp index 847a08f5..651c7ad0 100644 --- a/src/ingen/main.cpp +++ b/src/ingen/main.cpp @@ -33,9 +33,9 @@ #include "ingen/EngineBase.hpp" #include "ingen/Interface.hpp" #include "ingen/serialisation/Parser.hpp" -#include "ingen/shared/Configuration.hpp" -#include "ingen/shared/World.hpp" -#include "ingen/shared/runtime_paths.hpp" +#include "ingen/Configuration.hpp" +#include "ingen/World.hpp" +#include "ingen/runtime_paths.hpp" #include "ingen/client/ThreadedSigClientInterface.hpp" #ifdef WITH_BINDINGS #include "bindings/ingen_bindings.hpp" @@ -44,7 +44,7 @@ using namespace std; using namespace Ingen; -Ingen::Shared::World* world = NULL; +Ingen::World* world = NULL; void ingen_interrupt(int signal) @@ -75,11 +75,11 @@ int main(int argc, char** argv) { Glib::thread_init(); - Shared::set_bundle_path_from_code((void*)&main); + Ingen::set_bundle_path_from_code((void*)&main); // Create world try { - world = new Ingen::Shared::World(argc, argv, NULL, NULL); + world = new Ingen::World(argc, argv, NULL, NULL); if (argc <= 1) { world->conf().print_usage("ingen", cout); return EXIT_FAILURE; @@ -92,7 +92,7 @@ main(int argc, char** argv) return EXIT_FAILURE; } - Shared::Configuration& conf = world->conf(); + Configuration& conf = world->conf(); if (conf.option("uuid").is_valid()) { world->set_jack_uuid(conf.option("uuid").get_string()); } diff --git a/src/runtime_paths.cpp b/src/runtime_paths.cpp new file mode 100644 index 00000000..352afa42 --- /dev/null +++ b/src/runtime_paths.cpp @@ -0,0 +1,114 @@ +/* + This file is part of Ingen. + Copyright 2007-2012 David Robillard + + Ingen is free software: you can redistribute it and/or modify it under the + terms of the GNU Affero General Public License as published by the Free + Software Foundation, either version 3 of the License, or any later version. + + Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. + + You should have received a copy of the GNU Affero General Public License + along with Ingen. If not, see . +*/ + +#include + +#include +#include + +#include + +#include +#include + +#include "raul/log.hpp" + +#include "ingen/runtime_paths.hpp" + +#include "ingen_config.h" + +using namespace std; + +namespace Ingen { + +static std::string bundle_path; + +/** Must be called once at startup, and passed a pointer to a function + * that lives in the 'top level' of the bundle (e.g. the executable). + * Passing a function defined in a module etc. will not work! + */ +void +set_bundle_path_from_code(void* function) +{ + Dl_info dli; + dladdr(function, &dli); + +#ifdef BUNDLE + char bin_loc[PATH_MAX]; + realpath(dli.dli_fname, bin_loc); +#else + const char* bin_loc = dli.dli_fname; +#endif + + Raul::info(Raul::fmt("Binary location: %1%\n") % bin_loc); + + string bundle = bin_loc; + bundle = bundle.substr(0, bundle.find_last_of(G_DIR_SEPARATOR)); + bundle_path = bundle; +} + +void +set_bundle_path(const char* path) +{ + bundle_path = path; +} + +/** Return the absolute path of a file in an Ingen LV2 bundle + */ +std::string +bundle_file_path(const std::string& name) +{ + return Glib::build_filename(bundle_path, name); +} + +/** Return the absolute path of a 'resource' file. + */ +std::string +data_file_path(const std::string& name) +{ +#ifdef BUNDLE + return Glib::build_filename(bundle_path, Glib::build_path(INGEN_DATA_DIR, name)); +#else + return Glib::build_filename(INGEN_DATA_DIR, name); +#endif +} + +/** Return the absolute path of a module (dynamically loaded shared library). + */ +std::string +module_path(const std::string& name, std::string dir) +{ + std::string ret; + if (dir == "") { +#ifdef BUNDLE + dir = Glib::build_path(bundle_path, INGEN_MODULE_DIR); +#else + dir = INGEN_MODULE_DIR; +#endif + } + + ret = Glib::Module::build_path(dir, string("ingen_") + name); + +#ifdef __APPLE__ + // MacPorts glib doesnt seem to do portable path building correctly... + if (ret.substr(ret.length() - 3) == ".so") + ret = ret.substr(0, ret.length() - 2).append("dylib"); +#endif + return ret; +} + +} // namespace Ingen + diff --git a/src/serialisation/Parser.cpp b/src/serialisation/Parser.cpp index 3033f538..f124722c 100644 --- a/src/serialisation/Parser.cpp +++ b/src/serialisation/Parser.cpp @@ -26,9 +26,9 @@ #include "ingen/Interface.hpp" #include "ingen/serialisation/Parser.hpp" -#include "ingen/shared/URIMap.hpp" -#include "ingen/shared/URIs.hpp" -#include "ingen/shared/World.hpp" +#include "ingen/URIMap.hpp" +#include "ingen/URIs.hpp" +#include "ingen/World.hpp" #include "raul/Atom.hpp" #include "raul/log.hpp" #include "serd/serd.h" @@ -42,7 +42,6 @@ using namespace std; using namespace Raul; -using namespace Ingen::Shared; typedef set RDFNodes; @@ -95,9 +94,9 @@ skip_property(const Sord::Node& predicate) } static Resource::Properties -get_properties(Ingen::Shared::World* world, - Sord::Model& model, - const Sord::Node& subject) +get_properties(Ingen::World* world, + Sord::Model& model, + const Sord::Node& subject) { SerdChunk out = { NULL, 0 }; LV2_URID_Map* map = &world->uri_map().urid_map_feature()->urid_map; @@ -136,11 +135,11 @@ get_properties(Ingen::Shared::World* world, typedef std::pair PortRecord; static int -get_port(Ingen::Shared::World* world, - Sord::Model& model, - const Sord::Node& subject, - const Raul::Path& parent, - PortRecord& record) +get_port(Ingen::World* world, + Sord::Model& model, + const Sord::Node& subject, + const Raul::Path& parent, + PortRecord& record) { const URIs& uris = world->uris(); @@ -172,7 +171,7 @@ get_port(Ingen::Shared::World* world, static boost::optional parse( - Shared::World* world, + World* world, Interface* target, Sord::Model& model, Glib::ustring document_uri, @@ -183,7 +182,7 @@ parse( static boost::optional parse_patch( - Shared::World* world, + World* world, Interface* target, Sord::Model& model, const Sord::Node& subject, @@ -193,7 +192,7 @@ parse_patch( static boost::optional parse_node( - Shared::World* world, + World* world, Interface* target, Sord::Model& model, const Sord::Node& subject, @@ -202,7 +201,7 @@ parse_node( static bool parse_properties( - Shared::World* world, + World* world, Interface* target, Sord::Model& model, const Sord::Node& subject, @@ -211,14 +210,14 @@ parse_properties( static bool parse_edges( - Shared::World* world, + World* world, Interface* target, Sord::Model& model, const Sord::Node& subject, const Raul::Path& patch); static boost::optional -parse_node(Ingen::Shared::World* world, +parse_node(Ingen::World* world, Ingen::Interface* target, Sord::Model& model, const Sord::Node& subject, @@ -281,7 +280,7 @@ parse_node(Ingen::Shared::World* world, } static boost::optional -parse_patch(Ingen::Shared::World* world, +parse_patch(Ingen::World* world, Ingen::Interface* target, Sord::Model& model, const Sord::Node& subject_node, @@ -402,11 +401,11 @@ parse_patch(Ingen::Shared::World* world, } static bool -parse_edge(Ingen::Shared::World* world, - Ingen::Interface* target, - Sord::Model& model, - const Sord::Node& subject, - const Raul::Path& parent) +parse_edge(Ingen::World* world, + Ingen::Interface* target, + Sord::Model& model, + const Sord::Node& subject, + const Raul::Path& parent) { const Sord::URI ingen_tail(*world->rdf_world(), NS_INGEN "tail"); const Sord::URI ingen_head(*world->rdf_world(), NS_INGEN "head"); @@ -444,11 +443,11 @@ parse_edge(Ingen::Shared::World* world, } static bool -parse_edges(Ingen::Shared::World* world, - Ingen::Interface* target, - Sord::Model& model, - const Sord::Node& subject, - const Raul::Path& parent) +parse_edges(Ingen::World* world, + Ingen::Interface* target, + Sord::Model& model, + const Sord::Node& subject, + const Raul::Path& parent) { const Sord::URI ingen_edge(*world->rdf_world(), NS_INGEN "edge"); const Sord::Node nil; @@ -461,7 +460,7 @@ parse_edges(Ingen::Shared::World* world, } static bool -parse_properties(Ingen::Shared::World* world, +parse_properties(Ingen::World* world, Ingen::Interface* target, Sord::Model& model, const Sord::Node& subject, @@ -480,7 +479,7 @@ parse_properties(Ingen::Shared::World* world, } static boost::optional -parse(Ingen::Shared::World* world, +parse(Ingen::World* world, Ingen::Interface* target, Sord::Model& model, Glib::ustring document_uri, @@ -562,7 +561,7 @@ parse(Ingen::Shared::World* world, * @return whether or not load was successful. */ bool -Parser::parse_file(Ingen::Shared::World* world, +Parser::parse_file(Ingen::World* world, Ingen::Interface* target, Glib::ustring path, boost::optional parent, @@ -617,7 +616,7 @@ Parser::parse_file(Ingen::Shared::World* world, } bool -Parser::parse_string(Ingen::Shared::World* world, +Parser::parse_string(Ingen::World* world, Ingen::Interface* target, const Glib::ustring& str, const Glib::ustring& base_uri, diff --git a/src/serialisation/Serialiser.cpp b/src/serialisation/Serialiser.cpp index d0ed16ca..c1842022 100644 --- a/src/serialisation/Serialiser.cpp +++ b/src/serialisation/Serialiser.cpp @@ -32,10 +32,10 @@ #include "ingen/Plugin.hpp" #include "ingen/Resource.hpp" #include "ingen/serialisation/Serialiser.hpp" -#include "ingen/shared/Store.hpp" -#include "ingen/shared/URIMap.hpp" -#include "ingen/shared/URIs.hpp" -#include "ingen/shared/World.hpp" +#include "ingen/Store.hpp" +#include "ingen/URIMap.hpp" +#include "ingen/URIs.hpp" +#include "ingen/World.hpp" #include "lv2/lv2plug.in/ns/ext/state/state.h" #include "lv2/lv2plug.in/ns/extensions/ui/ui.h" #include "raul/Path.hpp" @@ -49,13 +49,12 @@ using namespace std; using namespace Raul; using namespace Sord; using namespace Ingen; -using namespace Ingen::Shared; namespace Ingen { namespace Serialisation { struct Serialiser::Impl { - explicit Impl(Shared::World& world) + explicit Impl(World& world) : _root_path("/") , _world(world) , _model(NULL) @@ -99,16 +98,16 @@ struct Serialiser::Impl { std::string finish(); - Raul::Path _root_path; - SharedPtr _store; - Mode _mode; - std::string _base_uri; - Shared::World& _world; - Sord::Model* _model; - Sratom* _sratom; + Raul::Path _root_path; + SharedPtr _store; + Mode _mode; + std::string _base_uri; + World& _world; + Sord::Model* _model; + Sratom* _sratom; }; -Serialiser::Serialiser(Shared::World& world) +Serialiser::Serialiser(World& world) : me(new Impl(world)) {} diff --git a/src/serialisation/serialisation.cpp b/src/serialisation/serialisation.cpp index b425e4ad..3c650dc6 100644 --- a/src/serialisation/serialisation.cpp +++ b/src/serialisation/serialisation.cpp @@ -14,16 +14,16 @@ along with Ingen. If not, see . */ -#include "ingen/shared/Module.hpp" -#include "ingen/shared/World.hpp" +#include "ingen/Module.hpp" +#include "ingen/World.hpp" #include "ingen/serialisation/Parser.hpp" #include "ingen/serialisation/Serialiser.hpp" using namespace Ingen; -struct IngenSerialisationModule : public Ingen::Shared::Module { - virtual void load(Ingen::Shared::World* world) { +struct IngenSerialisationModule : public Ingen::Module { + virtual void load(Ingen::World* world) { world->set_parser(SharedPtr( new Serialisation::Parser())); world->set_serialiser(SharedPtr( @@ -33,7 +33,7 @@ struct IngenSerialisationModule : public Ingen::Shared::Module { extern "C" { -Ingen::Shared::Module* +Ingen::Module* ingen_module_load() { return new IngenSerialisationModule(); } diff --git a/src/serialisation/wscript b/src/serialisation/wscript index 23924970..190b1aee 100644 --- a/src/serialisation/wscript +++ b/src/serialisation/wscript @@ -11,7 +11,7 @@ def build(bld): name = 'libingen_serialisation', target = 'ingen_serialisation', install_path = '${LIBDIR}', - use = 'libingen_shared') + use = 'libingen') autowaf.use_lib(bld, obj, 'GLIBMM LV2 LILV RAUL SORD SRATOM') if bld.env['BUILD_TESTS']: @@ -24,7 +24,7 @@ def build(bld): name = 'libingen_serialisation_profiled', target = 'ingen_serialisation_profiled', install_path = '', - use = 'libingen_shared_profiled', + use = 'libingen_profiled', lib = bld.env['INGEN_TEST_LIBS'], cxxflags = bld.env['INGEN_TEST_CXXFLAGS']) autowaf.use_lib(bld, obj, 'GLIBMM LV2 LILV RAUL SORD SRATOM') diff --git a/src/server/AudioBuffer.hpp b/src/server/AudioBuffer.hpp index 4836b05b..69558a1f 100644 --- a/src/server/AudioBuffer.hpp +++ b/src/server/AudioBuffer.hpp @@ -23,7 +23,7 @@ #include -#include "ingen/shared/URIs.hpp" +#include "ingen/URIs.hpp" #include "Buffer.hpp" #include "BufferFactory.hpp" diff --git a/src/server/Broadcaster.hpp b/src/server/Broadcaster.hpp index 32a1ab92..85b133b3 100644 --- a/src/server/Broadcaster.hpp +++ b/src/server/Broadcaster.hpp @@ -32,8 +32,6 @@ namespace Ingen { namespace Server { -class GraphObjectImpl; - /** Broadcaster for all clients. * * This is an Interface that forwards all messages to all registered diff --git a/src/server/Buffer.cpp b/src/server/Buffer.cpp index 5438b4ce..e877533a 100644 --- a/src/server/Buffer.cpp +++ b/src/server/Buffer.cpp @@ -22,9 +22,9 @@ #include -#include "ingen/shared/URIMap.hpp" -#include "ingen/shared/URIs.hpp" -#include "ingen/shared/World.hpp" +#include "ingen/URIMap.hpp" +#include "ingen/URIs.hpp" +#include "ingen/World.hpp" #include "ingen_config.h" #include "lv2/lv2plug.in/ns/ext/atom/util.h" #include "raul/log.hpp" diff --git a/src/server/BufferFactory.cpp b/src/server/BufferFactory.cpp index 2bcf8201..59da152f 100644 --- a/src/server/BufferFactory.cpp +++ b/src/server/BufferFactory.cpp @@ -14,7 +14,7 @@ along with Ingen. If not, see . */ -#include "ingen/shared/URIs.hpp" +#include "ingen/URIs.hpp" #include "raul/log.hpp" #include "AudioBuffer.hpp" @@ -27,7 +27,7 @@ namespace Server { static const size_t EVENT_BYTES_PER_FRAME = 4; // FIXME -BufferFactory::BufferFactory(Engine& engine, Shared::URIs& uris) +BufferFactory::BufferFactory(Engine& engine, URIs& uris) : _engine(engine) , _uris(uris) , _silent_buffer(NULL) @@ -42,7 +42,7 @@ BufferFactory::~BufferFactory() free_list(_free_object.get()); } -Shared::Forge& +Forge& BufferFactory::forge() { return _engine.world()->forge(); diff --git a/src/server/BufferFactory.hpp b/src/server/BufferFactory.hpp index 366c2ffa..11d31b2d 100644 --- a/src/server/BufferFactory.hpp +++ b/src/server/BufferFactory.hpp @@ -26,8 +26,8 @@ #include "raul/AtomicPtr.hpp" #include "raul/RingBuffer.hpp" #include "raul/SharedPtr.hpp" -#include "ingen/shared/Forge.hpp" -#include "ingen/shared/URIs.hpp" +#include "ingen/Forge.hpp" +#include "ingen/URIs.hpp" #include "Buffer.hpp" #include "BufferRef.hpp" @@ -36,7 +36,7 @@ namespace Ingen { -namespace Shared { class URIs; } +class URIs; namespace Server { @@ -45,7 +45,7 @@ class Engine; class BufferFactory { public: - BufferFactory(Engine& engine, Shared::URIs& uris); + BufferFactory(Engine& engine, URIs& uris); ~BufferFactory(); static uint32_t audio_buffer_size(SampleCount nframes); @@ -60,9 +60,9 @@ public: void set_block_length(SampleCount block_length); - Shared::Forge& forge(); - Shared::URIs& uris() { return _uris; } - Engine& engine() { return _engine; } + Forge& forge(); + URIs& uris() { return _uris; } + Engine& engine() { return _engine; } private: friend class Buffer; @@ -86,9 +86,9 @@ private: Raul::AtomicPtr _free_control; Raul::AtomicPtr _free_object; - Glib::Mutex _mutex; - Engine& _engine; - Shared::URIs& _uris; + Glib::Mutex _mutex; + Engine& _engine; + URIs& _uris; BufferRef _silent_buffer; }; diff --git a/src/server/Context.cpp b/src/server/Context.cpp index 7d47800f..cd42b8d1 100644 --- a/src/server/Context.cpp +++ b/src/server/Context.cpp @@ -14,8 +14,8 @@ along with Ingen. If not, see . */ -#include "ingen/shared/Forge.hpp" -#include "ingen/shared/URIMap.hpp" +#include "ingen/Forge.hpp" +#include "ingen/URIMap.hpp" #include "raul/log.hpp" #include "Context.hpp" diff --git a/src/server/Context.hpp b/src/server/Context.hpp index 70bf9949..2311f7d2 100644 --- a/src/server/Context.hpp +++ b/src/server/Context.hpp @@ -17,7 +17,7 @@ #ifndef INGEN_ENGINE_CONTEXT_HPP #define INGEN_ENGINE_CONTEXT_HPP -#include "ingen/shared/World.hpp" +#include "ingen/World.hpp" #include "raul/Atom.hpp" #include "raul/RingBuffer.hpp" diff --git a/src/server/ControlBindings.cpp b/src/server/ControlBindings.cpp index 023f38c1..cec5a83c 100644 --- a/src/server/ControlBindings.cpp +++ b/src/server/ControlBindings.cpp @@ -16,9 +16,9 @@ #include -#include "ingen/shared/URIMap.hpp" -#include "ingen/shared/URIs.hpp" -#include "ingen/shared/World.hpp" +#include "ingen/URIMap.hpp" +#include "ingen/URIs.hpp" +#include "ingen/World.hpp" #include "lv2/lv2plug.in/ns/ext/atom/util.h" #include "raul/log.hpp" #include "raul/midi_events.h" @@ -59,7 +59,7 @@ ControlBindings::Key ControlBindings::port_binding(PortImpl* port) const { ThreadManager::assert_thread(THREAD_PRE_PROCESS); - const Ingen::Shared::URIs& uris = _engine.world()->uris(); + const Ingen::URIs& uris = _engine.world()->uris(); const Raul::Atom& binding = port->get_property(uris.ingen_controlBinding); return binding_key(binding); } @@ -67,7 +67,7 @@ ControlBindings::port_binding(PortImpl* port) const ControlBindings::Key ControlBindings::binding_key(const Raul::Atom& binding) const { - const Ingen::Shared::URIs& uris = _engine.world()->uris(); + const Ingen::URIs& uris = _engine.world()->uris(); Key key; LV2_Atom* num = NULL; if (binding.type() == uris.atom_Blank) { @@ -141,8 +141,8 @@ ControlBindings::port_value_changed(ProcessContext& context, Key key, const Raul::Atom& value_atom) { - Ingen::Shared::World* world = context.engine().world(); - const Ingen::Shared::URIs& uris = world->uris(); + Ingen::World* world = context.engine().world(); + const Ingen::URIs& uris = world->uris(); if (key) { int16_t value = port_value_to_control( context, port, key.type, value_atom); @@ -279,7 +279,7 @@ ControlBindings::port_value_to_control(ProcessContext& context, } static void -forge_binding(const Shared::URIs& uris, +forge_binding(const URIs& uris, LV2_Atom_Forge* forge, ControlBindings::Type binding_type, int32_t value) @@ -329,7 +329,7 @@ ControlBindings::set_port_value(ProcessContext& context, reinterpret_cast(port->buffer(v).get())->set_value( port_value.get_float(), context.start(), context.start()); - Shared::URIs& uris = context.engine().world()->uris(); + URIs& uris = context.engine().world()->uris(); context.notify(uris.ingen_value, context.start(), port, port_value.size(), port_value.type(), port_value.get_body()); } @@ -337,7 +337,7 @@ ControlBindings::set_port_value(ProcessContext& context, bool ControlBindings::bind(ProcessContext& context, Key key) { - const Ingen::Shared::URIs& uris = context.engine().world()->uris(); + const Ingen::URIs& uris = context.engine().world()->uris(); assert(_learn_port); if (key.type == MIDI_NOTE) { if (!_learn_port->is_toggled()) @@ -410,8 +410,8 @@ ControlBindings::pre_process(ProcessContext& context, Buffer* buffer) SharedPtr bindings = _bindings; _feedback->clear(); - Ingen::Shared::World* world = context.engine().world(); - const Ingen::Shared::URIs& uris = world->uris(); + Ingen::World* world = context.engine().world(); + const Ingen::URIs& uris = world->uris(); if (!_learn_port && bindings->empty()) { // Don't bother reading input diff --git a/src/server/DuplexPort.cpp b/src/server/DuplexPort.cpp index 6d332ad6..c3b1a6b7 100644 --- a/src/server/DuplexPort.cpp +++ b/src/server/DuplexPort.cpp @@ -16,7 +16,7 @@ #include -#include "ingen/shared/URIs.hpp" +#include "ingen/URIs.hpp" #include "Buffer.hpp" #include "DuplexPort.hpp" diff --git a/src/server/EdgeImpl.cpp b/src/server/EdgeImpl.cpp index 46d45f27..7fad4e94 100644 --- a/src/server/EdgeImpl.cpp +++ b/src/server/EdgeImpl.cpp @@ -14,7 +14,7 @@ along with Ingen. If not, see . */ -#include "ingen/shared/URIs.hpp" +#include "ingen/URIs.hpp" #include "lv2/lv2plug.in/ns/ext/atom/util.h" #include "raul/log.hpp" @@ -106,7 +106,7 @@ EdgeImpl::queue(Context& context) if (!must_queue()) return; - const Ingen::Shared::URIs& uris = _tail->bufs().uris(); + const Ingen::URIs& uris = _tail->bufs().uris(); BufferRef src_buf = _tail->buffer(0); if (src_buf->atom()->type != uris.atom_Sequence) { @@ -152,7 +152,7 @@ EdgeImpl::must_queue() const bool EdgeImpl::can_connect(const OutputPort* src, const InputPort* dst) { - const Ingen::Shared::URIs& uris = src->bufs().uris(); + const Ingen::URIs& uris = src->bufs().uris(); return ( // (Audio | Control | CV) => (Audio | Control | CV) ( (src->is_a(PortType::CONTROL) || diff --git a/src/server/Engine.cpp b/src/server/Engine.cpp index 30350d52..3e7ab4d0 100644 --- a/src/server/Engine.cpp +++ b/src/server/Engine.cpp @@ -17,10 +17,10 @@ #include #include "events/CreatePort.hpp" -#include "ingen/shared/Configuration.hpp" -#include "ingen/shared/Store.hpp" -#include "ingen/shared/URIs.hpp" -#include "ingen/shared/World.hpp" +#include "ingen/Configuration.hpp" +#include "ingen/Store.hpp" +#include "ingen/URIs.hpp" +#include "ingen/World.hpp" #include "raul/Maid.hpp" #include "raul/SharedPtr.hpp" @@ -50,7 +50,7 @@ namespace Server { Raul::ThreadVar ThreadManager::flags(0); bool ThreadManager::single_threaded(true); -Engine::Engine(Ingen::Shared::World* a_world) +Engine::Engine(Ingen::World* a_world) : _world(a_world) , _broadcaster(new Broadcaster()) , _control_bindings(NULL) @@ -72,7 +72,7 @@ Engine::Engine(Ingen::Shared::World* a_world) } else { _buffer_factory = new BufferFactory(*this, a_world->uris()); a_world->set_store( - SharedPtr( + SharedPtr( new EngineStore(SharedPtr(_buffer_factory)))); } @@ -88,7 +88,7 @@ Engine::~Engine() SharedPtr store = engine_store(); if (store) for (EngineStore::iterator i = store->begin(); i != store->end(); ++i) - if ( ! PtrCast(i->second)->parent() ) + if (!PtrCast(i->second)->parent()) i->second.reset(); delete _maid; @@ -181,8 +181,8 @@ Engine::activate() _pre_processor->start(); _message_context.Thread::start(); - const Ingen::Shared::URIs& uris = world()->uris(); - Shared::Forge& forge = world()->forge(); + const Ingen::URIs& uris = world()->uris(); + Forge& forge = world()->forge(); // Create root patch if (!_root_patch) { diff --git a/src/server/Engine.hpp b/src/server/Engine.hpp index 4ee14988..c4290d60 100644 --- a/src/server/Engine.hpp +++ b/src/server/Engine.hpp @@ -30,7 +30,7 @@ namespace Raul { class Maid; } namespace Ingen { -namespace Shared { class World; } +class World; namespace Server { @@ -54,14 +54,14 @@ class Worker; This is a simple class that provides pointers to the various components that make up the engine implementation. In processes with a local engine, - it can be accessed via the Ingen::Shared::World. + it can be accessed via the Ingen::World. @ingroup engine */ class Engine : public boost::noncopyable, public EngineBase { public: - explicit Engine(Ingen::Shared::World* world); + explicit Engine(Ingen::World* world); virtual ~Engine(); @@ -91,7 +91,7 @@ public: return &context == &_process_context; } - Ingen::Shared::World* world() const { return _world; } + Ingen::World* world() const { return _world; } EventWriter* interface() const { return _event_writer; } Broadcaster* broadcaster() const { return _broadcaster; } @@ -112,7 +112,7 @@ public: size_t event_queue_size() const; private: - Ingen::Shared::World* _world; + Ingen::World* _world; Broadcaster* _broadcaster; BufferFactory* _buffer_factory; diff --git a/src/server/EngineStore.hpp b/src/server/EngineStore.hpp index ccac2b74..8b16335f 100644 --- a/src/server/EngineStore.hpp +++ b/src/server/EngineStore.hpp @@ -19,7 +19,7 @@ #include "raul/SharedPtr.hpp" -#include "ingen/shared/Store.hpp" +#include "ingen/Store.hpp" namespace Ingen { @@ -28,10 +28,10 @@ class GraphObject; namespace Server { class BufferFactory; -class GraphObjectImpl; class NodeImpl; class PatchImpl; class PortImpl; +class GraphObjectImpl; /** Storage for all GraphObjects (tree of GraphObject's sorted by path). * @@ -42,7 +42,7 @@ class PortImpl; * Searching with find*() is fast (O(log(n)) binary search on contiguous * memory) and realtime safe, but modification (add or remove) are neither. */ -class EngineStore : public Ingen::Shared::Store +class EngineStore : public Ingen::Store { public: explicit EngineStore(SharedPtr f) : _factory(f) {} diff --git a/src/server/EventWriter.cpp b/src/server/EventWriter.cpp index 43cf25ac..c913c17a 100644 --- a/src/server/EventWriter.cpp +++ b/src/server/EventWriter.cpp @@ -14,7 +14,7 @@ along with Ingen. If not, see . */ -#include "ingen/shared/URIs.hpp" +#include "ingen/URIs.hpp" #include "Engine.hpp" #include "EventWriter.hpp" diff --git a/src/server/GraphObjectImpl.cpp b/src/server/GraphObjectImpl.cpp index 050992c8..0d07b510 100644 --- a/src/server/GraphObjectImpl.cpp +++ b/src/server/GraphObjectImpl.cpp @@ -25,9 +25,9 @@ using namespace std; namespace Ingen { namespace Server { -GraphObjectImpl::GraphObjectImpl(Ingen::Shared::URIs& uris, - GraphObjectImpl* parent, - const Raul::Symbol& symbol) +GraphObjectImpl::GraphObjectImpl(Ingen::URIs& uris, + GraphObjectImpl* parent, + const Raul::Symbol& symbol) : GraphObject(uris, parent ? parent->path().child(symbol) : "/") , _parent(parent) , _path(parent ? parent->path().child(symbol) : "/") diff --git a/src/server/GraphObjectImpl.hpp b/src/server/GraphObjectImpl.hpp index 5df7b565..45a9e979 100644 --- a/src/server/GraphObjectImpl.hpp +++ b/src/server/GraphObjectImpl.hpp @@ -93,9 +93,9 @@ public: ProcessContext& context, Raul::Maid& maid, uint32_t poly) = 0; protected: - GraphObjectImpl(Ingen::Shared::URIs& uris, - GraphObjectImpl* parent, - const Raul::Symbol& symbol); + GraphObjectImpl(Ingen::URIs& uris, + GraphObjectImpl* parent, + const Raul::Symbol& symbol); GraphObjectImpl* _parent; Raul::Path _path; diff --git a/src/server/InputPort.cpp b/src/server/InputPort.cpp index 90d01cca..796bfe52 100644 --- a/src/server/InputPort.cpp +++ b/src/server/InputPort.cpp @@ -24,7 +24,7 @@ #include "NodeImpl.hpp" #include "OutputPort.hpp" #include "ProcessContext.hpp" -#include "ingen/shared/URIs.hpp" +#include "ingen/URIs.hpp" #include "mix.hpp" using namespace std; @@ -44,7 +44,7 @@ InputPort::InputPort(BufferFactory& bufs, : PortImpl(bufs, parent, symbol, index, poly, type, buffer_type, value, buffer_size) , _num_edges(0) { - const Ingen::Shared::URIs& uris = bufs.uris(); + const Ingen::URIs& uris = bufs.uris(); if (parent->graph_type() != GraphObject::PATCH) { add_property(uris.rdf_type, uris.lv2_InputPort); diff --git a/src/server/InternalPlugin.cpp b/src/server/InternalPlugin.cpp index f88b696e..587acaf6 100644 --- a/src/server/InternalPlugin.cpp +++ b/src/server/InternalPlugin.cpp @@ -16,7 +16,7 @@ #include #include -#include "ingen/shared/URIs.hpp" +#include "ingen/URIs.hpp" #include "internals/Controller.hpp" #include "internals/Delay.hpp" #include "internals/Note.hpp" @@ -32,7 +32,7 @@ namespace Server { using namespace Internals; -InternalPlugin::InternalPlugin(Shared::URIs& uris, +InternalPlugin::InternalPlugin(URIs& uris, const std::string& uri, const std::string& symbol) : PluginImpl(uris, Plugin::Internal, uri) diff --git a/src/server/InternalPlugin.hpp b/src/server/InternalPlugin.hpp index 79669420..5c89e3c0 100644 --- a/src/server/InternalPlugin.hpp +++ b/src/server/InternalPlugin.hpp @@ -38,7 +38,7 @@ class BufferFactory; class InternalPlugin : public PluginImpl { public: - InternalPlugin(Shared::URIs& uris, + InternalPlugin(URIs& uris, const std::string& uri, const std::string& symbol); diff --git a/src/server/JackDriver.cpp b/src/server/JackDriver.cpp index 3dcf6072..db535a0f 100644 --- a/src/server/JackDriver.cpp +++ b/src/server/JackDriver.cpp @@ -26,9 +26,9 @@ #include "ingen/serialisation/Serialiser.hpp" #endif -#include "ingen/shared/Configuration.hpp" -#include "ingen/shared/LV2Features.hpp" -#include "ingen/shared/World.hpp" +#include "ingen/Configuration.hpp" +#include "ingen/LV2Features.hpp" +#include "ingen/World.hpp" #include "lv2/lv2plug.in/ns/ext/atom/util.h" #include "raul/List.hpp" #include "raul/log.hpp" @@ -262,7 +262,7 @@ JackDriver::attach(const std::string& server_name, void JackDriver::activate() { - Shared::World* world = _engine.world(); + World* world = _engine.world(); if (_is_activated) { LOG(Raul::warn)("Jack driver already activated\n"); diff --git a/src/server/LV2Info.cpp b/src/server/LV2Info.cpp index b2554dfe..b7474b76 100644 --- a/src/server/LV2Info.cpp +++ b/src/server/LV2Info.cpp @@ -23,8 +23,8 @@ #include "lv2/lv2plug.in/ns/ext/resize-port/resize-port.h" #include "lv2/lv2plug.in/ns/ext/worker/worker.h" -#include "ingen/shared/World.hpp" -#include "ingen/shared/LV2Features.hpp" +#include "ingen/World.hpp" +#include "ingen/LV2Features.hpp" #include "LV2Info.hpp" #include "LV2ResizeFeature.hpp" @@ -32,7 +32,7 @@ namespace Ingen { namespace Server { -LV2Info::LV2Info(Ingen::Shared::World* world) +LV2Info::LV2Info(Ingen::World* world) : atom_AtomPort(lilv_new_uri(world->lilv_world(), LV2_ATOM__AtomPort)) , atom_bufferType(lilv_new_uri(world->lilv_world(), LV2_ATOM__bufferType)) , atom_supports(lilv_new_uri(world->lilv_world(), LV2_ATOM__supports)) @@ -54,7 +54,7 @@ LV2Info::LV2Info(Ingen::Shared::World* world) assert(world); world->lv2_features().add_feature( - SharedPtr(new ResizeFeature())); + SharedPtr(new ResizeFeature())); } LV2Info::~LV2Info() diff --git a/src/server/LV2Info.hpp b/src/server/LV2Info.hpp index 321561e7..9b6ea9db 100644 --- a/src/server/LV2Info.hpp +++ b/src/server/LV2Info.hpp @@ -18,19 +18,16 @@ #define INGEN_ENGINE_LV2INFO_HPP #include "lilv/lilv.h" -#include "ingen/shared/World.hpp" +#include "ingen/World.hpp" namespace Ingen { - -class Node; - namespace Server { /** Stuff that may need to be passed to an LV2 plugin (i.e. LV2 features). */ class LV2Info { public: - explicit LV2Info(Ingen::Shared::World* world); + explicit LV2Info(Ingen::World* world); ~LV2Info(); LilvNode* atom_AtomPort; @@ -50,11 +47,11 @@ public: LilvNode* rsz_minimumSize; LilvNode* work_schedule; - Ingen::Shared::World& world() { return *_world; } - LilvWorld* lv2_world() { return _world->lilv_world(); } + Ingen::World& world() { return *_world; } + LilvWorld* lv2_world() { return _world->lilv_world(); } private: - Ingen::Shared::World* _world; + Ingen::World* _world; }; } // namespace Server diff --git a/src/server/LV2Node.cpp b/src/server/LV2Node.cpp index a3c0faa4..5861a068 100644 --- a/src/server/LV2Node.cpp +++ b/src/server/LV2Node.cpp @@ -27,8 +27,8 @@ #include "raul/Maid.hpp" #include "raul/Array.hpp" -#include "ingen/shared/URIMap.hpp" -#include "ingen/shared/URIs.hpp" +#include "ingen/URIMap.hpp" +#include "ingen/URIs.hpp" #include "AudioBuffer.hpp" #include "Driver.hpp" @@ -69,10 +69,10 @@ LV2Node::~LV2Node() } SharedPtr -LV2Node::make_instance(Shared::URIs& uris, - SampleRate rate, - uint32_t voice, - bool preparing) +LV2Node::make_instance(URIs& uris, + SampleRate rate, + uint32_t voice, + bool preparing) { LilvInstance* inst = lilv_plugin_instantiate( _lv2_plugin->lilv_plugin(), rate, _features->array()); @@ -192,11 +192,11 @@ LV2Node::apply_poly(ProcessContext& context, Raul::Maid& maid, uint32_t poly) bool LV2Node::instantiate(BufferFactory& bufs) { - const Ingen::Shared::URIs& uris = bufs.uris(); - SharedPtr info = _lv2_plugin->lv2_info(); - const LilvPlugin* plug = _lv2_plugin->lilv_plugin(); - Ingen::Shared::Forge& forge = bufs.forge(); - const uint32_t num_ports = lilv_plugin_get_num_ports(plug); + const Ingen::URIs& uris = bufs.uris(); + SharedPtr info = _lv2_plugin->lv2_info(); + const LilvPlugin* plug = _lv2_plugin->lilv_plugin(); + Ingen::Forge& forge = bufs.forge(); + const uint32_t num_ports = lilv_plugin_get_num_ports(plug); _ports = new Raul::Array(num_ports, NULL); diff --git a/src/server/LV2Node.hpp b/src/server/LV2Node.hpp index 60d412c8..f4d20658 100644 --- a/src/server/LV2Node.hpp +++ b/src/server/LV2Node.hpp @@ -24,7 +24,7 @@ #include "BufferRef.hpp" #include "NodeImpl.hpp" -#include "ingen/shared/LV2Features.hpp" +#include "ingen/LV2Features.hpp" #include "types.hpp" namespace Ingen { @@ -65,10 +65,10 @@ public: SampleCount offset); protected: - SharedPtr make_instance(Shared::URIs& uris, - SampleRate rate, - uint32_t voice, - bool preparing); + SharedPtr make_instance(URIs& uris, + SampleRate rate, + uint32_t voice, + bool preparing); inline LilvInstance* instance(uint32_t voice) { return (LilvInstance*)(*_instances)[voice].get(); @@ -103,12 +103,12 @@ protected: static LV2_Worker_Status work_respond( LV2_Worker_Respond_Handle handle, uint32_t size, const void* data); - LV2Plugin* _lv2_plugin; - Instances* _instances; - Instances* _prepared_instances; - LV2_Worker_Interface* _worker_iface; - Responses _responses; - SharedPtr _features; + LV2Plugin* _lv2_plugin; + Instances* _instances; + Instances* _prepared_instances; + LV2_Worker_Interface* _worker_iface; + Responses _responses; + SharedPtr _features; }; } // namespace Server diff --git a/src/server/LV2Plugin.cpp b/src/server/LV2Plugin.cpp index 9280d520..c5fcd6cc 100644 --- a/src/server/LV2Plugin.cpp +++ b/src/server/LV2Plugin.cpp @@ -16,7 +16,7 @@ #include -#include "ingen/shared/URIs.hpp" +#include "ingen/URIs.hpp" #include "Driver.hpp" #include "Engine.hpp" diff --git a/src/server/LV2ResizeFeature.hpp b/src/server/LV2ResizeFeature.hpp index 978a1c8f..d9a9330f 100644 --- a/src/server/LV2ResizeFeature.hpp +++ b/src/server/LV2ResizeFeature.hpp @@ -19,14 +19,14 @@ #include "raul/log.hpp" #include "lv2/lv2plug.in/ns/ext/resize-port/resize-port.h" -#include "ingen/shared/LV2Features.hpp" +#include "ingen/LV2Features.hpp" #include "NodeImpl.hpp" #include "PortImpl.hpp" namespace Ingen { namespace Server { -struct ResizeFeature : public Ingen::Shared::LV2Features::Feature { +struct ResizeFeature : public Ingen::LV2Features::Feature { static LV2_Resize_Port_Status resize_port( LV2_Resize_Port_Feature_Data data, uint32_t index, @@ -46,7 +46,7 @@ struct ResizeFeature : public Ingen::Shared::LV2Features::Feature { free(feature); } - SharedPtr feature(Shared::World* w, GraphObject* n) { + SharedPtr feature(World* w, GraphObject* n) { NodeImpl* node = dynamic_cast(n); if (!node) return SharedPtr(); diff --git a/src/server/NodeFactory.cpp b/src/server/NodeFactory.cpp index f42d32c8..616a1b35 100644 --- a/src/server/NodeFactory.cpp +++ b/src/server/NodeFactory.cpp @@ -24,7 +24,7 @@ #include "internals/Delay.hpp" #include "internals/Note.hpp" #include "internals/Trigger.hpp" -#include "ingen/shared/World.hpp" +#include "ingen/World.hpp" #include "InternalPlugin.hpp" #include "LV2Plugin.hpp" @@ -38,7 +38,7 @@ namespace Server { using namespace Internals; -NodeFactory::NodeFactory(Ingen::Shared::World* world) +NodeFactory::NodeFactory(Ingen::World* world) : _world(world) , _lv2_info(new LV2Info(world)) , _has_loaded(false) @@ -91,7 +91,7 @@ NodeFactory::load_plugins() void NodeFactory::load_internal_plugins() { - Ingen::Shared::URIs& uris = _world->uris(); + Ingen::URIs& uris = _world->uris(); InternalPlugin* controller_plug = ControllerNode::internal_plugin(uris); _plugins.insert(make_pair(controller_plug->uri(), controller_plug)); diff --git a/src/server/NodeFactory.hpp b/src/server/NodeFactory.hpp index 2188266b..a6811c9c 100644 --- a/src/server/NodeFactory.hpp +++ b/src/server/NodeFactory.hpp @@ -22,7 +22,7 @@ #include "raul/SharedPtr.hpp" #include "raul/URI.hpp" -#include "ingen/shared/World.hpp" +#include "ingen/World.hpp" namespace Ingen { namespace Server { @@ -39,7 +39,7 @@ class LV2Info; class NodeFactory { public: - explicit NodeFactory(Ingen::Shared::World* world); + explicit NodeFactory(Ingen::World* world); ~NodeFactory(); void load_plugin(const Raul::URI& uri); @@ -54,10 +54,10 @@ private: void load_lv2_plugins(); void load_internal_plugins(); - Plugins _plugins; - Ingen::Shared::World* _world; - SharedPtr _lv2_info; - bool _has_loaded; + Plugins _plugins; + Ingen::World* _world; + SharedPtr _lv2_info; + bool _has_loaded; }; } // namespace Server diff --git a/src/server/OutputPort.cpp b/src/server/OutputPort.cpp index 30650f90..4c790c0b 100644 --- a/src/server/OutputPort.cpp +++ b/src/server/OutputPort.cpp @@ -14,7 +14,7 @@ along with Ingen. If not, see . */ -#include "ingen/shared/URIs.hpp" +#include "ingen/URIs.hpp" #include "Buffer.hpp" #include "BufferFactory.hpp" diff --git a/src/server/PatchImpl.cpp b/src/server/PatchImpl.cpp index 95bb2132..359122fa 100644 --- a/src/server/PatchImpl.cpp +++ b/src/server/PatchImpl.cpp @@ -17,8 +17,8 @@ #include #include -#include "ingen/shared/URIs.hpp" -#include "ingen/shared/World.hpp" +#include "ingen/URIs.hpp" +#include "ingen/World.hpp" #include "raul/log.hpp" #include "EdgeImpl.hpp" diff --git a/src/server/PatchPlugin.hpp b/src/server/PatchPlugin.hpp index 8f5ca07a..860ddd78 100644 --- a/src/server/PatchPlugin.hpp +++ b/src/server/PatchPlugin.hpp @@ -32,7 +32,7 @@ class NodeImpl; class PatchPlugin : public PluginImpl { public: - PatchPlugin(Shared::URIs& uris, + PatchPlugin(URIs& uris, const std::string& uri, const std::string& symbol, const std::string& name) diff --git a/src/server/PluginImpl.hpp b/src/server/PluginImpl.hpp index 968c43f6..1031c8e3 100644 --- a/src/server/PluginImpl.hpp +++ b/src/server/PluginImpl.hpp @@ -27,7 +27,7 @@ namespace Ingen { -namespace Shared { class URIs; } +class URIs; namespace Server { @@ -44,9 +44,9 @@ class PluginImpl : public Plugin , public boost::noncopyable { public: - PluginImpl(Ingen::Shared::URIs& uris, - Type type, - const std::string& uri) + PluginImpl(Ingen::URIs& uris, + Type type, + const std::string& uri) : Plugin(uris, uri) , _type(type) {} diff --git a/src/server/PortImpl.cpp b/src/server/PortImpl.cpp index 671c8ae2..8c044d7b 100644 --- a/src/server/PortImpl.cpp +++ b/src/server/PortImpl.cpp @@ -14,7 +14,7 @@ along with Ingen. If not, see . */ -#include "ingen/shared/URIs.hpp" +#include "ingen/URIs.hpp" #include "lv2/lv2plug.in/ns/ext/atom/util.h" #include "raul/Array.hpp" #include "raul/Maid.hpp" @@ -65,7 +65,7 @@ PortImpl::PortImpl(BufferFactory& bufs, assert(node != NULL); assert(_poly > 0); - const Ingen::Shared::URIs& uris = bufs.uris(); + const Ingen::URIs& uris = bufs.uris(); set_type(type, buffer_type); @@ -232,8 +232,8 @@ PortImpl::clear_buffers() void PortImpl::broadcast_value(Context& context, bool force) { - Shared::Forge& forge = context.engine().world()->forge(); - Shared::URIs& uris = context.engine().world()->uris(); + Forge& forge = context.engine().world()->forge(); + URIs& uris = context.engine().world()->uris(); LV2_URID key = 0; Raul::Atom val; switch (_type.symbol()) { diff --git a/src/server/PortImpl.hpp b/src/server/PortImpl.hpp index 63efb64f..459c1858 100644 --- a/src/server/PortImpl.hpp +++ b/src/server/PortImpl.hpp @@ -25,9 +25,9 @@ #include "Buffer.hpp" #include "BufferRef.hpp" -#include "Context.hpp" #include "GraphObjectImpl.hpp" #include "PortType.hpp" +#include "ProcessContext.hpp" #include "types.hpp" namespace Raul { class Maid; } diff --git a/src/server/Worker.cpp b/src/server/Worker.cpp index 58cf6104..da0b2047 100644 --- a/src/server/Worker.cpp +++ b/src/server/Worker.cpp @@ -14,7 +14,7 @@ along with Ingen. If not, see . */ -#include "ingen/shared/LV2Features.hpp" +#include "ingen/LV2Features.hpp" #include "lv2/lv2plug.in/ns/ext/worker/worker.h" #include "raul/log.hpp" @@ -80,7 +80,7 @@ delete_feature(LV2_Feature* feature) } SharedPtr -Worker::Schedule::feature(Shared::World* world, GraphObject* n) +Worker::Schedule::feature(World* world, GraphObject* n) { LV2Node* node = dynamic_cast(n); if (!node) { diff --git a/src/server/Worker.hpp b/src/server/Worker.hpp index 785c8fa2..f23597e6 100644 --- a/src/server/Worker.hpp +++ b/src/server/Worker.hpp @@ -17,7 +17,7 @@ #ifndef INGEN_ENGINE_WORKER_HPP #define INGEN_ENGINE_WORKER_HPP -#include "ingen/shared/LV2Features.hpp" +#include "ingen/LV2Features.hpp" #include "lv2/lv2plug.in/ns/ext/worker/worker.h" #include "raul/RingBuffer.hpp" #include "raul/Semaphore.hpp" @@ -33,8 +33,8 @@ class Worker : public Raul::Thread public: Worker(uint32_t buffer_size); - struct Schedule : public Shared::LV2Features::Feature { - SharedPtr feature(Shared::World* world, GraphObject* n); + struct Schedule : public LV2Features::Feature { + SharedPtr feature(World* world, GraphObject* n); }; LV2_Worker_Status request(LV2Node* node, diff --git a/src/server/events/CreateNode.cpp b/src/server/events/CreateNode.cpp index f7e570f0..f1b65fa3 100644 --- a/src/server/events/CreateNode.cpp +++ b/src/server/events/CreateNode.cpp @@ -14,7 +14,7 @@ along with Ingen. If not, see . */ -#include "ingen/shared/URIs.hpp" +#include "ingen/URIs.hpp" #include "raul/Maid.hpp" #include "raul/Path.hpp" @@ -49,7 +49,7 @@ CreateNode::CreateNode(Engine& engine, bool CreateNode::pre_process() { - Ingen::Shared::URIs& uris = _engine.world()->uris(); + Ingen::URIs& uris = _engine.world()->uris(); typedef Resource::Properties::const_iterator iterator; diff --git a/src/server/events/CreatePatch.cpp b/src/server/events/CreatePatch.cpp index 602fe2a4..476ccccb 100644 --- a/src/server/events/CreatePatch.cpp +++ b/src/server/events/CreatePatch.cpp @@ -14,7 +14,7 @@ along with Ingen. If not, see . */ -#include "ingen/shared/URIs.hpp" +#include "ingen/URIs.hpp" #include "raul/Maid.hpp" #include "raul/Path.hpp" @@ -58,7 +58,7 @@ CreatePatch::pre_process() return Event::pre_process_done(PARENT_NOT_FOUND, path.parent()); } - const Ingen::Shared::URIs& uris = _engine.world()->uris(); + const Ingen::URIs& uris = _engine.world()->uris(); typedef Resource::Properties::const_iterator iterator; diff --git a/src/server/events/CreatePort.cpp b/src/server/events/CreatePort.cpp index b89a90cc..c62e858c 100644 --- a/src/server/events/CreatePort.cpp +++ b/src/server/events/CreatePort.cpp @@ -16,8 +16,8 @@ #include -#include "ingen/shared/URIMap.hpp" -#include "ingen/shared/URIs.hpp" +#include "ingen/URIMap.hpp" +#include "ingen/URIs.hpp" #include "raul/Array.hpp" #include "raul/Atom.hpp" #include "raul/Path.hpp" @@ -54,7 +54,7 @@ CreatePort::CreatePort(Engine& engine, , _properties(properties) , _is_output(is_output) { - const Ingen::Shared::URIs& uris = _engine.world()->uris(); + const Ingen::URIs& uris = _engine.world()->uris(); typedef Resource::Properties::const_iterator Iterator; typedef std::pair Range; @@ -96,7 +96,7 @@ CreatePort::pre_process() return Event::pre_process_done(PARENT_NOT_FOUND, _path.parent()); } - const Shared::URIs& uris = _engine.world()->uris(); + const URIs& uris = _engine.world()->uris(); const BufferFactory& buffer_factory = *_engine.buffer_factory(); const uint32_t buf_size = buffer_factory.default_size(_buf_type); diff --git a/src/server/events/Delta.cpp b/src/server/events/Delta.cpp index 4e9ca791..a497bb37 100644 --- a/src/server/events/Delta.cpp +++ b/src/server/events/Delta.cpp @@ -18,7 +18,7 @@ #include -#include "ingen/shared/URIs.hpp" +#include "ingen/URIs.hpp" #include "raul/Maid.hpp" #include "Broadcaster.hpp" @@ -29,7 +29,6 @@ #include "Delta.hpp" #include "Engine.hpp" #include "EngineStore.hpp" -#include "GraphObjectImpl.hpp" #include "PatchImpl.hpp" #include "PluginImpl.hpp" #include "PortImpl.hpp" @@ -39,7 +38,7 @@ #define LOG(s) s << "[Delta] " // #define DUMP 1 -// #include "ingen/shared/URIMap.hpp" +// #include "ingen/URIMap.hpp" namespace Ingen { namespace Server { @@ -115,7 +114,7 @@ Delta::pre_process() return Event::pre_process_done(NOT_FOUND, _subject); } - const Ingen::Shared::URIs& uris = _engine.world()->uris(); + const Ingen::URIs& uris = _engine.world()->uris(); if (is_graph_object && !_object) { Raul::Path path(_subject.str()); @@ -146,16 +145,6 @@ Delta::pre_process() GraphObjectImpl* obj = dynamic_cast(_object); -#if 0 - // If we're replacing (i.e. this is a PUT, not a POST), first remove all properties - // with keys we will later set. This must be done first so a PUT with several properties - // of the same predicate (e.g. rdf:type) retains the multiple values. Only previously - // existing properties should be replaced - if (_replace) - for (Properties::iterator p = _properties.begin(); p != _properties.end(); ++p) - obj->properties().erase(p->first); -#endif - for (Properties::const_iterator p = _remove.begin(); p != _remove.end(); ++p) { const Raul::URI& key = p->first; const Raul::Atom& value = p->second; @@ -260,7 +249,7 @@ Delta::execute(ProcessContext& context) return; } - const Ingen::Shared::URIs& uris = _engine.world()->uris(); + const Ingen::URIs& uris = _engine.world()->uris(); if (_create_event) { _create_event->set_time(_time); diff --git a/src/server/events/DisconnectAll.cpp b/src/server/events/DisconnectAll.cpp index 33cd236b..6632750f 100644 --- a/src/server/events/DisconnectAll.cpp +++ b/src/server/events/DisconnectAll.cpp @@ -59,9 +59,9 @@ DisconnectAll::DisconnectAll(Engine& engine, /** Internal version for use by other events. */ -DisconnectAll::DisconnectAll(Engine& engine, - PatchImpl* parent, - GraphObjectImpl* object) +DisconnectAll::DisconnectAll(Engine& engine, + PatchImpl* parent, + GraphObject* object) : Event(engine) , _parent_path(parent->path()) , _path(object->path()) diff --git a/src/server/events/DisconnectAll.hpp b/src/server/events/DisconnectAll.hpp index a6d5d3d6..12c04ffa 100644 --- a/src/server/events/DisconnectAll.hpp +++ b/src/server/events/DisconnectAll.hpp @@ -50,9 +50,9 @@ public: const Raul::Path& parent, const Raul::Path& object); - DisconnectAll(Engine& engine, - PatchImpl* parent, - GraphObjectImpl* object); + DisconnectAll(Engine& engine, + PatchImpl* parent, + GraphObject* object); ~DisconnectAll(); diff --git a/src/server/events/Get.cpp b/src/server/events/Get.cpp index cc64aaef..f2204e67 100644 --- a/src/server/events/Get.cpp +++ b/src/server/events/Get.cpp @@ -134,7 +134,7 @@ Get::post_process() _engine.broadcaster()->send_plugins_to(_request_client.get(), _plugins); } else if (_uri == "ingen:engine") { // TODO: Keep a proper RDF model of the engine - Shared::URIs& uris = _engine.world()->uris(); + URIs& uris = _engine.world()->uris(); _request_client->set_property( uris.ingen_engine, uris.ingen_sampleRate, diff --git a/src/server/events/Get.hpp b/src/server/events/Get.hpp index adc3f0bb..fd1059ad 100644 --- a/src/server/events/Get.hpp +++ b/src/server/events/Get.hpp @@ -26,7 +26,7 @@ namespace Ingen { namespace Server { -class GraphObjectImpl; +class GraphObject; class PluginImpl; namespace Events { diff --git a/src/server/events/SetPortValue.cpp b/src/server/events/SetPortValue.cpp index e0a56489..52d17c32 100644 --- a/src/server/events/SetPortValue.cpp +++ b/src/server/events/SetPortValue.cpp @@ -14,9 +14,9 @@ along with Ingen. If not, see . */ -#include "ingen/shared/LV2Features.hpp" -#include "ingen/shared/URIs.hpp" -#include "ingen/shared/World.hpp" +#include "ingen/LV2Features.hpp" +#include "ingen/URIs.hpp" +#include "ingen/World.hpp" #include "raul/log.hpp" #include "AudioBuffer.hpp" @@ -96,8 +96,8 @@ SetPortValue::apply(Context& context) return; } - Ingen::Shared::URIs& uris = _engine.world()->uris(); - Buffer* const buf = _port->buffer(0).get(); + Ingen::URIs& uris = _engine.world()->uris(); + Buffer* const buf = _port->buffer(0).get(); AudioBuffer* const abuf = dynamic_cast(buf); if (abuf) { diff --git a/src/server/ingen_engine.cpp b/src/server/ingen_engine.cpp index 6e5665cb..3a0d4324 100644 --- a/src/server/ingen_engine.cpp +++ b/src/server/ingen_engine.cpp @@ -14,16 +14,16 @@ along with Ingen. If not, see . */ -#include "ingen/shared/Module.hpp" -#include "ingen/shared/World.hpp" +#include "ingen/Module.hpp" +#include "ingen/World.hpp" #include "Engine.hpp" #include "EventWriter.hpp" #include "util.hpp" using namespace Ingen; -struct IngenEngineModule : public Ingen::Shared::Module { - virtual void load(Ingen::Shared::World* world) { +struct IngenEngineModule : public Ingen::Module { + virtual void load(Ingen::World* world) { Server::set_denormal_flags(); SharedPtr engine(new Server::Engine(world)); world->set_engine(engine); @@ -36,7 +36,7 @@ struct IngenEngineModule : public Ingen::Shared::Module { extern "C" { -Ingen::Shared::Module* +Ingen::Module* ingen_module_load() { return new IngenEngineModule(); diff --git a/src/server/ingen_jack.cpp b/src/server/ingen_jack.cpp index 415a57a2..6019d1d8 100644 --- a/src/server/ingen_jack.cpp +++ b/src/server/ingen_jack.cpp @@ -16,9 +16,9 @@ #include -#include "ingen/shared/Configuration.hpp" -#include "ingen/shared/Module.hpp" -#include "ingen/shared/World.hpp" +#include "ingen/Configuration.hpp" +#include "ingen/Module.hpp" +#include "ingen/World.hpp" #include "raul/Configuration.hpp" #include "raul/log.hpp" @@ -28,8 +28,8 @@ using namespace std; using namespace Ingen; -struct IngenJackModule : public Ingen::Shared::Module { - void load(Ingen::Shared::World* world) { +struct IngenJackModule : public Ingen::Module { + void load(Ingen::World* world) { if (((Server::Engine*)world->engine().get())->driver()) { Raul::warn << "Engine already has a driver" << std::endl; return; @@ -49,7 +49,7 @@ struct IngenJackModule : public Ingen::Shared::Module { extern "C" { -Ingen::Shared::Module* +Ingen::Module* ingen_module_load() { return new IngenJackModule(); diff --git a/src/server/ingen_lv2.cpp b/src/server/ingen_lv2.cpp index aadb0914..88db9b24 100644 --- a/src/server/ingen_lv2.cpp +++ b/src/server/ingen_lv2.cpp @@ -33,11 +33,11 @@ #include "ingen/Interface.hpp" #include "ingen/serialisation/Parser.hpp" #include "ingen/serialisation/Serialiser.hpp" -#include "ingen/shared/AtomReader.hpp" -#include "ingen/shared/AtomWriter.hpp" -#include "ingen/shared/Store.hpp" -#include "ingen/shared/World.hpp" -#include "ingen/shared/runtime_paths.hpp" +#include "ingen/AtomReader.hpp" +#include "ingen/AtomWriter.hpp" +#include "ingen/Store.hpp" +#include "ingen/World.hpp" +#include "ingen/runtime_paths.hpp" #include "raul/SharedPtr.hpp" #include "raul/Thread.hpp" #include "raul/log.hpp" @@ -109,7 +109,7 @@ public: LV2_Atom_Sequence* seq = (LV2_Atom_Sequence*)_buffer; bool enqueued = false; Buffer* patch_buf = _patch_port->buffer(0).get(); - Shared::URIs& uris = _patch_port->bufs().uris(); + URIs& uris = _patch_port->bufs().uris(); patch_buf->prepare_write(context); LV2_ATOM_SEQUENCE_FOREACH(seq, ev) { if (!patch_buf->append_event( @@ -118,7 +118,7 @@ public: Raul::warn("Failed to write to buffer, event lost!\n"); } - if (Shared::AtomReader::is_message(uris, &ev->body)) { + if (AtomReader::is_message(uris, &ev->body)) { enqueue_message(context, _driver, &ev->body); enqueued = true; } @@ -146,7 +146,7 @@ private: }; class LV2Driver : public Ingen::Server::Driver - , public Ingen::Shared::AtomSink + , public Ingen::AtomSink { private: typedef std::vector Ports; @@ -333,26 +333,26 @@ public: virtual SampleCount sample_rate() const { return _sample_rate; } virtual SampleCount frame_time() const { return _frame_time; } - virtual bool is_realtime() const { return true; } - Shared::AtomReader& reader() { return _reader; } - Shared::AtomWriter& writer() { return _writer; } + virtual bool is_realtime() const { return true; } + AtomReader& reader() { return _reader; } + AtomWriter& writer() { return _writer; } Ports& ports() { return _ports; } private: - Engine& _engine; - Raul::Semaphore _main_sem; - Shared::AtomReader _reader; - Shared::AtomWriter _writer; - Raul::RingBuffer _from_ui; - Raul::RingBuffer _to_ui; - PatchImpl* _root_patch; - SampleCount _block_length; - SampleCount _sample_rate; - SampleCount _frame_time; - Ports _ports; - Raul::Semaphore _to_ui_overflow_sem; - bool _to_ui_overflow; + Engine& _engine; + Raul::Semaphore _main_sem; + AtomReader _reader; + AtomWriter _writer; + Raul::RingBuffer _from_ui; + Raul::RingBuffer _to_ui; + PatchImpl* _root_patch; + SampleCount _block_length; + SampleCount _sample_rate; + SampleCount _frame_time; + Ports _ports; + Raul::Semaphore _to_ui_overflow_sem; + bool _to_ui_overflow; }; void @@ -414,11 +414,11 @@ struct IngenPlugin { , argv(NULL) {} - Ingen::Shared::World* world; - MainThread* main; - LV2_URID_Map* map; - int argc; - char** argv; + Ingen::World* world; + MainThread* main; + LV2_URID_Map* map; + int argc; + char** argv; }; static Lib::Patches @@ -465,10 +465,9 @@ ingen_instantiate(const LV2_Descriptor* descriptor, Glib::thread_init(); } - Shared::set_bundle_path(bundle_path); + set_bundle_path(bundle_path); Lib::Patches patches = find_patches( - Glib::filename_to_uri( - Shared::bundle_file_path("manifest.ttl"))); + Glib::filename_to_uri(Ingen::bundle_file_path("manifest.ttl"))); const LV2Patch* patch = NULL; for (Lib::Patches::iterator i = patches.begin(); i != patches.end(); ++i) { @@ -506,7 +505,7 @@ ingen_instantiate(const LV2_Descriptor* descriptor, Raul::warn("Warning: No buffer size access, guessing 4096 frames.\n"); } - plugin->world = new Ingen::Shared::World( + plugin->world = new Ingen::World( plugin->argc, plugin->argv, plugin->map, unmap); if (!plugin->world->load_module("serialisation")) { delete plugin->world; @@ -650,7 +649,7 @@ ingen_save(LV2_Handle instance, char* real_path = make_path->path(make_path->handle, "patch.ttl"); char* state_path = map_path->abstract_path(map_path->handle, real_path); - Ingen::Shared::Store::iterator root = plugin->world->store()->find("/"); + Ingen::Store::iterator root = plugin->world->store()->find("/"); plugin->world->serialiser()->to_file(root->second, real_path); store(handle, @@ -731,10 +730,9 @@ LV2Patch::LV2Patch(const std::string& u, const std::string& f) Lib::Lib(const char* bundle_path) { - Ingen::Shared::set_bundle_path(bundle_path); + Ingen::set_bundle_path(bundle_path); patches = find_patches( - Glib::filename_to_uri( - Ingen::Shared::bundle_file_path("manifest.ttl"))); + Glib::filename_to_uri(Ingen::bundle_file_path("manifest.ttl"))); } static void diff --git a/src/server/internals/Controller.cpp b/src/server/internals/Controller.cpp index 76183e85..85f69442 100644 --- a/src/server/internals/Controller.cpp +++ b/src/server/internals/Controller.cpp @@ -18,7 +18,7 @@ #include -#include "ingen/shared/URIs.hpp" +#include "ingen/URIs.hpp" #include "internals/Controller.hpp" #include "lv2/lv2plug.in/ns/ext/atom/util.h" #include "raul/midi_events.h" @@ -38,7 +38,7 @@ namespace Ingen { namespace Server { namespace Internals { -InternalPlugin* ControllerNode::internal_plugin(Shared::URIs& uris) { +InternalPlugin* ControllerNode::internal_plugin(URIs& uris) { return new InternalPlugin(uris, NS_INTERNALS "Controller", "controller"); } @@ -51,7 +51,7 @@ ControllerNode::ControllerNode(InternalPlugin* plugin, : NodeImpl(plugin, path, false, parent, srate) , _learning(false) { - const Ingen::Shared::URIs& uris = bufs.uris(); + const Ingen::URIs& uris = bufs.uris(); _ports = new Raul::Array(6); _midi_in_port = new InputPort(bufs, this, "input", 0, 1, diff --git a/src/server/internals/Controller.hpp b/src/server/internals/Controller.hpp index 5672d8ab..e4717247 100644 --- a/src/server/internals/Controller.hpp +++ b/src/server/internals/Controller.hpp @@ -52,7 +52,7 @@ public: void learn() { _learning = true; } - static InternalPlugin* internal_plugin(Shared::URIs& uris); + static InternalPlugin* internal_plugin(URIs& uris); private: InputPort* _midi_in_port; diff --git a/src/server/internals/Delay.cpp b/src/server/internals/Delay.cpp index d7cbcfb9..9e7f0afd 100644 --- a/src/server/internals/Delay.cpp +++ b/src/server/internals/Delay.cpp @@ -19,7 +19,7 @@ #include #include -#include "ingen/shared/URIs.hpp" +#include "ingen/URIs.hpp" #include "raul/Array.hpp" #include "raul/Maid.hpp" #include "raul/log.hpp" @@ -49,7 +49,7 @@ namespace Internals { static const float MAX_DELAY_SECONDS = 8.0f; -InternalPlugin* DelayNode::internal_plugin(Shared::URIs& uris) { +InternalPlugin* DelayNode::internal_plugin(URIs& uris) { return new InternalPlugin(uris, NS_INTERNALS "Delay", "delay"); } @@ -65,7 +65,7 @@ DelayNode::DelayNode(InternalPlugin* plugin, , _buffer_mask(0) , _write_phase(0) { - const Ingen::Shared::URIs& uris = bufs.uris(); + const Ingen::URIs& uris = bufs.uris(); _ports = new Raul::Array(3); const float default_delay = 1.0f; diff --git a/src/server/internals/Delay.hpp b/src/server/internals/Delay.hpp index e9695ecc..4609eaa0 100644 --- a/src/server/internals/Delay.hpp +++ b/src/server/internals/Delay.hpp @@ -48,7 +48,7 @@ public: void process(ProcessContext& context); - static InternalPlugin* internal_plugin(Shared::URIs& uris); + static InternalPlugin* internal_plugin(URIs& uris); float delay_samples() const { return _delay_samples; } diff --git a/src/server/internals/Note.cpp b/src/server/internals/Note.cpp index 923b70c0..1292686d 100644 --- a/src/server/internals/Note.cpp +++ b/src/server/internals/Note.cpp @@ -17,7 +17,7 @@ #include #include -#include "ingen/shared/URIs.hpp" +#include "ingen/URIs.hpp" #include "lv2/lv2plug.in/ns/ext/atom/util.h" #include "raul/Array.hpp" #include "raul/Maid.hpp" @@ -45,7 +45,7 @@ namespace Ingen { namespace Server { namespace Internals { -InternalPlugin* NoteNode::internal_plugin(Shared::URIs& uris) { +InternalPlugin* NoteNode::internal_plugin(URIs& uris) { return new InternalPlugin(uris, NS_INTERNALS "Note", "note"); } @@ -60,7 +60,7 @@ NoteNode::NoteNode(InternalPlugin* plugin, , _prepared_voices(NULL) , _sustain(false) { - const Ingen::Shared::URIs& uris = bufs.uris(); + const Ingen::URIs& uris = bufs.uris(); _ports = new Raul::Array(5); _midi_in_port = new InputPort(bufs, this, "input", 0, 1, diff --git a/src/server/internals/Note.hpp b/src/server/internals/Note.hpp index 591214ce..ed7fd6b0 100644 --- a/src/server/internals/Note.hpp +++ b/src/server/internals/Note.hpp @@ -60,7 +60,7 @@ public: void sustain_on(ProcessContext& context, FrameTime time); void sustain_off(ProcessContext& context, FrameTime time); - static InternalPlugin* internal_plugin(Shared::URIs& uris); + static InternalPlugin* internal_plugin(URIs& uris); private: /** Key, one for each key on the keyboard */ diff --git a/src/server/internals/Trigger.cpp b/src/server/internals/Trigger.cpp index 36f80dd6..699c31f1 100644 --- a/src/server/internals/Trigger.cpp +++ b/src/server/internals/Trigger.cpp @@ -17,7 +17,7 @@ #include #include -#include "ingen/shared/URIs.hpp" +#include "ingen/URIs.hpp" #include "lv2/lv2plug.in/ns/ext/atom/util.h" #include "raul/log.hpp" #include "raul/midi_events.h" @@ -39,7 +39,7 @@ namespace Ingen { namespace Server { namespace Internals { -InternalPlugin* TriggerNode::internal_plugin(Shared::URIs& uris) { +InternalPlugin* TriggerNode::internal_plugin(URIs& uris) { return new InternalPlugin(uris, NS_INTERNALS "Trigger", "trigger"); } @@ -52,7 +52,7 @@ TriggerNode::TriggerNode(InternalPlugin* plugin, : NodeImpl(plugin, path, false, parent, srate) , _learning(false) { - const Ingen::Shared::URIs& uris = bufs.uris(); + const Ingen::URIs& uris = bufs.uris(); _ports = new Raul::Array(5); _midi_in_port = new InputPort(bufs, this, "input", 0, 1, diff --git a/src/server/internals/Trigger.hpp b/src/server/internals/Trigger.hpp index 5bbae82d..a9a561ee 100644 --- a/src/server/internals/Trigger.hpp +++ b/src/server/internals/Trigger.hpp @@ -56,7 +56,7 @@ public: void learn() { _learning = true; } - static InternalPlugin* internal_plugin(Shared::URIs& uris); + static InternalPlugin* internal_plugin(URIs& uris); private: bool _learning; diff --git a/src/server/mix.cpp b/src/server/mix.cpp index e1e03063..be1a9f9f 100644 --- a/src/server/mix.cpp +++ b/src/server/mix.cpp @@ -16,7 +16,7 @@ #include "lv2/lv2plug.in/ns/ext/atom/util.h" -#include "ingen/shared/URIs.hpp" +#include "ingen/URIs.hpp" #include "raul/log.hpp" #include "AudioBuffer.hpp" @@ -53,7 +53,7 @@ audio_accumulate(Context& context, AudioBuffer* dst, const AudioBuffer* src) } static inline bool -is_audio(Shared::URIs& uris, LV2_URID type) +is_audio(URIs& uris, LV2_URID type) { return type == uris.atom_Float || type == uris.atom_Sound; } @@ -69,7 +69,7 @@ is_end(const Buffer* buf, LV2_Atom_Event* ev) void mix(Context& context, - Shared::URIs& uris, + URIs& uris, Buffer* dst, const Buffer*const* srcs, uint32_t num_srcs) diff --git a/src/server/mix.hpp b/src/server/mix.hpp index 65dd8de2..320019a0 100644 --- a/src/server/mix.hpp +++ b/src/server/mix.hpp @@ -21,7 +21,7 @@ namespace Ingen { -namespace Shared { class URIs; } +class URIs; namespace Server { @@ -30,7 +30,7 @@ class Buffer; void mix(Context& context, - Shared::URIs& uris, + URIs& uris, Buffer* dst, const Buffer*const* srcs, uint32_t num_srcs); diff --git a/src/server/wscript b/src/server/wscript index fbdf78fa..7f048828 100644 --- a/src/server/wscript +++ b/src/server/wscript @@ -57,7 +57,7 @@ def build(bld): name = 'libingen_server', target = 'ingen_server', install_path = '${LIBDIR}', - use = 'libingen_shared') + use = 'libingen') core_libs = 'GLIBMM GTHREAD LV2 LILV RAUL SORD' autowaf.use_lib(bld, obj, core_libs) @@ -69,7 +69,7 @@ def build(bld): name = 'libingen_server_profiled', target = 'ingen_server_profiled', install_path = '${LIBDIR}', - use = 'libingen_shared_profiled', + use = 'libingen_profiled', lib = bld.env['INGEN_TEST_LIBS'], cxxflags = bld.env['INGEN_TEST_CXXFLAGS']) autowaf.use_lib(bld, obj, core_libs) @@ -91,5 +91,5 @@ def build(bld): name = 'libingen_lv2', target = 'ingen_lv2', install_path = '${LV2DIR}/ingen.lv2/', - use = 'libingen_server libingen_shared') + use = 'libingen libingen_server') autowaf.use_lib(bld, obj, core_libs) diff --git a/src/shared/AtomReader.cpp b/src/shared/AtomReader.cpp deleted file mode 100644 index 862c61b1..00000000 --- a/src/shared/AtomReader.cpp +++ /dev/null @@ -1,276 +0,0 @@ -/* - This file is part of Ingen. - Copyright 2007-2012 David Robillard - - Ingen is free software: you can redistribute it and/or modify it under the - terms of the GNU Affero General Public License as published by the Free - Software Foundation, either version 3 of the License, or any later version. - - Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. - - You should have received a copy of the GNU Affero General Public License - along with Ingen. If not, see . -*/ - -#include - -#include "ingen/shared/AtomReader.hpp" -#include "ingen/shared/URIMap.hpp" -#include "lv2/lv2plug.in/ns/ext/atom/util.h" -#include "raul/Path.hpp" -#include "raul/log.hpp" - -namespace Ingen { -namespace Shared { - -AtomReader::AtomReader(URIMap& map, URIs& uris, Forge& forge, Interface& iface) - : _map(map) - , _uris(uris) - , _forge(forge) - , _iface(iface) -{ -} - -void -AtomReader::get_atom(const LV2_Atom* in, Raul::Atom& out) -{ - if (in) { - if (in->type == _uris.atom_URID) { - const LV2_Atom_URID* urid = (const LV2_Atom_URID*)in; - const char* uri = _map.unmap_uri(urid->body); - if (uri) { - out = _forge.alloc_uri(_map.unmap_uri(urid->body)); - } else { - Raul::error(Raul::fmt("Unable to unmap URID %1%\n") - % urid->body); - } - } else { - out = _forge.alloc(in->size, in->type, LV2_ATOM_BODY(in)); - } - } -} - -void -AtomReader::get_props(const LV2_Atom_Object* obj, - Ingen::Resource::Properties& props) -{ - if (obj->body.otype) { - props.insert( - std::make_pair(_uris.rdf_type, - _forge.alloc_uri(_map.unmap_uri(obj->body.otype)))); - } - LV2_ATOM_OBJECT_FOREACH(obj, p) { - Raul::Atom val; - get_atom(&p->value, val); - props.insert(std::make_pair(_map.unmap_uri(p->key), val)); - } -} - -const char* -AtomReader::atom_to_uri(const LV2_Atom* atom) -{ - if (atom && atom->type == _uris.atom_URI) { - return (const char*)LV2_ATOM_BODY(atom); - } else if (atom && atom->type == _uris.atom_URID) { - return _map.unmap_uri(((LV2_Atom_URID*)atom)->body); - } else { - return NULL; - } -} - -bool -AtomReader::is_message(URIs& uris, const LV2_Atom* msg) -{ - if (msg->type != uris.atom_Blank && msg->type != uris.atom_Resource) { - return false; - } - - const LV2_Atom_Object* obj = (const LV2_Atom_Object*)msg; - return (obj->body.otype == uris.patch_Get || - obj->body.otype == uris.patch_Delete || - obj->body.otype == uris.patch_Put || - obj->body.otype == uris.patch_Patch || - obj->body.otype == uris.patch_Move || - obj->body.otype == uris.patch_Response); -} - -bool -AtomReader::write(const LV2_Atom* msg) -{ - if (msg->type != _uris.atom_Blank && msg->type != _uris.atom_Resource) { - Raul::warn << (Raul::fmt("Unknown message type <%1%>\n") - % _map.unmap_uri(msg->type)).str(); - return false; - } - - const LV2_Atom_Object* obj = (const LV2_Atom_Object*)msg; - const LV2_Atom* subject = NULL; - - lv2_atom_object_get(obj, (LV2_URID)_uris.patch_subject, &subject, NULL); - const char* subject_uri = atom_to_uri(subject); - - if (obj->body.otype == _uris.patch_Get) { - _iface.set_response_id(obj->body.id); - _iface.get(subject_uri); - } else if (obj->body.otype == _uris.patch_Delete) { - const LV2_Atom_Object* body = NULL; - lv2_atom_object_get(obj, (LV2_URID)_uris.patch_body, &body, 0); - - if (subject_uri && !body) { - _iface.del(subject_uri); - return true; - } else if (body && body->body.otype == _uris.ingen_Edge) { - const LV2_Atom* tail = NULL; - const LV2_Atom* head = NULL; - const LV2_Atom* incidentTo = NULL; - lv2_atom_object_get(body, - (LV2_URID)_uris.ingen_tail, &tail, - (LV2_URID)_uris.ingen_head, &head, - (LV2_URID)_uris.ingen_incidentTo, &incidentTo, - NULL); - - Raul::Atom tail_atom; - Raul::Atom head_atom; - Raul::Atom incidentTo_atom; - get_atom(tail, tail_atom); - get_atom(head, head_atom); - get_atom(incidentTo, incidentTo_atom); - if (tail_atom.is_valid() && head_atom.is_valid()) { - _iface.disconnect(Raul::Path(tail_atom.get_uri()), - Raul::Path(head_atom.get_uri())); - } else if (incidentTo_atom.is_valid()) { - _iface.disconnect_all(subject_uri, - Raul::Path(incidentTo_atom.get_uri())); - } else { - Raul::warn << "Delete of unknown object." << std::endl; - return false; - } - } - } else if (obj->body.otype == _uris.patch_Put) { - const LV2_Atom_Object* body = NULL; - lv2_atom_object_get(obj, (LV2_URID)_uris.patch_body, &body, 0); - if (!body) { - Raul::warn << "Put message has no body" << std::endl; - return false; - } else if (!subject_uri) { - Raul::warn << "Put message has no subject" << std::endl; - return false; - } - - if (body->body.otype == _uris.ingen_Edge) { - LV2_Atom* tail = NULL; - LV2_Atom* head = NULL; - lv2_atom_object_get(body, - (LV2_URID)_uris.ingen_tail, &tail, - (LV2_URID)_uris.ingen_head, &head, - NULL); - if (!tail || !head) { - Raul::warn << "Edge has no tail or head" << std::endl; - return false; - } - - Raul::Atom tail_atom; - Raul::Atom head_atom; - get_atom(tail, tail_atom); - get_atom(head, head_atom); - _iface.connect(Raul::Path(tail_atom.get_uri()), - Raul::Path(head_atom.get_uri())); - } else { - Ingen::Resource::Properties props; - get_props(body, props); - _iface.set_response_id(obj->body.id); - _iface.put(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) { - Raul::warn << "Set message has no body" << std::endl; - return false; - } else if (!subject_uri) { - Raul::warn << "Set message has no subject" << std::endl; - return false; - } - - LV2_ATOM_OBJECT_FOREACH(body, p) { - Raul::Atom val; - get_atom(&p->value, val); - _iface.set_property(subject_uri, _map.unmap_uri(p->key), val); - } - } else if (obj->body.otype == _uris.patch_Patch) { - if (!subject_uri) { - Raul::warn << "Put message has no subject" << std::endl; - return false; - } - - const LV2_Atom_Object* remove = NULL; - lv2_atom_object_get(obj, (LV2_URID)_uris.patch_remove, &remove, 0); - if (!remove) { - Raul::warn << "Patch message has no remove" << std::endl; - return false; - } - - const LV2_Atom_Object* add = NULL; - lv2_atom_object_get(obj, (LV2_URID)_uris.patch_add, &add, 0); - if (!add) { - Raul::warn << "Patch message has no add" << std::endl; - return false; - } - - Ingen::Resource::Properties add_props; - get_props(remove, add_props); - - Ingen::Resource::Properties remove_props; - get_props(remove, remove_props); - - _iface.delta(subject_uri, remove_props, add_props); - } else if (obj->body.otype == _uris.patch_Move) { - if (!subject_uri) { - Raul::warn << "Move message has no subject" << std::endl; - return false; - } - - const LV2_Atom* dest = NULL; - lv2_atom_object_get(obj, (LV2_URID)_uris.patch_destination, &dest, 0); - if (!dest) { - Raul::warn << "Move message has no destination" << std::endl; - return false; - } - - const char* dest_uri = atom_to_uri(dest); - if (!dest_uri) { - Raul::warn << "Move message destination is not a URI" << std::endl; - return false; - } - - _iface.move(subject_uri, dest_uri); - } else if (obj->body.otype == _uris.patch_Response) { - const LV2_Atom* request = NULL; - const LV2_Atom* body = NULL; - lv2_atom_object_get(obj, - (LV2_URID)_uris.patch_request, &request, - (LV2_URID)_uris.patch_body, &body, - 0); - if (!request || request->type != _uris.atom_Int) { - Raul::warn << "Response message has no request" << std::endl; - return false; - } else if (!body || body->type != _uris.atom_Int) { - Raul::warn << "Response message body is not integer" << std::endl; - return false; - } - _iface.response(((LV2_Atom_Int*)request)->body, - (Ingen::Status)((LV2_Atom_Int*)body)->body, - subject_uri); - } else { - Raul::warn << "Unknown object type <" - << _map.unmap_uri(obj->body.otype) - << ">" << std::endl; - } - - return true; -} - -} // namespace Shared -} // namespace Ingen diff --git a/src/shared/AtomWriter.cpp b/src/shared/AtomWriter.cpp deleted file mode 100644 index 80bd0156..00000000 --- a/src/shared/AtomWriter.cpp +++ /dev/null @@ -1,301 +0,0 @@ -/* - This file is part of Ingen. - Copyright 2007-2012 David Robillard - - Ingen is free software: you can redistribute it and/or modify it under the - terms of the GNU Affero General Public License as published by the Free - Software Foundation, either version 3 of the License, or any later version. - - Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. - - You should have received a copy of the GNU Affero General Public License - along with Ingen. If not, see . -*/ - -#include - -#include "ingen/shared/AtomSink.hpp" -#include "ingen/shared/AtomWriter.hpp" -#include "ingen/shared/URIMap.hpp" -#include "raul/Path.hpp" -#include "serd/serd.h" - -namespace Ingen { -namespace Shared { - -static LV2_Atom_Forge_Ref -forge_sink(LV2_Atom_Forge_Sink_Handle handle, - const void* buf, - uint32_t size) -{ - SerdChunk* chunk = (SerdChunk*)handle; - const LV2_Atom_Forge_Ref ref = chunk->len + 1; - serd_chunk_sink(buf, size, chunk); - return ref; -} - -static LV2_Atom* -forge_deref(LV2_Atom_Forge_Sink_Handle handle, LV2_Atom_Forge_Ref ref) -{ - SerdChunk* chunk = (SerdChunk*)handle; - return (LV2_Atom*)(chunk->buf + ref - 1); -} - -AtomWriter::AtomWriter(URIMap& map, URIs& uris, AtomSink& sink) - : _map(map) - , _uris(uris) - , _sink(sink) - , _id(1) -{ - _out.buf = NULL; - _out.len = 0; - lv2_atom_forge_init(&_forge, &map.urid_map_feature()->urid_map); - lv2_atom_forge_set_sink(&_forge, forge_sink, forge_deref, &_out); -} - -void -AtomWriter::finish_msg() -{ - _sink.write((LV2_Atom*)_out.buf); - _out.len = 0; -} - -int32_t -AtomWriter::next_id() -{ - if (_id == -1) { - return 0; - } else { - return ++_id; - } -} - -void -AtomWriter::bundle_begin() -{ -} - -void -AtomWriter::bundle_end() -{ -} - -void -AtomWriter::forge_uri(const Raul::URI& uri) -{ - if (serd_uri_string_has_scheme((const uint8_t*)uri.c_str())) { - lv2_atom_forge_urid(&_forge, _map.map_uri(uri.c_str())); - } else { - lv2_atom_forge_uri(&_forge, uri.c_str(), uri.length()); - } -} - -void -AtomWriter::forge_properties(const Resource::Properties& properties) -{ - for (Resource::Properties::const_iterator i = properties.begin(); - i != properties.end(); ++i) { - lv2_atom_forge_property_head(&_forge, _map.map_uri(i->first.c_str()), 0); - if (i->second.type() == _forge.URI) { - forge_uri(i->second.get_uri()); - } else { - lv2_atom_forge_atom(&_forge, i->second.size(), i->second.type()); - lv2_atom_forge_write(&_forge, i->second.get_body(), i->second.size()); - } - } -} - -void -AtomWriter::forge_edge(const Raul::URI& tail, const Raul::URI& head) -{ - LV2_Atom_Forge_Frame edge; - lv2_atom_forge_blank(&_forge, &edge, 0, _uris.ingen_Edge); - lv2_atom_forge_property_head(&_forge, _uris.ingen_tail, 0); - forge_uri(tail); - lv2_atom_forge_property_head(&_forge, _uris.ingen_head, 0); - forge_uri(head); - lv2_atom_forge_pop(&_forge, &edge); -} - -void -AtomWriter::put(const Raul::URI& uri, - const Resource::Properties& properties, - Resource::Graph ctx) -{ - LV2_Atom_Forge_Frame msg; - lv2_atom_forge_blank(&_forge, &msg, next_id(), _uris.patch_Put); - lv2_atom_forge_property_head(&_forge, _uris.patch_subject, 0); - forge_uri(uri); - lv2_atom_forge_property_head(&_forge, _uris.patch_body, 0); - - LV2_Atom_Forge_Frame body; - lv2_atom_forge_blank(&_forge, &body, 0, 0); - forge_properties(properties); - lv2_atom_forge_pop(&_forge, &body); - - lv2_atom_forge_pop(&_forge, &msg); - finish_msg(); -} - -void -AtomWriter::delta(const Raul::URI& uri, - const Resource::Properties& remove, - const Resource::Properties& add) -{ - LV2_Atom_Forge_Frame msg; - lv2_atom_forge_blank(&_forge, &msg, next_id(), _uris.patch_Patch); - lv2_atom_forge_property_head(&_forge, _uris.patch_subject, 0); - forge_uri(uri); - - lv2_atom_forge_property_head(&_forge, _uris.patch_remove, 0); - LV2_Atom_Forge_Frame remove_obj; - lv2_atom_forge_blank(&_forge, &remove_obj, 0, 0); - forge_properties(remove); - lv2_atom_forge_pop(&_forge, &remove_obj); - - lv2_atom_forge_property_head(&_forge, _uris.patch_add, 0); - LV2_Atom_Forge_Frame add_obj; - lv2_atom_forge_blank(&_forge, &add_obj, 0, 0); - forge_properties(add); - lv2_atom_forge_pop(&_forge, &add_obj); - - lv2_atom_forge_pop(&_forge, &msg); - finish_msg(); -} - -void -AtomWriter::move(const Raul::Path& old_path, - const Raul::Path& new_path) -{ - LV2_Atom_Forge_Frame msg; - lv2_atom_forge_blank(&_forge, &msg, next_id(), _uris.patch_Move); - lv2_atom_forge_property_head(&_forge, _uris.patch_subject, 0); - forge_uri(old_path); - lv2_atom_forge_property_head(&_forge, _uris.patch_destination, 0); - forge_uri(new_path); -} - -void -AtomWriter::del(const Raul::URI& uri) -{ - LV2_Atom_Forge_Frame msg; - lv2_atom_forge_blank(&_forge, &msg, next_id(), _uris.patch_Delete); - lv2_atom_forge_property_head(&_forge, _uris.patch_subject, 0); - forge_uri(uri); -} - -void -AtomWriter::connect(const Raul::Path& tail, - const Raul::Path& head) -{ - LV2_Atom_Forge_Frame msg; - lv2_atom_forge_blank(&_forge, &msg, next_id(), _uris.patch_Put); - lv2_atom_forge_property_head(&_forge, _uris.patch_subject, 0); - forge_uri(Raul::Path::lca(tail, head)); - lv2_atom_forge_property_head(&_forge, _uris.patch_body, 0); - forge_edge(tail, head); - lv2_atom_forge_pop(&_forge, &msg); - finish_msg(); -} - -void -AtomWriter::disconnect(const Raul::Path& tail, - const Raul::Path& head) -{ - LV2_Atom_Forge_Frame msg; - lv2_atom_forge_blank(&_forge, &msg, next_id(), _uris.patch_Delete); - lv2_atom_forge_property_head(&_forge, _uris.patch_body, 0); - forge_edge(tail, head); - lv2_atom_forge_pop(&_forge, &msg); - finish_msg(); -} - -void -AtomWriter::disconnect_all(const Raul::Path& parent_patch_path, - const Raul::Path& path) -{ - LV2_Atom_Forge_Frame msg; - lv2_atom_forge_blank(&_forge, &msg, next_id(), _uris.patch_Delete); - - lv2_atom_forge_property_head(&_forge, _uris.patch_subject, 0); - forge_uri(parent_patch_path); - - lv2_atom_forge_property_head(&_forge, _uris.patch_body, 0); - LV2_Atom_Forge_Frame edge; - lv2_atom_forge_blank(&_forge, &edge, 0, _uris.ingen_Edge); - lv2_atom_forge_property_head(&_forge, _uris.ingen_incidentTo, 0); - forge_uri(path); - lv2_atom_forge_pop(&_forge, &edge); - - lv2_atom_forge_pop(&_forge, &msg); - finish_msg(); -} - -void -AtomWriter::set_property(const Raul::URI& subject, - const Raul::URI& predicate, - const Raul::Atom& value) -{ - LV2_Atom_Forge_Frame msg; - 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_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(); -} - -void -AtomWriter::set_response_id(int32_t id) -{ -} - -void -AtomWriter::get(const Raul::URI& uri) -{ - LV2_Atom_Forge_Frame msg; - lv2_atom_forge_blank(&_forge, &msg, next_id(), _uris.patch_Get); - lv2_atom_forge_property_head(&_forge, _uris.patch_subject, 0); - forge_uri(uri); - lv2_atom_forge_pop(&_forge, &msg); - finish_msg(); -} - -void -AtomWriter::response(int32_t id, Status status, const std::string& subject) -{ - if (id == -1) { - return; - } - - LV2_Atom_Forge_Frame msg; - lv2_atom_forge_blank(&_forge, &msg, next_id(), _uris.patch_Response); - lv2_atom_forge_property_head(&_forge, _uris.patch_request, 0); - lv2_atom_forge_int(&_forge, id); - if (!subject.empty() && Raul::URI::is_valid(subject)) { - lv2_atom_forge_property_head(&_forge, _uris.patch_subject, 0); - lv2_atom_forge_uri(&_forge, subject.c_str(), subject.length()); - } - lv2_atom_forge_property_head(&_forge, _uris.patch_body, 0); - lv2_atom_forge_int(&_forge, status); - lv2_atom_forge_pop(&_forge, &msg); - finish_msg(); -} - -void -AtomWriter::error(const std::string& msg) -{ -} - -} // namespace Shared -} // namespace Ingen diff --git a/src/shared/Builder.cpp b/src/shared/Builder.cpp deleted file mode 100644 index dadd2989..00000000 --- a/src/shared/Builder.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/* - This file is part of Ingen. - Copyright 2007-2012 David Robillard - - Ingen is free software: you can redistribute it and/or modify it under the - terms of the GNU Affero General Public License as published by the Free - Software Foundation, either version 3 of the License, or any later version. - - Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. - - You should have received a copy of the GNU Affero General Public License - along with Ingen. If not, see . -*/ - -#include "ingen/Edge.hpp" -#include "ingen/GraphObject.hpp" -#include "ingen/Interface.hpp" -#include "ingen/shared/Builder.hpp" -#include "ingen/shared/URIs.hpp" -#include "raul/Atom.hpp" -#include "raul/Path.hpp" - -using namespace std; - -namespace Ingen { -namespace Shared { - -Builder::Builder(Shared::URIs& uris, Interface& interface) - : _uris(uris) - , _interface(interface) -{ -} - -void -Builder::build(SharedPtr object) -{ - _interface.put(object->path(), object->properties()); -} - -void -Builder::connect(SharedPtr object) -{ - if (object->graph_type() == GraphObject::PATCH) { - for (GraphObject::Edges::const_iterator i = object->edges().begin(); - i != object->edges().end(); ++i) { - _interface.connect(i->second->tail_path(), i->second->head_path()); - } - return; - } -} - -} // namespace Shared -} // namespace Ingen diff --git a/src/shared/ClashAvoider.cpp b/src/shared/ClashAvoider.cpp deleted file mode 100644 index 8e6683e8..00000000 --- a/src/shared/ClashAvoider.cpp +++ /dev/null @@ -1,206 +0,0 @@ -/* - This file is part of Ingen. - Copyright 2007-2012 David Robillard - - Ingen is free software: you can redistribute it and/or modify it under the - terms of the GNU Affero General Public License as published by the Free - Software Foundation, either version 3 of the License, or any later version. - - Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. - - You should have received a copy of the GNU Affero General Public License - along with Ingen. If not, see . -*/ - -#include -#include -#include -#include - -#include "raul/log.hpp" - -#include "ingen/shared/ClashAvoider.hpp" -#include "ingen/shared/Store.hpp" - -using namespace std; - -namespace Ingen { -namespace Shared { - -const Raul::URI -ClashAvoider::map_uri(const Raul::URI& in) -{ - if (Raul::Path::is_path(in)) - return map_path(in.str()); - else - return in; -} - -const Raul::Path -ClashAvoider::map_path(const Raul::Path& in) -{ - Raul::debug << "MAP PATH: " << in; - - unsigned offset = 0; - bool has_offset = false; - const size_t pos = in.find_last_of('_'); - if (pos != string::npos && pos != (in.length()-1)) { - const std::string trailing = in.substr(pos + 1); - has_offset = (sscanf(trailing.c_str(), "%u", &offset) > 0); - } - - Raul::debug << "OFFSET: " << offset << endl; - - // Path without _n suffix - Raul::Path base_path = in; - if (has_offset) - base_path = base_path.substr(0, base_path.find_last_of('_')); - - Raul::debug << "BASE: " << base_path << endl; - - SymbolMap::iterator m = _symbol_map.find(in); - if (m != _symbol_map.end()) { - Raul::debug << " (1) " << m->second << endl; - return m->second; - } else { - typedef std::pair InsertRecord; - - // See if parent is mapped - Raul::Path parent = in.parent(); - do { - Raul::debug << "CHECK: " << parent << endl; - SymbolMap::iterator p = _symbol_map.find(parent); - if (p != _symbol_map.end()) { - const Raul::Path mapped = p->second.base() + in.substr(parent.base().length()); - InsertRecord i = _symbol_map.insert(make_pair(in, mapped)); - Raul::debug << " (2) " << i.first->second << endl; - return i.first->second; - } - parent = parent.parent(); - } while (!parent.is_root()); - - // No clash, use symbol unmodified - if (!exists(in) && _symbol_map.find(in) == _symbol_map.end()) { - InsertRecord i = _symbol_map.insert(make_pair(in, in)); - assert(i.second); - Raul::debug << " (3) " << i.first->second << endl; - return i.first->second; - - // Append _2 _3 etc until an unused symbol is found - } else { - while (true) { - Offsets::iterator o = _offsets.find(base_path); - if (o != _offsets.end()) { - offset = ++o->second; - } else { - string parent_str = in.parent().base(); - parent_str = parent_str.substr(0, parent_str.find_last_of("/")); - if (parent_str.empty()) - parent_str = "/"; - Raul::debug << "PARENT: " << parent_str << endl; - } - - if (offset == 0) - offset = 2; - - std::stringstream ss; - ss << base_path << "_" << offset; - if (!exists(ss.str())) { - string name = base_path.symbol(); - if (name == "") - name = "_"; - string str = ss.str(); - InsertRecord i = _symbol_map.insert(make_pair(in, str)); - Raul::debug << "HIT: offset = " << offset << ", str = " << str << endl; - offset = _store.child_name_offset(in.parent(), name, false); - _offsets.insert(make_pair(base_path, offset)); - Raul::debug << " (4) " << i.first->second << endl; - return i.first->second; - } else { - Raul::debug << "MISSED OFFSET: " << in << " => " << ss.str() << endl; - if (o != _offsets.end()) - offset = ++o->second; - else - ++offset; - } - } - } - } -} - -bool -ClashAvoider::exists(const Raul::Path& path) const -{ - bool exists = (_store.find(path) != _store.end()); - if (exists) - return true; - - if (_also_avoid) - return (_also_avoid->find(path) != _also_avoid->end()); - else - return false; -} - -void -ClashAvoider::put(const Raul::URI& path, - const Resource::Properties& properties, - Resource::Graph ctx) -{ - _target.put(map_uri(path), properties, ctx); -} - -void -ClashAvoider::delta(const Raul::URI& path, - const Resource::Properties& remove, - const Resource::Properties& add) -{ - _target.delta(map_uri(path), remove, add); -} - -void -ClashAvoider::move(const Raul::Path& old_path, - const Raul::Path& new_path) -{ - _target.move(map_path(old_path), map_path(new_path)); -} - -void -ClashAvoider::connect(const Raul::Path& tail, - const Raul::Path& head) -{ - _target.connect(map_path(tail), map_path(head)); -} - -void -ClashAvoider::disconnect(const Raul::Path& tail, - const Raul::Path& head) -{ - _target.disconnect(map_path(tail), map_path(head)); -} - -void -ClashAvoider::disconnect_all(const Raul::Path& parent_patch, - const Raul::Path& path) -{ - _target.disconnect_all(map_path(parent_patch), map_path(path)); -} - -void -ClashAvoider::set_property(const Raul::URI& subject, - const Raul::URI& predicate, - const Raul::Atom& value) -{ - _target.set_property(map_uri(subject), predicate, value); -} - -void -ClashAvoider::del(const Raul::URI& uri) -{ - if (Raul::Path::is_path(uri)) - _target.del(map_path(Raul::Path(uri.str()))); -} - -} // namespace Shared -} // namespace Ingen diff --git a/src/shared/Configuration.cpp b/src/shared/Configuration.cpp deleted file mode 100644 index 28038466..00000000 --- a/src/shared/Configuration.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* - This file is part of Ingen. - Copyright 2007-2012 David Robillard - - Ingen is free software: you can redistribute it and/or modify it under the - terms of the GNU Affero General Public License as published by the Free - Software Foundation, either version 3 of the License, or any later version. - - Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. - - You should have received a copy of the GNU Affero General Public License - along with Ingen. If not, see . -*/ - -#include "ingen/shared/Configuration.hpp" - -namespace Ingen { -namespace Shared { - -Configuration::Configuration() - : Raul::Configuration( - "A realtime modular audio processor.", - "Ingen is a flexible modular system that be used in various ways.\n" - "The engine can run as a stand-alone server controlled via network protocol,\n" - "or internal to another process (e.g. the GUI). The GUI, or other\n" - "clients, can communicate with the engine via any supported protocol, or host the\n" - "engine in the same process. Many clients can connect to an engine at once.\n\n" - "Examples:\n" - " ingen -e # Run an engine, listen for connections\n" - " ingen -g # Run a GUI, connect to running engine\n" - " ingen -eg # Run an engine and a GUI in one process\n" - " ingen -egl patch.ttl # Run an engine and a GUI and load a patch file\n" - " ingen -egl patch.ingen # Run an engine and a GUI and load a patch bundle") -{ - add("client-port", 'C', "Client port", INT, Value()); - add("connect", 'c', "Connect to engine URI", STRING, Value("unix:///tmp/ingen.sock")); - add("engine", 'e', "Run (JACK) engine", BOOL, Value(false)); - add("engine-port", 'E', "Engine listen port", INT, Value(16180)); - add("socket", 'S', "Engine socket path", STRING, Value("/tmp/ingen.sock")); - add("gui", 'g', "Launch the GTK graphical interface", BOOL, Value(false)); - add("help", 'h', "Print this help message", BOOL, Value(false)); - add("jack-client", 'n', "JACK client name", STRING, Value("ingen")); - add("jack-server", 's', "JACK server name", STRING, Value("")); - add("uuid", 'u', "JACK session UUID", STRING, Value()); - add("load", 'l', "Load patch", STRING, Value()); - add("packet-size", 'k', "Maximum UDP packet size", INT, Value(4096)); - add("parallelism", 'p', "Number of concurrent process threads", INT, Value(1)); - add("path", 'L', "Target path for loaded patch", STRING, Value()); - add("queue-size", 'q', "Event queue size", INT, Value(4096)); - add("run", 'r', "Run script", STRING, Value()); -} - -} // namespace Shared -} // namespace Ingen diff --git a/src/shared/Forge.cpp b/src/shared/Forge.cpp deleted file mode 100644 index b667cf1c..00000000 --- a/src/shared/Forge.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* - This file is part of Ingen. - Copyright 2007-2012 David Robillard - - Ingen is free software: you can redistribute it and/or modify it under the - terms of the GNU Affero General Public License as published by the Free - Software Foundation, either version 3 of the License, or any later version. - - Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. - - You should have received a copy of the GNU Affero General Public License - along with Ingen. If not, see . -*/ - -#include -#include - -#include "ingen/shared/Forge.hpp" -#include "ingen/shared/URIMap.hpp" -#include "lv2/lv2plug.in/ns/ext/atom/atom.h" - -namespace Ingen { -namespace Shared { - -Forge::Forge(Shared::URIMap& map) -{ - Int = map.map_uri(LV2_ATOM__Int); - Float = map.map_uri(LV2_ATOM__Float); - Bool = map.map_uri(LV2_ATOM__Bool); - URI = map.map_uri(LV2_ATOM__URI); - URID = map.map_uri(LV2_ATOM__URID); - String = map.map_uri(LV2_ATOM__String); -} - -std::string -Forge::str(const Raul::Atom& atom) -{ - std::ostringstream ss; - if (atom.type() == Int) { - ss << atom.get_int32(); - } else if (atom.type() == Float) { - ss << atom.get_float(); - } else if (atom.type() == Bool) { - ss << (atom.get_bool() ? "true" : "false"); - } else if (atom.type() == URI) { - ss << "<" << atom.get_uri() << ">"; - } else if (atom.type() == String) { - ss << "\"" << atom.get_string() << "\""; - } - return ss.str(); -} - -} // namespace Shared -} // namespace Ingen diff --git a/src/shared/LV2Features.cpp b/src/shared/LV2Features.cpp deleted file mode 100644 index 7061ff76..00000000 --- a/src/shared/LV2Features.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - This file is part of Ingen. - Copyright 2007-2012 David Robillard - - Ingen is free software: you can redistribute it and/or modify it under the - terms of the GNU Affero General Public License as published by the Free - Software Foundation, either version 3 of the License, or any later version. - - Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. - - You should have received a copy of the GNU Affero General Public License - along with Ingen. If not, see . -*/ - -#include - -#include "ingen/shared/LV2Features.hpp" - -using namespace std; - -namespace Ingen { -namespace Shared { - -LV2Features::LV2Features() -{ -} - -void -LV2Features::add_feature(SharedPtr feature) -{ - _features.push_back(feature); -} - -LV2Features::FeatureArray::FeatureArray(FeatureVector& features) - : _features(features) -{ - _array = (LV2_Feature**)malloc(sizeof(LV2_Feature) * (features.size() + 1)); - _array[features.size()] = NULL; - for (size_t i = 0; i < features.size(); ++i) { - _array[i] = features[i].get(); - } -} - -LV2Features::FeatureArray::~FeatureArray() -{ - free(_array); -} - -SharedPtr -LV2Features::lv2_features(Shared::World* world, GraphObject* node) const -{ - FeatureArray::FeatureVector vec; - for (Features::const_iterator f = _features.begin(); f != _features.end(); ++f) { - SharedPtr fptr = (*f)->feature(world, node); - if (fptr) { - vec.push_back(fptr); - } - } - return SharedPtr(new FeatureArray(vec)); -} - -} // namespace Shared -} // namespace Ingen diff --git a/src/shared/Store.cpp b/src/shared/Store.cpp deleted file mode 100644 index ad950fd7..00000000 --- a/src/shared/Store.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* - This file is part of Ingen. - Copyright 2007-2012 David Robillard - - Ingen is free software: you can redistribute it and/or modify it under the - terms of the GNU Affero General Public License as published by the Free - Software Foundation, either version 3 of the License, or any later version. - - Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. - - You should have received a copy of the GNU Affero General Public License - along with Ingen. If not, see . -*/ - -#include -#include - -#include "ingen/GraphObject.hpp" -#include "ingen/shared/Store.hpp" -#include "raul/PathTable.hpp" -#include "raul/TableImpl.hpp" -#include "raul/log.hpp" - -using namespace std; - -namespace Ingen { -namespace Shared { - -void -Store::add(GraphObject* o) -{ - if (find(o->path()) != end()) { - Raul::error << "[Store] Attempt to add duplicate object " << o->path() << endl; - return; - } - - insert(make_pair(o->path(), o)); - - for (uint32_t i = 0; i < o->num_ports(); ++i) { - add(o->port(i)); - } -} - -Store::const_iterator -Store::children_begin(SharedPtr o) const -{ - const_iterator parent = find(o->path()); - assert(parent != end()); - ++parent; - return parent; -} - -Store::const_iterator -Store::children_end(SharedPtr o) const -{ - const_iterator parent = find(o->path()); - assert(parent != end()); - return find_descendants_end(parent); -} - -SharedPtr -Store::find_child(SharedPtr parent, - const string& child_name) const -{ - const_iterator pi = find(parent->path()); - assert(pi != end()); - const_iterator children_end = find_descendants_end(pi); - const_iterator child = find(pi, children_end, parent->path().base() + child_name); - if (child != end()) - return child->second; - else - return SharedPtr(); -} - -unsigned -Store::child_name_offset(const Raul::Path& parent, - const Raul::Symbol& symbol, - bool allow_zero) -{ - unsigned offset = 0; - - while (true) { - std::stringstream ss; - ss << symbol; - if (offset > 0) - ss << "_" << offset; - if (find(parent.base() + ss.str()) == end() && (allow_zero || offset > 0)) - break; - else if (offset == 0) - offset = 2; - else - ++offset; - } - - return offset; -} - -} // namespace Shared -} // namespace Ingen diff --git a/src/shared/URIMap.cpp b/src/shared/URIMap.cpp deleted file mode 100644 index b8981fd3..00000000 --- a/src/shared/URIMap.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/* - This file is part of Ingen. - Copyright 2007-2012 David Robillard - - Ingen is free software: you can redistribute it and/or modify it under the - terms of the GNU Affero General Public License as published by the Free - Software Foundation, either version 3 of the License, or any later version. - - Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. - - You should have received a copy of the GNU Affero General Public License - along with Ingen. If not, see . -*/ - -#include - -#include - -#include "ingen/shared/URIMap.hpp" - -using namespace std; - -namespace Ingen { -namespace Shared { - -URIMap::URIMap(LV2_URID_Map* map, LV2_URID_Unmap* unmap) - : _urid_map_feature(new URIDMapFeature(this, map)) - , _urid_unmap_feature(new URIDUnmapFeature(this, unmap)) -{ -} - -URIMap::URIDMapFeature::URIDMapFeature(URIMap* map, - LV2_URID_Map* impl) - : Feature(LV2_URID__map, &urid_map) -{ - if (impl) { - urid_map = *impl; - } else { - urid_map.map = default_map; - urid_map.handle = NULL; - } -} - -LV2_URID -URIMap::URIDMapFeature::default_map(LV2_URID_Map_Handle handle, - const char* uri) -{ - return static_cast(g_quark_from_string(uri)); -} - -LV2_URID -URIMap::URIDMapFeature::map(const char* uri) -{ - return urid_map.map(urid_map.handle, uri); -} - -URIMap::URIDUnmapFeature::URIDUnmapFeature(URIMap* map, - LV2_URID_Unmap* impl) - : Feature(LV2_URID__unmap, &urid_unmap) -{ - if (impl) { - urid_unmap = *impl; - } else { - urid_unmap.unmap = default_unmap; - urid_unmap.handle = NULL; - } -} - -const char* -URIMap::URIDUnmapFeature::default_unmap(LV2_URID_Unmap_Handle handle, - LV2_URID urid) -{ - return g_quark_to_string(urid); -} - -const char* -URIMap::URIDUnmapFeature::unmap(LV2_URID urid) -{ - return urid_unmap.unmap(urid_unmap.handle, urid); -} - -uint32_t -URIMap::map_uri(const char* uri) -{ - return _urid_map_feature->map(uri); -} - -const char* -URIMap::unmap_uri(uint32_t urid) const -{ - return _urid_unmap_feature->unmap(urid); -} - -} // namespace Shared -} // namespace Ingen diff --git a/src/shared/URIs.cpp b/src/shared/URIs.cpp deleted file mode 100644 index 102c7b8b..00000000 --- a/src/shared/URIs.cpp +++ /dev/null @@ -1,128 +0,0 @@ -/* - This file is part of Ingen. - Copyright 2007-2012 David Robillard - - Ingen is free software: you can redistribute it and/or modify it under the - terms of the GNU Affero General Public License as published by the Free - Software Foundation, either version 3 of the License, or any later version. - - Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. - - You should have received a copy of the GNU Affero General Public License - along with Ingen. If not, see . -*/ - -#include "ingen/shared/URIMap.hpp" -#include "ingen/shared/URIs.hpp" -#include "lv2/lv2plug.in/ns/ext/atom/atom.h" -#include "lv2/lv2plug.in/ns/ext/midi/midi.h" -#include "lv2/lv2plug.in/ns/ext/patch/patch.h" -#include "lv2/lv2plug.in/ns/ext/port-props/port-props.h" -#include "lv2/lv2plug.in/ns/lv2core/lv2.h" - -namespace Ingen { -namespace Shared { - -URIs::Quark::Quark(Shared::Forge& forge, URIMap* map, const char* c_str) - : Raul::URI(c_str) - , id(map->map_uri(c_str)) - , atom(forge.alloc_uri(c_str)) -{ -} - -#define NS_INGEN "http://drobilla.net/ns/ingen#" -#define NS_RDF "http://www.w3.org/1999/02/22-rdf-syntax-ns#" -#define NS_RDFS "http://www.w3.org/2000/01/rdf-schema#" - -URIs::URIs(Shared::Forge& f, URIMap* map) - : forge(f) - , atom_AtomPort (forge, map, LV2_ATOM__AtomPort) - , atom_Blank (forge, map, LV2_ATOM__Blank) - , atom_Bool (forge, map, LV2_ATOM__Bool) - , atom_Chunk (forge, map, LV2_ATOM__Chunk) - , atom_Float (forge, map, LV2_ATOM__Float) - , atom_Int (forge, map, LV2_ATOM__Int) - , atom_Resource (forge, map, LV2_ATOM__Resource) - , atom_Sequence (forge, map, LV2_ATOM__Sequence) - , atom_Sound (forge, map, LV2_ATOM__Sound) - , atom_String (forge, map, LV2_ATOM__String) - , atom_URI (forge, map, LV2_ATOM__URI) - , atom_URID (forge, map, LV2_ATOM__URID) - , atom_Vector (forge, map, LV2_ATOM__Vector) - , atom_bufferType (forge, map, LV2_ATOM__bufferType) - , atom_eventTransfer (forge, map, LV2_ATOM__eventTransfer) - , atom_supports (forge, map, LV2_ATOM__supports) - , doap_name (forge, map, "http://usefulinc.com/ns/doap#name") - , ingen_Edge (forge, map, NS_INGEN "Edge") - , ingen_Internal (forge, map, NS_INGEN "Internal") - , ingen_Node (forge, map, NS_INGEN "Node") - , ingen_Patch (forge, map, NS_INGEN "Patch") - , ingen_activity (forge, map, NS_INGEN "activity") - , ingen_broadcast (forge, map, NS_INGEN "broadcast") - , ingen_canvasX (forge, map, NS_INGEN "canvasX") - , ingen_canvasY (forge, map, NS_INGEN "canvasY") - , ingen_controlBinding (forge, map, NS_INGEN "controlBinding") - , ingen_document (forge, map, NS_INGEN "document") - , ingen_enabled (forge, map, NS_INGEN "enabled") - , ingen_engine (forge, map, NS_INGEN "engine") - , ingen_head (forge, map, NS_INGEN "head") - , ingen_incidentTo (forge, map, NS_INGEN "incidentTo") - , ingen_nil (forge, map, NS_INGEN "nil") - , ingen_node (forge, map, NS_INGEN "node") - , ingen_polyphonic (forge, map, NS_INGEN "polyphonic") - , ingen_polyphony (forge, map, NS_INGEN "polyphony") - , ingen_prototype (forge, map, NS_INGEN "prototype") - , ingen_sampleRate (forge, map, NS_INGEN "sampleRate") - , ingen_status (forge, map, NS_INGEN "status") - , ingen_tail (forge, map, NS_INGEN "tail") - , ingen_uiEmbedded (forge, map, NS_INGEN "uiEmbedded") - , ingen_value (forge, map, NS_INGEN "value") - , lv2_AudioPort (forge, map, LV2_CORE__AudioPort) - , lv2_CVPort (forge, map, LV2_CORE__CVPort) - , lv2_ControlPort (forge, map, LV2_CORE__ControlPort) - , lv2_InputPort (forge, map, LV2_CORE__InputPort) - , lv2_OutputPort (forge, map, LV2_CORE__OutputPort) - , lv2_Plugin (forge, map, LV2_CORE__Plugin) - , lv2_connectionOptional(forge, map, LV2_CORE__connectionOptional) - , lv2_default (forge, map, LV2_CORE__default) - , lv2_index (forge, map, LV2_CORE__index) - , lv2_integer (forge, map, LV2_CORE__integer) - , lv2_maximum (forge, map, LV2_CORE__maximum) - , lv2_minimum (forge, map, LV2_CORE__minimum) - , lv2_name (forge, map, LV2_CORE__name) - , lv2_portProperty (forge, map, LV2_CORE__portProperty) - , lv2_sampleRate (forge, map, LV2_CORE__sampleRate) - , lv2_scalePoint (forge, map, LV2_CORE__scalePoint) - , lv2_symbol (forge, map, LV2_CORE__symbol) - , lv2_toggled (forge, map, LV2_CORE__toggled) - , midi_Bender (forge, map, LV2_MIDI__Bender) - , midi_ChannelPressure (forge, map, LV2_MIDI__ChannelPressure) - , midi_Controller (forge, map, LV2_MIDI__Controller) - , midi_MidiEvent (forge, map, LV2_MIDI__MidiEvent) - , midi_NoteOn (forge, map, LV2_MIDI__NoteOn) - , midi_controllerNumber (forge, map, LV2_MIDI__controllerNumber) - , midi_noteNumber (forge, map, LV2_MIDI__noteNumber) - , patch_Delete (forge, map, LV2_PATCH__Delete) - , patch_Get (forge, map, LV2_PATCH__Get) - , patch_Move (forge, map, LV2_PATCH__Move) - , patch_Patch (forge, map, LV2_PATCH__Patch) - , patch_Put (forge, map, LV2_PATCH__Put) - , patch_Response (forge, map, LV2_PATCH__Response) - , patch_Set (forge, map, LV2_PATCH__Set) - , patch_add (forge, map, LV2_PATCH__add) - , patch_body (forge, map, LV2_PATCH__body) - , patch_destination (forge, map, LV2_PATCH__destination) - , patch_remove (forge, map, LV2_PATCH__remove) - , patch_request (forge, map, LV2_PATCH__request) - , patch_subject (forge, map, LV2_PATCH__subject) - , pprops_logarithmic (forge, map, LV2_PORT_PROPS__logarithmic) - , rdf_type (forge, map, NS_RDF "type") - , rdfs_seeAlso (forge, map, NS_RDFS "seeAlso") - , wildcard (forge, map, NS_INGEN "wildcard") -{ -} - -} // namespace Shared -} // namespace Ingen diff --git a/src/shared/World.cpp b/src/shared/World.cpp deleted file mode 100644 index 05a941e9..00000000 --- a/src/shared/World.cpp +++ /dev/null @@ -1,323 +0,0 @@ -/* - This file is part of Ingen. - Copyright 2007-2012 David Robillard - - Ingen is free software: you can redistribute it and/or modify it under the - terms of the GNU Affero General Public License as published by the Free - Software Foundation, either version 3 of the License, or any later version. - - Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. - - You should have received a copy of the GNU Affero General Public License - along with Ingen. If not, see . -*/ - -#include -#include - -#include -#include -#include - -#include "ingen/shared/Configuration.hpp" -#include "ingen/shared/LV2Features.hpp" -#include "ingen/shared/Module.hpp" -#include "ingen/shared/URIMap.hpp" -#include "ingen/shared/URIs.hpp" -#include "ingen/shared/World.hpp" -#include "ingen/shared/runtime_paths.hpp" -#include "lilv/lilv.h" -#include "raul/log.hpp" -#include "sord/sordmm.hpp" - -#define LOG(s) (s("[World] ")) - -using namespace std; - -namespace Ingen { - -class EngineBase; -class Interface; - -namespace Serialisation { class Parser; class Serialiser; } - -namespace Shared { - -class Store; - -/** Load a dynamic module from the default path. - * - * This will check in the directories specified in the environment variable - * INGEN_MODULE_PATH (typical colon delimited format), then the default module - * installation directory (ie /usr/local/lib/ingen), in that order. - * - * \param name The base name of the module, e.g. "ingen_serialisation" - */ -Glib::Module* -ingen_load_module(const string& name) -{ - Glib::Module* module = NULL; - - // Search INGEN_MODULE_PATH first - bool module_path_found; - string module_path = Glib::getenv("INGEN_MODULE_PATH", module_path_found); - if (module_path_found) { - string dir; - istringstream iss(module_path); - while (getline(iss, dir, G_SEARCHPATH_SEPARATOR)) { - string filename = Shared::module_path(name, dir); - if (Glib::file_test(filename, Glib::FILE_TEST_EXISTS)) { - module = new Glib::Module(filename); - if (*module) { - LOG(Raul::info)(Raul::fmt("Loading %1%\n") % filename); - return module; - } else { - Raul::error << Glib::Module::get_last_error() << endl; - } - } - } - } - - // Try default directory if not found - module = new Glib::Module(Shared::module_path(name)); - - if (module) { - LOG(Raul::info)(Raul::fmt("Loading %1%\n") % Shared::module_path(name)); - return module; - } else if (!module_path_found) { - LOG(Raul::error)(Raul::fmt("Unable to find %1% (%2%)\n") - % name % Glib::Module::get_last_error()); - return NULL; - } else { - LOG(Raul::error)(Raul::fmt("Unable to load %1% from %2% (%3%)\n") - % name % module_path % Glib::Module::get_last_error()); - LOG(Raul::error)("Is Ingen installed?\n"); - return NULL; - } -} - -class World::Impl { -public: - Impl(int& a_argc, - char**& a_argv, - LV2_URID_Map* map, - LV2_URID_Unmap* unmap) - : argc(a_argc) - , argv(a_argv) - , lv2_features(NULL) - , rdf_world(new Sord::World()) - , uri_map(new Ingen::Shared::URIMap(map, unmap)) - , forge(new Ingen::Shared::Forge(*uri_map)) - , uris(new Shared::URIs(*forge, uri_map)) - , lilv_world(lilv_world_new()) - { - conf.parse(argc, argv); - lv2_features = new Ingen::Shared::LV2Features(); - lv2_features->add_feature(uri_map->urid_map_feature()); - lv2_features->add_feature(uri_map->urid_unmap_feature()); - lilv_world_load_all(lilv_world); - - // Set up RDF namespaces - rdf_world->add_prefix("atom", "http://lv2plug.in/ns/ext/atom#"); - rdf_world->add_prefix("patch", "http://lv2plug.in/ns/ext/patch#"); - rdf_world->add_prefix("doap", "http://usefulinc.com/ns/doap#"); - rdf_world->add_prefix("ingen", "http://drobilla.net/ns/ingen#"); - rdf_world->add_prefix("lv2", "http://lv2plug.in/ns/lv2core#"); - rdf_world->add_prefix("lv2ev", "http://lv2plug.in/ns/ext/event#"); - rdf_world->add_prefix("midi", "http://lv2plug.in/ns/ext/midi#"); - rdf_world->add_prefix("owl", "http://www.w3.org/2002/07/owl#"); - rdf_world->add_prefix("rdfs", "http://www.w3.org/2000/01/rdf-schema#"); - rdf_world->add_prefix("xsd", "http://www.w3.org/2001/XMLSchema#"); - } - - ~Impl() - { - serialiser.reset(); - parser.reset(); - interface.reset(); - engine.reset(); - store.reset(); - - interface_factories.clear(); - script_runners.clear(); - - delete rdf_world; - delete lv2_features; - delete uris; - delete forge; - delete uri_map; - - lilv_world_free(lilv_world); - - - for (Modules::iterator i = modules.begin(); i != modules.end(); ++i) { - // Keep a reference to the library - Glib::Module* lib = i->second->library; - - // Destroy the Ingen module - delete i->second; - - // Now all references to library code should be done, close it - delete lib; - } - } - - typedef std::map Modules; - Modules modules; - - typedef std::map InterfaceFactories; - InterfaceFactories interface_factories; - - typedef bool (*ScriptRunner)(World* world, const char* filename); - typedef std::map ScriptRunners; - ScriptRunners script_runners; - - int& argc; - char**& argv; - Shared::Configuration conf; - LV2Features* lv2_features; - Sord::World* rdf_world; - URIMap* uri_map; - Shared::Forge* forge; - URIs* uris; - SharedPtr interface; - SharedPtr engine; - SharedPtr serialiser; - SharedPtr parser; - SharedPtr store; - LilvWorld* lilv_world; - std::string jack_uuid; -}; - -World::World(int& argc, - char**& argv, - LV2_URID_Map* map, - LV2_URID_Unmap* unmap) - : _impl(new Impl(argc, argv, map, unmap)) -{ -} - -World::~World() -{ - delete _impl; -} - -void World::set_engine(SharedPtr e) { _impl->engine = e; } -void World::set_interface(SharedPtr i) { _impl->interface = i; } -void World::set_parser(SharedPtr p) { _impl->parser = p; } -void World::set_serialiser(SharedPtr s) { _impl->serialiser = s; } -void World::set_store(SharedPtr s) { _impl->store = s; } - -SharedPtr World::engine() { return _impl->engine; } -SharedPtr World::interface() { return _impl->interface; } -SharedPtr World::parser() { return _impl->parser; } -SharedPtr World::serialiser() { return _impl->serialiser; } -SharedPtr World::store() { return _impl->store; } - -int& World::argc() { return _impl->argc; } -char**& World::argv() { return _impl->argv; } -Shared::Configuration& World::conf() { return _impl->conf; } - -Sord::World* World::rdf_world() { return _impl->rdf_world; } -LilvWorld* World::lilv_world() { return _impl->lilv_world; } - -LV2Features& World::lv2_features() { return *_impl->lv2_features; } -Shared::Forge& World::forge() { return *_impl->forge; } -URIs& World::uris() { return *_impl->uris; } -URIMap& World::uri_map() { return *_impl->uri_map; } - -bool -World::load_module(const char* name) -{ - Impl::Modules::iterator i = _impl->modules.find(name); - if (i != _impl->modules.end()) { - LOG(Raul::info)(Raul::fmt("Module `%1%' already loaded\n") % name); - return true; - } - Glib::Module* lib = ingen_load_module(name); - Ingen::Shared::Module* (*module_load)() = NULL; - if (lib && lib->get_symbol("ingen_module_load", (void*&)module_load)) { - Module* module = module_load(); - if (module) { - module->library = lib; - module->load(this); - _impl->modules.insert(make_pair(string(name), module)); - return true; - } - } - - LOG(Raul::error)(Raul::fmt("Failed to load module `%1%'\n") % name); - delete lib; - return false; -} - -bool -World::run_module(const char* name) -{ - Impl::Modules::iterator i = _impl->modules.find(name); - if (i == _impl->modules.end()) { - LOG(Raul::error) << "Attempt to run unloaded module `" << name << "'" << endl; - return false; - } - - i->second->run(this); - return true; -} - -void -World::unload_modules() -{ - _impl->modules.clear(); -} - -/** Get an interface for a remote engine at @a url - */ -SharedPtr -World::new_interface(const std::string& engine_url, - SharedPtr respondee) -{ - const string scheme = engine_url.substr(0, engine_url.find(":")); - const Impl::InterfaceFactories::const_iterator i = _impl->interface_factories.find(scheme); - if (i == _impl->interface_factories.end()) { - Raul::warn << "Unknown URI scheme `" << scheme << "'" << endl; - return SharedPtr(); - } - - return i->second(this, engine_url, respondee); -} - -/** Run a script of type @a mime_type at filename @a filename */ -bool -World::run(const std::string& mime_type, const std::string& filename) -{ - const Impl::ScriptRunners::const_iterator i = _impl->script_runners.find(mime_type); - if (i == _impl->script_runners.end()) { - Raul::warn << "Unknown script MIME type `" << mime_type << "'" << endl; - return false; - } - - return i->second(this, filename.c_str()); -} - -void -World::add_interface_factory(const std::string& scheme, InterfaceFactory factory) -{ - _impl->interface_factories.insert(make_pair(scheme, factory)); -} - -void -World::set_jack_uuid(const std::string& uuid) -{ - _impl->jack_uuid = uuid; -} - -std::string -World::jack_uuid() -{ - return _impl->jack_uuid; -} - -} // namespace Shared -} // namespace Ingen diff --git a/src/shared/runtime_paths.cpp b/src/shared/runtime_paths.cpp deleted file mode 100644 index 8439b248..00000000 --- a/src/shared/runtime_paths.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/* - This file is part of Ingen. - Copyright 2007-2012 David Robillard - - Ingen is free software: you can redistribute it and/or modify it under the - terms of the GNU Affero General Public License as published by the Free - Software Foundation, either version 3 of the License, or any later version. - - Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. - - You should have received a copy of the GNU Affero General Public License - along with Ingen. If not, see . -*/ - -#include - -#include -#include - -#include - -#include -#include - -#include "raul/log.hpp" - -#include "ingen/shared/runtime_paths.hpp" - -#include "ingen_config.h" - -using namespace std; - -namespace Ingen { -namespace Shared { - -static std::string bundle_path; - -/** Must be called once at startup, and passed a pointer to a function - * that lives in the 'top level' of the bundle (e.g. the executable). - * Passing a function defined in a module etc. will not work! - */ -void -set_bundle_path_from_code(void* function) -{ - Dl_info dli; - dladdr(function, &dli); - -#ifdef BUNDLE - char bin_loc[PATH_MAX]; - realpath(dli.dli_fname, bin_loc); -#else - const char* bin_loc = dli.dli_fname; -#endif - - Raul::info(Raul::fmt("Binary location: %1%\n") % bin_loc); - - string bundle = bin_loc; - bundle = bundle.substr(0, bundle.find_last_of(G_DIR_SEPARATOR)); - bundle_path = bundle; -} - -void -set_bundle_path(const char* path) -{ - bundle_path = path; -} - -/** Return the absolute path of a file in an Ingen LV2 bundle - */ -std::string -bundle_file_path(const std::string& name) -{ - return Glib::build_filename(bundle_path, name); -} - -/** Return the absolute path of a 'resource' file. - */ -std::string -data_file_path(const std::string& name) -{ -#ifdef BUNDLE - return Glib::build_filename(bundle_path, Glib::build_path(INGEN_DATA_DIR, name)); -#else - return Glib::build_filename(INGEN_DATA_DIR, name); -#endif -} - -/** Return the absolute path of a module (dynamically loaded shared library). - */ -std::string -module_path(const std::string& name, std::string dir) -{ - std::string ret; - if (dir == "") { -#ifdef BUNDLE - dir = Glib::build_path(bundle_path, INGEN_MODULE_DIR); -#else - dir = INGEN_MODULE_DIR; -#endif - } - - ret = Glib::Module::build_path(dir, string("ingen_") + name); - -#ifdef __APPLE__ - // MacPorts glib doesnt seem to do portable path building correctly... - if (ret.substr(ret.length() - 3) == ".so") - ret = ret.substr(0, ret.length() - 2).append("dylib"); -#endif - return ret; -} - -} // namespace Ingen -} // namespace Shared - diff --git a/src/shared/wscript b/src/shared/wscript deleted file mode 100644 index 8a873653..00000000 --- a/src/shared/wscript +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/env python -from waflib.extras import autowaf as autowaf - -sources = [ - 'AtomReader.cpp', - 'AtomWriter.cpp', - 'Builder.cpp', - 'ClashAvoider.cpp', - 'Configuration.cpp', - 'Forge.cpp', - 'LV2Features.cpp', - 'Store.cpp', - 'URIMap.cpp', - 'URIs.cpp', - 'World.cpp', - 'runtime_paths.cpp', -] - -def build(bld): - obj = bld(features = 'cxx cxxshlib', - source = sources, - export_includes = ['../..'], - includes = ['../..'], - name = 'libingen_shared', - target = 'ingen_shared', - use = 'libingen', - vnum = '0.0.0', - install_path = '${LIBDIR}', - lib = ['dl']) - autowaf.use_lib(bld, obj, 'GLIBMM LV2 LILV RAUL SORD LV2_MIDI') - - if bld.env['BUILD_TESTS']: - obj = bld(features = 'cxx cxxshlib', - source = sources, - export_includes = ['../..'], - includes = ['../..'], - name = 'libingen_shared_profiled', - target = 'ingen_shared_profiled', - use = 'libingen', - install_path = '', - lib = ['dl'] + bld.env['INGEN_TEST_LIBS'], - cxxflags = bld.env['INGEN_TEST_CXXFLAGS']) - autowaf.use_lib(bld, obj, 'GLIBMM LV2 LILV RAUL SORD LV2_MIDI') - diff --git a/src/socket/SocketClient.hpp b/src/socket/SocketClient.hpp index a58f92a5..c316e4a4 100644 --- a/src/socket/SocketClient.hpp +++ b/src/socket/SocketClient.hpp @@ -29,7 +29,7 @@ namespace Socket { class SocketClient : public SocketWriter { public: - SocketClient(Shared::World& world, + SocketClient(World& world, const std::string& uri, SharedPtr sock, SharedPtr respondee) diff --git a/src/socket/SocketListener.cpp b/src/socket/SocketListener.cpp index a2dcaba0..f79c055a 100644 --- a/src/socket/SocketListener.cpp +++ b/src/socket/SocketListener.cpp @@ -21,9 +21,9 @@ #include #include "ingen/Interface.hpp" -#include "ingen/shared/AtomReader.hpp" -#include "ingen/shared/Configuration.hpp" -#include "ingen/shared/World.hpp" +#include "ingen/AtomReader.hpp" +#include "ingen/Configuration.hpp" +#include "ingen/World.hpp" #include "sord/sordmm.hpp" #include "sratom/sratom.h" @@ -37,7 +37,7 @@ namespace Ingen { namespace Socket { -SocketListener::SocketListener(Ingen::Shared::World& world) +SocketListener::SocketListener(Ingen::World& world) : Raul::Thread("SocketListener") , _world(world) , _unix_sock(Socket::UNIX) diff --git a/src/socket/SocketListener.hpp b/src/socket/SocketListener.hpp index e9c27d85..c4700ed4 100644 --- a/src/socket/SocketListener.hpp +++ b/src/socket/SocketListener.hpp @@ -24,24 +24,23 @@ namespace Ingen { class Interface; - -namespace Shared { class World; } +class World; namespace Socket { class SocketListener : public Raul::Thread { public: - explicit SocketListener(Ingen::Shared::World& world); + explicit SocketListener(Ingen::World& world); ~SocketListener(); private: virtual void _run(); - Ingen::Shared::World& _world; - std::string _unix_path; - Socket _unix_sock; - Socket _net_sock; + Ingen::World& _world; + std::string _unix_path; + Socket _unix_sock; + Socket _net_sock; }; } // namespace Ingen diff --git a/src/socket/SocketReader.cpp b/src/socket/SocketReader.cpp index 1a3e5475..9d28b405 100644 --- a/src/socket/SocketReader.cpp +++ b/src/socket/SocketReader.cpp @@ -18,9 +18,9 @@ #include #include "ingen/Interface.hpp" -#include "ingen/shared/AtomReader.hpp" -#include "ingen/shared/URIMap.hpp" -#include "ingen/shared/World.hpp" +#include "ingen/AtomReader.hpp" +#include "ingen/URIMap.hpp" +#include "ingen/World.hpp" #include "sord/sordmm.hpp" #include "sratom/sratom.h" @@ -31,9 +31,9 @@ namespace Ingen { namespace Socket { -SocketReader::SocketReader(Ingen::Shared::World& world, - Interface& iface, - SharedPtr sock) +SocketReader::SocketReader(Ingen::World& world, + Interface& iface, + SharedPtr sock) : Raul::Thread("SocketReader") , _world(world) , _iface(iface) @@ -132,8 +132,7 @@ SocketReader::_run() serd_reader_start_stream(reader, f, (const uint8_t*)"(socket)", false); // Make an AtomReader to call Ingen Interface methods based on Atom - Shared::AtomReader ar( - _world.uri_map(), _world.uris(), _world.forge(), _iface); + AtomReader ar(_world.uri_map(), _world.uris(), _world.forge(), _iface); struct pollfd pfd; pfd.fd = _socket->fd(); diff --git a/src/socket/SocketReader.hpp b/src/socket/SocketReader.hpp index 5e205186..51435368 100644 --- a/src/socket/SocketReader.hpp +++ b/src/socket/SocketReader.hpp @@ -25,8 +25,7 @@ namespace Ingen { class Interface; - -namespace Shared { class World; } +class World; namespace Socket { @@ -34,7 +33,7 @@ namespace Socket { class SocketReader : public Raul::Thread { public: - SocketReader(Shared::World& world, + SocketReader(World& world, Interface& iface, SharedPtr sock); @@ -59,7 +58,7 @@ private: const SerdNode* object_datatype, const SerdNode* object_lang); - Shared::World& _world; + World& _world; Interface& _iface; SerdEnv* _env; SordInserter* _inserter; diff --git a/src/socket/SocketServer.hpp b/src/socket/SocketServer.hpp index 6732ed4e..6bbd792d 100644 --- a/src/socket/SocketServer.hpp +++ b/src/socket/SocketServer.hpp @@ -29,7 +29,7 @@ namespace Socket { class SocketServer : public Server::EventWriter, public SocketReader { public: - SocketServer(Shared::World& world, + SocketServer(World& world, Server::Engine& engine, SharedPtr sock) : Server::EventWriter(engine) diff --git a/src/socket/SocketWriter.cpp b/src/socket/SocketWriter.cpp index c375ae16..ae815aea 100644 --- a/src/socket/SocketWriter.cpp +++ b/src/socket/SocketWriter.cpp @@ -18,7 +18,7 @@ #include #include -#include "ingen/shared/URIMap.hpp" +#include "ingen/URIMap.hpp" #include "SocketWriter.hpp" @@ -40,8 +40,8 @@ socket_sink(const void* buf, size_t len, void* stream) return ret; } -SocketWriter::SocketWriter(Shared::URIMap& map, - Shared::URIs& uris, +SocketWriter::SocketWriter(URIMap& map, + URIs& uris, const Raul::URI& uri, SharedPtr sock) : AtomWriter(map, uris, *this) diff --git a/src/socket/SocketWriter.hpp b/src/socket/SocketWriter.hpp index 2a17d843..cbdb2602 100644 --- a/src/socket/SocketWriter.hpp +++ b/src/socket/SocketWriter.hpp @@ -20,8 +20,8 @@ #include #include "ingen/Interface.hpp" -#include "ingen/shared/AtomSink.hpp" -#include "ingen/shared/AtomWriter.hpp" +#include "ingen/AtomSink.hpp" +#include "ingen/AtomWriter.hpp" #include "raul/URI.hpp" #include "raul/SharedPtr.hpp" #include "sratom/sratom.h" @@ -33,11 +33,11 @@ namespace Socket { /** An Interface that writes Turtle messages to a socket. */ -class SocketWriter : public Shared::AtomWriter, public Shared::AtomSink +class SocketWriter : public AtomWriter, public AtomSink { public: - SocketWriter(Shared::URIMap& map, - Shared::URIs& uris, + SocketWriter(URIMap& map, + URIs& uris, const Raul::URI& uri, SharedPtr sock); @@ -49,7 +49,7 @@ public: Raul::URI uri() const { return _uri; } protected: - Shared::URIMap& _map; + URIMap& _map; Sratom* _sratom; SerdNode _base; SerdURI _base_uri; diff --git a/src/socket/ingen_socket_client.cpp b/src/socket/ingen_socket_client.cpp index b10d598e..8819ea2c 100644 --- a/src/socket/ingen_socket_client.cpp +++ b/src/socket/ingen_socket_client.cpp @@ -16,15 +16,15 @@ #include -#include "ingen/shared/Module.hpp" -#include "ingen/shared/World.hpp" +#include "ingen/Module.hpp" +#include "ingen/World.hpp" #include "raul/log.hpp" #include "Socket.hpp" #include "SocketClient.hpp" static SharedPtr -new_socket_interface(Ingen::Shared::World* world, +new_socket_interface(Ingen::World* world, const std::string& url, SharedPtr respondee) { @@ -41,8 +41,8 @@ new_socket_interface(Ingen::Shared::World* world, return SharedPtr(client); } -struct IngenSocketClientModule : public Ingen::Shared::Module { - void load(Ingen::Shared::World* world) { +struct IngenSocketClientModule : public Ingen::Module { + void load(Ingen::World* world) { world->add_interface_factory("unix", &new_socket_interface); world->add_interface_factory("tcp", &new_socket_interface); } @@ -50,7 +50,7 @@ struct IngenSocketClientModule : public Ingen::Shared::Module { extern "C" { -Ingen::Shared::Module* +Ingen::Module* ingen_module_load() { return new IngenSocketClientModule(); diff --git a/src/socket/ingen_socket_server.cpp b/src/socket/ingen_socket_server.cpp index 5bf679bb..aa13eebd 100644 --- a/src/socket/ingen_socket_server.cpp +++ b/src/socket/ingen_socket_server.cpp @@ -16,8 +16,8 @@ #include "raul/log.hpp" -#include "ingen/shared/Module.hpp" -#include "ingen/shared/World.hpp" +#include "ingen/Module.hpp" +#include "ingen/World.hpp" #include "../server/Engine.hpp" #include "../server/EventWriter.hpp" @@ -26,8 +26,8 @@ using namespace Ingen; -struct IngenSocketServerModule : public Ingen::Shared::Module { - void load(Ingen::Shared::World* world) { +struct IngenSocketServerModule : public Ingen::Module { + void load(Ingen::World* world) { listener = SharedPtr( new Ingen::Socket::SocketListener(*world)); } @@ -37,7 +37,7 @@ struct IngenSocketServerModule : public Ingen::Shared::Module { extern "C" { -Ingen::Shared::Module* +Ingen::Module* ingen_module_load() { return new IngenSocketServerModule(); diff --git a/src/wscript b/src/wscript new file mode 100644 index 00000000..243e9fa2 --- /dev/null +++ b/src/wscript @@ -0,0 +1,43 @@ +#!/usr/bin/env python +from waflib.extras import autowaf as autowaf + +sources = [ + 'AtomReader.cpp', + 'AtomWriter.cpp', + 'Builder.cpp', + 'ClashAvoider.cpp', + 'Configuration.cpp', + 'Forge.cpp', + 'LV2Features.cpp', + 'Resource.cpp', + 'Store.cpp', + 'URIMap.cpp', + 'URIs.cpp', + 'World.cpp', + 'runtime_paths.cpp', +] + +def build(bld): + obj = bld(features = 'cxx cxxshlib', + source = sources, + export_includes = ['..'], + includes = ['..'], + name = 'libingen', + target = 'ingen', + vnum = '0.0.0', + install_path = '${LIBDIR}', + lib = ['dl']) + autowaf.use_lib(bld, obj, 'GLIBMM LV2 LILV RAUL SORD LV2_MIDI') + + if bld.env['BUILD_TESTS']: + obj = bld(features = 'cxx cxxshlib', + source = sources, + export_includes = ['..'], + includes = ['..'], + name = 'libingen_profiled', + target = 'ingen_profiled', + install_path = '', + lib = ['dl'] + bld.env['INGEN_TEST_LIBS'], + cxxflags = bld.env['INGEN_TEST_CXXFLAGS']) + autowaf.use_lib(bld, obj, 'GLIBMM LV2 LILV RAUL SORD LV2_MIDI') + diff --git a/tests/ingen_test.cpp b/tests/ingen_test.cpp index dcde210f..f3b37391 100644 --- a/tests/ingen_test.cpp +++ b/tests/ingen_test.cpp @@ -42,12 +42,12 @@ #include "ingen/EngineBase.hpp" #include "ingen/Interface.hpp" #include "ingen/serialisation/Parser.hpp" -#include "ingen/shared/AtomReader.hpp" -#include "ingen/shared/AtomWriter.hpp" -#include "ingen/shared/Configuration.hpp" -#include "ingen/shared/URIMap.hpp" -#include "ingen/shared/World.hpp" -#include "ingen/shared/runtime_paths.hpp" +#include "ingen/AtomReader.hpp" +#include "ingen/AtomWriter.hpp" +#include "ingen/Configuration.hpp" +#include "ingen/URIMap.hpp" +#include "ingen/World.hpp" +#include "ingen/runtime_paths.hpp" #include "ingen/client/ThreadedSigClientInterface.hpp" #ifdef WITH_BINDINGS #include "bindings/ingen_bindings.hpp" @@ -56,10 +56,10 @@ using namespace std; using namespace Ingen; -Shared::World* world = NULL; +World* world = NULL; /* -class TestClient : public Shared::AtomSink { +class TestClient : public AtomSink { void write(const LV2_Atom* msg) { } }; @@ -135,7 +135,7 @@ int main(int argc, char** argv) { Glib::thread_init(); - Shared::set_bundle_path_from_code((void*)&main); + set_bundle_path_from_code((void*)&main); if (argc != 3) { cerr << "Usage: ingen_test START_PATCH COMMANDS_FILE" << endl; @@ -144,7 +144,7 @@ main(int argc, char** argv) // Create world try { - world = new Shared::World(argc, argv, NULL, NULL); + world = new World(argc, argv, NULL, NULL); } catch (std::exception& e) { cout << "ingen: " << e.what() << endl; return EXIT_FAILURE; @@ -186,14 +186,14 @@ main(int argc, char** argv) const std::string cmds_file_path = argv[2]; // AtomReader to read commands from a file and send them to engine - Shared::AtomReader atom_reader( + AtomReader atom_reader( world->uri_map(), world->uris(), world->forge(), *world->interface().get()); // AtomWriter to serialise responses from the engine /* TestClient client; - SharedPtr atom_writer( - new Shared::AtomWriter(world->uri_map(), world->uris(), client)); + SharedPtr atom_writer( + new AtomWriter(world->uri_map(), world->uris(), client)); */ SharedPtr client(new TestClient()); diff --git a/wscript b/wscript index fd0b45a5..357a4dd8 100644 --- a/wscript +++ b/wscript @@ -138,13 +138,12 @@ def build(bld): opts.moduledir = opts.moduledir or bld.env['PREFIX'] + 'lib/ingen' # Headers - for i in ['', 'client', 'serialisation', 'shared']: + for i in ['', 'client', 'serialisation']: bld.install_files('${INCLUDEDIR}/ingen/%s' % i, bld.path.ant_glob('ingen/%s/*' % i)) # Modules bld.recurse('src') - bld.recurse('src/shared') bld.recurse('src/serialisation') bld.recurse('src/server') bld.recurse('src/client') @@ -158,7 +157,7 @@ def build(bld): source = 'src/ingen/main.cpp', target = bld.path.get_bld().make_node('ingen'), includes = ['.'], - use = 'libingen_shared', + use = 'libingen', install_path = '${BINDIR}') autowaf.use_lib(bld, obj, 'GTHREAD GLIBMM SORD RAUL LILV INGEN LV2') @@ -168,7 +167,7 @@ def build(bld): source = 'tests/ingen_test.cpp', target = 'tests/ingen_test', includes = ['.'], - use = 'libingen_shared_profiled', + use = 'libingen_profiled', install_path = '', lib = bld.env['INGEN_TEST_LIBS'], cxxflags = bld.env['INGEN_TEST_CXXFLAGS']) @@ -203,7 +202,7 @@ def lint(ctx): def test(ctx): os.environ['PATH'] = 'tests' + os.pathsep + os.getenv('PATH') - os.environ['LD_LIBRARY_PATH'] = os.path.join('src', 'shared') + os.environ['LD_LIBRARY_PATH'] = os.path.join('src') os.environ['INGEN_MODULE_PATH'] = os.pathsep.join([ os.path.join('src', 'server') , os.path.join('src', 'serialisation')]) -- cgit v1.2.1