From 254b434f0a79fea54bd963e8ff2e845a5b0cd3a6 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 19 Mar 2012 20:16:46 +0000 Subject: Partially functioning communication between Ingen LV2 plugin and UI. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4078 a436a847-0d15-0410-975c-d299462d15a1 --- ingen/serialisation/Parser.hpp | 3 +-- ingen/serialisation/Serialiser.hpp | 3 +-- ingen/shared/AtomReader.hpp | 55 ++++++++++++++++++++++++++++++++++++++ ingen/shared/Configuration.hpp | 2 +- ingen/shared/Forge.hpp | 36 +++++++++++++++++++++++++ ingen/shared/LV2Atom.hpp | 45 ------------------------------- ingen/shared/LV2URIMap.hpp | 26 ------------------ ingen/shared/ResourceImpl.hpp | 2 -- ingen/shared/URIs.hpp | 19 ++++++++----- ingen/shared/World.hpp | 5 ++-- 10 files changed, 110 insertions(+), 86 deletions(-) create mode 100644 ingen/shared/AtomReader.hpp create mode 100644 ingen/shared/Forge.hpp delete mode 100644 ingen/shared/LV2Atom.hpp (limited to 'ingen') diff --git a/ingen/serialisation/Parser.hpp b/ingen/serialisation/Parser.hpp index f242108b..48fd59f0 100644 --- a/ingen/serialisation/Parser.hpp +++ b/ingen/serialisation/Parser.hpp @@ -24,9 +24,8 @@ #include #include -#include "raul/Path.hpp" - #include "ingen/GraphObject.hpp" +#include "raul/Path.hpp" namespace Ingen { diff --git a/ingen/serialisation/Serialiser.hpp b/ingen/serialisation/Serialiser.hpp index 8d5805e1..f317d04c 100644 --- a/ingen/serialisation/Serialiser.hpp +++ b/ingen/serialisation/Serialiser.hpp @@ -60,8 +60,7 @@ public: const std::string& path); virtual std::string to_string(SharedPtr object, - const std::string& base_uri, - const Properties& extra_rdf); + const std::string& base_uri); virtual void start_to_string(const Raul::Path& root, const std::string& base_uri); diff --git a/ingen/shared/AtomReader.hpp b/ingen/shared/AtomReader.hpp new file mode 100644 index 00000000..76b5ff92 --- /dev/null +++ b/ingen/shared/AtomReader.hpp @@ -0,0 +1,55 @@ +/* This file is part of Ingen. + * Copyright 2012 David Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) 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 General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef INGEN_SHARED_ATOM_READER_HPP +#define INGEN_SHARED_ATOM_READER_HPP + +#include "ingen/Interface.hpp" +#include "ingen/shared/AtomSink.hpp" +#include "ingen/shared/LV2URIMap.hpp" +#include "ingen/shared/URIs.hpp" +#include "serd/serd.h" + +namespace Ingen { + +class Forge; + +namespace Shared { + +class AtomSink; + +/** An AtomSink that calls methods on an Interface. */ +class AtomReader : public AtomSink +{ +public: + AtomReader(LV2URIMap& map, URIs& uris, Forge& forge, Interface& iface); + ~AtomReader() {} + + void write(const LV2_Atom* msg); + +private: + LV2URIMap& _map; + URIs& _uris; + Forge& _forge; + Interface& _iface; +}; + +} // namespace Shared +} // namespace Ingen + +#endif // INGEN_SHARED_ATOM_READER_HPP + diff --git a/ingen/shared/Configuration.hpp b/ingen/shared/Configuration.hpp index 21bc5737..e51bdc71 100644 --- a/ingen/shared/Configuration.hpp +++ b/ingen/shared/Configuration.hpp @@ -25,7 +25,7 @@ namespace Shared { class Configuration : public Raul::Configuration { public: - Configuration(Raul::Forge* forge); + Configuration(); }; } // namespace Shared diff --git a/ingen/shared/Forge.hpp b/ingen/shared/Forge.hpp new file mode 100644 index 00000000..273742c9 --- /dev/null +++ b/ingen/shared/Forge.hpp @@ -0,0 +1,36 @@ +/* This file is part of Ingen. + * Copyright 2012 David Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) 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 General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef INGEN_FORGE_HPP +#define INGEN_FORGE_HPP + +#include "ingen/shared/Forge.hpp" +#include "ingen/shared/LV2URIMap.hpp" +#include "raul/Atom.hpp" + +namespace Ingen { + +class Forge : public Raul::Forge { +public: + Forge(Shared::LV2URIMap& map); + + std::string str(const Raul::Atom& atom); +}; + +} // namespace Ingen + +#endif // INGEN_FORGE_HPP diff --git a/ingen/shared/LV2Atom.hpp b/ingen/shared/LV2Atom.hpp deleted file mode 100644 index 0aa35889..00000000 --- a/ingen/shared/LV2Atom.hpp +++ /dev/null @@ -1,45 +0,0 @@ -/* This file is part of Ingen. - * Copyright 2009-2011 David Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) 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 General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef INGEN_SHARED_LV2ATOM_HPP -#define INGEN_SHARED_LV2ATOM_HPP - -#include "lv2/lv2plug.in/ns/ext/atom/atom.h" - -namespace Raul { class Atom; } - -namespace Ingen { -namespace Shared { - -class URIs; - -namespace LV2Atom { - -bool to_atom(const URIs& uris, - const LV2_Atom* object, - Raul::Atom& atom); - -bool from_atom(const URIs& uris, - const Raul::Atom& atom, - LV2_Atom* object); - -} // namespace LV2Atom - -} // namespace Shared -} // namespace Ingen - -#endif // INGEN_SHARED_LV2ATOM_HPP diff --git a/ingen/shared/LV2URIMap.hpp b/ingen/shared/LV2URIMap.hpp index 01bbfb7d..5375ed51 100644 --- a/ingen/shared/LV2URIMap.hpp +++ b/ingen/shared/LV2URIMap.hpp @@ -24,7 +24,6 @@ #include #include "ingen/shared/LV2Features.hpp" -#include "lv2/lv2plug.in/ns/ext/uri-map/uri-map.h" #include "lv2/lv2plug.in/ns/ext/urid/urid.h" #include "raul/URI.hpp" @@ -55,11 +54,6 @@ public: LV2_Feature _feature; }; - struct URIMapFeature : public Feature { - URIMapFeature(LV2URIMap* map); - LV2_URI_Map_Feature uri_map; - }; - struct URIDMapFeature : public Feature { URIDMapFeature(LV2URIMap* map, LV2_URID_Map* urid_map); LV2_URID map(const char* uri); @@ -74,32 +68,12 @@ public: LV2_URID_Unmap urid_unmap; }; - SharedPtr uri_map_feature() { return _uri_map_feature; } SharedPtr urid_map_feature() { return _urid_map_feature; } SharedPtr urid_unmap_feature() { return _urid_unmap_feature; } - virtual uint32_t uri_to_id(const char* map, const char* uri); - virtual const char* id_to_uri(const char* map, uint32_t id); - - std::pair event_to_global(uint16_t event_id) const; - std::pair global_to_event(uint32_t global_id) const; - private: - static uint32_t uri_map_uri_to_id(LV2_URI_Map_Callback_Data callback_data, - const char* map, - const char* uri); - - static LV2_URID urid_map(LV2_URID_Map_Handle handle, const char* uri); - static const char* urid_unmap(LV2_URID_Unmap_Handle handle, LV2_URID urid); - - typedef std::map EventToGlobal; - typedef std::map GlobalToEvent; - - SharedPtr _uri_map_feature; SharedPtr _urid_map_feature; SharedPtr _urid_unmap_feature; - EventToGlobal _event_to_global; - GlobalToEvent _global_to_event; }; } // namespace Shared diff --git a/ingen/shared/ResourceImpl.hpp b/ingen/shared/ResourceImpl.hpp index 8069c480..fe8d3017 100644 --- a/ingen/shared/ResourceImpl.hpp +++ b/ingen/shared/ResourceImpl.hpp @@ -67,8 +67,6 @@ public: void add_properties(const Properties& p); void remove_properties(const Properties& p); - void dump(std::ostream& os) const; - /** Get the ingen type from a set of Properties. * If some coherent ingen type is found, true is returned and the appropriate * output parameter set to true. Otherwise false is returned. diff --git a/ingen/shared/URIs.hpp b/ingen/shared/URIs.hpp index 4f95c6c7..a23b32d4 100644 --- a/ingen/shared/URIs.hpp +++ b/ingen/shared/URIs.hpp @@ -21,6 +21,8 @@ #include #include "ingen/shared/LV2URIMap.hpp" +#include "ingen/shared/Forge.hpp" +#include "raul/Atom.hpp" #include "raul/URI.hpp" namespace Raul { @@ -32,23 +34,29 @@ namespace Shared { class URIs : public boost::noncopyable { public: - URIs(Raul::Forge& forge, LV2URIMap* map); + URIs(Ingen::Forge& forge, LV2URIMap* map); struct Quark : public Raul::URI { - Quark(LV2URIMap* map, const char* str); - operator LV2_URID() const { return id; } - uint32_t id; + Quark(Ingen::Forge& forge, LV2URIMap* map, const char* str); + operator LV2_URID() const { return id; } + operator Raul::Atom() const { return atom; } + uint32_t id; + Raul::Atom atom; }; - Raul::Forge& forge; + Ingen::Forge& forge; + const Quark atom_Blank; const Quark atom_Bool; const Quark atom_Float; const Quark atom_Int; const Quark atom_MessagePort; + const Quark atom_Sequence; + const Quark atom_Sound; const Quark atom_String; const Quark atom_ValuePort; const Quark atom_Vector; + const Quark atom_bufferType; const Quark atom_eventTransfer; const Quark atom_supports; const Quark ctx_audioContext; @@ -56,7 +64,6 @@ public: const Quark ctx_messageContext; const Quark cv_CVPort; const Quark doap_name; - const Quark ev_EventPort; const Quark ingen_Connection; const Quark ingen_Internal; const Quark ingen_Node; diff --git a/ingen/shared/World.hpp b/ingen/shared/World.hpp index aa308efd..114be857 100644 --- a/ingen/shared/World.hpp +++ b/ingen/shared/World.hpp @@ -23,8 +23,9 @@ #include #include +#include "ingen/shared/Forge.hpp" #include "lv2/lv2plug.in/ns/ext/urid/urid.h" - +#include "raul/Atom.hpp" #include "raul/Configuration.hpp" #include "raul/SharedPtr.hpp" @@ -108,7 +109,7 @@ public: virtual Raul::Configuration* conf(); virtual void set_conf(Raul::Configuration* c); - virtual Raul::Forge& forge(); + virtual Ingen::Forge& forge(); virtual LV2Features* lv2_features(); -- cgit v1.2.1