From 40ff85e256ca9094fb75cdcbabd3442339f91ecd Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 2 May 2007 23:58:28 +0000 Subject: Added svn:ignore property to everything. Made engine and patch loader separate dynamically loaded modules. No more monolithic ingenuity (module loaded at runtime). git-svn-id: http://svn.drobilla.net/lad/ingen@491 a436a847-0d15-0410-975c-d299462d15a1 --- src/common/Makefile.am | 1 + src/common/interface/ClientInterface.h | 2 +- src/common/interface/EngineInterface.h | 2 +- src/libs/Makefile.am | 2 +- src/libs/client/ConnectionModel.h | 4 +- src/libs/client/ControlModel.h | 2 +- src/libs/client/DeprecatedLoader.cpp | 46 ++-- src/libs/client/DeprecatedLoader.h | 11 +- src/libs/client/Loader.cpp | 342 ------------------------- src/libs/client/Loader.h | 49 ---- src/libs/client/Makefile.am | 13 +- src/libs/client/ModelEngineInterface.cpp | 99 ------- src/libs/client/ModelEngineInterface.h | 72 ------ src/libs/client/NodeModel.h | 4 +- src/libs/client/OSCClientReceiver.cpp | 2 +- src/libs/client/OSCEngineSender.cpp | 2 +- src/libs/client/OSCModelEngineInterface.h | 42 --- src/libs/client/ObjectModel.h | 6 +- src/libs/client/PatchModel.h | 2 +- src/libs/client/PluginModel.h | 4 +- src/libs/client/PortModel.h | 4 +- src/libs/client/Serializer.cpp | 2 +- src/libs/client/Serializer.h | 1 - src/libs/client/Store.h | 6 +- src/libs/client/ThreadedSigClientInterface.h | 4 +- src/libs/engine/ClientBroadcaster.h | 2 +- src/libs/engine/DirectResponder.h | 2 +- src/libs/engine/Driver.h | 2 +- src/libs/engine/Engine.cpp | 33 ++- src/libs/engine/Engine.h | 18 +- src/libs/engine/Event.h | 2 +- src/libs/engine/GraphObject.h | 4 +- src/libs/engine/Makefile.am | 24 +- src/libs/engine/OSCClientSender.cpp | 2 +- src/libs/engine/OSCEngineReceiver.cpp | 16 +- src/libs/engine/OSCEngineReceiver.h | 4 +- src/libs/engine/ObjectStore.h | 2 +- src/libs/engine/PostProcessor.h | 4 +- src/libs/engine/QueuedEngineInterface.cpp | 66 ++--- src/libs/engine/QueuedEngineInterface.h | 6 +- src/libs/engine/QueuedEventSource.h | 6 +- src/libs/engine/Responder.h | 2 +- src/libs/engine/ThreadManager.h | 2 +- src/libs/engine/engine.cpp | 42 +++ src/libs/engine/engine.h | 38 +++ src/libs/engine/events/AddNodeEvent.cpp | 4 +- src/libs/engine/events/AddNodeEvent.h | 2 +- src/libs/engine/events/AddPortEvent.cpp | 4 +- src/libs/engine/events/ConnectionEvent.h | 2 +- src/libs/engine/events/CreatePatchEvent.cpp | 2 +- src/libs/engine/events/DestroyEvent.cpp | 2 +- src/libs/engine/events/DisconnectNodeEvent.cpp | 2 +- src/libs/engine/events/DisconnectPortEvent.h | 2 +- src/libs/engine/events/RenameEvent.cpp | 2 +- src/libs/engine/events/RequestMetadataEvent.h | 2 +- src/libs/engine/events/SetMetadataEvent.h | 2 +- src/libs/module/Makefile.am | 9 + src/libs/module/Module.cpp | 80 ++++++ src/libs/module/Module.h | 39 +++ src/libs/serialisation/Loader.cpp | 342 +++++++++++++++++++++++++ src/libs/serialisation/Loader.h | 56 ++++ src/libs/serialisation/Makefile.am | 16 ++ src/libs/serialisation/serialisation.cpp | 34 +++ src/libs/serialisation/serialisation.h | 38 +++ src/progs/demolition/demolition.cpp | 2 +- src/progs/ingenuity/App.cpp | 12 +- src/progs/ingenuity/App.h | 35 +-- src/progs/ingenuity/BreadCrumb.h | 4 +- src/progs/ingenuity/BreadCrumbBox.h | 4 +- src/progs/ingenuity/ConfigWindow.cpp | 7 +- src/progs/ingenuity/ConfigWindow.h | 5 +- src/progs/ingenuity/Configuration.cpp | 8 +- src/progs/ingenuity/ConnectWindow.cpp | 94 +++---- src/progs/ingenuity/ConnectWindow.h | 10 +- src/progs/ingenuity/Connection.h | 4 +- src/progs/ingenuity/ControlGroups.cpp | 8 +- src/progs/ingenuity/ControlGroups.h | 4 +- src/progs/ingenuity/ControlPanel.cpp | 10 +- src/progs/ingenuity/ControlPanel.h | 11 +- src/progs/ingenuity/DSSIController.cpp | 4 +- src/progs/ingenuity/DSSIController.h | 4 +- src/progs/ingenuity/LoadPatchWindow.cpp | 4 +- src/progs/ingenuity/LoadPatchWindow.h | 7 +- src/progs/ingenuity/LoadPluginWindow.cpp | 14 +- src/progs/ingenuity/LoadPluginWindow.h | 6 +- src/progs/ingenuity/LoadRemotePatchWindow.cpp | 6 +- src/progs/ingenuity/LoadRemotePatchWindow.h | 7 +- src/progs/ingenuity/LoadSubpatchWindow.cpp | 8 +- src/progs/ingenuity/LoadSubpatchWindow.h | 6 +- src/progs/ingenuity/Makefile.am | 15 +- src/progs/ingenuity/NewSubpatchWindow.cpp | 11 +- src/progs/ingenuity/NewSubpatchWindow.h | 6 +- src/progs/ingenuity/NodeControlWindow.cpp | 11 +- src/progs/ingenuity/NodeControlWindow.h | 2 +- src/progs/ingenuity/NodeMenu.cpp | 6 +- src/progs/ingenuity/NodeMenu.h | 6 +- src/progs/ingenuity/NodeModule.cpp | 10 +- src/progs/ingenuity/NodeModule.h | 2 +- src/progs/ingenuity/NodePropertiesWindow.cpp | 6 +- src/progs/ingenuity/NodePropertiesWindow.h | 4 +- src/progs/ingenuity/PatchCanvas.cpp | 24 +- src/progs/ingenuity/PatchCanvas.h | 4 +- src/progs/ingenuity/PatchPortModule.cpp | 6 +- src/progs/ingenuity/PatchPortModule.h | 2 +- src/progs/ingenuity/PatchPropertiesWindow.cpp | 4 +- src/progs/ingenuity/PatchPropertiesWindow.h | 2 +- src/progs/ingenuity/PatchTreeWindow.cpp | 11 +- src/progs/ingenuity/PatchTreeWindow.h | 2 +- src/progs/ingenuity/PatchView.cpp | 6 +- src/progs/ingenuity/PatchView.h | 4 +- src/progs/ingenuity/PatchWindow.cpp | 6 +- src/progs/ingenuity/PatchWindow.h | 6 +- src/progs/ingenuity/Port.cpp | 10 +- src/progs/ingenuity/Port.h | 2 +- src/progs/ingenuity/PortPropertiesWindow.cpp | 10 +- src/progs/ingenuity/PortPropertiesWindow.h | 4 +- src/progs/ingenuity/RenameWindow.cpp | 9 +- src/progs/ingenuity/RenameWindow.h | 4 +- src/progs/ingenuity/SubpatchModule.cpp | 4 +- src/progs/ingenuity/SubpatchModule.h | 6 +- src/progs/ingenuity/ThreadedLoader.cpp | 26 +- src/progs/ingenuity/ThreadedLoader.h | 18 +- src/progs/ingenuity/UploadPatchWindow.cpp | 8 +- src/progs/ingenuity/UploadPatchWindow.h | 10 +- src/progs/ingenuity/WindowFactory.h | 5 +- src/progs/ingenuity/ingenuity_dev | 3 + src/progs/patch_loader/Makefile.am | 6 +- src/progs/patch_loader/new_patch_loader.cpp | 2 +- src/progs/patch_loader/patch_loader.cpp | 36 ++- src/progs/server/Makefile.am | 7 +- src/progs/server/cmdline.c | 63 +---- src/progs/server/cmdline.ggo | 1 - src/progs/server/cmdline.h | 6 +- src/progs/server/ingen_dev | 3 + src/progs/server/main.cpp | 41 +-- src/set_dev_environment.sh | 8 + 136 files changed, 1271 insertions(+), 1102 deletions(-) delete mode 100644 src/libs/client/Loader.cpp delete mode 100644 src/libs/client/Loader.h delete mode 100644 src/libs/client/ModelEngineInterface.cpp delete mode 100644 src/libs/client/ModelEngineInterface.h delete mode 100644 src/libs/client/OSCModelEngineInterface.h create mode 100644 src/libs/engine/engine.cpp create mode 100644 src/libs/engine/engine.h create mode 100644 src/libs/module/Makefile.am create mode 100644 src/libs/module/Module.cpp create mode 100644 src/libs/module/Module.h create mode 100644 src/libs/serialisation/Loader.cpp create mode 100644 src/libs/serialisation/Loader.h create mode 100644 src/libs/serialisation/Makefile.am create mode 100644 src/libs/serialisation/serialisation.cpp create mode 100644 src/libs/serialisation/serialisation.h create mode 100755 src/progs/ingenuity/ingenuity_dev create mode 100755 src/progs/server/ingen_dev create mode 100755 src/set_dev_environment.sh (limited to 'src') diff --git a/src/common/Makefile.am b/src/common/Makefile.am index e6c5258e..676fa95d 100644 --- a/src/common/Makefile.am +++ b/src/common/Makefile.am @@ -1 +1,2 @@ DIST_SUBDIRS = interface lv2ext + diff --git a/src/common/interface/ClientInterface.h b/src/common/interface/ClientInterface.h index d6fb1da0..68dcaac3 100644 --- a/src/common/interface/ClientInterface.h +++ b/src/common/interface/ClientInterface.h @@ -19,7 +19,7 @@ #define CLIENTINTERFACE_H #include -#include "raul/Atom.h" +#include #include using std::string; diff --git a/src/common/interface/EngineInterface.h b/src/common/interface/EngineInterface.h index 264c78f0..8a10c840 100644 --- a/src/common/interface/EngineInterface.h +++ b/src/common/interface/EngineInterface.h @@ -20,7 +20,7 @@ #include #include -#include "raul/SharedPtr.h" +#include #include "interface/ClientInterface.h" using std::string; diff --git a/src/libs/Makefile.am b/src/libs/Makefile.am index b509598e..81422435 100644 --- a/src/libs/Makefile.am +++ b/src/libs/Makefile.am @@ -1,2 +1,2 @@ -SUBDIRS = engine client +SUBDIRS = module engine serialisation client diff --git a/src/libs/client/ConnectionModel.h b/src/libs/client/ConnectionModel.h index 7024d058..9e62d5b4 100644 --- a/src/libs/client/ConnectionModel.h +++ b/src/libs/client/ConnectionModel.h @@ -19,8 +19,8 @@ #define CONNECTIONMODEL_H #include -#include "raul/Path.h" -#include "raul/SharedPtr.h" +#include +#include #include "PortModel.h" #include using std::string; diff --git a/src/libs/client/ControlModel.h b/src/libs/client/ControlModel.h index dc709944..5729faec 100644 --- a/src/libs/client/ControlModel.h +++ b/src/libs/client/ControlModel.h @@ -19,7 +19,7 @@ #define CONTROLMODEL_H #include -#include "raul/Path.h" +#include namespace Ingen { namespace Client { diff --git a/src/libs/client/DeprecatedLoader.cpp b/src/libs/client/DeprecatedLoader.cpp index 97e6583d..d4b650df 100644 --- a/src/libs/client/DeprecatedLoader.cpp +++ b/src/libs/client/DeprecatedLoader.cpp @@ -15,28 +15,29 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "DeprecatedLoader.h" -#include -#include -#include -#include -#include "PatchModel.h" -#include "NodeModel.h" -#include "ConnectionModel.h" -#include "PortModel.h" -#include "PresetModel.h" -#include "ModelEngineInterface.h" -#include "PluginModel.h" -#include "raul/Path.h" + #include #include #include +#include #include // for pair, make_pair #include #include #include #include // for atof #include +#include +#include +#include +#include +#include "interface/EngineInterface.h" +#include "PatchModel.h" +#include "NodeModel.h" +#include "ConnectionModel.h" +#include "PortModel.h" +#include "PresetModel.h" +#include "PluginModel.h" +#include "DeprecatedLoader.h" using std::string; using std::vector; using std::pair; using std::cerr; using std::cout; using std::endl; @@ -245,8 +246,11 @@ DeprecatedLoader::load_patch(const Glib::ustring& filename, poly = 1; // Create it, if we're not merging - if (!existing) - _engine->create_patch_with_data(path, poly, initial_data); + if (!existing) { + _engine->create_patch(path, poly); + for (MetadataMap::const_iterator i = initial_data.begin(); i != initial_data.end(); ++i) + _engine->set_metadata(path, i->first, i->second); + } // Load nodes cur = xmlDocGetRootElement(doc)->xmlChildrenNode; @@ -294,7 +298,8 @@ DeprecatedLoader::load_patch(const Glib::ustring& filename, xmlCleanupParser(); // Done above.. late enough? - //_engine->set_metadata_map(path, initial_data); + //for (MetadataMap::const_iterator i = data.begin(); i != data.end(); ++i) + // _engine->set_metadata(subject, i->first, i->second); if (!existing) _engine->enable_patch(path); @@ -485,7 +490,8 @@ DeprecatedLoader::load_node(const Path& parent, xmlDocPtr doc, const xmlNodePtr path = new_path; - _engine->set_metadata_map(path, initial_data); + for (MetadataMap::const_iterator i = initial_data.begin(); i != initial_data.end(); ++i) + _engine->set_metadata(path, i->first, i->second); return SharedPtr(); @@ -508,7 +514,8 @@ DeprecatedLoader::load_node(const Path& parent, xmlDocPtr doc, const xmlNodePtr else _engine->create_node(path, plugin_type, library_name, plugin_label, polyphonic); - _engine->set_metadata_map(path, initial_data); + for (MetadataMap::const_iterator i = initial_data.begin(); i != initial_data.end(); ++i) + _engine->set_metadata(path, i->first, i->second); return true; } @@ -516,7 +523,8 @@ DeprecatedLoader::load_node(const Path& parent, xmlDocPtr doc, const xmlNodePtr // Not deprecated } else { _engine->create_node(path, plugin_uri, polyphonic); - _engine->set_metadata_map(path, initial_data); + for (MetadataMap::const_iterator i = initial_data.begin(); i != initial_data.end(); ++i) + _engine->set_metadata(path, i->first, i->second); return true; } diff --git a/src/libs/client/DeprecatedLoader.h b/src/libs/client/DeprecatedLoader.h index aa9557f5..dde9f631 100644 --- a/src/libs/client/DeprecatedLoader.h +++ b/src/libs/client/DeprecatedLoader.h @@ -25,11 +25,13 @@ #include #include #include -#include "raul/SharedPtr.h" -#include "raul/Path.h" +#include +#include +#include "interface/EngineInterface.h" #include "ObjectModel.h" using std::string; +using Ingen::Shared::EngineInterface; namespace Ingen { namespace Client { @@ -38,7 +40,6 @@ class PatchModel; class NodeModel; class ConnectionModel; class PresetModel; -class ModelEngineInterface; /** Loads deprecated (XML) patch files (from the Om days). @@ -48,7 +49,7 @@ class ModelEngineInterface; class DeprecatedLoader { public: - DeprecatedLoader(SharedPtr engine) + DeprecatedLoader(SharedPtr engine) : /*_patch_search_path(".")*/ _engine(engine) { assert(_engine); @@ -72,7 +73,7 @@ private: string translate_load_path(const string& path); //string _patch_search_path; - SharedPtr _engine; + SharedPtr _engine; /// Translations of paths from the loading file to actual paths (for deprecated patches) std::map _load_path_translations; diff --git a/src/libs/client/Loader.cpp b/src/libs/client/Loader.cpp deleted file mode 100644 index 8ebea580..00000000 --- a/src/libs/client/Loader.cpp +++ /dev/null @@ -1,342 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave 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 - */ - -#include -#include -#include -#include -#include "Loader.h" -#include "interface/EngineInterface.h" - -using namespace std; -using namespace Raul; -using namespace Ingen::Shared; - -namespace Ingen { -namespace Serialisation { - - -/** Load (create) a patch from RDF into the engine. - * - * @param document_uri URI of file to load objects from. - * @param parent Path of parent under which to load objects. - * @return whether or not load was successful. - */ -bool -load(SharedPtr engine, - Raul::RDF::World* rdf_world, - const Glib::ustring& document_uri, - boost::optional parent, - string patch_name, - Glib::ustring patch_uri, - map data) -{ - // FIXME: this whole thing is a mess - - std::map created; - - RDF::Model model(*rdf_world, document_uri); - - //patch_uri = string("<") + patch_uri + ">"; - patch_uri = string("<") + document_uri + ">"; - - cerr << "[Loader] Loading " << patch_uri << " from " << document_uri - << " under " << (string)(parent ? (string)parent.get() : "no parent") << endl; - - /* Get polyphony (mandatory) */ - - // FIXME: polyphony datatype - RDF::Query query(*rdf_world, Glib::ustring( - "SELECT DISTINCT ?poly WHERE {\n") + - patch_uri + " ingen:polyphony ?poly\n }"); - - RDF::Query::Results results = query.run(*rdf_world, model); - - if (results.size() == 0) { - cerr << "[Loader] ERROR: No polyphony found!" << endl; - return false; - } - - RDF::Node poly_node = (*results.begin())["poly"]; - assert(poly_node.is_int()); - size_t patch_poly = (size_t)poly_node.to_int(); - - /* Get name (if available/necessary) */ - - if (patch_name == "") { - patch_name = string(document_uri.substr(document_uri.find_last_of("/")+1)); - if (patch_name.substr(patch_name.length()-10) == ".ingen.ttl") - patch_name = patch_name.substr(0, patch_name.length()-10); - - query = RDF::Query(*rdf_world, Glib::ustring( - "SELECT DISTINCT ?name WHERE {\n") + - patch_uri + " ingen:name ?name\n}"); - - results = query.run(*rdf_world, model); - - if (results.size() > 0) - patch_name = (*results.begin())["name"].to_string(); - } - - Path patch_path = ( parent ? (parent.get().base() + patch_name) : Path("/") ); - cerr << "************ PATCH: name=" << patch_name << ", path=" << patch_path - << ", poly = " << patch_poly << endl; - engine->create_patch(patch_path, patch_poly); - - - /* Load (plugin) nodes */ - - query = RDF::Query(*rdf_world, Glib::ustring( - "SELECT DISTINCT ?name ?plugin ?floatkey ?floatval WHERE {\n") + - patch_uri + " ingen:node ?node .\n" - "?node ingen:name ?name ;\n" - " ingen:plugin ?plugin .\n" - "OPTIONAL { ?node ?floatkey ?floatval . \n" - " FILTER ( datatype(?floatval) = xsd:decimal ) }\n" - "}"); - - results = query.run(*rdf_world, model); - - for (RDF::Query::Results::iterator i = results.begin(); i != results.end(); ++i) { - - string name = (*i)["name"].to_string(); - string plugin = (*i)["plugin"].to_string(); - - const Path node_path = patch_path.base() + (string)name; - - if (created.find(node_path) == created.end()) { - engine->create_node(node_path, plugin, false); - created[node_path] = true; - } - - string floatkey = rdf_world->prefixes().qualify((*i)["floatkey"].to_string()); - RDF::Node val_node = (*i)["floatval"]; - - if (floatkey != "" && val_node.is_float()) - engine->set_metadata(patch_path.base() + name, floatkey, Atom(val_node.to_float())); - } - - - /* Load subpatches */ - - query = RDF::Query(*rdf_world, Glib::ustring( - "SELECT DISTINCT ?patch ?name WHERE {\n") + - patch_uri + " ingen:node ?patch .\n" - "?patch a ingen:Patch ;\n" - " ingen:name ?name .\n" - "}"); - - results = query.run(*rdf_world, model); - - for (RDF::Query::Results::iterator i = results.begin(); i != results.end(); ++i) { - - string name = (*i)["name"].to_string(); - string patch = (*i)["patch"].to_string(); - - const Path subpatch_path = patch_path.base() + (string)name; - - if (created.find(subpatch_path) == created.end()) { - load(engine, rdf_world, document_uri, patch_path, name, patch); - created[subpatch_path] = true; - } - } - - created.clear(); - - - /* Set node port control values */ - - query = RDF::Query(*rdf_world, Glib::ustring( - "SELECT DISTINCT ?nodename ?portname ?portval WHERE {\n") + - patch_uri + " ingen:node ?node .\n" - "?node ingen:name ?nodename ;\n" - " ingen:port ?port .\n" - "?port ingen:name ?portname ;\n" - " ingen:value ?portval .\n" - "FILTER ( datatype(?portval) = xsd:decimal )\n" - "}\n"); - - results = query.run(*rdf_world, model); - - for (RDF::Query::Results::iterator i = results.begin(); i != results.end(); ++i) { - - string node_name = (*i)["nodename"].to_string(); - string port_name = (*i)["portname"].to_string(); - const float val = (*i)["portval"].to_float(); - - Path port_path = patch_path.base() + (const string&)node_name +"/"+ (const string&)port_name; - - engine->set_port_value(port_path, val); - } - - - /* Load this patch's ports */ - - query = RDF::Query(*rdf_world, Glib::ustring( - "SELECT DISTINCT ?port ?type ?name ?datatype ?floatkey ?floatval ?portval WHERE {\n") + - patch_uri + " ingen:port ?port .\n" - "?port a ?type ;\n" - " ingen:name ?name ;\n" - " ingen:dataType ?datatype .\n" - "OPTIONAL { ?port ?floatkey ?floatval . \n" - " FILTER ( datatype(?floatval) = xsd:decimal ) }\n" - "OPTIONAL { ?port ingen:value ?portval . \n" - " FILTER ( datatype(?portval) = xsd:decimal ) }\n" - "}"); - - results = query.run(*rdf_world, model); - - for (RDF::Query::Results::iterator i = results.begin(); i != results.end(); ++i) { - string name = (*i)["name"].to_string(); - string type = rdf_world->qualify((*i)["type"].to_string()); - string datatype = (*i)["datatype"].to_string(); - - const Path port_path = patch_path.base() + (string)name; - - if (created.find(port_path) == created.end()) { - //cerr << "TYPE: " << type << endl; - bool is_output = (type == "ingen:OutputPort"); // FIXME: check validity - engine->create_port(port_path, datatype, is_output); - created[port_path] = true; - } - - RDF::Node val_node = (*i)["portval"]; - if (val_node.is_float()) - engine->set_port_value(patch_path.base() + name, val_node.to_float()); - - string floatkey = rdf_world->qualify((*i)["floatkey"].to_string()); - val_node = (*i)["floatval"]; - - if (floatkey != "" && val_node.is_float()) - engine->set_metadata(patch_path.base() + name, floatkey, Atom(val_node.to_float())); - } - - created.clear(); - - - /* Node -> Node connections */ - - query = RDF::Query(*rdf_world, Glib::ustring( - "SELECT DISTINCT ?srcnodename ?srcname ?dstnodename ?dstname WHERE {\n") + - patch_uri + "ingen:node ?srcnode ;\n" - " ingen:node ?dstnode .\n" - "?srcnode ingen:port ?src ;\n" - " ingen:name ?srcnodename .\n" - "?dstnode ingen:port ?dst ;\n" - " ingen:name ?dstnodename .\n" - "?src ingen:name ?srcname .\n" - "?dst ingen:connectedTo ?src ;\n" - " ingen:name ?dstname .\n" - "}\n"); - - results = query.run(*rdf_world, model); - - for (RDF::Query::Results::iterator i = results.begin(); i != results.end(); ++i) { - Path src_node = patch_path.base() + (*i)["srcnodename"].to_string(); - Path src_port = src_node.base() + (*i)["srcname"].to_string(); - Path dst_node = patch_path.base() + (*i)["dstnodename"].to_string(); - Path dst_port = dst_node.base() + (*i)["dstname"].to_string(); - - cerr << patch_path << " 1 CONNECTION: " << src_port << " -> " << dst_port << endl; - - engine->connect(src_port, dst_port); - } - - - /* This Patch -> Node connections */ - - query = RDF::Query(*rdf_world, Glib::ustring( - "SELECT DISTINCT ?srcname ?dstnodename ?dstname WHERE {\n") + - patch_uri + " ingen:port ?src ;\n" - " ingen:node ?dstnode .\n" - "?dstnode ingen:port ?dst ;\n" - " ingen:name ?dstnodename .\n" - "?dst ingen:connectedTo ?src ;\n" - " ingen:name ?dstname .\n" - "?src ingen:name ?srcname .\n" - "}\n"); - - results = query.run(*rdf_world, model); - - for (RDF::Query::Results::iterator i = results.begin(); i != results.end(); ++i) { - Path src_port = patch_path.base() + (*i)["srcname"].to_string(); - Path dst_node = patch_path.base() + (*i)["dstnodename"].to_string(); - Path dst_port = dst_node.base() + (*i)["dstname"].to_string(); - - cerr << patch_path << " 2 CONNECTION: " << src_port << " -> " << dst_port << endl; - - engine->connect(src_port, dst_port); - } - - - /* Node -> This Patch connections */ - - query = RDF::Query(*rdf_world, Glib::ustring( - "SELECT DISTINCT ?srcnodename ?srcname ?dstname WHERE {\n") + - patch_uri + " ingen:port ?dst ;\n" - " ingen:node ?srcnode .\n" - "?srcnode ingen:port ?src ;\n" - " ingen:name ?srcnodename .\n" - "?dst ingen:connectedTo ?src ;\n" - " ingen:name ?dstname .\n" - "?src ingen:name ?srcname .\n" - "}\n"); - - results = query.run(*rdf_world, model); - - for (RDF::Query::Results::iterator i = results.begin(); i != results.end(); ++i) { - Path dst_port = patch_path.base() + (*i)["dstname"].to_string(); - Path src_node = patch_path.base() + (*i)["srcnodename"].to_string(); - Path src_port = src_node.base() + (*i)["srcname"].to_string(); - - cerr << patch_path << " 3 CONNECTION: " << src_port << " -> " << dst_port << endl; - - engine->connect(src_port, dst_port); - } - - - /* Load metadata */ - - query = RDF::Query(*rdf_world, Glib::ustring( - "SELECT DISTINCT ?floatkey ?floatval WHERE {\n") + - patch_uri + " ?floatkey ?floatval . \n" - " FILTER ( datatype(?floatval) = xsd:decimal ) \n" - "}"); - - results = query.run(*rdf_world, model); - - for (RDF::Query::Results::iterator i = results.begin(); i != results.end(); ++i) { - - string floatkey = rdf_world->prefixes().qualify((*i)["floatkey"].to_string()); - RDF::Node val_node = (*i)["floatval"]; - - if (floatkey != "" && val_node.is_float()) - engine->set_metadata(patch_path, floatkey, Atom(val_node.to_float())); - } - - - // Set passed metadata last to override any loaded values - for (Metadata::const_iterator i = data.begin(); i != data.end(); ++i) - engine->set_metadata(patch_path, i->first, i->second); - - return true; -} - - -} // namespace Serialisation -} // namespace Ingen - diff --git a/src/libs/client/Loader.h b/src/libs/client/Loader.h deleted file mode 100644 index 74aa7cbb..00000000 --- a/src/libs/client/Loader.h +++ /dev/null @@ -1,49 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave 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 LOADER_H -#define LOADER_H - -#include -#include -#include -#include -#include -#include - -namespace Raul { class Atom; namespace RDF { class World; } } -namespace Ingen { namespace Shared { class EngineInterface; } } - -namespace Ingen { -namespace Serialisation { - -typedef std::map Metadata; - -bool -load(SharedPtr engine, - Raul::RDF::World* world, - const Glib::ustring& uri, - boost::optional parent, - std::string patch_name, - Glib::ustring patch_uri = "", - Metadata data = Metadata()); - - -} // namespace Serialisation -} // namespace Ingen - -#endif // LOADER_H diff --git a/src/libs/client/Makefile.am b/src/libs/client/Makefile.am index b226c381..1a0aa61d 100644 --- a/src/libs/client/Makefile.am +++ b/src/libs/client/Makefile.am @@ -1,23 +1,20 @@ if BUILD_CLIENT_LIB -noinst_LTLIBRARIES = libingenclient.la +noinst_LTLIBRARIES = libingen_client.la -libingenclient_la_CXXFLAGS = @RAUL_CFLAGS@ @SLV2_CFLAGS@ @LXML2_CFLAGS@ @RASQAL_CFLAGS@ @RAPTOR_CFLAGS@ @LSIGCPP_CFLAGS@ @GLIBMM_CFLAGS@ -I$(top_srcdir)/src/common -DPKGDATADIR=\"$(pkgdatadir)\" +libingen_client_la_CXXFLAGS = @RAUL_CFLAGS@ @SLV2_CFLAGS@ @LXML2_CFLAGS@ @RASQAL_CFLAGS@ @RAPTOR_CFLAGS@ @LSIGCPP_CFLAGS@ @GLIBMM_CFLAGS@ -I$(top_srcdir)/src/common -DPKGDATADIR=\"$(pkgdatadir)\" -libingenclient_la_LIBADD = @RAUL_LIBS@ @SLV2_LIBS@ @LXML2_LIBS@ @LOSC_LIBS@ @RASQAL_LIBS@ @RAPTOR_LIBS@ @LSIGCPP_LIBS@ @GLIBMM_LIBS@ +libingen_client_la_LIBADD = @RAUL_LIBS@ @SLV2_LIBS@ @LXML2_LIBS@ @LOSC_LIBS@ @RASQAL_LIBS@ @RAPTOR_LIBS@ @LSIGCPP_LIBS@ @GLIBMM_LIBS@ -libingenclient_la_SOURCES = \ +libingen_client_la_SOURCES = \ OSCEngineSender.h \ OSCEngineSender.cpp \ - OSCModelEngineInterface.h \ OSCClientReceiver.h \ OSCClientReceiver.cpp \ SigClientInterface.h \ DirectSigClientInterface.h \ ThreadedSigClientInterface.h \ ThreadedSigClientInterface.cpp \ - ModelEngineInterface.h \ - ModelEngineInterface.cpp \ PresetModel.h \ ControlModel.h \ ObjectModel.h \ @@ -31,8 +28,6 @@ libingenclient_la_SOURCES = \ PluginModel.cpp \ Serializer.h \ Serializer.cpp \ - Loader.h \ - Loader.cpp \ DeprecatedLoader.h \ DeprecatedLoader.cpp \ ConnectionModel.h \ diff --git a/src/libs/client/ModelEngineInterface.cpp b/src/libs/client/ModelEngineInterface.cpp deleted file mode 100644 index 9401a937..00000000 --- a/src/libs/client/ModelEngineInterface.cpp +++ /dev/null @@ -1,99 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave 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 - */ - -#include "ModelEngineInterface.h" -#include "PatchModel.h" -#include "PresetModel.h" - -namespace Ingen { -namespace Client { - - -/** Load a node. - */ -void -ModelEngineInterface::create_node_with_data(const string& plugin_uri, - const Path& path, - bool is_polyphonic, - const MetadataMap& initial_data) -{ - // Load by URI - if (plugin_uri.length() > 0) { - create_node(path, plugin_uri, is_polyphonic); - - // Load by libname, label - } else { - cerr << "FIXME: non-uri" << endl; - #if 0 - //assert(nm->plugin()->lib_name().length() > 0); - assert(nm->plugin()->plug_label().length() > 0); - - create_node(nm->path(), - nm->plugin()->type_string(), - nm->plugin()->lib_name().c_str(), - nm->plugin()->plug_label().c_str(), - nm->polyphonic()); - #endif - } - - set_metadata_map(path, initial_data); -} - - -/** Create a patch. - */ -void -ModelEngineInterface::create_patch_with_data(const Path& path, size_t poly, const MetadataMap& data) -{ - create_patch(path, poly); - set_metadata_map(path, data); -} - - -void -ModelEngineInterface::create_port_with_data(const Path& path, - const string& data_type, - bool direction, - const MetadataMap& data) -{ - create_port(path, data_type, direction); - set_metadata_map(path, data); -} - -/** Set all pieces of metadata in a map. - */ -void -ModelEngineInterface::set_metadata_map(const Path& subject, const MetadataMap& data) -{ - for (MetadataMap::const_iterator i = data.begin(); i != data.end(); ++i) - set_metadata(subject, i->first, i->second); -} - - -/** Set a preset by setting all relevant controls for a patch. - */ -void -ModelEngineInterface::set_preset(const Path& patch_path, const PresetModel* const pm) -{ - for (list::const_iterator i = pm->controls().begin(); i != pm->controls().end(); ++i) { - set_port_value_queued((*i).port_path(), (*i).value()); - } -} - - -} // namespace Client -} // namespace Ingen diff --git a/src/libs/client/ModelEngineInterface.h b/src/libs/client/ModelEngineInterface.h deleted file mode 100644 index d93d6564..00000000 --- a/src/libs/client/ModelEngineInterface.h +++ /dev/null @@ -1,72 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave 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 MODELENGINEINTERFACE_H -#define MODELENGINEINTERFACE_H - -#include -#include -#include "interface/EngineInterface.h" -#include "ObjectModel.h" -using std::string; - -class Path; - -/** \defgroup IngenClient Client Library */ -namespace Ingen { -namespace Client { - -class ObjectModel; -class NodeModel; -class PresetModel; -class PatchModel; - - -/** Model-based engine command interface. - * - * \ingroup IngenClient - */ -class ModelEngineInterface : public virtual Shared::EngineInterface -{ -public: - virtual ~ModelEngineInterface() {} - - virtual void create_patch_with_data(const Path& path, - size_t poly, - const MetadataMap& initial_data); - - virtual void create_node_with_data(const string& plugin_uri, - const Path& path, - bool is_polyphonicc, - const MetadataMap& initial_data); - - virtual void create_port_with_data(const Path& path, - const string& data_type, - bool direction, - const MetadataMap& data); - - virtual void set_metadata_map(const Path& subject, const MetadataMap& data); - virtual void set_preset(const Path& patch_path, const PresetModel* pm); - -protected: - ModelEngineInterface() {} -}; - -} // namespace Client -} // namespace Ingen - -#endif // MODELENGINEINTERFACE_H diff --git a/src/libs/client/NodeModel.h b/src/libs/client/NodeModel.h index 2dd96f35..f8866f15 100644 --- a/src/libs/client/NodeModel.h +++ b/src/libs/client/NodeModel.h @@ -25,8 +25,8 @@ #include #include "ObjectModel.h" #include "PortModel.h" -#include "raul/Path.h" -#include "raul/SharedPtr.h" +#include +#include #include "PluginModel.h" using std::string; using std::map; using std::find; diff --git a/src/libs/client/OSCClientReceiver.cpp b/src/libs/client/OSCClientReceiver.cpp index 7545b141..d56b8f2e 100644 --- a/src/libs/client/OSCClientReceiver.cpp +++ b/src/libs/client/OSCClientReceiver.cpp @@ -16,7 +16,7 @@ */ #include "OSCClientReceiver.h" -#include "raul/AtomLiblo.h" +#include #include #include #include diff --git a/src/libs/client/OSCEngineSender.cpp b/src/libs/client/OSCEngineSender.cpp index 11bbc3d7..6ebf8df0 100644 --- a/src/libs/client/OSCEngineSender.cpp +++ b/src/libs/client/OSCEngineSender.cpp @@ -18,7 +18,7 @@ #include #include "OSCEngineSender.h" #include "interface/ClientKey.h" -#include "raul/AtomLiblo.h" +#include using std::cout; using std::cerr; using std::endl; namespace Ingen { diff --git a/src/libs/client/OSCModelEngineInterface.h b/src/libs/client/OSCModelEngineInterface.h deleted file mode 100644 index a4a19c95..00000000 --- a/src/libs/client/OSCModelEngineInterface.h +++ /dev/null @@ -1,42 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave 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 OSCMODELENGINEINTERFACE_H -#define OSCMODELENGINEINTERFACE_H - -#include -#include "OSCEngineSender.h" -#include "ModelEngineInterface.h" - -using std::string; - -/** \defgroup IngenClient Client Library */ -namespace Ingen { -namespace Client { - - -class OSCModelEngineInterface : public OSCEngineSender, public ModelEngineInterface -{ -public: - OSCModelEngineInterface(const string& engine_url) : OSCEngineSender(engine_url) {} -}; - - -} // namespace Client -} // namespace Ingen - -#endif // OSCMODELENGINEINTERFACE_H diff --git a/src/libs/client/ObjectModel.h b/src/libs/client/ObjectModel.h index 882ff911..d388475a 100644 --- a/src/libs/client/ObjectModel.h +++ b/src/libs/client/ObjectModel.h @@ -26,9 +26,9 @@ #include #include #include -#include "raul/Atom.h" -#include "raul/Path.h" -#include "raul/SharedPtr.h" +#include +#include +#include using std::string; using std::map; using std::find; using std::cout; using std::cerr; using std::endl; diff --git a/src/libs/client/PatchModel.h b/src/libs/client/PatchModel.h index c55bce89..faceef72 100644 --- a/src/libs/client/PatchModel.h +++ b/src/libs/client/PatchModel.h @@ -24,7 +24,7 @@ #include #include #include "NodeModel.h" -#include "raul/SharedPtr.h" +#include #include "ConnectionModel.h" using std::list; using std::string; using std::map; diff --git a/src/libs/client/PluginModel.h b/src/libs/client/PluginModel.h index aba4d1cf..20777bd9 100644 --- a/src/libs/client/PluginModel.h +++ b/src/libs/client/PluginModel.h @@ -21,8 +21,8 @@ #include "../../../config.h" #include #include -#include "raul/Path.h" -#include "raul/SharedPtr.h" +#include +#include #ifdef HAVE_SLV2 #include #endif diff --git a/src/libs/client/PortModel.h b/src/libs/client/PortModel.h index 15a381d4..139e2a97 100644 --- a/src/libs/client/PortModel.h +++ b/src/libs/client/PortModel.h @@ -24,8 +24,8 @@ #include #include #include "ObjectModel.h" -#include "raul/SharedPtr.h" -#include "raul/Path.h" +#include +#include using std::string; using std::list; using std::cerr; using std::endl; namespace Ingen { diff --git a/src/libs/client/Serializer.cpp b/src/libs/client/Serializer.cpp index 85a13331..4a746ae1 100644 --- a/src/libs/client/Serializer.cpp +++ b/src/libs/client/Serializer.cpp @@ -33,13 +33,13 @@ #include #include #include +#include "interface/EngineInterface.h" #include "Serializer.h" #include "PatchModel.h" #include "NodeModel.h" #include "ConnectionModel.h" #include "PortModel.h" #include "PresetModel.h" -#include "ModelEngineInterface.h" #include "PluginModel.h" using namespace std; diff --git a/src/libs/client/Serializer.h b/src/libs/client/Serializer.h index ad91afac..ee7d3dff 100644 --- a/src/libs/client/Serializer.h +++ b/src/libs/client/Serializer.h @@ -39,7 +39,6 @@ class NodeModel; class PortModel; class ConnectionModel; class PresetModel; -class ModelEngineInterface; /** Serializes Ingen objects (patches, nodes, etc) to RDF. diff --git a/src/libs/client/Store.h b/src/libs/client/Store.h index 2059f55f..e481fc2d 100644 --- a/src/libs/client/Store.h +++ b/src/libs/client/Store.h @@ -22,10 +22,10 @@ #include #include #include -#include "raul/SharedPtr.h" +#include #include -#include "raul/Path.h" -#include "raul/Atom.h" +#include +#include #include "interface/EngineInterface.h" using std::string; using std::map; using std::list; using Ingen::Shared::EngineInterface; diff --git a/src/libs/client/ThreadedSigClientInterface.h b/src/libs/client/ThreadedSigClientInterface.h index c0b1ce73..d0cb4e89 100644 --- a/src/libs/client/ThreadedSigClientInterface.h +++ b/src/libs/client/ThreadedSigClientInterface.h @@ -23,8 +23,8 @@ #include #include "interface/ClientInterface.h" #include "SigClientInterface.h" -#include "raul/SRSWQueue.h" -#include "raul/Atom.h" +#include +#include using std::string; /** Returns nothing and takes no parameters (because they have all been bound) */ diff --git a/src/libs/engine/ClientBroadcaster.h b/src/libs/engine/ClientBroadcaster.h index 4cdecaa2..8b6d4616 100644 --- a/src/libs/engine/ClientBroadcaster.h +++ b/src/libs/engine/ClientBroadcaster.h @@ -26,7 +26,7 @@ #include #include "types.h" #include "interface/ClientInterface.h" -#include "raul/SharedPtr.h" +#include using std::list; using std::string; using std::pair; diff --git a/src/libs/engine/DirectResponder.h b/src/libs/engine/DirectResponder.h index d38693b1..c9e50f76 100644 --- a/src/libs/engine/DirectResponder.h +++ b/src/libs/engine/DirectResponder.h @@ -19,7 +19,7 @@ #ifndef DIRECTRESPONDER_H #define DIRECTRESPONDER_H -#include "raul/SharedPtr.h" +#include #include "interface/ClientInterface.h" #include "Responder.h" diff --git a/src/libs/engine/Driver.h b/src/libs/engine/Driver.h index fbddc828..bb65fe9b 100644 --- a/src/libs/engine/Driver.h +++ b/src/libs/engine/Driver.h @@ -20,7 +20,7 @@ #include #include -#include "raul/Path.h" +#include #include "DataType.h" namespace Ingen { diff --git a/src/libs/engine/Engine.cpp b/src/libs/engine/Engine.cpp index ddb9ea81..d9481786 100644 --- a/src/libs/engine/Engine.cpp +++ b/src/libs/engine/Engine.cpp @@ -35,6 +35,7 @@ #include "PostProcessor.h" #include "CreatePatchEvent.h" #include "EnablePatchEvent.h" +#include "OSCEngineReceiver.h" #ifdef HAVE_JACK_MIDI #include "JackMidiDriver.h" #endif @@ -139,14 +140,37 @@ Engine::main_iteration() } +void +Engine::start_jack_driver() +{ + _audio_driver = SharedPtr(new JackAudioDriver(*this)); +} + + +void +Engine::start_osc_driver(const std::string& port) +{ + _event_source = SharedPtr(new OSCEngineReceiver( + *this, pre_processor_queue_size, port.c_str())); +} + + +void +Engine::set_event_source(SharedPtr source) +{ + _event_source = source; +} + + bool -Engine::activate(SharedPtr ad, SharedPtr es) +Engine::activate() { if (_activated) return false; - // Setup drivers - _audio_driver = ad; + assert(_audio_driver); + assert(_event_source); + #ifdef HAVE_JACK_MIDI _midi_driver = new JackMidiDriver(((JackAudioDriver*)_audio_driver.get())->jack_client()); #elif HAVE_ALSA_MIDI @@ -155,9 +179,6 @@ Engine::activate(SharedPtr ad, SharedPtr es) _midi_driver = new DummyMidiDriver(); #endif - // Set event source (FIXME: handle multiple sources) - _event_source = es; - _event_source->activate(); // Create root patch diff --git a/src/libs/engine/Engine.h b/src/libs/engine/Engine.h index 38d638c3..e66e1125 100644 --- a/src/libs/engine/Engine.h +++ b/src/libs/engine/Engine.h @@ -54,19 +54,23 @@ class Engine : boost::noncopyable { public: Engine(); - ~Engine(); + virtual ~Engine(); - int main(); - bool main_iteration(); + virtual int main(); + virtual bool main_iteration(); /** Set the quit flag that should kill all threads and exit cleanly. * Note that it will take some time. */ - void quit() { _quit_flag = true; } + virtual void quit() { _quit_flag = true; } + + virtual void start_jack_driver(); + virtual void start_osc_driver(const std::string& port); + virtual void set_event_source(SharedPtr source); - bool activate(SharedPtr ad, SharedPtr es); - void deactivate(); + virtual bool activate(); + virtual void deactivate(); - bool activated() { return _activated; } + virtual bool activated() { return _activated; } Raul::Maid* maid() const { return _maid; } EventSource* event_source() const { return _event_source.get(); } diff --git a/src/libs/engine/Event.h b/src/libs/engine/Event.h index f0fd170a..9fd398e2 100644 --- a/src/libs/engine/Event.h +++ b/src/libs/engine/Event.h @@ -19,7 +19,7 @@ #define EVENT_H #include -#include "raul/SharedPtr.h" +#include #include "types.h" #include #include "Responder.h" diff --git a/src/libs/engine/GraphObject.h b/src/libs/engine/GraphObject.h index 8754c28a..c5993595 100644 --- a/src/libs/engine/GraphObject.h +++ b/src/libs/engine/GraphObject.h @@ -23,8 +23,8 @@ #include #include #include -#include "raul/Path.h" -#include "raul/Atom.h" +#include +#include #include "types.h" using std::string; diff --git a/src/libs/engine/Makefile.am b/src/libs/engine/Makefile.am index 98737957..5529898d 100644 --- a/src/libs/engine/Makefile.am +++ b/src/libs/engine/Makefile.am @@ -2,12 +2,16 @@ SUBDIRS = tests events MAINTAINERCLEANFILES = Makefile.in -noinst_LTLIBRARIES = libingen.la -libingen_la_CXXFLAGS = @RAUL_CFLAGS@ @JACK_CFLAGS@ @LOSC_CFLAGS@ @ALSA_CFLAGS@ @LASH_CFLAGS@ @SLV2_CFLAGS@ -I$(top_srcdir)/src/common -I$(top_srcdir)/src/libs/engine/events +moduledir = $(libdir)/ingen -libingen_la_LIBADD = @RAUL_LIBS@ @JACK_LIBS@ @LOSC_LIBS@ @ALSA_LIBS@ @LASH_LIBS@ @SLV2_LIBS@ +module_LTLIBRARIES = libingen_engine.la +libingen_engine_la_CXXFLAGS = @RAUL_CFLAGS@ @JACK_CFLAGS@ @LOSC_CFLAGS@ @ALSA_CFLAGS@ @LASH_CFLAGS@ @SLV2_CFLAGS@ -I$(top_srcdir)/src/common -I$(top_srcdir)/src/libs/engine/events +libingen_engine_la_LDFLAGS = -no-undefined -module -avoid-version +libingen_engine_la_LIBADD = @RAUL_LIBS@ @JACK_LIBS@ @LOSC_LIBS@ @ALSA_LIBS@ @LASH_LIBS@ @SLV2_LIBS@ -libingen_la_SOURCES = \ +libingen_engine_la_SOURCES = \ + engine.h \ + engine.cpp \ util.h \ tuning.h \ events.h \ @@ -160,26 +164,26 @@ libingen_la_SOURCES = \ # MidiOutputNode.cpp if WITH_JACK_MIDI -libingen_la_SOURCES += \ +libingen_engine_la_SOURCES += \ JackMidiDriver.h \ JackMidiDriver.cpp \ jack_compat.h endif if WITH_ALSA_MIDI -libingen_la_SOURCES += \ +libingen_engine_la_SOURCES += \ AlsaMidiDriver.h \ AlsaMidiDriver.cpp endif if WITH_LADSPA -libingen_la_SOURCES += \ +libingen_engine_la_SOURCES += \ LADSPANode.h \ LADSPANode.cpp endif if WITH_DSSI -libingen_la_SOURCES += \ +libingen_engine_la_SOURCES += \ DSSINode.h \ DSSINode.cpp \ events/DSSIConfigureEvent.cpp \ @@ -193,13 +197,13 @@ libingen_la_SOURCES += \ endif if WITH_LV2 -libingen_la_SOURCES += \ +libingen_engine_la_SOURCES += \ LV2Node.h \ LV2Node.cpp endif if WITH_LASH -libingen_la_SOURCES += \ +libingen_engine_la_SOURCES += \ LashDriver.h \ LashDriver.cpp endif diff --git a/src/libs/engine/OSCClientSender.cpp b/src/libs/engine/OSCClientSender.cpp index 1ba9491d..763574d1 100644 --- a/src/libs/engine/OSCClientSender.cpp +++ b/src/libs/engine/OSCClientSender.cpp @@ -30,7 +30,7 @@ #include "AudioDriver.h" #include "interface/ClientInterface.h" #include "Responder.h" -#include "raul/AtomLiblo.h" +#include using std::cout; using std::cerr; using std::endl; namespace Ingen { diff --git a/src/libs/engine/OSCEngineReceiver.cpp b/src/libs/engine/OSCEngineReceiver.cpp index 218af3c5..1d835190 100644 --- a/src/libs/engine/OSCEngineReceiver.cpp +++ b/src/libs/engine/OSCEngineReceiver.cpp @@ -15,17 +15,17 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "OSCEngineReceiver.h" #include #include #include #include #include "types.h" -#include "raul/SharedPtr.h" -#include "raul/AtomLiblo.h" -#include "QueuedEventSource.h" +#include +#include #include "interface/ClientKey.h" #include "interface/ClientInterface.h" +#include "OSCEngineReceiver.h" +#include "QueuedEventSource.h" #include "OSCClientSender.h" #include "OSCResponder.h" #include "ClientBroadcaster.h" @@ -48,7 +48,7 @@ using Shared::ClientKey; */ -OSCEngineReceiver::OSCEngineReceiver(SharedPtr engine, size_t queue_size, const char* const port) +OSCEngineReceiver::OSCEngineReceiver(Engine& engine, size_t queue_size, const char* const port) : EngineInterface(), QueuedEngineInterface(engine, queue_size, queue_size), // FIXME _port(port), @@ -227,7 +227,7 @@ OSCEngineReceiver::set_response_address_cb(const char* path, const char* types, // Shitty deal, make a new one //cerr << "** Setting response address to " << url << "(2)" << endl; me->_osc_responder = SharedPtr( - new OSCResponder(me->_engine->broadcaster(), id, url)); + new OSCResponder(me->_engine.broadcaster(), id, url)); me->set_responder(me->_osc_responder); @@ -237,7 +237,7 @@ OSCEngineReceiver::set_response_address_cb(const char* path, const char* types, // Otherwise we have a NULL responder, definitely need to set a new one } else { //cerr << "** null responder\n"; - me->_osc_responder = SharedPtr(new OSCResponder(me->_engine->broadcaster(), id, url)); + me->_osc_responder = SharedPtr(new OSCResponder(me->_engine.broadcaster(), id, url)); me->set_responder(me->_osc_responder); //cerr << "** Setting response address to " << url << "(2)" << endl; } @@ -247,7 +247,7 @@ OSCEngineReceiver::set_response_address_cb(const char* path, const char* types, // Don't respond } else { me->disable_responses(); - SharedPtr client = me->_engine->broadcaster()->client( + SharedPtr client = me->_engine.broadcaster()->client( ClientKey(ClientKey::OSC_URL, (const char*)url)); if (client) client->disable(); diff --git a/src/libs/engine/OSCEngineReceiver.h b/src/libs/engine/OSCEngineReceiver.h index 15fae6cd..04448fdf 100644 --- a/src/libs/engine/OSCEngineReceiver.h +++ b/src/libs/engine/OSCEngineReceiver.h @@ -21,7 +21,7 @@ #include "config.h" #include #include -#include "raul/SharedPtr.h" +#include #include "QueuedEngineInterface.h" #include "OSCResponder.h" using std::string; @@ -61,7 +61,7 @@ inline static int name##_cb(LO_HANDLER_ARGS, void* myself)\ class OSCEngineReceiver : public QueuedEngineInterface { public: - OSCEngineReceiver(SharedPtr engine, size_t queue_size, const char* const port); + OSCEngineReceiver(Engine& engine, size_t queue_size, const char* const port); ~OSCEngineReceiver(); void activate(); diff --git a/src/libs/engine/ObjectStore.h b/src/libs/engine/ObjectStore.h index 7cfa10c3..4c0a621a 100644 --- a/src/libs/engine/ObjectStore.h +++ b/src/libs/engine/ObjectStore.h @@ -20,7 +20,7 @@ #define OBJECTSTORE_H #include -#include "raul/Path.h" +#include #include "Tree.h" using std::string; diff --git a/src/libs/engine/PostProcessor.h b/src/libs/engine/PostProcessor.h index 4ab4ae2f..4e3d91a1 100644 --- a/src/libs/engine/PostProcessor.h +++ b/src/libs/engine/PostProcessor.h @@ -20,8 +20,8 @@ #include #include "types.h" -#include "raul/SRSWQueue.h" -#include "raul/Slave.h" +#include +#include namespace Raul { class Maid; } diff --git a/src/libs/engine/QueuedEngineInterface.cpp b/src/libs/engine/QueuedEngineInterface.cpp index 681cf798..b38692ea 100644 --- a/src/libs/engine/QueuedEngineInterface.cpp +++ b/src/libs/engine/QueuedEngineInterface.cpp @@ -24,7 +24,7 @@ namespace Ingen { -QueuedEngineInterface::QueuedEngineInterface(SharedPtr engine, size_t queued_size, size_t stamped_size) +QueuedEngineInterface::QueuedEngineInterface(Engine& engine, size_t queued_size, size_t stamped_size) : QueuedEventSource(queued_size, stamped_size) , _responder(SharedPtr(new Responder())) // NULL responder , _engine(engine) @@ -37,7 +37,7 @@ QueuedEngineInterface::now() const { // Exactly one cycle latency (some could run ASAP if we get lucky, but not always, and a slight // constant latency is far better than jittery lower (average) latency - return _engine->audio_driver()->frame_time() + _engine->audio_driver()->buffer_size(); + return _engine.audio_driver()->frame_time() + _engine.audio_driver()->buffer_size(); } @@ -76,14 +76,14 @@ QueuedEngineInterface::disable_responses() void QueuedEngineInterface::register_client(ClientKey key, SharedPtr client) { - push_queued(new RegisterClientEvent(*_engine.get(), _responder, now(), key, client)); + push_queued(new RegisterClientEvent(_engine, _responder, now(), key, client)); } void QueuedEngineInterface::unregister_client(ClientKey key) { - push_queued(new UnregisterClientEvent(*_engine.get(), _responder, now(), key)); + push_queued(new UnregisterClientEvent(_engine, _responder, now(), key)); } @@ -92,7 +92,7 @@ QueuedEngineInterface::unregister_client(ClientKey key) void QueuedEngineInterface::load_plugins() { - push_queued(new LoadPluginsEvent(*_engine.get(), _responder, now())); + push_queued(new LoadPluginsEvent(_engine, _responder, now())); } @@ -100,14 +100,14 @@ QueuedEngineInterface::load_plugins() void QueuedEngineInterface::activate() { - push_queued(new PingQueuedEvent(*_engine.get(), _responder, now())); + push_queued(new PingQueuedEvent(_engine, _responder, now())); } void QueuedEngineInterface::deactivate() { - push_queued(new DeactivateEvent(*_engine.get(), _responder, now())); + push_queued(new DeactivateEvent(_engine, _responder, now())); } @@ -115,7 +115,7 @@ void QueuedEngineInterface::quit() { _responder->respond_ok(); - _engine->quit(); + _engine.quit(); } @@ -126,7 +126,7 @@ void QueuedEngineInterface::create_patch(const string& path, uint32_t poly) { - push_queued(new CreatePatchEvent(*_engine.get(), _responder, now(), path, poly)); + push_queued(new CreatePatchEvent(_engine, _responder, now(), path, poly)); } @@ -135,7 +135,7 @@ void QueuedEngineInterface::create_port(const string& path, const string& data_type, bool direction) { - push_queued(new AddPortEvent(*_engine.get(), _responder, now(), path, data_type, direction, this)); + push_queued(new AddPortEvent(_engine, _responder, now(), path, data_type, direction, this)); } @@ -144,7 +144,7 @@ QueuedEngineInterface::create_node(const string& path, const string& plugin_uri, bool polyphonic) { - push_queued(new AddNodeEvent(*_engine.get(), _responder, now(), + push_queued(new AddNodeEvent(_engine, _responder, now(), path, plugin_uri, polyphonic)); } @@ -156,7 +156,7 @@ QueuedEngineInterface::create_node(const string& path, const string& plugin_label, bool polyphonic) { - push_queued(new AddNodeEvent(*_engine.get(), _responder, now(), + push_queued(new AddNodeEvent(_engine, _responder, now(), path, plugin_type, plugin_lib, plugin_label, polyphonic)); } @@ -164,35 +164,35 @@ void QueuedEngineInterface::rename(const string& old_path, const string& new_name) { - push_queued(new RenameEvent(*_engine.get(), _responder, now(), old_path, new_name)); + push_queued(new RenameEvent(_engine, _responder, now(), old_path, new_name)); } void QueuedEngineInterface::destroy(const string& path) { - push_queued(new DestroyEvent(*_engine.get(), _responder, now(), this, path)); + push_queued(new DestroyEvent(_engine, _responder, now(), this, path)); } void QueuedEngineInterface::clear_patch(const string& patch_path) { - push_queued(new ClearPatchEvent(*_engine.get(), _responder, now(), this, patch_path)); + push_queued(new ClearPatchEvent(_engine, _responder, now(), this, patch_path)); } void QueuedEngineInterface::enable_patch(const string& patch_path) { - push_queued(new EnablePatchEvent(*_engine.get(), _responder, now(), patch_path)); + push_queued(new EnablePatchEvent(_engine, _responder, now(), patch_path)); } void QueuedEngineInterface::disable_patch(const string& patch_path) { - push_queued(new DisablePatchEvent(*_engine.get(), _responder, now(), patch_path)); + push_queued(new DisablePatchEvent(_engine, _responder, now(), patch_path)); } @@ -200,7 +200,7 @@ void QueuedEngineInterface::connect(const string& src_port_path, const string& dst_port_path) { - push_queued(new ConnectionEvent(*_engine.get(), _responder, now(), src_port_path, dst_port_path)); + push_queued(new ConnectionEvent(_engine, _responder, now(), src_port_path, dst_port_path)); } @@ -209,14 +209,14 @@ void QueuedEngineInterface::disconnect(const string& src_port_path, const string& dst_port_path) { - push_queued(new DisconnectionEvent(*_engine.get(), _responder, now(), src_port_path, dst_port_path)); + push_queued(new DisconnectionEvent(_engine, _responder, now(), src_port_path, dst_port_path)); } void QueuedEngineInterface::disconnect_all(const string& node_path) { - push_queued(new DisconnectNodeEvent(*_engine.get(), _responder, now(), node_path)); + push_queued(new DisconnectNodeEvent(_engine, _responder, now(), node_path)); } @@ -224,7 +224,7 @@ void QueuedEngineInterface::set_port_value(const string& port_path, float value) { - push_stamped(new SetPortValueEvent(*_engine.get(), _responder, now(), port_path, value)); + push_stamped(new SetPortValueEvent(_engine, _responder, now(), port_path, value)); } @@ -233,7 +233,7 @@ QueuedEngineInterface::set_port_value(const string& port_path, uint32_t voice, float value) { - push_stamped(new SetPortValueEvent(*_engine.get(), _responder, now(), voice, port_path, value)); + push_stamped(new SetPortValueEvent(_engine, _responder, now(), voice, port_path, value)); } @@ -241,7 +241,7 @@ void QueuedEngineInterface::set_port_value_queued(const string& port_path, float value) { - push_queued(new SetPortValueQueuedEvent(*_engine.get(), _responder, now(), port_path, value)); + push_queued(new SetPortValueQueuedEvent(_engine, _responder, now(), port_path, value)); } @@ -251,7 +251,7 @@ QueuedEngineInterface::set_program(const string& node_path, uint32_t program) { #ifdef HAVE_DSSI - push_queued(new DSSIProgramEvent(*_engine.get(), _responder, now(), node_path, bank, program)); + push_queued(new DSSIProgramEvent(_engine, _responder, now(), node_path, bank, program)); #endif } @@ -259,7 +259,7 @@ QueuedEngineInterface::set_program(const string& node_path, void QueuedEngineInterface::midi_learn(const string& node_path) { - push_queued(new MidiLearnEvent(*_engine.get(), _responder, now(), node_path)); + push_queued(new MidiLearnEvent(_engine, _responder, now(), node_path)); } @@ -268,7 +268,7 @@ QueuedEngineInterface::set_metadata(const string& path, const string& predicate, const Atom& value) { - push_queued(new SetMetadataEvent(*_engine.get(), _responder, now(), path, predicate, value)); + push_queued(new SetMetadataEvent(_engine, _responder, now(), path, predicate, value)); } @@ -277,8 +277,8 @@ QueuedEngineInterface::set_metadata(const string& path, void QueuedEngineInterface::ping() { - if (_engine->activated()) { - push_queued(new PingQueuedEvent(*_engine.get(), _responder, now())); + if (_engine.activated()) { + push_queued(new PingQueuedEvent(_engine, _responder, now())); } else if (_responder) { _responder->respond_ok(); } @@ -288,35 +288,35 @@ QueuedEngineInterface::ping() void QueuedEngineInterface::request_plugin(const string& uri) { - push_queued(new RequestPluginEvent(*_engine.get(), _responder, now(), uri)); + push_queued(new RequestPluginEvent(_engine, _responder, now(), uri)); } void QueuedEngineInterface::request_object(const string& path) { - push_queued(new RequestObjectEvent(*_engine.get(), _responder, now(), path)); + push_queued(new RequestObjectEvent(_engine, _responder, now(), path)); } void QueuedEngineInterface::request_port_value(const string& port_path) { - push_queued(new RequestPortValueEvent(*_engine.get(), _responder, now(), port_path)); + push_queued(new RequestPortValueEvent(_engine, _responder, now(), port_path)); } void QueuedEngineInterface::request_plugins() { - push_queued(new RequestPluginsEvent(*_engine.get(), _responder, now())); + push_queued(new RequestPluginsEvent(_engine, _responder, now())); } void QueuedEngineInterface::request_all_objects() { - push_queued(new RequestAllObjectsEvent(*_engine.get(), _responder, now())); + push_queued(new RequestAllObjectsEvent(_engine, _responder, now())); } diff --git a/src/libs/engine/QueuedEngineInterface.h b/src/libs/engine/QueuedEngineInterface.h index bfc4237f..ddf293dc 100644 --- a/src/libs/engine/QueuedEngineInterface.h +++ b/src/libs/engine/QueuedEngineInterface.h @@ -21,7 +21,7 @@ #include #include #include -#include "raul/SharedPtr.h" +#include #include "interface/EngineInterface.h" #include "interface/ClientInterface.h" #include "interface/ClientKey.h" @@ -61,7 +61,7 @@ class Engine; class QueuedEngineInterface : public QueuedEventSource, public virtual EngineInterface { public: - QueuedEngineInterface(SharedPtr engine, size_t queued_size, size_t stamped_size); + QueuedEngineInterface(Engine& engine, size_t queued_size, size_t stamped_size); virtual ~QueuedEngineInterface() {} void set_next_response_id(int32_t id); @@ -158,7 +158,7 @@ protected: /** Where responses to current messages will go. */ SharedPtr _responder; - SharedPtr _engine; + Engine& _engine; private: SampleCount now() const; diff --git a/src/libs/engine/QueuedEventSource.h b/src/libs/engine/QueuedEventSource.h index 9bda226f..d0c17c0b 100644 --- a/src/libs/engine/QueuedEventSource.h +++ b/src/libs/engine/QueuedEventSource.h @@ -21,9 +21,9 @@ #include #include #include "types.h" -#include "raul/Semaphore.h" -#include "raul/SRSWQueue.h" -#include "raul/Slave.h" +#include +#include +#include #include "Event.h" #include "EventSource.h" diff --git a/src/libs/engine/Responder.h b/src/libs/engine/Responder.h index 9fa72dcf..f111b02a 100644 --- a/src/libs/engine/Responder.h +++ b/src/libs/engine/Responder.h @@ -20,7 +20,7 @@ #include #include -#include "raul/SharedPtr.h" +#include #include "interface/ClientKey.h" #include "interface/ClientInterface.h" using std::string; diff --git a/src/libs/engine/ThreadManager.h b/src/libs/engine/ThreadManager.h index a62431ff..dc415526 100644 --- a/src/libs/engine/ThreadManager.h +++ b/src/libs/engine/ThreadManager.h @@ -18,7 +18,7 @@ #ifndef THREADMANAGER_H #define THREADMANAGER_H -#include "raul/Thread.h" +#include using Raul::Thread; diff --git a/src/libs/engine/engine.cpp b/src/libs/engine/engine.cpp new file mode 100644 index 00000000..a2ba26da --- /dev/null +++ b/src/libs/engine/engine.cpp @@ -0,0 +1,42 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave 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 + */ + +#include "engine.h" +#include "Engine.h" +#include "QueuedEngineInterface.h" +#include "tuning.h" + +namespace Ingen { + + +Engine* +new_engine() +{ + return new Engine(); +} + + +QueuedEngineInterface* +new_queued_engine_interface(Engine& engine) +{ + return new QueuedEngineInterface(engine, + Ingen::event_queue_size, Ingen::event_queue_size); +} + + +} // namespace Ingen + diff --git a/src/libs/engine/engine.h b/src/libs/engine/engine.h new file mode 100644 index 00000000..aac69661 --- /dev/null +++ b/src/libs/engine/engine.h @@ -0,0 +1,38 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave 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_ENGINE_H +#define INGEN_ENGINE_H + +namespace Ingen { + +class Engine; +class QueuedEngineInterface; + + +extern "C" { + + extern Engine* new_engine(); + extern QueuedEngineInterface* new_queued_interface(Engine& engine); + +} + + +} // namespace Ingen + +#endif // INGEN_ENGINE_H + diff --git a/src/libs/engine/events/AddNodeEvent.cpp b/src/libs/engine/events/AddNodeEvent.cpp index 0e3fa56d..88efbb45 100644 --- a/src/libs/engine/events/AddNodeEvent.cpp +++ b/src/libs/engine/events/AddNodeEvent.cpp @@ -26,9 +26,9 @@ #include "NodeFactory.h" #include "ClientBroadcaster.h" #include -#include "raul/Path.h" +#include #include "ObjectStore.h" -#include "raul/Path.h" +#include #include "Port.h" namespace Ingen { diff --git a/src/libs/engine/events/AddNodeEvent.h b/src/libs/engine/events/AddNodeEvent.h index 6b68f627..7a88cd1c 100644 --- a/src/libs/engine/events/AddNodeEvent.h +++ b/src/libs/engine/events/AddNodeEvent.h @@ -19,7 +19,7 @@ #define ADDNODEEVENT_H #include "QueuedEvent.h" -#include "raul/Path.h" +#include #include using std::string; diff --git a/src/libs/engine/events/AddPortEvent.cpp b/src/libs/engine/events/AddPortEvent.cpp index c9f22cd1..1157d06a 100644 --- a/src/libs/engine/events/AddPortEvent.cpp +++ b/src/libs/engine/events/AddPortEvent.cpp @@ -23,11 +23,11 @@ #include "Engine.h" #include "Patch.h" #include -#include "raul/Path.h" +#include #include "QueuedEventSource.h" #include "ObjectStore.h" #include "ClientBroadcaster.h" -#include "raul/Path.h" +#include #include "Port.h" #include "AudioDriver.h" #include "MidiDriver.h" diff --git a/src/libs/engine/events/ConnectionEvent.h b/src/libs/engine/events/ConnectionEvent.h index bebb6cfd..9565d79f 100644 --- a/src/libs/engine/events/ConnectionEvent.h +++ b/src/libs/engine/events/ConnectionEvent.h @@ -20,7 +20,7 @@ #include #include "QueuedEvent.h" -#include "raul/Path.h" +#include #include "types.h" using std::string; diff --git a/src/libs/engine/events/CreatePatchEvent.cpp b/src/libs/engine/events/CreatePatchEvent.cpp index 344dbbe9..81d05368 100644 --- a/src/libs/engine/events/CreatePatchEvent.cpp +++ b/src/libs/engine/events/CreatePatchEvent.cpp @@ -25,7 +25,7 @@ #include #include "ClientBroadcaster.h" #include "AudioDriver.h" -#include "raul/Path.h" +#include #include "ObjectStore.h" namespace Ingen { diff --git a/src/libs/engine/events/DestroyEvent.cpp b/src/libs/engine/events/DestroyEvent.cpp index 14e6702c..c00306d8 100644 --- a/src/libs/engine/events/DestroyEvent.cpp +++ b/src/libs/engine/events/DestroyEvent.cpp @@ -30,7 +30,7 @@ #include "ClientBroadcaster.h" #include #include "ObjectStore.h" -#include "raul/Path.h" +#include #include "QueuedEventSource.h" #include "Port.h" diff --git a/src/libs/engine/events/DisconnectNodeEvent.cpp b/src/libs/engine/events/DisconnectNodeEvent.cpp index 8f2a90f2..f304f0b1 100644 --- a/src/libs/engine/events/DisconnectNodeEvent.cpp +++ b/src/libs/engine/events/DisconnectNodeEvent.cpp @@ -32,7 +32,7 @@ #include "ClientBroadcaster.h" #include "util.h" #include "ObjectStore.h" -#include "raul/Path.h" +#include using std::cerr; using std::endl; diff --git a/src/libs/engine/events/DisconnectPortEvent.h b/src/libs/engine/events/DisconnectPortEvent.h index f3058fa1..089508ea 100644 --- a/src/libs/engine/events/DisconnectPortEvent.h +++ b/src/libs/engine/events/DisconnectPortEvent.h @@ -19,7 +19,7 @@ #define DISCONNECTPORTEVENT_H #include -#include "raul/Path.h" +#include #include "QueuedEvent.h" #include diff --git a/src/libs/engine/events/RenameEvent.cpp b/src/libs/engine/events/RenameEvent.cpp index 52205046..a833c42e 100644 --- a/src/libs/engine/events/RenameEvent.cpp +++ b/src/libs/engine/events/RenameEvent.cpp @@ -22,7 +22,7 @@ #include "Tree.h" #include "Engine.h" #include "ClientBroadcaster.h" -#include "raul/Path.h" +#include #include "ObjectStore.h" namespace Ingen { diff --git a/src/libs/engine/events/RequestMetadataEvent.h b/src/libs/engine/events/RequestMetadataEvent.h index e074b6ee..497a94bf 100644 --- a/src/libs/engine/events/RequestMetadataEvent.h +++ b/src/libs/engine/events/RequestMetadataEvent.h @@ -20,7 +20,7 @@ #include #include "QueuedEvent.h" -#include "raul/Atom.h" +#include using std::string; namespace Ingen { diff --git a/src/libs/engine/events/SetMetadataEvent.h b/src/libs/engine/events/SetMetadataEvent.h index ca50adda..fae167a4 100644 --- a/src/libs/engine/events/SetMetadataEvent.h +++ b/src/libs/engine/events/SetMetadataEvent.h @@ -20,7 +20,7 @@ #include #include "QueuedEvent.h" -#include "raul/Atom.h" +#include using std::string; diff --git a/src/libs/module/Makefile.am b/src/libs/module/Makefile.am new file mode 100644 index 00000000..28cd2822 --- /dev/null +++ b/src/libs/module/Makefile.am @@ -0,0 +1,9 @@ +noinst_LTLIBRARIES = libingen_module.la + +libingen_module_la_CXXFLAGS = @RAUL_CFLAGS@ @GLIBMM_CFLAGS@ -DINGEN_MODULE_DIR=\"$(libdir)/ingen\" + +libingen_module_la_LIBADD = @RAUL_LIBS@ @GLIBMM_LIBS@ + +libingen_module_la_SOURCES = \ + Module.h \ + Module.cpp diff --git a/src/libs/module/Module.cpp b/src/libs/module/Module.cpp new file mode 100644 index 00000000..d92ee97a --- /dev/null +++ b/src/libs/module/Module.cpp @@ -0,0 +1,80 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave 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 + */ + +#include +#include +#include +#include +#include +#include + +#ifndef INGEN_MODULE_DIR +#error This file expects INGEN_MODULE_DIR to be defined. +#endif + +using namespace std; + +namespace Ingen { +namespace Shared { + + +/** 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" + */ +SharedPtr +load_module(const string& name) +{ + SharedPtr module; + + // 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, ':')) { + module = SharedPtr(new Glib::Module( + Glib::Module::build_path(dir, name), + Glib::MODULE_BIND_LAZY)); + + if (module && *module.get()) + return module; + } + } + + // Try default directory if not found + module = SharedPtr(new Glib::Module( + Glib::Module::build_path(INGEN_MODULE_DIR, name), + Glib::MODULE_BIND_LAZY)); + + if (*module.get()) { + return module; + } else { + cerr << "Unable to load module \"" << name << "\" (you may want to set INGEN_MODULE_PATH)." << endl; + return SharedPtr(); + } +} + + +} // namespace Shared +} // namespace Ingen + diff --git a/src/libs/module/Module.h b/src/libs/module/Module.h new file mode 100644 index 00000000..b0fdee1b --- /dev/null +++ b/src/libs/module/Module.h @@ -0,0 +1,39 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave 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 + */ + +#include +#include +#include + +#ifndef INGEN_MODULE_DIR +#error This file expects INGEN_MODULE_DIR to be defined. +#endif + +namespace Ingen { +namespace Shared { + + +/** Load a dynamic module from the default path. + * + * \param name The base name of the module, e.g. "ingen_serialisation" + */ +SharedPtr load_module(const std::string& name); + + +} // namespace Shared +} // namespace Ingen + diff --git a/src/libs/serialisation/Loader.cpp b/src/libs/serialisation/Loader.cpp new file mode 100644 index 00000000..157756b1 --- /dev/null +++ b/src/libs/serialisation/Loader.cpp @@ -0,0 +1,342 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave 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 + */ + +#include +#include +#include +#include +#include "interface/EngineInterface.h" +#include "Loader.h" + +using namespace std; +using namespace Raul; +using namespace Ingen::Shared; + +namespace Ingen { +namespace Serialisation { + + +/** Load (create) a patch from RDF into the engine. + * + * @param document_uri URI of file to load objects from. + * @param parent Path of parent under which to load objects. + * @return whether or not load was successful. + */ +bool +Loader::load(SharedPtr engine, + Raul::RDF::World* rdf_world, + const Glib::ustring& document_uri, + boost::optional parent, + string patch_name, + Glib::ustring patch_uri, + map data) +{ + // FIXME: this whole thing is a mess + + std::map created; + + RDF::Model model(*rdf_world, document_uri); + + //patch_uri = string("<") + patch_uri + ">"; + patch_uri = string("<") + document_uri + ">"; + + cerr << "[Loader] Loading " << patch_uri << " from " << document_uri + << " under " << (string)(parent ? (string)parent.get() : "no parent") << endl; + + /* Get polyphony (mandatory) */ + + // FIXME: polyphony datatype + RDF::Query query(*rdf_world, Glib::ustring( + "SELECT DISTINCT ?poly WHERE {\n") + + patch_uri + " ingen:polyphony ?poly\n }"); + + RDF::Query::Results results = query.run(*rdf_world, model); + + if (results.size() == 0) { + cerr << "[Loader] ERROR: No polyphony found!" << endl; + return false; + } + + RDF::Node poly_node = (*results.begin())["poly"]; + assert(poly_node.is_int()); + size_t patch_poly = (size_t)poly_node.to_int(); + + /* Get name (if available/necessary) */ + + if (patch_name == "") { + patch_name = string(document_uri.substr(document_uri.find_last_of("/")+1)); + if (patch_name.substr(patch_name.length()-10) == ".ingen.ttl") + patch_name = patch_name.substr(0, patch_name.length()-10); + + query = RDF::Query(*rdf_world, Glib::ustring( + "SELECT DISTINCT ?name WHERE {\n") + + patch_uri + " ingen:name ?name\n}"); + + results = query.run(*rdf_world, model); + + if (results.size() > 0) + patch_name = (*results.begin())["name"].to_string(); + } + + Path patch_path = ( parent ? (parent.get().base() + patch_name) : Path("/") ); + cerr << "************ PATCH: name=" << patch_name << ", path=" << patch_path + << ", poly = " << patch_poly << endl; + engine->create_patch(patch_path, patch_poly); + + + /* Load (plugin) nodes */ + + query = RDF::Query(*rdf_world, Glib::ustring( + "SELECT DISTINCT ?name ?plugin ?floatkey ?floatval WHERE {\n") + + patch_uri + " ingen:node ?node .\n" + "?node ingen:name ?name ;\n" + " ingen:plugin ?plugin .\n" + "OPTIONAL { ?node ?floatkey ?floatval . \n" + " FILTER ( datatype(?floatval) = xsd:decimal ) }\n" + "}"); + + results = query.run(*rdf_world, model); + + for (RDF::Query::Results::iterator i = results.begin(); i != results.end(); ++i) { + + string name = (*i)["name"].to_string(); + string plugin = (*i)["plugin"].to_string(); + + const Path node_path = patch_path.base() + (string)name; + + if (created.find(node_path) == created.end()) { + engine->create_node(node_path, plugin, false); + created[node_path] = true; + } + + string floatkey = rdf_world->prefixes().qualify((*i)["floatkey"].to_string()); + RDF::Node val_node = (*i)["floatval"]; + + if (floatkey != "" && val_node.is_float()) + engine->set_metadata(patch_path.base() + name, floatkey, Atom(val_node.to_float())); + } + + + /* Load subpatches */ + + query = RDF::Query(*rdf_world, Glib::ustring( + "SELECT DISTINCT ?patch ?name WHERE {\n") + + patch_uri + " ingen:node ?patch .\n" + "?patch a ingen:Patch ;\n" + " ingen:name ?name .\n" + "}"); + + results = query.run(*rdf_world, model); + + for (RDF::Query::Results::iterator i = results.begin(); i != results.end(); ++i) { + + string name = (*i)["name"].to_string(); + string patch = (*i)["patch"].to_string(); + + const Path subpatch_path = patch_path.base() + (string)name; + + if (created.find(subpatch_path) == created.end()) { + load(engine, rdf_world, document_uri, patch_path, name, patch); + created[subpatch_path] = true; + } + } + + created.clear(); + + + /* Set node port control values */ + + query = RDF::Query(*rdf_world, Glib::ustring( + "SELECT DISTINCT ?nodename ?portname ?portval WHERE {\n") + + patch_uri + " ingen:node ?node .\n" + "?node ingen:name ?nodename ;\n" + " ingen:port ?port .\n" + "?port ingen:name ?portname ;\n" + " ingen:value ?portval .\n" + "FILTER ( datatype(?portval) = xsd:decimal )\n" + "}\n"); + + results = query.run(*rdf_world, model); + + for (RDF::Query::Results::iterator i = results.begin(); i != results.end(); ++i) { + + string node_name = (*i)["nodename"].to_string(); + string port_name = (*i)["portname"].to_string(); + const float val = (*i)["portval"].to_float(); + + Path port_path = patch_path.base() + (const string&)node_name +"/"+ (const string&)port_name; + + engine->set_port_value(port_path, val); + } + + + /* Load this patch's ports */ + + query = RDF::Query(*rdf_world, Glib::ustring( + "SELECT DISTINCT ?port ?type ?name ?datatype ?floatkey ?floatval ?portval WHERE {\n") + + patch_uri + " ingen:port ?port .\n" + "?port a ?type ;\n" + " ingen:name ?name ;\n" + " ingen:dataType ?datatype .\n" + "OPTIONAL { ?port ?floatkey ?floatval . \n" + " FILTER ( datatype(?floatval) = xsd:decimal ) }\n" + "OPTIONAL { ?port ingen:value ?portval . \n" + " FILTER ( datatype(?portval) = xsd:decimal ) }\n" + "}"); + + results = query.run(*rdf_world, model); + + for (RDF::Query::Results::iterator i = results.begin(); i != results.end(); ++i) { + string name = (*i)["name"].to_string(); + string type = rdf_world->qualify((*i)["type"].to_string()); + string datatype = (*i)["datatype"].to_string(); + + const Path port_path = patch_path.base() + (string)name; + + if (created.find(port_path) == created.end()) { + //cerr << "TYPE: " << type << endl; + bool is_output = (type == "ingen:OutputPort"); // FIXME: check validity + engine->create_port(port_path, datatype, is_output); + created[port_path] = true; + } + + RDF::Node val_node = (*i)["portval"]; + if (val_node.is_float()) + engine->set_port_value(patch_path.base() + name, val_node.to_float()); + + string floatkey = rdf_world->qualify((*i)["floatkey"].to_string()); + val_node = (*i)["floatval"]; + + if (floatkey != "" && val_node.is_float()) + engine->set_metadata(patch_path.base() + name, floatkey, Atom(val_node.to_float())); + } + + created.clear(); + + + /* Node -> Node connections */ + + query = RDF::Query(*rdf_world, Glib::ustring( + "SELECT DISTINCT ?srcnodename ?srcname ?dstnodename ?dstname WHERE {\n") + + patch_uri + "ingen:node ?srcnode ;\n" + " ingen:node ?dstnode .\n" + "?srcnode ingen:port ?src ;\n" + " ingen:name ?srcnodename .\n" + "?dstnode ingen:port ?dst ;\n" + " ingen:name ?dstnodename .\n" + "?src ingen:name ?srcname .\n" + "?dst ingen:connectedTo ?src ;\n" + " ingen:name ?dstname .\n" + "}\n"); + + results = query.run(*rdf_world, model); + + for (RDF::Query::Results::iterator i = results.begin(); i != results.end(); ++i) { + Path src_node = patch_path.base() + (*i)["srcnodename"].to_string(); + Path src_port = src_node.base() + (*i)["srcname"].to_string(); + Path dst_node = patch_path.base() + (*i)["dstnodename"].to_string(); + Path dst_port = dst_node.base() + (*i)["dstname"].to_string(); + + cerr << patch_path << " 1 CONNECTION: " << src_port << " -> " << dst_port << endl; + + engine->connect(src_port, dst_port); + } + + + /* This Patch -> Node connections */ + + query = RDF::Query(*rdf_world, Glib::ustring( + "SELECT DISTINCT ?srcname ?dstnodename ?dstname WHERE {\n") + + patch_uri + " ingen:port ?src ;\n" + " ingen:node ?dstnode .\n" + "?dstnode ingen:port ?dst ;\n" + " ingen:name ?dstnodename .\n" + "?dst ingen:connectedTo ?src ;\n" + " ingen:name ?dstname .\n" + "?src ingen:name ?srcname .\n" + "}\n"); + + results = query.run(*rdf_world, model); + + for (RDF::Query::Results::iterator i = results.begin(); i != results.end(); ++i) { + Path src_port = patch_path.base() + (*i)["srcname"].to_string(); + Path dst_node = patch_path.base() + (*i)["dstnodename"].to_string(); + Path dst_port = dst_node.base() + (*i)["dstname"].to_string(); + + cerr << patch_path << " 2 CONNECTION: " << src_port << " -> " << dst_port << endl; + + engine->connect(src_port, dst_port); + } + + + /* Node -> This Patch connections */ + + query = RDF::Query(*rdf_world, Glib::ustring( + "SELECT DISTINCT ?srcnodename ?srcname ?dstname WHERE {\n") + + patch_uri + " ingen:port ?dst ;\n" + " ingen:node ?srcnode .\n" + "?srcnode ingen:port ?src ;\n" + " ingen:name ?srcnodename .\n" + "?dst ingen:connectedTo ?src ;\n" + " ingen:name ?dstname .\n" + "?src ingen:name ?srcname .\n" + "}\n"); + + results = query.run(*rdf_world, model); + + for (RDF::Query::Results::iterator i = results.begin(); i != results.end(); ++i) { + Path dst_port = patch_path.base() + (*i)["dstname"].to_string(); + Path src_node = patch_path.base() + (*i)["srcnodename"].to_string(); + Path src_port = src_node.base() + (*i)["srcname"].to_string(); + + cerr << patch_path << " 3 CONNECTION: " << src_port << " -> " << dst_port << endl; + + engine->connect(src_port, dst_port); + } + + + /* Load metadata */ + + query = RDF::Query(*rdf_world, Glib::ustring( + "SELECT DISTINCT ?floatkey ?floatval WHERE {\n") + + patch_uri + " ?floatkey ?floatval . \n" + " FILTER ( datatype(?floatval) = xsd:decimal ) \n" + "}"); + + results = query.run(*rdf_world, model); + + for (RDF::Query::Results::iterator i = results.begin(); i != results.end(); ++i) { + + string floatkey = rdf_world->prefixes().qualify((*i)["floatkey"].to_string()); + RDF::Node val_node = (*i)["floatval"]; + + if (floatkey != "" && val_node.is_float()) + engine->set_metadata(patch_path, floatkey, Atom(val_node.to_float())); + } + + + // Set passed metadata last to override any loaded values + for (Metadata::const_iterator i = data.begin(); i != data.end(); ++i) + engine->set_metadata(patch_path, i->first, i->second); + + return true; +} + + +} // namespace Serialisation +} // namespace Ingen + diff --git a/src/libs/serialisation/Loader.h b/src/libs/serialisation/Loader.h new file mode 100644 index 00000000..a02e5cdb --- /dev/null +++ b/src/libs/serialisation/Loader.h @@ -0,0 +1,56 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave 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 LOADER_H +#define LOADER_H + +#include +#include +#include +#include +#include +#include +#include + +namespace Raul { class Atom; namespace RDF { class World; } } +namespace Ingen { namespace Shared { class EngineInterface; } } + +namespace Ingen { +namespace Serialisation { + + +class Loader { +public: + virtual ~Loader() {} + + typedef std::map Metadata; + + virtual bool + load(SharedPtr engine, + Raul::RDF::World* world, + const Glib::ustring& uri, + boost::optional parent, + std::string patch_name, + Glib::ustring patch_uri = "", + Metadata data = Metadata()); +}; + + +} // namespace Serialisation +} // namespace Ingen + +#endif // LOADER_H diff --git a/src/libs/serialisation/Makefile.am b/src/libs/serialisation/Makefile.am new file mode 100644 index 00000000..f1343463 --- /dev/null +++ b/src/libs/serialisation/Makefile.am @@ -0,0 +1,16 @@ +MAINTAINERCLEANFILES = Makefile.in + +moduledir = $(libdir)/ingen + +module_LTLIBRARIES = libingen_serialisation.la + +libingen_serialisation_la_CXXFLAGS = @RAUL_CFLAGS@ -I$(top_srcdir)/src/common +libingen_serialisation_la_LDFLAGS = -no-undefined -module -avoid-version +libingen_serialisation_la_LIBADD = @RAUL_LIBS@ + +libingen_serialisation_la_SOURCES = \ + serialisation.h \ + serialisation.cpp \ + Loader.h \ + Loader.cpp + diff --git a/src/libs/serialisation/serialisation.cpp b/src/libs/serialisation/serialisation.cpp new file mode 100644 index 00000000..e0764fc1 --- /dev/null +++ b/src/libs/serialisation/serialisation.cpp @@ -0,0 +1,34 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave 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 + */ + +#include "serialisation.h" +#include "Loader.h" + +namespace Ingen { +namespace Serialisation { + + +Ingen::Serialisation::Loader* +new_loader() +{ + return new Loader(); +} + + +} // namespace Serialisation +} // namespace Ingen + diff --git a/src/libs/serialisation/serialisation.h b/src/libs/serialisation/serialisation.h new file mode 100644 index 00000000..f65b9c2e --- /dev/null +++ b/src/libs/serialisation/serialisation.h @@ -0,0 +1,38 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave 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_SERIALISATION_H +#define INGEN_SERIALISATION_H + +namespace Ingen { +namespace Serialisation { + +class Loader; + + +extern "C" { + + extern Loader* new_loader(); + +} + + +} // namespace Serialisation +} // namespace Ingen + +#endif // INGEN_SERIALISATION_H + diff --git a/src/progs/demolition/demolition.cpp b/src/progs/demolition/demolition.cpp index 2998f774..feba204a 100644 --- a/src/progs/demolition/demolition.cpp +++ b/src/progs/demolition/demolition.cpp @@ -23,7 +23,7 @@ #include "Store.h" #include "PatchLibrarian.h" #include "PluginModel.h" -#include "raul/SharedPtr.h" +#include #include #include #include diff --git a/src/progs/ingenuity/App.cpp b/src/progs/ingenuity/App.cpp index 0e726db9..20b61da6 100644 --- a/src/progs/ingenuity/App.cpp +++ b/src/progs/ingenuity/App.cpp @@ -23,6 +23,11 @@ #include #include #include +#include +#include "interface/EngineInterface.h" +#include "client/ObjectModel.h" +#include "client/PatchModel.h" +#include "client/Store.h" #include "NodeModule.h" #include "ControlPanel.h" #include "SubpatchModule.h" @@ -31,16 +36,11 @@ #include "MessagesWindow.h" #include "ConfigWindow.h" #include "GladeFactory.h" -#include "raul/Path.h" -#include "ObjectModel.h" -#include "PatchModel.h" #include "PatchTreeWindow.h" #include "Configuration.h" #include "ConnectWindow.h" -#include "Store.h" #include "ThreadedLoader.h" #include "WindowFactory.h" -#include "ModelEngineInterface.h" #ifdef HAVE_LASH #include "LashController.h" #endif @@ -102,7 +102,7 @@ App::instantiate() void -App::attach(const SharedPtr& engine, const SharedPtr& client) +App::attach(const SharedPtr& engine, const SharedPtr& client) { assert( ! _engine); assert( ! _client); diff --git a/src/progs/ingenuity/App.h b/src/progs/ingenuity/App.h index aaf33893..2ef0891d 100644 --- a/src/progs/ingenuity/App.h +++ b/src/progs/ingenuity/App.h @@ -31,14 +31,19 @@ using std::string; using std::map; using std::list; using std::cerr; using std::endl; -namespace Ingen { namespace Client { - class PatchModel; - class PluginModel; - class Store; - class SigClientInterface; - class ModelEngineInterface; -} } +namespace Ingen { + namespace Shared { + class EngineInterface; + } + namespace Client { + class PatchModel; + class PluginModel; + class Store; + class SigClientInterface; + } +} using namespace Ingen::Client; +using Ingen::Shared::EngineInterface; /** \defgroup Ingenuity GTK Client */ @@ -72,8 +77,8 @@ public: void error_message(const string& msg); - void attach(const SharedPtr& engine, - const SharedPtr& client); + void attach(const SharedPtr& engine, + const SharedPtr& client); void detach(); @@ -89,10 +94,10 @@ public: Raul::RDF::World* rdf_world() { return &_rdf_world; } - const SharedPtr& engine() const { return _engine; } - const SharedPtr& client() const { return _client; } - const SharedPtr& store() const { return _store; } - const SharedPtr& loader() const { return _loader; } + const SharedPtr& engine() const { return _engine; } + const SharedPtr& client() const { return _client; } + const SharedPtr& store() const { return _store; } + const SharedPtr& loader() const { return _loader; } static inline App& instance() { assert(_instance); return *_instance; } static void instantiate(); @@ -101,8 +106,8 @@ protected: App(); static App* _instance; - SharedPtr _engine; - SharedPtr _client; + SharedPtr _engine; + SharedPtr _client; SharedPtr _store; SharedPtr _loader; diff --git a/src/progs/ingenuity/BreadCrumb.h b/src/progs/ingenuity/BreadCrumb.h index ae829dee..1e8b4c9b 100644 --- a/src/progs/ingenuity/BreadCrumb.h +++ b/src/progs/ingenuity/BreadCrumb.h @@ -19,8 +19,8 @@ #define BREADCRUMB_H #include -#include "raul/Path.h" -#include "raul/SharedPtr.h" +#include +#include #include "PatchView.h" namespace Ingenuity { diff --git a/src/progs/ingenuity/BreadCrumbBox.h b/src/progs/ingenuity/BreadCrumbBox.h index f05a14d1..952e04f1 100644 --- a/src/progs/ingenuity/BreadCrumbBox.h +++ b/src/progs/ingenuity/BreadCrumbBox.h @@ -22,8 +22,8 @@ #include #include #include -#include "raul/Path.h" -#include "raul/SharedPtr.h" +#include +#include #include "PatchView.h" namespace Ingenuity { diff --git a/src/progs/ingenuity/ConfigWindow.cpp b/src/progs/ingenuity/ConfigWindow.cpp index decd18ef..eef81ce3 100644 --- a/src/progs/ingenuity/ConfigWindow.cpp +++ b/src/progs/ingenuity/ConfigWindow.cpp @@ -15,17 +15,18 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "ConfigWindow.h" #include #include #include #include -#include "NodeModel.h" -using std::cout; using std::cerr; using std::endl; +#include "client/NodeModel.h" +#include "ConfigWindow.h" +using namespace std; namespace Ingenuity { + ConfigWindow::ConfigWindow(BaseObjectType* cobject, const Glib::RefPtr& xml) : Gtk::Window(cobject), _configuration(NULL) diff --git a/src/progs/ingenuity/ConfigWindow.h b/src/progs/ingenuity/ConfigWindow.h index 04a25689..31e564bd 100644 --- a/src/progs/ingenuity/ConfigWindow.h +++ b/src/progs/ingenuity/ConfigWindow.h @@ -15,16 +15,15 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - #ifndef CONFIGWINDOW_H #define CONFIGWINDOW_H -#include "PluginModel.h" -#include "Configuration.h" #include #include #include #include +#include "client/PluginModel.h" +#include "Configuration.h" using std::list; using Ingen::Client::PluginModel; diff --git a/src/progs/ingenuity/Configuration.cpp b/src/progs/ingenuity/Configuration.cpp index 4d2b8e07..d3d7f295 100644 --- a/src/progs/ingenuity/Configuration.cpp +++ b/src/progs/ingenuity/Configuration.cpp @@ -21,10 +21,10 @@ #include #include #include -#include "PortModel.h" -#include "PluginModel.h" -#include "PatchModel.h" -#include "Loader.h" +#include "client/PortModel.h" +#include "client/PluginModel.h" +#include "client/PatchModel.h" +#include "serialisation/Loader.h" #include "App.h" using std::cerr; using std::cout; using std::endl; diff --git a/src/progs/ingenuity/ConnectWindow.cpp b/src/progs/ingenuity/ConnectWindow.cpp index 6e5b6c67..322750ea 100644 --- a/src/progs/ingenuity/ConnectWindow.cpp +++ b/src/progs/ingenuity/ConnectWindow.cpp @@ -21,25 +21,24 @@ #include #include #include -#include "raul/Process.h" +#include #include "config.h" -#include "ConnectWindow.h" #include "interface/ClientKey.h" -#include "OSCModelEngineInterface.h" -#include "OSCClientReceiver.h" -#include "ThreadedSigClientInterface.h" -#include "Store.h" -#include "PatchModel.h" +#include "interface/EngineInterface.h" +#include "engine/tuning.h" +#include "engine/Engine.h" +#include "engine/DirectResponder.h" +#include "engine/QueuedEngineInterface.h" +#include "client/OSCClientReceiver.h" +#include "client/OSCEngineSender.h" +#include "client/ThreadedSigClientInterface.h" +#include "client/Store.h" +#include "client/PatchModel.h" +#include "module/Module.h" #include "App.h" #include "WindowFactory.h" -#ifdef MONOLITHIC_INGENUITY - #include "engine/Engine.h" - #include "engine/JackAudioDriver.h" - #include "engine/QueuedEngineInterface.h" - #include "engine/DirectResponder.h" - #include "engine/tuning.h" +#include "ConnectWindow.h" using Ingen::QueuedEngineInterface; -#endif using Ingen::Client::ThreadedSigClientInterface; namespace Ingenuity { @@ -58,18 +57,6 @@ struct OSCSigEmitter : public OSCClientReceiver, public ThreadedSigClientInterfa }; -#ifdef MONOLITHIC_INGENUITY -struct QueuedModelEngineInterface : public QueuedEngineInterface, public ModelEngineInterface { - QueuedModelEngineInterface(SharedPtr engine) - : Ingen::Shared::EngineInterface() - , Ingen::QueuedEngineInterface(engine, Ingen::event_queue_size, Ingen::event_queue_size) - { - QueuedEventSource::start(); - } -}; -#endif - - // ConnectWindow @@ -79,6 +66,8 @@ ConnectWindow::ConnectWindow(BaseObjectType* cobject, const Glib::RefPtrget_widget("connect_icon", _icon); xml->get_widget("connect_progress_bar", _progress_bar); @@ -91,13 +80,29 @@ ConnectWindow::ConnectWindow(BaseObjectType* cobject, const Glib::RefPtrget_widget("connect_disconnect_button", _disconnect_button); xml->get_widget("connect_connect_button", _connect_button); xml->get_widget("connect_quit_button", _quit_button); - + _server_radio->signal_toggled().connect(sigc::mem_fun(this, &ConnectWindow::server_toggled)); _launch_radio->signal_toggled().connect(sigc::mem_fun(this, &ConnectWindow::launch_toggled)); _internal_radio->signal_clicked().connect(sigc::mem_fun(this, &ConnectWindow::internal_toggled)); _disconnect_button->signal_clicked().connect(sigc::mem_fun(this, &ConnectWindow::disconnect)); _connect_button->signal_clicked().connect(sigc::mem_fun(this, &ConnectWindow::connect)); _quit_button->signal_clicked().connect(sigc::mem_fun(this, &ConnectWindow::quit)); + + _engine_module = Ingen::Shared::load_module("ingen_engine"); + + if (!_engine_module) { + cerr << "Unable to load ingen_engine module, internal engine unavailable." << endl; + cerr << "If you are running from the source tree, run ingenuity_dev." << endl; + } + + bool found1 = _engine_module->get_symbol("new_engine", (void*&)_new_engine); + bool found2 = _engine_module->get_symbol("new_queued_engine_interface", + (void*&)_new_queued_engine_interface); + + if (!found1 || !found2) { + cerr << "Unable to find module entry point, internal engine unavailable." << endl; + _engine_module.reset(); + } } @@ -121,11 +126,10 @@ ConnectWindow::init() _disconnect_button->set_sensitive(false); _port_spinbutton->set_sensitive(false); _launch_radio->set_sensitive(true); -#ifdef MONOLITHIC_INGENUITY - _internal_radio->set_sensitive(true); -#else - _internal_radio->set_sensitive(false); -#endif + if (_new_engine) + _internal_radio->set_sensitive(true); + else + _internal_radio->set_sensitive(false); server_toggled(); _progress_label->set_text(string("Disconnected")); @@ -151,8 +155,8 @@ ConnectWindow::connect() _connect_stage = 0; if (_mode == CONNECT_REMOTE) { - SharedPtr engine( - new OSCModelEngineInterface(_url_entry->get_text())); + SharedPtr engine( + new OSCEngineSender(_url_entry->get_text())); OSCSigEmitter* ose = new OSCSigEmitter(1024, 16181); // FIXME: args SharedPtr client(ose); @@ -172,8 +176,8 @@ ConnectWindow::connect() const string cmd = string("ingen --port=").append(port_str); if (Raul::Process::launch(cmd)) { - SharedPtr engine( - new OSCModelEngineInterface(string("osc.udp://localhost:").append(port_str))); + SharedPtr engine( + new OSCEngineSender(string("osc.udp://localhost:").append(port_str))); OSCSigEmitter* ose = new OSCSigEmitter(1024, 16181); // FIXME: args SharedPtr client(ose); @@ -189,13 +193,14 @@ ConnectWindow::connect() cerr << "Failed to launch ingen process." << endl; } -#ifdef MONOLITHIC_INGENUITY } else if (_mode == INTERNAL) { - SharedPtr engine(new Ingen::Engine()); - SharedPtr audio_driver( - new Ingen::JackAudioDriver(*engine.get()) ); - SharedPtr engine_interface( - new QueuedModelEngineInterface(engine) ); + assert(_new_engine); + SharedPtr engine(_new_engine()); + engine->start_jack_driver(); + + assert(_new_queued_engine_interface); + SharedPtr engine_interface(_new_queued_engine_interface(*engine.get())); + ThreadedSigClientInterface* tsci = new ThreadedSigClientInterface(Ingen::event_queue_size); SharedPtr client(tsci); @@ -203,7 +208,9 @@ ConnectWindow::connect() engine_interface->set_responder(SharedPtr(new Ingen::DirectResponder(client, 1))); - engine->activate(audio_driver, engine_interface); + engine->set_event_source(engine_interface); + + engine->activate(); Glib::signal_timeout().connect( sigc::mem_fun(engine.get(), &Ingen::Engine::main_iteration), 1000); @@ -213,7 +220,6 @@ ConnectWindow::connect() Glib::signal_timeout().connect( sigc::mem_fun(tsci, &ThreadedSigClientInterface::emit_signals), 2, G_PRIORITY_HIGH_IDLE); -#endif } } diff --git a/src/progs/ingenuity/ConnectWindow.h b/src/progs/ingenuity/ConnectWindow.h index 7e137066..fb1a012f 100644 --- a/src/progs/ingenuity/ConnectWindow.h +++ b/src/progs/ingenuity/ConnectWindow.h @@ -21,10 +21,12 @@ #include #include #include -#include "raul/SharedPtr.h" -#include "ThreadedSigClientInterface.h" +#include +#include "client/ThreadedSigClientInterface.h" using Ingen::Client::SigClientInterface; +namespace Ingen { class Engine; class QueuedEngineInterface; } + namespace Ingenuity { class App; @@ -66,6 +68,10 @@ private: int _connect_stage; + SharedPtr _engine_module; + Ingen::Engine* (*_new_engine)(); + Ingen::QueuedEngineInterface* (*_new_queued_engine_interface)(Ingen::Engine&); + Gtk::Image* _icon; Gtk::ProgressBar* _progress_bar; Gtk::Label* _progress_label; diff --git a/src/progs/ingenuity/Connection.h b/src/progs/ingenuity/Connection.h index 7e0f3cc5..d7b3a9cc 100644 --- a/src/progs/ingenuity/Connection.h +++ b/src/progs/ingenuity/Connection.h @@ -21,8 +21,8 @@ #include #include #include -#include "ConnectionModel.h" -#include "raul/SharedPtr.h" +#include +#include "client/ConnectionModel.h" using Ingen::Client::ConnectionModel; namespace Ingenuity { diff --git a/src/progs/ingenuity/ControlGroups.cpp b/src/progs/ingenuity/ControlGroups.cpp index f775709a..2cdbf0a3 100644 --- a/src/progs/ingenuity/ControlGroups.cpp +++ b/src/progs/ingenuity/ControlGroups.cpp @@ -17,12 +17,12 @@ #include #include -#include "ModelEngineInterface.h" +#include "interface/EngineInterface.h" +#include "client/PluginModel.h" +#include "client/NodeModel.h" +#include "client/PortModel.h" #include "ControlGroups.h" #include "ControlPanel.h" -#include "PluginModel.h" -#include "NodeModel.h" -#include "PortModel.h" #include "PortPropertiesWindow.h" #include "GladeFactory.h" #include "App.h" diff --git a/src/progs/ingenuity/ControlGroups.h b/src/progs/ingenuity/ControlGroups.h index 020b7bf7..70b8bb72 100644 --- a/src/progs/ingenuity/ControlGroups.h +++ b/src/progs/ingenuity/ControlGroups.h @@ -22,8 +22,8 @@ #include #include #include -#include "PortModel.h" -#include "raul/SharedPtr.h" +#include "client/PortModel.h" +#include namespace Ingen { namespace Client { class PortModel; } } using namespace Ingen::Client; diff --git a/src/progs/ingenuity/ControlPanel.cpp b/src/progs/ingenuity/ControlPanel.cpp index fa28f0b2..7e153ba5 100644 --- a/src/progs/ingenuity/ControlPanel.cpp +++ b/src/progs/ingenuity/ControlPanel.cpp @@ -15,13 +15,13 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "interface/EngineInterface.h" +#include "client/PatchModel.h" +#include "client/NodeModel.h" +#include "client/PortModel.h" +#include "client/PluginModel.h" #include "App.h" -#include "ModelEngineInterface.h" #include "ControlPanel.h" -#include "PatchModel.h" -#include "NodeModel.h" -#include "PortModel.h" -#include "PluginModel.h" #include "ControlGroups.h" #include "GladeFactory.h" diff --git a/src/progs/ingenuity/ControlPanel.h b/src/progs/ingenuity/ControlPanel.h index 309d2e50..f7da37ad 100644 --- a/src/progs/ingenuity/ControlPanel.h +++ b/src/progs/ingenuity/ControlPanel.h @@ -18,16 +18,17 @@ #ifndef CONTROLPANEL_H #define CONTROLPANEL_H -#include -#include -#include -#include #include #include #include #include // for pair<> +#include +#include +#include +#include +#include #include "ControlGroups.h" -#include "raul/Path.h" + using std::vector; using std::string; using std::pair; using std::cerr; using std::cout; using std::endl; diff --git a/src/progs/ingenuity/DSSIController.cpp b/src/progs/ingenuity/DSSIController.cpp index 811d6f1a..01ef96c4 100644 --- a/src/progs/ingenuity/DSSIController.cpp +++ b/src/progs/ingenuity/DSSIController.cpp @@ -21,10 +21,10 @@ #include #include #include +#include "interface/EngineInterface.h" +#include "client/NodeModel.h" #include "App.h" -#include "NodeModel.h" #include "DSSIModule.h" -#include "ModelEngineInterface.h" namespace Ingenuity { diff --git a/src/progs/ingenuity/DSSIController.h b/src/progs/ingenuity/DSSIController.h index 78ae3a35..3d5922c9 100644 --- a/src/progs/ingenuity/DSSIController.h +++ b/src/progs/ingenuity/DSSIController.h @@ -20,8 +20,8 @@ #include #include -#include "raul/Path.h" -#include "NodeModel.h" +#include +#include "client/NodeModel.h" using std::string; using namespace Ingen::Client; diff --git a/src/progs/ingenuity/LoadPatchWindow.cpp b/src/progs/ingenuity/LoadPatchWindow.cpp index cc7ff7bd..70d5c409 100644 --- a/src/progs/ingenuity/LoadPatchWindow.cpp +++ b/src/progs/ingenuity/LoadPatchWindow.cpp @@ -19,10 +19,10 @@ #include #include #include +#include "interface/EngineInterface.h" +#include "client/PatchModel.h" #include "App.h" #include "Configuration.h" -#include "PatchModel.h" -#include "ModelEngineInterface.h" #include "ThreadedLoader.h" using namespace Ingen::Serialisation; diff --git a/src/progs/ingenuity/LoadPatchWindow.h b/src/progs/ingenuity/LoadPatchWindow.h index 3ac3d137..7f17cef7 100644 --- a/src/progs/ingenuity/LoadPatchWindow.h +++ b/src/progs/ingenuity/LoadPatchWindow.h @@ -18,12 +18,11 @@ #ifndef LOADPATCHWINDOW_H #define LOADPATCHWINDOW_H -#include "PluginModel.h" - #include #include -#include "raul/SharedPtr.h" -#include "PatchModel.h" +#include +#include "client/PluginModel.h" +#include "client/PatchModel.h" using Ingen::Client::PatchModel; using Ingen::Client::MetadataMap; diff --git a/src/progs/ingenuity/LoadPluginWindow.cpp b/src/progs/ingenuity/LoadPluginWindow.cpp index d0311446..5d314db2 100644 --- a/src/progs/ingenuity/LoadPluginWindow.cpp +++ b/src/progs/ingenuity/LoadPluginWindow.cpp @@ -15,17 +15,17 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "LoadPluginWindow.h" #include #include #include #include -#include "NodeModel.h" +#include "interface/EngineInterface.h" +#include "client/NodeModel.h" +#include "client/PatchModel.h" +#include "client/Store.h" #include "App.h" +#include "LoadPluginWindow.h" #include "PatchWindow.h" -#include "PatchModel.h" -#include "Store.h" -#include "ModelEngineInterface.h" #include "PatchView.h" #include "PatchCanvas.h" using std::cout; using std::cerr; using std::endl; @@ -341,7 +341,9 @@ LoadPluginWindow::add_clicked() dialog.run(); } else { Path path = _patch->path().base() + Path::nameify(name); - App::instance().engine()->create_node_with_data(plugin->uri(), path, polyphonic, _initial_data); + App::instance().engine()->create_node(plugin->uri(), path, polyphonic); + for (MetadataMap::const_iterator i = _initial_data.begin(); i != _initial_data.end(); ++i) + App::instance().engine()->set_metadata(path, i->first, i->second); ++_plugin_name_offset; _node_name_entry->set_text(generate_module_name(_plugin_name_offset)); diff --git a/src/progs/ingenuity/LoadPluginWindow.h b/src/progs/ingenuity/LoadPluginWindow.h index 39329f0e..7bfb63e1 100644 --- a/src/progs/ingenuity/LoadPluginWindow.h +++ b/src/progs/ingenuity/LoadPluginWindow.h @@ -19,13 +19,13 @@ #ifndef LOADPLUGINWINDOW_H #define LOADPLUGINWINDOW_H -#include "PluginModel.h" #include #include #include #include -#include "raul/SharedPtr.h" -#include "PatchModel.h" +#include +#include "client/PatchModel.h" +#include "client/PluginModel.h" using Ingen::Client::PluginModel; using Ingen::Client::PatchModel; using Ingen::Client::MetadataMap; diff --git a/src/progs/ingenuity/LoadRemotePatchWindow.cpp b/src/progs/ingenuity/LoadRemotePatchWindow.cpp index d1aa0db3..f42c0849 100644 --- a/src/progs/ingenuity/LoadRemotePatchWindow.cpp +++ b/src/progs/ingenuity/LoadRemotePatchWindow.cpp @@ -19,11 +19,11 @@ #include #include #include -#include "raul/RDFQuery.h" +#include +#include "interface/EngineInterface.h" +#include "client/PatchModel.h" #include "App.h" #include "Configuration.h" -#include "PatchModel.h" -#include "ModelEngineInterface.h" #include "ThreadedLoader.h" using boost::optional; diff --git a/src/progs/ingenuity/LoadRemotePatchWindow.h b/src/progs/ingenuity/LoadRemotePatchWindow.h index 5c399888..5a9de63a 100644 --- a/src/progs/ingenuity/LoadRemotePatchWindow.h +++ b/src/progs/ingenuity/LoadRemotePatchWindow.h @@ -18,12 +18,11 @@ #ifndef LOADREMOTEPATCHWINDOW_H #define LOADREMOTEPATCHWINDOW_H -#include "PluginModel.h" - #include #include -#include "raul/SharedPtr.h" -#include "PatchModel.h" +#include +#include "client/PatchModel.h" +#include "client/PluginModel.h" using Ingen::Client::PatchModel; using Ingen::Client::MetadataMap; diff --git a/src/progs/ingenuity/LoadSubpatchWindow.cpp b/src/progs/ingenuity/LoadSubpatchWindow.cpp index 37648ca8..d1f4b953 100644 --- a/src/progs/ingenuity/LoadSubpatchWindow.cpp +++ b/src/progs/ingenuity/LoadSubpatchWindow.cpp @@ -15,17 +15,17 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "LoadSubpatchWindow.h" #include #include #include #include +#include "interface/EngineInterface.h" +#include "client/NodeModel.h" +#include "client/PatchModel.h" #include "App.h" +#include "LoadSubpatchWindow.h" #include "PatchView.h" -#include "NodeModel.h" -#include "PatchModel.h" #include "Configuration.h" -#include "ModelEngineInterface.h" #include "ThreadedLoader.h" using boost::optional; diff --git a/src/progs/ingenuity/LoadSubpatchWindow.h b/src/progs/ingenuity/LoadSubpatchWindow.h index 6580bce1..54693504 100644 --- a/src/progs/ingenuity/LoadSubpatchWindow.h +++ b/src/progs/ingenuity/LoadSubpatchWindow.h @@ -18,11 +18,11 @@ #ifndef LOADSUBPATCHWINDOW_H #define LOADSUBPATCHWINDOW_H -#include "PluginModel.h" #include #include -#include "raul/SharedPtr.h" -#include "PatchModel.h" +#include +#include "client/PatchModel.h" +#include "client/PluginModel.h" using Ingen::Client::PatchModel; using Ingen::Client::MetadataMap; diff --git a/src/progs/ingenuity/Makefile.am b/src/progs/ingenuity/Makefile.am index 07420b48..82d96b15 100644 --- a/src/progs/ingenuity/Makefile.am +++ b/src/progs/ingenuity/Makefile.am @@ -1,6 +1,6 @@ if BUILD_GTK_CLIENT -EXTRA_DIST = ingenuity.gladep +EXTRA_DIST = ingenuity.gladep ingenuity_dev MAINTAINERCLEANFILES = Makefile.in sharefilesdir = $(pkgdatadir) @@ -12,16 +12,9 @@ dist_desktopfiles_DATA = ingenuity.desktop globalpixmapsdir = $(datadir)/pixmaps dist_globalpixmaps_DATA = ingen.svg -ingenuity_CXXFLAGS = -DGTK_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -I$(top_srcdir)/src/common -I$(top_srcdir)/src/libs/client -DPKGDATADIR=\"$(pkgdatadir)\" @RAUL_CFLAGS@ @GTKMM_CFLAGS@ @LIBGLADEMM_CFLAGS@ @GNOMECANVASMM_CFLAGS@ @LOSC_CFLAGS@ @LASH_CFLAGS@ @FLOWCANVAS_CFLAGS@ @SLV2_CFLAGS@ @CURL_CFLAGS@ -ingenuity_LDADD = @RAUL_LIBS@ @GTKMM_LIBS@ @LIBGLADEMM_LIBS@ @GNOMECANVASMM_LIBS@ @LOSC_LIBS@ @LASH_LIBS@ @FLOWCANVAS_LIBS@ @SLV2_LIBS@ @CURL_LIBS@ ../../libs/client/libingenclient.la -ingenuity_DEPENDENCIES = ../../libs/client/libingenclient.la - -# FIXME: make engine have a separate include dir -if MONOLITHIC_INGENUITY -ingenuity_CXXFLAGS += -I$(top_srcdir)/src/libs -ingenuity_LDADD += ../../libs/engine/libingen.la -ingenuity_DEPENDENCIES += ../../libs/engine/libingen.la -endif +ingenuity_CXXFLAGS = -DGTK_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -I$(top_srcdir)/src/common -I$(top_srcdir)/src/libs -DPKGDATADIR=\"$(pkgdatadir)\" @RAUL_CFLAGS@ @GTKMM_CFLAGS@ @LIBGLADEMM_CFLAGS@ @GNOMECANVASMM_CFLAGS@ @LOSC_CFLAGS@ @LASH_CFLAGS@ @FLOWCANVAS_CFLAGS@ @SLV2_CFLAGS@ @CURL_CFLAGS@ -DINGEN_MODULE_DIR=\"$(libdir)/ingen\" +ingenuity_LDADD = @RAUL_LIBS@ @GTKMM_LIBS@ @LIBGLADEMM_LIBS@ @GNOMECANVASMM_LIBS@ @LOSC_LIBS@ @LASH_LIBS@ @FLOWCANVAS_LIBS@ @SLV2_LIBS@ @CURL_LIBS@ ../../libs/client/libingen_client.la ../../libs/module/libingen_module.la +ingenuity_DEPENDENCIES = ../../libs/client/libingen_client.la ../../libs/module/libingen_module.la bin_PROGRAMS = ingenuity ingenuity_SOURCES = \ diff --git a/src/progs/ingenuity/NewSubpatchWindow.cpp b/src/progs/ingenuity/NewSubpatchWindow.cpp index b30003e7..e49340b8 100644 --- a/src/progs/ingenuity/NewSubpatchWindow.cpp +++ b/src/progs/ingenuity/NewSubpatchWindow.cpp @@ -16,10 +16,10 @@ */ #include "App.h" -#include "ModelEngineInterface.h" +#include "interface/EngineInterface.h" +#include "client/NodeModel.h" +#include "client/PatchModel.h" #include "NewSubpatchWindow.h" -#include "NodeModel.h" -#include "PatchModel.h" #include "PatchView.h" namespace Ingenuity { @@ -89,7 +89,10 @@ NewSubpatchWindow::ok_clicked() const Path path = _patch->path().base() + Path::nameify(_name_entry->get_text()); const size_t poly = _poly_spinbutton->get_value_as_int(); - App::instance().engine()->create_patch_with_data(path, poly, _initial_data); + App::instance().engine()->create_patch(path, poly); + for (MetadataMap::const_iterator i = _initial_data.begin(); i != _initial_data.end(); ++i) + App::instance().engine()->set_metadata(path, i->first, i->second); + App::instance().engine()->enable_patch(path); hide(); diff --git a/src/progs/ingenuity/NewSubpatchWindow.h b/src/progs/ingenuity/NewSubpatchWindow.h index 554005fa..28730137 100644 --- a/src/progs/ingenuity/NewSubpatchWindow.h +++ b/src/progs/ingenuity/NewSubpatchWindow.h @@ -18,11 +18,11 @@ #ifndef NEWSUBPATCHWINDOW_H #define NEWSUBPATCHWINDOW_H -#include "PluginModel.h" #include #include -#include "raul/SharedPtr.h" -#include "PatchModel.h" +#include +#include "client/PatchModel.h" +#include "client/PluginModel.h" using Ingen::Client::PatchModel; using Ingen::Client::MetadataMap; diff --git a/src/progs/ingenuity/NodeControlWindow.cpp b/src/progs/ingenuity/NodeControlWindow.cpp index 49578c1d..8d324a65 100644 --- a/src/progs/ingenuity/NodeControlWindow.cpp +++ b/src/progs/ingenuity/NodeControlWindow.cpp @@ -15,17 +15,18 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include +#include +#include "interface/EngineInterface.h" +#include "client/NodeModel.h" #include "App.h" -#include "ModelEngineInterface.h" #include "NodeControlWindow.h" #include "GladeFactory.h" -#include "NodeModel.h" #include "ControlGroups.h" #include "ControlPanel.h" #include "PatchWindow.h" -#include -#include -using std::cerr; using std::cout; using std::endl; + +using namespace std; namespace Ingenuity { diff --git a/src/progs/ingenuity/NodeControlWindow.h b/src/progs/ingenuity/NodeControlWindow.h index ab3e7e85..62ab497d 100644 --- a/src/progs/ingenuity/NodeControlWindow.h +++ b/src/progs/ingenuity/NodeControlWindow.h @@ -23,7 +23,7 @@ #include #include #include -#include "raul/SharedPtr.h" +#include using std::string; using std::vector; namespace Ingen { namespace Client { diff --git a/src/progs/ingenuity/NodeMenu.cpp b/src/progs/ingenuity/NodeMenu.cpp index d8a64184..a0efe441 100644 --- a/src/progs/ingenuity/NodeMenu.cpp +++ b/src/progs/ingenuity/NodeMenu.cpp @@ -17,10 +17,10 @@ #include #include -#include "NodeMenu.h" -#include "NodeModel.h" +#include "interface/EngineInterface.h" +#include "client/NodeModel.h" #include "App.h" -#include "ModelEngineInterface.h" +#include "NodeMenu.h" #include "WindowFactory.h" using std::cerr; using std::endl; diff --git a/src/progs/ingenuity/NodeMenu.h b/src/progs/ingenuity/NodeMenu.h index 23e7c890..d6f598ad 100644 --- a/src/progs/ingenuity/NodeMenu.h +++ b/src/progs/ingenuity/NodeMenu.h @@ -20,9 +20,9 @@ #include #include -#include "raul/Path.h" -#include "raul/SharedPtr.h" -#include "NodeModel.h" +#include +#include +#include "client/NodeModel.h" using Ingen::Client::NodeModel; using std::string; diff --git a/src/progs/ingenuity/NodeModule.cpp b/src/progs/ingenuity/NodeModule.cpp index c927114d..dd03fde8 100644 --- a/src/progs/ingenuity/NodeModule.cpp +++ b/src/progs/ingenuity/NodeModule.cpp @@ -15,14 +15,14 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "NodeModule.h" #include -#include "raul/Atom.h" +#include +#include "interface/EngineInterface.h" +#include "client/PatchModel.h" +#include "client/NodeModel.h" #include "App.h" -#include "ModelEngineInterface.h" +#include "NodeModule.h" #include "PatchCanvas.h" -#include "PatchModel.h" -#include "NodeModel.h" #include "Port.h" #include "GladeFactory.h" #include "RenameWindow.h" diff --git a/src/progs/ingenuity/NodeModule.h b/src/progs/ingenuity/NodeModule.h index 77829e93..d87bcfcc 100644 --- a/src/progs/ingenuity/NodeModule.h +++ b/src/progs/ingenuity/NodeModule.h @@ -20,7 +20,7 @@ #include #include #include -#include "raul/SharedPtr.h" +#include #include "Port.h" #include "NodeMenu.h" using std::string; diff --git a/src/progs/ingenuity/NodePropertiesWindow.cpp b/src/progs/ingenuity/NodePropertiesWindow.cpp index 87e09c99..428119a3 100644 --- a/src/progs/ingenuity/NodePropertiesWindow.cpp +++ b/src/progs/ingenuity/NodePropertiesWindow.cpp @@ -15,11 +15,11 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "NodePropertiesWindow.h" #include #include -#include "NodeModel.h" -#include "PluginModel.h" +#include "client/NodeModel.h" +#include "client/PluginModel.h" +#include "NodePropertiesWindow.h" namespace Ingenuity { using std::string; diff --git a/src/progs/ingenuity/NodePropertiesWindow.h b/src/progs/ingenuity/NodePropertiesWindow.h index b6d90062..eae9bfdc 100644 --- a/src/progs/ingenuity/NodePropertiesWindow.h +++ b/src/progs/ingenuity/NodePropertiesWindow.h @@ -20,8 +20,8 @@ #include #include -#include "raul/SharedPtr.h" -#include "NodeModel.h" +#include +#include "client/NodeModel.h" using namespace Ingen::Client; namespace Ingenuity { diff --git a/src/progs/ingenuity/PatchCanvas.cpp b/src/progs/ingenuity/PatchCanvas.cpp index 38fd0d87..e6397a3d 100644 --- a/src/progs/ingenuity/PatchCanvas.cpp +++ b/src/progs/ingenuity/PatchCanvas.cpp @@ -15,12 +15,16 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "PatchCanvas.h" #include #include +#include "interface/EngineInterface.h" +#include "client/PluginModel.h" +#include "client/PatchModel.h" +#include "client/NodeModel.h" +#include "client/Store.h" +#include "client/Serializer.h" #include "App.h" -#include "ModelEngineInterface.h" -#include "PatchModel.h" +#include "PatchCanvas.h" #include "PatchWindow.h" #include "PatchPortModule.h" #include "LoadPluginWindow.h" @@ -28,14 +32,10 @@ #include "NewSubpatchWindow.h" #include "Port.h" #include "Connection.h" -#include "NodeModel.h" #include "NodeModule.h" #include "SubpatchModule.h" #include "GladeFactory.h" #include "WindowFactory.h" -#include "Serializer.h" -#include "Store.h" -#include "PluginModel.h" #include "config.h" using Ingen::Client::Store; using Ingen::Client::Serializer; @@ -456,7 +456,10 @@ void PatchCanvas::menu_add_port(const string& name, const string& type, bool is_output) { const Path& path = _patch->path().base() + generate_port_name(name); - App::instance().engine()->create_port_with_data(path, type, is_output, get_initial_data()); + App::instance().engine()->create_port(path, type, is_output); + MetadataMap data = get_initial_data(); + for (MetadataMap::const_iterator i = data.begin(); i != data.end(); ++i) + App::instance().engine()->set_metadata(path, i->first, i->second); } @@ -465,7 +468,10 @@ PatchCanvas::load_plugin(SharedPtr plugin) { const Path& path = _patch->path().base() + plugin->default_node_name(_patch); // FIXME: polyphony? - App::instance().engine()->create_node_with_data(plugin->uri(), path, false, get_initial_data()); + App::instance().engine()->create_node(plugin->uri(), path, false); + MetadataMap data = get_initial_data(); + for (MetadataMap::const_iterator i = data.begin(); i != data.end(); ++i) + App::instance().engine()->set_metadata(path, i->first, i->second); } diff --git a/src/progs/ingenuity/PatchCanvas.h b/src/progs/ingenuity/PatchCanvas.h index b36bd115..297e9874 100644 --- a/src/progs/ingenuity/PatchCanvas.h +++ b/src/progs/ingenuity/PatchCanvas.h @@ -25,8 +25,8 @@ #include #include #include -#include "ConnectionModel.h" -#include "PatchModel.h" +#include "client/ConnectionModel.h" +#include "client/PatchModel.h" #include "NodeModule.h" using std::string; diff --git a/src/progs/ingenuity/PatchPortModule.cpp b/src/progs/ingenuity/PatchPortModule.cpp index 048d0ee7..08e7dbbd 100644 --- a/src/progs/ingenuity/PatchPortModule.cpp +++ b/src/progs/ingenuity/PatchPortModule.cpp @@ -17,11 +17,11 @@ #include "PatchPortModule.h" #include +#include "interface/EngineInterface.h" +#include "client/PatchModel.h" +#include "client/NodeModel.h" #include "App.h" -#include "ModelEngineInterface.h" #include "PatchCanvas.h" -#include "PatchModel.h" -#include "NodeModel.h" #include "Port.h" #include "GladeFactory.h" #include "RenameWindow.h" diff --git a/src/progs/ingenuity/PatchPortModule.h b/src/progs/ingenuity/PatchPortModule.h index 21455089..f42b7592 100644 --- a/src/progs/ingenuity/PatchPortModule.h +++ b/src/progs/ingenuity/PatchPortModule.h @@ -22,7 +22,7 @@ #include #include #include -#include "raul/Atom.h" +#include #include "Port.h" using std::string; diff --git a/src/progs/ingenuity/PatchPropertiesWindow.cpp b/src/progs/ingenuity/PatchPropertiesWindow.cpp index 33afd1fb..17b28d34 100644 --- a/src/progs/ingenuity/PatchPropertiesWindow.cpp +++ b/src/progs/ingenuity/PatchPropertiesWindow.cpp @@ -15,9 +15,9 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "PatchPropertiesWindow.h" #include -#include "PatchModel.h" +#include "client/PatchModel.h" +#include "PatchPropertiesWindow.h" namespace Ingenuity { using std::string; diff --git a/src/progs/ingenuity/PatchPropertiesWindow.h b/src/progs/ingenuity/PatchPropertiesWindow.h index f5dc3b79..8e461381 100644 --- a/src/progs/ingenuity/PatchPropertiesWindow.h +++ b/src/progs/ingenuity/PatchPropertiesWindow.h @@ -21,7 +21,7 @@ #include #include #include -#include "raul/SharedPtr.h" +#include using std::string; namespace Ingen { namespace Client { class PatchModel; } } diff --git a/src/progs/ingenuity/PatchTreeWindow.cpp b/src/progs/ingenuity/PatchTreeWindow.cpp index 5f17a774..77caf6dd 100644 --- a/src/progs/ingenuity/PatchTreeWindow.cpp +++ b/src/progs/ingenuity/PatchTreeWindow.cpp @@ -15,16 +15,15 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include +#include "interface/EngineInterface.h" +#include "client/OSCEngineSender.h" +#include "client/Store.h" +#include "client/PatchModel.h" #include "App.h" -#include "ModelEngineInterface.h" -#include "OSCEngineSender.h" #include "PatchTreeWindow.h" -#include "PatchWindow.h" -#include "Store.h" #include "SubpatchModule.h" -#include "PatchModel.h" #include "WindowFactory.h" -#include "raul/Path.h" namespace Ingenuity { diff --git a/src/progs/ingenuity/PatchTreeWindow.h b/src/progs/ingenuity/PatchTreeWindow.h index 00dcf25c..c7fc3c10 100644 --- a/src/progs/ingenuity/PatchTreeWindow.h +++ b/src/progs/ingenuity/PatchTreeWindow.h @@ -20,7 +20,7 @@ #include #include -#include "raul/Path.h" +#include namespace Ingen { namespace Client { class Store; diff --git a/src/progs/ingenuity/PatchView.cpp b/src/progs/ingenuity/PatchView.cpp index aafe798a..076eaa40 100644 --- a/src/progs/ingenuity/PatchView.cpp +++ b/src/progs/ingenuity/PatchView.cpp @@ -15,15 +15,15 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "PatchView.h" #include #include #include +#include "interface/EngineInterface.h" +#include "client/PatchModel.h" #include "App.h" -#include "ModelEngineInterface.h" +#include "PatchView.h" #include "PatchCanvas.h" #include "LoadPluginWindow.h" -#include "PatchModel.h" #include "NewSubpatchWindow.h" #include "LoadSubpatchWindow.h" #include "NodeControlWindow.h" diff --git a/src/progs/ingenuity/PatchView.h b/src/progs/ingenuity/PatchView.h index 3ea52932..95683251 100644 --- a/src/progs/ingenuity/PatchView.h +++ b/src/progs/ingenuity/PatchView.h @@ -22,8 +22,8 @@ #include #include #include -#include "raul/SharedPtr.h" -#include "PatchModel.h" +#include +#include "client/PatchModel.h" using std::string; diff --git a/src/progs/ingenuity/PatchWindow.cpp b/src/progs/ingenuity/PatchWindow.cpp index 606674bb..2e764ff0 100644 --- a/src/progs/ingenuity/PatchWindow.cpp +++ b/src/progs/ingenuity/PatchWindow.cpp @@ -19,11 +19,12 @@ #include #include #include +#include "interface/EngineInterface.h" +#include "client/PatchModel.h" +#include "client/Store.h" #include "App.h" -#include "ModelEngineInterface.h" #include "PatchCanvas.h" #include "LoadPluginWindow.h" -#include "PatchModel.h" #include "NewSubpatchWindow.h" #include "LoadPatchWindow.h" #include "LoadSubpatchWindow.h" @@ -33,7 +34,6 @@ #include "MessagesWindow.h" #include "PatchTreeWindow.h" #include "BreadCrumbBox.h" -#include "Store.h" #include "ConnectWindow.h" #include "ThreadedLoader.h" #include "WindowFactory.h" diff --git a/src/progs/ingenuity/PatchWindow.h b/src/progs/ingenuity/PatchWindow.h index a5ce150d..f4399a20 100644 --- a/src/progs/ingenuity/PatchWindow.h +++ b/src/progs/ingenuity/PatchWindow.h @@ -23,9 +23,9 @@ #include #include #include -#include "raul/Path.h" -#include "raul/SharedPtr.h" -#include "PatchModel.h" +#include +#include +#include "client/PatchModel.h" #include "PatchView.h" using Ingen::Client::PatchModel; diff --git a/src/progs/ingenuity/Port.cpp b/src/progs/ingenuity/Port.cpp index 4c27c3b1..b13ccda9 100644 --- a/src/progs/ingenuity/Port.cpp +++ b/src/progs/ingenuity/Port.cpp @@ -15,15 +15,15 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "Port.h" #include #include -#include "PatchModel.h" -#include "PortModel.h" -#include "ControlModel.h" +#include "interface/EngineInterface.h" +#include "client/PatchModel.h" +#include "client/PortModel.h" +#include "client/ControlModel.h" #include "Configuration.h" -#include "ModelEngineInterface.h" #include "App.h" +#include "Port.h" using std::cerr; using std::endl; using namespace Ingen::Client; diff --git a/src/progs/ingenuity/Port.h b/src/progs/ingenuity/Port.h index 78950040..b006ba45 100644 --- a/src/progs/ingenuity/Port.h +++ b/src/progs/ingenuity/Port.h @@ -21,7 +21,7 @@ #include #include #include -#include "raul/SharedPtr.h" +#include namespace Ingen { namespace Client { class PortModel; } } using Ingen::Client::PortModel; diff --git a/src/progs/ingenuity/PortPropertiesWindow.cpp b/src/progs/ingenuity/PortPropertiesWindow.cpp index 3a490a74..eb23c542 100644 --- a/src/progs/ingenuity/PortPropertiesWindow.cpp +++ b/src/progs/ingenuity/PortPropertiesWindow.cpp @@ -15,14 +15,14 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "PortPropertiesWindow.h" #include #include -#include "NodeModel.h" -#include "PluginModel.h" -#include "ModelEngineInterface.h" -#include "ControlGroups.h" +#include "interface/EngineInterface.h" +#include "client/NodeModel.h" +#include "client/PluginModel.h" #include "App.h" +#include "ControlGroups.h" +#include "PortPropertiesWindow.h" using std::string; diff --git a/src/progs/ingenuity/PortPropertiesWindow.h b/src/progs/ingenuity/PortPropertiesWindow.h index cd22cb09..adb0a2f0 100644 --- a/src/progs/ingenuity/PortPropertiesWindow.h +++ b/src/progs/ingenuity/PortPropertiesWindow.h @@ -20,8 +20,8 @@ #include #include -#include "raul/SharedPtr.h" -#include "PortModel.h" +#include +#include "client/PortModel.h" using namespace Ingen::Client; namespace Ingenuity { diff --git a/src/progs/ingenuity/RenameWindow.cpp b/src/progs/ingenuity/RenameWindow.cpp index c2dca012..28a8ddfe 100644 --- a/src/progs/ingenuity/RenameWindow.cpp +++ b/src/progs/ingenuity/RenameWindow.cpp @@ -15,13 +15,14 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "RenameWindow.h" #include #include -#include "ObjectModel.h" -#include "Store.h" +#include "interface/EngineInterface.h" +#include "client/ObjectModel.h" +#include "client/Store.h" #include "App.h" -#include "ModelEngineInterface.h" +#include "RenameWindow.h" + using std::string; namespace Ingenuity { diff --git a/src/progs/ingenuity/RenameWindow.h b/src/progs/ingenuity/RenameWindow.h index 11adbff8..04f765d4 100644 --- a/src/progs/ingenuity/RenameWindow.h +++ b/src/progs/ingenuity/RenameWindow.h @@ -20,8 +20,8 @@ #include #include -#include "raul/SharedPtr.h" -#include "ObjectModel.h" +#include +#include "client/ObjectModel.h" using Ingen::Client::ObjectModel; namespace Ingenuity { diff --git a/src/progs/ingenuity/SubpatchModule.cpp b/src/progs/ingenuity/SubpatchModule.cpp index ec4d7fd9..53958375 100644 --- a/src/progs/ingenuity/SubpatchModule.cpp +++ b/src/progs/ingenuity/SubpatchModule.cpp @@ -18,11 +18,11 @@ #include "SubpatchModule.h" #include #include +#include "interface/EngineInterface.h" +#include "client/PatchModel.h" #include "App.h" -#include "ModelEngineInterface.h" #include "NodeModule.h" #include "NodeControlWindow.h" -#include "PatchModel.h" #include "PatchWindow.h" #include "PatchCanvas.h" #include "Port.h" diff --git a/src/progs/ingenuity/SubpatchModule.h b/src/progs/ingenuity/SubpatchModule.h index 4bf33431..36e9a2d3 100644 --- a/src/progs/ingenuity/SubpatchModule.h +++ b/src/progs/ingenuity/SubpatchModule.h @@ -21,10 +21,10 @@ #include #include -#include "NodeModule.h" -#include "raul/SharedPtr.h" -#include "PatchModel.h" +#include +#include "client/PatchModel.h" #include "PatchPortModule.h" +#include "NodeModule.h" using std::string; using std::list; namespace Ingen { namespace Client { diff --git a/src/progs/ingenuity/ThreadedLoader.cpp b/src/progs/ingenuity/ThreadedLoader.cpp index bf195dce..43bc76c8 100644 --- a/src/progs/ingenuity/ThreadedLoader.cpp +++ b/src/progs/ingenuity/ThreadedLoader.cpp @@ -15,24 +15,38 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "ThreadedLoader.h" #include #include #include -#include "PatchModel.h" +#include "client/PatchModel.h" +#include "module/Module.h" #include "App.h" +#include "ThreadedLoader.h" using std::cout; using std::endl; namespace Ingenuity { -ThreadedLoader::ThreadedLoader(SharedPtr engine) - : _engine(engine) +ThreadedLoader::ThreadedLoader(SharedPtr engine) + : _serialisation_module(Ingen::Shared::load_module("ingen_serialisation")) + , _engine(engine) , _deprecated_loader(engine) , _serializer(*App::instance().rdf_world()) { // FIXME: rework this so the thread is only present when it's doing something (save mem) - start(); + if (_serialisation_module) { + Loader* (*new_loader)() = NULL; + bool found = _serialisation_module->get_symbol("new_loader", (void*&)new_loader); + if (found) + _loader = SharedPtr(new_loader()); + } + + if (_loader) { + start(); + } else { + cerr << "WARNING: Failed to load ingen_serialisation module, unable to load patches." << endl;; + cerr << "If you are running from the source tree, run ingenuity_dev." << endl; + } } @@ -78,7 +92,7 @@ ThreadedLoader::load_patch(bool merge, false))); } else { _events.push_back(sigc::hide_return(sigc::bind( - sigc::ptr_fun(&Ingen::Serialisation::load), + sigc::mem_fun(_loader.get(), &Ingen::Serialisation::Loader::load), App::instance().engine(), App::instance().rdf_world(), data_base_uri, diff --git a/src/progs/ingenuity/ThreadedLoader.h b/src/progs/ingenuity/ThreadedLoader.h index bf2c2ed5..1846cece 100644 --- a/src/progs/ingenuity/ThreadedLoader.h +++ b/src/progs/ingenuity/ThreadedLoader.h @@ -26,16 +26,17 @@ #include #include #include -#include "ModelEngineInterface.h" -#include "Serializer.h" -#include "DeprecatedLoader.h" -#include "Loader.h" -#include "PatchModel.h" +#include "interface/EngineInterface.h" +#include "client/PatchModel.h" +#include "client/Serializer.h" +#include "client/DeprecatedLoader.h" +#include "serialisation/Loader.h" using std::string; using std::list; using boost::optional; using namespace Ingen::Client; +using namespace Ingen::Serialisation; namespace Ingenuity { @@ -54,7 +55,7 @@ namespace Ingenuity { class ThreadedLoader : public Raul::Slave { public: - ThreadedLoader(SharedPtr engine); + ThreadedLoader(SharedPtr engine); ~ThreadedLoader(); // FIXME: there's a pattern here.... @@ -79,7 +80,10 @@ private: void _whipped(); - SharedPtr _engine; + SharedPtr _serialisation_module; + + SharedPtr _engine; + SharedPtr _loader; DeprecatedLoader _deprecated_loader; Serializer _serializer; diff --git a/src/progs/ingenuity/UploadPatchWindow.cpp b/src/progs/ingenuity/UploadPatchWindow.cpp index 6c68236d..400c2369 100644 --- a/src/progs/ingenuity/UploadPatchWindow.cpp +++ b/src/progs/ingenuity/UploadPatchWindow.cpp @@ -21,13 +21,13 @@ #include #include #include -#include "Serializer.h" -#include "raul/RDFQuery.h" +#include +#include "interface/EngineInterface.h" +#include "client/Serializer.h" +#include "client/PatchModel.h" #include "UploadPatchWindow.h" #include "App.h" #include "Configuration.h" -#include "PatchModel.h" -#include "ModelEngineInterface.h" #include "ThreadedLoader.h" using boost::optional; diff --git a/src/progs/ingenuity/UploadPatchWindow.h b/src/progs/ingenuity/UploadPatchWindow.h index ffc0f17c..36b39b07 100644 --- a/src/progs/ingenuity/UploadPatchWindow.h +++ b/src/progs/ingenuity/UploadPatchWindow.h @@ -22,11 +22,11 @@ #include #include #include -#include "raul/SharedPtr.h" -#include "raul/Thread.h" -#include "raul/AtomicInt.h" -#include "PatchModel.h" -#include "PluginModel.h" +#include +#include +#include +#include "client/PatchModel.h" +#include "client/PluginModel.h" using Ingen::Client::PatchModel; using Ingen::Client::MetadataMap; diff --git a/src/progs/ingenuity/WindowFactory.h b/src/progs/ingenuity/WindowFactory.h index 9c6cfa0a..085ff9b6 100644 --- a/src/progs/ingenuity/WindowFactory.h +++ b/src/progs/ingenuity/WindowFactory.h @@ -20,9 +20,10 @@ #include #include -#include "raul/SharedPtr.h" +#include +#include "client/PatchModel.h" #include "PatchView.h" -#include "PatchModel.h" + using Ingen::Client::PatchModel; namespace Ingenuity { diff --git a/src/progs/ingenuity/ingenuity_dev b/src/progs/ingenuity/ingenuity_dev new file mode 100755 index 00000000..b77d2fe6 --- /dev/null +++ b/src/progs/ingenuity/ingenuity_dev @@ -0,0 +1,3 @@ +#!/usr/bin/env sh + +INGEN_MODULE_PATH=../../libs/engine/.libs:../../libs/serialisation/.libs ./ingenuity diff --git a/src/progs/patch_loader/Makefile.am b/src/progs/patch_loader/Makefile.am index 9913411a..f16cc495 100644 --- a/src/progs/patch_loader/Makefile.am +++ b/src/progs/patch_loader/Makefile.am @@ -1,11 +1,11 @@ EXTRA_DIST = README -ingen_load_CXXFLAGS = -I$(top_srcdir)/src/libs/client -I$(top_srcdir)/src/common @LSIGCPP_CFLAGS@ @RAUL_CFLAGS@ @GLIBMM_CFLAGS@ @RASQAL_CFLAGS@ -ingen_load_LDADD = ../../libs/client/libingenclient.la @RAUL_LIBS@ @LSIGCPP_LIBS@ @GLIBMM_LIBS@ @RASQAL_LIBS@ +ingen_load_CXXFLAGS = -I$(top_srcdir)/src/libs -I$(top_srcdir)/src/common @LSIGCPP_CFLAGS@ @RAUL_CFLAGS@ @GLIBMM_CFLAGS@ @RASQAL_CFLAGS@ -DINGEN_MODULE_DIR=\"$(libdir)/ingen\" +ingen_load_LDADD = ../../libs/client/libingen_client.la ../../libs/module/libingen_module.la @RAUL_LIBS@ @LSIGCPP_LIBS@ @GLIBMM_LIBS@ @RASQAL_LIBS@ bin_PROGRAMS = ingen_load -#ingen_load_DEPENDENCIES = ../../libs/client/libingenclient.la +#ingen_load_DEPENDENCIES = ../../libs/client/libingen_client.la ingen_load_SOURCES = \ patch_loader.cpp \ diff --git a/src/progs/patch_loader/new_patch_loader.cpp b/src/progs/patch_loader/new_patch_loader.cpp index 6c879f43..cee48827 100644 --- a/src/progs/patch_loader/new_patch_loader.cpp +++ b/src/progs/patch_loader/new_patch_loader.cpp @@ -17,8 +17,8 @@ #include #include +#include #include "cmdline.h" // generated by gengetopt -#include "raul/Path.h" #include "OSCEngineInterface.h" #include "PatchLibrarian.h" diff --git a/src/progs/patch_loader/patch_loader.cpp b/src/progs/patch_loader/patch_loader.cpp index cc3c1903..57bba0e0 100644 --- a/src/progs/patch_loader/patch_loader.cpp +++ b/src/progs/patch_loader/patch_loader.cpp @@ -17,16 +17,20 @@ #include #include +#include #include #include -#include "OSCModelEngineInterface.h" -#include "Loader.h" -#include "PatchModel.h" +#include "client/OSCEngineSender.h" +#include "client/PatchModel.h" +#include "module/Module.h" +#include "serialisation/serialisation.h" +#include "serialisation/Loader.h" #include "cmdline.h" // generated by gengetopt -using std::cout; using std::endl; - +using namespace std; using namespace Ingen::Client; +using namespace Ingen::Serialisation; + int main(int argc, char** argv) { @@ -60,7 +64,7 @@ int main(int argc, char** argv) rdf_world.add_prefix("rdfs", "http://www.w3.org/2000/01/rdf-schema#"); rdf_world.add_prefix("doap", "http://usefulinc.com/ns/doap#"); - SharedPtr engine(new OSCModelEngineInterface(engine_url)); + SharedPtr engine(new OSCEngineSender(engine_url)); /* Connect to engine */ engine->attach(-1, client_port); @@ -76,11 +80,29 @@ int main(int argc, char** argv) * engine->wait_for_response(); */ + SharedPtr module = Ingen::Shared::load_module("ingen_serialisation"); + + if (!module) { + cerr << "Unable to load ingen_serialisation module, exiting." << endl; + return -1; + } + + Loader* (*new_loader)() = NULL; + + bool found = module->get_symbol("new_loader", (void*&)new_loader); + + if (!found) { + cerr << "Unable to find module entry point, exiting." << endl; + return -1; + } + + SharedPtr loader(new_loader()); + // Load patches for (uint i=0; i < args_info.inputs_num; ++i) { cerr << "FIXME: load patch under root" << endl; cerr << "Load " << args_info.inputs[i] << endl; - Ingen::Serialisation::load(engine, &rdf_world, + loader->load(engine, &rdf_world, string("file:") + args_info.inputs[i], Path("/"), ""); } diff --git a/src/progs/server/Makefile.am b/src/progs/server/Makefile.am index 7584ee87..ab384494 100644 --- a/src/progs/server/Makefile.am +++ b/src/progs/server/Makefile.am @@ -1,6 +1,7 @@ -AM_CXXFLAGS = @RAUL_CFLAGS@ @SLV2_CFLAGS@ @JACK_CFLAGS@ @LOSC_CFLAGS@ @ALSA_CFLAGS@ @LASH_CFLAGS@ -I$(top_srcdir)/src/common -I$(top_srcdir)/src/libs/engine -I$(top_srcdir)/src/libs/engine/events +AM_CXXFLAGS = @RAUL_CFLAGS@ @JACK_CFLAGS@ @LOSC_CFLAGS@ @ALSA_CFLAGS@ @LASH_CFLAGS@ @SLV2_CFLAGS@ -I$(top_srcdir)/src/common -I$(top_srcdir)/src/libs -DINGEN_MODULE_DIR=\"$(libdir)/ingen\" MAINTAINERCLEANFILES = Makefile.in +EXTRA_DIST = ingen_dev # # Stand-alone engine @@ -8,8 +9,8 @@ MAINTAINERCLEANFILES = Makefile.in if BUILD_SERVER bin_PROGRAMS = ingen -ingen_DEPENDENCIES = ../../libs/engine/libingen.la -ingen_LDADD = @RAUL_LIBS@ @SLV2_LIBS@ @JACK_LIBS@ @LOSC_LIBS@ @ALSA_LIBS@ @LASH_LIBS@ -lrt ../../libs/engine/libingen.la +ingen_LDADD = @RAUL_LIBS@ @JACK_LIBS@ @LOSC_LIBS@ @ALSA_LIBS@ @LASH_LIBS@ @SLV2_LIBS@ -lrt ../../libs/module/libingen_module.la +ingen_DEPENDENCIES = ../../libs/module/libingen_module.la ingen_SOURCES = \ main.cpp \ diff --git a/src/progs/server/cmdline.c b/src/progs/server/cmdline.c index 6a697a04..1e97e1ef 100644 --- a/src/progs/server/cmdline.c +++ b/src/progs/server/cmdline.c @@ -1,5 +1,5 @@ /* - File autogenerated by gengetopt version 2.18 + File autogenerated by gengetopt version 2.19.1 generated with the following command: gengetopt -u @@ -23,14 +23,15 @@ const char *gengetopt_args_info_purpose = ""; -const char *gengetopt_args_info_usage = "Usage: Om - An OSC controlled realtime modular synthesizer [OPTIONS]... [FILES]..."; +const char *gengetopt_args_info_usage = "Usage: Om - An OSC controlled realtime modular synthesizer [OPTIONS]... \n [FILES]..."; + +const char *gengetopt_args_info_description = ""; const char *gengetopt_args_info_help[] = { - " -h, --help Print help and exit", - " -V, --version Print version and exit", - " -p, --port=STRING OSC port to listen on (default=`16180')", - " -j, --jack-server=STRING Name of Jack server to attach to", - " -i, --in-jackd Run engine as in-process JACK client (default=off)", + " -h, --help Print help and exit", + " -V, --version Print version and exit", + " -p, --port=STRING OSC port to listen on (default=`16180')", + " -i, --in-jackd Run engine as in-process JACK client (default=off)", 0 }; @@ -52,7 +53,6 @@ void clear_given (struct gengetopt_args_info *args_info) args_info->help_given = 0 ; args_info->version_given = 0 ; args_info->port_given = 0 ; - args_info->jack_server_given = 0 ; args_info->in_jackd_given = 0 ; } @@ -61,8 +61,6 @@ void clear_args (struct gengetopt_args_info *args_info) { args_info->port_arg = gengetopt_strdup ("16180"); args_info->port_orig = NULL; - args_info->jack_server_arg = NULL; - args_info->jack_server_orig = NULL; args_info->in_jackd_flag = 0; } @@ -73,8 +71,7 @@ void init_args_info(struct gengetopt_args_info *args_info) args_info->help_help = gengetopt_args_info_help[0] ; args_info->version_help = gengetopt_args_info_help[1] ; args_info->port_help = gengetopt_args_info_help[2] ; - args_info->jack_server_help = gengetopt_args_info_help[3] ; - args_info->in_jackd_help = gengetopt_args_info_help[4] ; + args_info->in_jackd_help = gengetopt_args_info_help[3] ; } @@ -94,6 +91,10 @@ cmdline_parser_print_help (void) printf("\n%s\n", gengetopt_args_info_purpose); printf("\n%s\n\n", gengetopt_args_info_usage); + + if (strlen(gengetopt_args_info_description) > 0) + printf("%s\n", gengetopt_args_info_description); + while (gengetopt_args_info_help[i]) printf("%s\n", gengetopt_args_info_help[i++]); } @@ -124,16 +125,6 @@ cmdline_parser_release (struct gengetopt_args_info *args_info) free (args_info->port_orig); /* free previous argument */ args_info->port_orig = 0; } - if (args_info->jack_server_arg) - { - free (args_info->jack_server_arg); /* free previous argument */ - args_info->jack_server_arg = 0; - } - if (args_info->jack_server_orig) - { - free (args_info->jack_server_orig); /* free previous argument */ - args_info->jack_server_orig = 0; - } for (i = 0; i < args_info->inputs_num; ++i) free (args_info->inputs [i]); @@ -171,13 +162,6 @@ cmdline_parser_file_save(const char *filename, struct gengetopt_args_info *args_ fprintf(outfile, "%s\n", "port"); } } - if (args_info->jack_server_given) { - if (args_info->jack_server_orig) { - fprintf(outfile, "%s=\"%s\"\n", "jack-server", args_info->jack_server_orig); - } else { - fprintf(outfile, "%s\n", "jack-server"); - } - } if (args_info->in_jackd_given) { fprintf(outfile, "%s\n", "in-jackd"); } @@ -266,13 +250,12 @@ cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_inf { "help", 0, NULL, 'h' }, { "version", 0, NULL, 'V' }, { "port", 1, NULL, 'p' }, - { "jack-server", 1, NULL, 'j' }, { "in-jackd", 0, NULL, 'i' }, { NULL, 0, NULL, 0 } }; stop_char = 0; - c = getopt_long (argc, argv, "hVp:j:i", long_options, &option_index); + c = getopt_long (argc, argv, "hVp:i", long_options, &option_index); if (c == -1) break; /* Exit from `while (1)' loop. */ @@ -306,24 +289,6 @@ cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_inf args_info->port_orig = gengetopt_strdup (optarg); break; - case 'j': /* Name of Jack server to attach to. */ - if (local_args_info.jack_server_given) - { - fprintf (stderr, "%s: `--jack-server' (`-j') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); - goto failure; - } - if (args_info->jack_server_given && ! override) - continue; - local_args_info.jack_server_given = 1; - args_info->jack_server_given = 1; - if (args_info->jack_server_arg) - free (args_info->jack_server_arg); /* free previous string */ - args_info->jack_server_arg = gengetopt_strdup (optarg); - if (args_info->jack_server_orig) - free (args_info->jack_server_orig); /* free previous string */ - args_info->jack_server_orig = gengetopt_strdup (optarg); - break; - case 'i': /* Run engine as in-process JACK client. */ if (local_args_info.in_jackd_given) { diff --git a/src/progs/server/cmdline.ggo b/src/progs/server/cmdline.ggo index ce50cea1..9635a8f5 100644 --- a/src/progs/server/cmdline.ggo +++ b/src/progs/server/cmdline.ggo @@ -3,6 +3,5 @@ package "Om - An OSC controlled realtime modular synthesizer" option "port" p "OSC port to listen on" string default="16180" no -option "jack-server" j "Name of Jack server to attach to" string no option "in-jackd" i "Run engine as in-process JACK client" flag off diff --git a/src/progs/server/cmdline.h b/src/progs/server/cmdline.h index 8ced9534..5253162c 100644 --- a/src/progs/server/cmdline.h +++ b/src/progs/server/cmdline.h @@ -1,6 +1,6 @@ /* cmdline.h */ -/* File autogenerated by gengetopt version 2.18 */ +/* File autogenerated by gengetopt version 2.19.1 */ #ifndef CMDLINE_H #define CMDLINE_H @@ -29,16 +29,12 @@ struct gengetopt_args_info char * port_arg; /* OSC port to listen on (default='16180'). */ char * port_orig; /* OSC port to listen on original value given at command line. */ const char *port_help; /* OSC port to listen on help description. */ - char * jack_server_arg; /* Name of Jack server to attach to. */ - char * jack_server_orig; /* Name of Jack server to attach to original value given at command line. */ - const char *jack_server_help; /* Name of Jack server to attach to help description. */ int in_jackd_flag; /* Run engine as in-process JACK client (default=off). */ const char *in_jackd_help; /* Run engine as in-process JACK client help description. */ int help_given ; /* Whether help was given. */ int version_given ; /* Whether version was given. */ int port_given ; /* Whether port was given. */ - int jack_server_given ; /* Whether jack-server was given. */ int in_jackd_given ; /* Whether in-jackd was given. */ char **inputs ; /* unamed options */ diff --git a/src/progs/server/ingen_dev b/src/progs/server/ingen_dev new file mode 100755 index 00000000..bd8857f7 --- /dev/null +++ b/src/progs/server/ingen_dev @@ -0,0 +1,3 @@ +#!/usr/bin/env sh + +INGEN_MODULE_PATH=../../libs/engine/.libs ./ingen diff --git a/src/progs/server/main.cpp b/src/progs/server/main.cpp index ea9b37d8..e92b635f 100644 --- a/src/progs/server/main.cpp +++ b/src/progs/server/main.cpp @@ -19,19 +19,18 @@ #include #include #include "config.h" -#include "util.h" -#include "cmdline.h" -#include "tuning.h" -#include "Engine.h" -#include "JackAudioDriver.h" -#include "OSCEngineReceiver.h" +#include "module/Module.h" +#include "engine/util.h" +#include "engine/Engine.h" +#include "engine/EventSource.h" #ifdef HAVE_LASH -#include "LashDriver.h" +#include "engine/LashDriver.h" #endif #ifdef BUILD_IN_PROCESS_ENGINE #include #include #endif +#include "cmdline.h" using std::cout; using std::endl; using std::cerr; using namespace Ingen; @@ -139,18 +138,28 @@ main(int argc, char** argv) set_denormal_flags(); - engine = SharedPtr(new Engine()); + SharedPtr module = Ingen::Shared::load_module("ingen_engine"); + + if (!module) { + cerr << "Aborting. If you are running from the source tree, run ingen_dev." << endl; + return -1; + } - std::string jack_name - = (args_info.jack_server_given) ? args_info.jack_server_arg : ""; + Engine* (*new_engine)() = NULL; + + bool found = module->get_symbol("new_engine", (void*&)new_engine); + + if (!found) { + cerr << "Unable to find module entry point, exiting." << endl; + return -1; + } - SharedPtr audio_driver( - new JackAudioDriver(*engine.get(), jack_name) ); + SharedPtr engine(new_engine()); - SharedPtr event_source(new OSCEngineReceiver( - engine, pre_processor_queue_size, args_info.port_arg )); + engine->start_jack_driver(); + engine->start_osc_driver(args_info.port_arg); - engine->activate(audio_driver, event_source); + engine->activate(); #ifdef HAVE_LASH lash_driver = new LashDriver(engine, lash_args); @@ -158,7 +167,7 @@ main(int argc, char** argv) engine->main(); - event_source->deactivate(); + engine->event_source()->deactivate(); #ifdef HAVE_LASH delete lash_driver; diff --git a/src/set_dev_environment.sh b/src/set_dev_environment.sh new file mode 100755 index 00000000..09807f5c --- /dev/null +++ b/src/set_dev_environment.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env sh + +# Source this file (e.g ". set_dev_environment.sh") to set up a development +# environment so dynamic modules in the source tree will be found and the +# executables can be run directly, or in gdb/valgrind/etc. + +export INGEN_MODULE_PATH="`pwd`/libs/engine/.libs:`pwd`/libs/serialisation/.libs" + -- cgit v1.2.1