summaryrefslogtreecommitdiffstats
path: root/src/libs
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs')
-rw-r--r--src/libs/client/PluginModel.hpp1
-rw-r--r--src/libs/client/SigClientInterface.hpp2
-rw-r--r--src/libs/engine/Engine.cpp7
-rw-r--r--src/libs/engine/Engine.hpp11
-rw-r--r--src/libs/engine/NodeFactory.cpp29
-rw-r--r--src/libs/engine/NodeFactory.hpp6
-rw-r--r--src/libs/engine/QueuedEngineInterface.cpp1
-rw-r--r--src/libs/engine/engine.cpp6
-rw-r--r--src/libs/engine/engine.hpp10
-rw-r--r--src/libs/gui/App.cpp28
-rw-r--r--src/libs/gui/App.hpp17
-rw-r--r--src/libs/gui/ConnectWindow.cpp5
-rw-r--r--src/libs/gui/ConnectWindow.hpp8
-rw-r--r--src/libs/gui/LoadRemotePatchWindow.cpp7
-rw-r--r--src/libs/gui/PatchCanvas.cpp3
-rw-r--r--src/libs/gui/ThreadedLoader.cpp6
-rw-r--r--src/libs/gui/UploadPatchWindow.cpp3
-rw-r--r--src/libs/gui/gui.cpp20
-rw-r--r--src/libs/gui/gui.hpp3
-rw-r--r--src/libs/module/Makefile.am2
-rw-r--r--src/libs/module/World.hpp58
-rw-r--r--src/libs/module/module.cpp50
-rw-r--r--src/libs/module/module.h39
23 files changed, 237 insertions, 85 deletions
diff --git a/src/libs/client/PluginModel.hpp b/src/libs/client/PluginModel.hpp
index f02528d1..63603687 100644
--- a/src/libs/client/PluginModel.hpp
+++ b/src/libs/client/PluginModel.hpp
@@ -103,7 +103,6 @@ public:
static void set_slv2_world(SLV2World world) {
_slv2_world = world;
- slv2_world_load_all(_slv2_world);
_slv2_plugins = slv2_world_get_all_plugins(_slv2_world);
}
diff --git a/src/libs/client/SigClientInterface.hpp b/src/libs/client/SigClientInterface.hpp
index f19f4a5e..58a3297a 100644
--- a/src/libs/client/SigClientInterface.hpp
+++ b/src/libs/client/SigClientInterface.hpp
@@ -41,7 +41,7 @@ class SigClientInterface : virtual public Ingen::Shared::ClientInterface, public
{
public:
- // Signal parameters math up directly with ClientInterface calls
+ // Signal parameters match up directly with ClientInterface calls
sigc::signal<void, int32_t, bool, string> response_sig;
sigc::signal<void> bundle_begin_sig;
diff --git a/src/libs/engine/Engine.cpp b/src/libs/engine/Engine.cpp
index 69f7ebe0..7b4c4f48 100644
--- a/src/libs/engine/Engine.cpp
+++ b/src/libs/engine/Engine.cpp
@@ -48,14 +48,15 @@ using namespace std;
namespace Ingen {
-Engine::Engine()
-: _midi_driver(NULL),
+Engine::Engine(Ingen::Shared::World* world)
+: _world(world),
+ _midi_driver(NULL),
_osc_driver(NULL),
_maid(new Raul::Maid(maid_queue_size)),
_post_processor(new PostProcessor(*_maid, post_processor_queue_size)),
_broadcaster(new ClientBroadcaster()),
_object_store(new ObjectStore()),
- _node_factory(new NodeFactory()),
+ _node_factory(new NodeFactory(world)),
/*#ifdef HAVE_LASH
_lash_driver(new LashDriver()),
#else */
diff --git a/src/libs/engine/Engine.hpp b/src/libs/engine/Engine.hpp
index b9780501..fc64e024 100644
--- a/src/libs/engine/Engine.hpp
+++ b/src/libs/engine/Engine.hpp
@@ -18,6 +18,9 @@
#ifndef ENGINE_H
#define ENGINE_H
+#include "../../../config/config.h"
+#include "module/module.h"
+
#include <cassert>
#include <boost/utility.hpp>
#include <raul/SharedPtr.hpp>
@@ -55,7 +58,8 @@ class Driver;
class Engine : boost::noncopyable
{
public:
- Engine();
+ Engine(Ingen::Shared::World* world);
+
virtual ~Engine();
virtual int main();
@@ -90,8 +94,13 @@ public:
/** Return the active driver for the given type */
Driver* driver(DataType type);
+
+ Ingen::Shared::World* world() { return _world; }
private:
+
+ Ingen::Shared::World* _world;
+
SharedPtr<EventSource> _event_source;
SharedPtr<AudioDriver> _audio_driver;
MidiDriver* _midi_driver;
diff --git a/src/libs/engine/NodeFactory.cpp b/src/libs/engine/NodeFactory.cpp
index 24221dd7..30e13ac2 100644
--- a/src/libs/engine/NodeFactory.cpp
+++ b/src/libs/engine/NodeFactory.cpp
@@ -32,7 +32,6 @@
#ifdef HAVE_SLV2
#include "LV2Node.hpp"
#include <slv2/slv2.h>
-#include <slv2/util.h> // old slv2 compat
#endif
#ifdef HAVE_LADSPA
#include "LADSPANode.hpp"
@@ -41,9 +40,7 @@
#include "DSSINode.hpp"
#endif
-using std::string;
-using std::cerr; using std::cout; using std::endl;
-
+using namespace std;
namespace Ingen {
@@ -54,14 +51,10 @@ namespace Ingen {
-NodeFactory::NodeFactory()
-: _has_loaded(false)
+NodeFactory::NodeFactory(Ingen::Shared::World* world)
+ : _world(world)
+ , _has_loaded(false)
{
-#ifdef HAVE_SLV2
- _world = slv2_world_new();
- slv2_world_load_all(_world);
-#endif
-
// Add builtin plugin types to _internal_plugins list
// FIXME: ewwww, definitely a better way to do this!
@@ -95,11 +88,6 @@ NodeFactory::~NodeFactory()
for (list<Glib::Module*>::iterator i = _libraries.begin(); i != _libraries.end(); ++i)
delete (*i);
_libraries.clear();
-
-#ifdef HAVE_SLV2
- slv2_world_free(_world);
-#endif
-
}
@@ -270,7 +258,7 @@ NodeFactory::load_internal_plugin(const string& uri,
void
NodeFactory::load_lv2_plugins()
{
- SLV2Plugins plugins = slv2_world_get_all_plugins(_world);
+ SLV2Plugins plugins = slv2_world_get_all_plugins(_world->slv2_world);
//cerr << "[NodeFactory] Found " << slv2_plugins_size(plugins) << " LV2 plugins:" << endl;
@@ -300,7 +288,10 @@ NodeFactory::load_lv2_plugins()
plug->module(NULL); // FIXME?
plug->lib_path(slv2_uri_to_path(slv2_plugin_get_library_uri(lv2_plug)));
char* name = slv2_plugin_get_name(lv2_plug);
- assert(name);
+ if (!name) {
+ cerr << "ERROR: LV2 Plugin " << uri << " has no name. Ignoring." << endl;
+ continue;
+ }
plug->name(name);
free(name);
@@ -308,7 +299,7 @@ NodeFactory::load_lv2_plugins()
_plugins.push_back(plug);
}
- slv2_plugins_free(_world, plugins);
+ slv2_plugins_free(_world->slv2_world, plugins);
}
diff --git a/src/libs/engine/NodeFactory.hpp b/src/libs/engine/NodeFactory.hpp
index 3b8eb711..184af94c 100644
--- a/src/libs/engine/NodeFactory.hpp
+++ b/src/libs/engine/NodeFactory.hpp
@@ -19,6 +19,7 @@
#define NODEFACTORY_H
#include "../../../../config/config.h"
+#include "module/module.h"
#include <list>
#include <string>
@@ -52,7 +53,7 @@ class Plugin;
class NodeFactory
{
public:
- NodeFactory();
+ NodeFactory(Ingen::Shared::World* world);
~NodeFactory();
void load_plugins();
@@ -72,8 +73,6 @@ private:
#ifdef HAVE_SLV2
void load_lv2_plugins();
Node* load_lv2_plugin(const string& plugin_uri, const string& name, size_t poly, Patch* parent, SampleRate srate, size_t buffer_size);
-
- SLV2World _world;
#endif
#ifdef HAVE_DSSI
@@ -87,6 +86,7 @@ private:
list<Plugin*> _internal_plugins;
list<Plugin*> _plugins; // FIXME: make a map
+ Ingen::Shared::World* _world;
bool _has_loaded;
};
diff --git a/src/libs/engine/QueuedEngineInterface.cpp b/src/libs/engine/QueuedEngineInterface.cpp
index a8906c97..68115d79 100644
--- a/src/libs/engine/QueuedEngineInterface.cpp
+++ b/src/libs/engine/QueuedEngineInterface.cpp
@@ -99,6 +99,7 @@ QueuedEngineInterface::load_plugins()
void
QueuedEngineInterface::activate()
{
+ QueuedEventSource::activate();
push_queued(new PingQueuedEvent(_engine, _responder, now()));
}
diff --git a/src/libs/engine/engine.cpp b/src/libs/engine/engine.cpp
index bc272663..53db86f8 100644
--- a/src/libs/engine/engine.cpp
+++ b/src/libs/engine/engine.cpp
@@ -15,6 +15,8 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "../../../../config/config.h"
+
#include <raul/Process.hpp>
#include "engine.hpp"
#include "Engine.hpp"
@@ -25,10 +27,10 @@
namespace Ingen {
Engine*
-new_engine()
+new_engine(Ingen::Shared::World* world)
{
set_denormal_flags();
- return new Engine();
+ return new Engine(world);
}
diff --git a/src/libs/engine/engine.hpp b/src/libs/engine/engine.hpp
index 940db440..93b426ac 100644
--- a/src/libs/engine/engine.hpp
+++ b/src/libs/engine/engine.hpp
@@ -18,20 +18,16 @@
#ifndef INGEN_ENGINE_H
#define INGEN_ENGINE_H
-#include <raul/SharedPtr.hpp>
-
namespace Ingen {
-class Engine;
-namespace Shared { class EngineInterface; }
+namespace Shared { class World; }
+class Engine;
extern "C" {
- //void run(int argc, char** argv);
-
/** Create a new engine in this process */
- Engine* new_engine();
+ Engine* new_engine(Ingen::Shared::World* world);
/** Launch an OSC engine as a completely separate process
* \return true if successful
diff --git a/src/libs/gui/App.cpp b/src/libs/gui/App.cpp
index acebf04e..7b1204d2 100644
--- a/src/libs/gui/App.cpp
+++ b/src/libs/gui/App.cpp
@@ -16,6 +16,7 @@
*/
#include "../../../config/config.h"
+#include "module/module.h"
#include "App.hpp"
#include <cassert>
#include <string>
@@ -44,6 +45,9 @@
/*#ifdef HAVE_LASH
#include "LashController.hpp"
#endif*/
+#ifdef HAVE_SLV2
+#include <slv2/slv2.h>
+#endif
using std::cerr; using std::cout; using std::endl;
using std::string;
namespace Ingen { namespace Client { class PluginModel; } }
@@ -59,10 +63,11 @@ class Port;
App* App::_instance = 0;
-App::App()
+App::App(Ingen::Shared::World* world)
: _configuration(new Configuration()),
_about_dialog(NULL),
_window_factory(new WindowFactory()),
+ _world(world),
_enable_signal(true)
{
Glib::RefPtr<Gnome::Glade::Xml> glade_xml = GladeFactory::new_glade_reference();
@@ -73,18 +78,19 @@ App::App()
glade_xml->get_widget_derived("config_win", _config_window);
glade_xml->get_widget("about_win", _about_dialog);
- _rdf_world.add_prefix("xsd", "http://www.w3.org/2001/XMLSchema#");
- _rdf_world.add_prefix("ingen", "http://drobilla.net/ns/ingen#");
- _rdf_world.add_prefix("ingenuity", "http://drobilla.net/ns/ingenuity#");
- _rdf_world.add_prefix("lv2", "http://lv2plug.in/ns/lv2core#");
- _rdf_world.add_prefix("rdfs", "http://www.w3.org/2000/01/rdf-schema#");
- _rdf_world.add_prefix("doap", "http://usefulinc.com/ns/doap#");
+ Raul::RDF::World& rdf_world = world->rdf_world;
+
+ rdf_world.add_prefix("xsd", "http://www.w3.org/2001/XMLSchema#");
+ rdf_world.add_prefix("ingen", "http://drobilla.net/ns/ingen#");
+ rdf_world.add_prefix("ingenuity", "http://drobilla.net/ns/ingenuity#");
+ rdf_world.add_prefix("lv2", "http://lv2plug.in/ns/lv2core#");
+ rdf_world.add_prefix("rdfs", "http://www.w3.org/2000/01/rdf-schema#");
+ rdf_world.add_prefix("doap", "http://usefulinc.com/ns/doap#");
_config_window->configuration(_configuration);
#ifdef HAVE_SLV2
- SLV2World slv2_world = slv2_world_new_using_rdf_world(_rdf_world.world());
- PluginModel::set_slv2_world(slv2_world);
+ PluginModel::set_slv2_world(world->slv2_world);
#endif
}
@@ -93,9 +99,9 @@ App::~App()
{
}
-
void
App::run(int argc, char** argv,
+ Ingen::Shared::World* world,
SharedPtr<Engine> engine,
SharedPtr<Shared::EngineInterface> interface)
{
@@ -103,7 +109,7 @@ App::run(int argc, char** argv,
Gtk::Main main(argc, argv);
if (!_instance)
- _instance = new App();
+ _instance = new App(world);
/* Load settings */
_instance->configuration()->load_settings();
diff --git a/src/libs/gui/App.hpp b/src/libs/gui/App.hpp
index 97bbb661..4ef36718 100644
--- a/src/libs/gui/App.hpp
+++ b/src/libs/gui/App.hpp
@@ -28,13 +28,14 @@
#include <libglademm.h>
#include <raul/RDFWorld.hpp>
#include <raul/SharedPtr.hpp>
-using std::string; using std::map; using std::list;
-using std::cerr; using std::endl;
+
+using namespace std;
namespace Ingen {
class Engine;
namespace Shared {
class EngineInterface;
+ class World;
}
namespace Client {
class PatchModel;
@@ -92,8 +93,6 @@ public:
Configuration* configuration() const { return _configuration; }
WindowFactory* window_factory() const { return _window_factory; }
- Raul::RDF::World* rdf_world() { return &_rdf_world; }
-
const SharedPtr<EngineInterface>& engine() const { return _engine; }
const SharedPtr<SigClientInterface>& client() const { return _client; }
const SharedPtr<Store>& store() const { return _store; }
@@ -102,15 +101,17 @@ public:
static inline App& instance() { assert(_instance); return *_instance; }
static void run(int argc, char** argv,
+ Ingen::Shared::World* world,
SharedPtr<Ingen::Engine> engine,
SharedPtr<Shared::EngineInterface> interface);
+ Ingen::Shared::World* world() { return _world; }
+
protected:
- App();
+ App(Ingen::Shared::World* world);
+
static App* _instance;
- static void instantiate(int argc, char** argv);
-
SharedPtr<EngineInterface> _engine;
SharedPtr<SigClientInterface> _client;
SharedPtr<Store> _store;
@@ -125,7 +126,7 @@ protected:
Gtk::Dialog* _about_dialog;
WindowFactory* _window_factory;
- Raul::RDF::World _rdf_world;
+ Ingen::Shared::World* _world;
/** Used to avoid feedback loops with (eg) process checkbutton
* FIXME: Maybe this should be globally implemented at the Controller level,
diff --git a/src/libs/gui/ConnectWindow.cpp b/src/libs/gui/ConnectWindow.cpp
index 86660d40..ca9dbbbc 100644
--- a/src/libs/gui/ConnectWindow.cpp
+++ b/src/libs/gui/ConnectWindow.cpp
@@ -229,7 +229,7 @@ ConnectWindow::connect()
} else if (_mode == INTERNAL) {
assert(_new_engine);
- SharedPtr<Ingen::Engine> engine(_new_engine());
+ SharedPtr<Ingen::Engine> engine(_new_engine(App::instance().world()));
engine->start_jack_driver();
@@ -371,7 +371,8 @@ ConnectWindow::gtk_callback()
//App::instance().engine()->register_client(App::instance().engine()->client_hooks());
// FIXME
//auto_ptr<ClientInterface> client(new ThreadedSigClientInterface();
- App::instance().engine()->register_client("FIXME_CLIENT_URI", App::instance().client());
+ // FIXME: client URI
+ App::instance().engine()->register_client("", App::instance().client());
App::instance().engine()->load_plugins();
++_connect_stage;
} else if (_connect_stage == 3) {
diff --git a/src/libs/gui/ConnectWindow.hpp b/src/libs/gui/ConnectWindow.hpp
index 5a0e67ad..fe26d549 100644
--- a/src/libs/gui/ConnectWindow.hpp
+++ b/src/libs/gui/ConnectWindow.hpp
@@ -18,6 +18,12 @@
#ifndef CONNECT_WINDOW_H
#define CONNECT_WINDOW_H
+#include "../../../config/config.h"
+
+#ifdef HAVE_SLV2
+#include <slv2/slv2.h>
+#endif
+
#include <gtkmm.h>
#include <libglademm/xml.h>
#include <libglademm.h>
@@ -70,7 +76,7 @@ private:
int _connect_stage;
SharedPtr<Glib::Module> _engine_module;
- Ingen::Engine* (*_new_engine)();
+ Ingen::Engine* (*_new_engine)(Ingen::Shared::World* world);
Gtk::Image* _icon;
Gtk::ProgressBar* _progress_bar;
diff --git a/src/libs/gui/LoadRemotePatchWindow.cpp b/src/libs/gui/LoadRemotePatchWindow.cpp
index 096f6d61..77a03386 100644
--- a/src/libs/gui/LoadRemotePatchWindow.cpp
+++ b/src/libs/gui/LoadRemotePatchWindow.cpp
@@ -15,6 +15,7 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "module/module.h"
#include "LoadRemotePatchWindow.hpp"
#include <sys/types.h>
#include <dirent.h>
@@ -65,17 +66,17 @@ LoadRemotePatchWindow::present(SharedPtr<PatchModel> patch, MetadataMap data)
set_patch(patch);
_initial_data = data;
- RDF::Model model(*App::instance().rdf_world(),
+ RDF::Model model(App::instance().world()->rdf_world,
"http://rdf.drobilla.net/ingen_patches/index.ttl",
"http://rdf.drobilla.net/ingen_patches/");
- RDF::Query query(*App::instance().rdf_world(), Glib::ustring(
+ RDF::Query query(App::instance().world()->rdf_world, Glib::ustring(
"SELECT DISTINCT ?name ?uri WHERE {"
" ?uri a ingen:Patch ;"
" doap:name ?name ."
"}"));
- RDF::Query::Results results = query.run(*App::instance().rdf_world(), model);
+ RDF::Query::Results results = query.run(App::instance().world()->rdf_world, model);
for (RDF::Query::Results::iterator i = results.begin(); i != results.end(); ++i) {
Gtk::TreeModel::iterator iter = _liststore->append();
diff --git a/src/libs/gui/PatchCanvas.cpp b/src/libs/gui/PatchCanvas.cpp
index ba7a58ce..8f6b53e9 100644
--- a/src/libs/gui/PatchCanvas.cpp
+++ b/src/libs/gui/PatchCanvas.cpp
@@ -16,6 +16,7 @@
*/
#include "../../../../config/config.h"
+#include "module/module.h"
#include <cassert>
#include <flowcanvas/Canvas.hpp>
@@ -425,7 +426,7 @@ PatchCanvas::destroy_selection()
void
PatchCanvas::copy_selection()
{
- Serializer serializer(*App::instance().rdf_world());
+ Serializer serializer(App::instance().world()->rdf_world);
serializer.start_to_string();
for (list<boost::shared_ptr<Item> >::iterator m = _selected_items.begin(); m != _selected_items.end(); ++m) {
diff --git a/src/libs/gui/ThreadedLoader.cpp b/src/libs/gui/ThreadedLoader.cpp
index 653f18b0..63c5bf3c 100644
--- a/src/libs/gui/ThreadedLoader.cpp
+++ b/src/libs/gui/ThreadedLoader.cpp
@@ -19,7 +19,7 @@
#include <cassert>
#include <string>
#include "client/PatchModel.hpp"
-#include "module/Module.hpp"
+#include "module/module.h"
#include "App.hpp"
#include "ThreadedLoader.hpp"
using std::cout; using std::endl;
@@ -32,7 +32,7 @@ ThreadedLoader::ThreadedLoader(SharedPtr<EngineInterface> engine)
: _serialisation_module(Ingen::Shared::load_module("ingen_serialisation"))
, _engine(engine)
, _deprecated_loader(engine)
- , _serializer(*App::instance().rdf_world())
+ , _serializer(App::instance().world()->rdf_world)
{
set_name("Loader");
@@ -97,7 +97,7 @@ ThreadedLoader::load_patch(bool merge,
_events.push_back(sigc::hide_return(sigc::bind(
sigc::mem_fun(_loader.get(), &Ingen::Serialisation::Loader::load),
App::instance().engine(),
- App::instance().rdf_world(),
+ &App::instance().world()->rdf_world,
data_base_uri,
engine_parent,
(engine_name) ? engine_name.get() : "",
diff --git a/src/libs/gui/UploadPatchWindow.cpp b/src/libs/gui/UploadPatchWindow.cpp
index 46be0987..aec4d8e6 100644
--- a/src/libs/gui/UploadPatchWindow.cpp
+++ b/src/libs/gui/UploadPatchWindow.cpp
@@ -22,6 +22,7 @@
#include <boost/optional/optional.hpp>
#include <curl/curl.h>
#include <raul/RDFQuery.hpp>
+#include "module/module.h"
#include "interface/EngineInterface.hpp"
#include "client/Serializer.hpp"
#include "client/PatchModel.hpp"
@@ -247,7 +248,7 @@ UploadPatchWindow::upload_clicked()
_upload_progress->set_fraction(0.0);
_upload_progress->set_text("");
- Serializer s(*App::instance().rdf_world());
+ Serializer s(App::instance().world()->rdf_world);
s.start_to_string();
s.serialize(_patch);
const string str = s.finish();
diff --git a/src/libs/gui/gui.cpp b/src/libs/gui/gui.cpp
index 689adf62..ca160e00 100644
--- a/src/libs/gui/gui.cpp
+++ b/src/libs/gui/gui.cpp
@@ -25,27 +25,11 @@ namespace GUI {
void run(int argc, char** argv,
+ Ingen::Shared::World* world,
SharedPtr<Ingen::Engine> engine,
SharedPtr<Shared::EngineInterface> interface)
{
- App::run(argc, argv, engine, interface);
-#if 0
- Gnome::Canvas::init();
- Gtk::Main gtk_main(argc, argv);
- Gtk::Window::set_default_icon_from_file(PKGDATADIR "/ingen.svg");
-
- /* Instantiate singleton (bad, FIXME) */
- App::instantiate(argc, argv);
-
- /* Load settings */
- App::instance().configuration()->load_settings();
- App::instance().configuration()->apply_settings();
-
- App::instance().connect_window()->start();
- gtk_main.run();
-
- return 0;
-#endif
+ App::run(argc, argv, world, engine, interface);
}
diff --git a/src/libs/gui/gui.hpp b/src/libs/gui/gui.hpp
index 992aa9d4..d99e4091 100644
--- a/src/libs/gui/gui.hpp
+++ b/src/libs/gui/gui.hpp
@@ -18,6 +18,8 @@
#ifndef INGEN_GUI_H
#define INGEN_GUI_H
+#include "../../../config/config.h"
+#include "module/module.h"
#include <raul/SharedPtr.hpp>
namespace Ingen {
@@ -32,6 +34,7 @@ namespace GUI {
extern "C" {
void run(int argc, char** argv,
+ Ingen::Shared::World* world,
SharedPtr<Ingen::Engine> engine,
SharedPtr<Shared::EngineInterface> interface);
diff --git a/src/libs/module/Makefile.am b/src/libs/module/Makefile.am
index bcd2ea4f..7f5865db 100644
--- a/src/libs/module/Makefile.am
+++ b/src/libs/module/Makefile.am
@@ -5,5 +5,7 @@ libingen_module_la_CXXFLAGS = -I$(top_srcdir)/raul -DINGEN_MODULE_DIR=\"$(libdir
libingen_module_la_LIBADD = @RAUL_LIBS@ @GLIBMM_LIBS@
libingen_module_la_SOURCES = \
+ module.h \
+ module.cpp \
Module.hpp \
Module.cpp
diff --git a/src/libs/module/World.hpp b/src/libs/module/World.hpp
new file mode 100644
index 00000000..c809080b
--- /dev/null
+++ b/src/libs/module/World.hpp
@@ -0,0 +1,58 @@
+/* This file is part of Ingen.
+ * Copyright (C) 2007 Dave Robillard <http://drobilla.net>
+ *
+ * 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_WORLD_HPP
+#define INGEN_WORLD_HPP
+
+#include <string>
+#include <glibmm/module.h>
+#include <raul/SharedPtr.hpp>
+#include <raul/RDFWorld.hpp>
+
+#include "../../../../config/config.h"
+
+#ifdef HAVE_SLV2
+#include <slv2/slv2.h>
+#endif
+
+namespace Ingen {
+namespace Shared {
+
+
+/** The "world" all Ingen modules may share.
+ *
+ * This is required for shared access to things like Redland, so locking can
+ * take place centrally and the engine/gui using the same library won't
+ * explode horribly.
+ *
+ * Hopefully at some point in the future it can allow some fun things like
+ * scripting bindings that play with all loaded components of
+ * The Ingen System(TM) and whatnot.
+ */
+struct World {
+#ifdef HAVE_SLV2
+ SLV2World slv2_world;
+#endif
+ Raul::RDF::World rdf_world;
+};
+
+
+} // namespace Shared
+} // namespace Ingen
+
+#endif // INGEN_WORLD_HPP
+
diff --git a/src/libs/module/module.cpp b/src/libs/module/module.cpp
new file mode 100644
index 00000000..25c68c67
--- /dev/null
+++ b/src/libs/module/module.cpp
@@ -0,0 +1,50 @@
+/* This file is part of Ingen.
+ * Copyright (C) 2007 Dave Robillard <http://drobilla.net>
+ *
+ * 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 "module.h"
+#include "World.hpp"
+
+namespace Ingen {
+namespace Shared {
+
+World* world;
+
+World*
+get_world()
+{
+ if (!world) {
+ world = new World();
+#ifdef HAVE_SLV2
+ world->slv2_world = slv2_world_new_using_rdf_world(world->rdf_world.world());
+ slv2_world_load_all(world->slv2_world);
+#endif
+ }
+
+ return world;
+}
+
+void
+destroy_world()
+{
+ slv2_world_free(world->slv2_world);
+ delete world;
+}
+
+
+} // namesace Shared
+} // namespace Ingen
+
diff --git a/src/libs/module/module.h b/src/libs/module/module.h
new file mode 100644
index 00000000..6c809f7e
--- /dev/null
+++ b/src/libs/module/module.h
@@ -0,0 +1,39 @@
+/* This file is part of Ingen.
+ * Copyright (C) 2007 Dave Robillard <http://drobilla.net>
+ *
+ * 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_MODULE_H
+#define INGEN_MODULE_H
+
+#include "World.hpp"
+#include "Module.hpp"
+
+namespace Ingen {
+namespace Shared {
+
+extern "C" {
+
+ World* get_world();
+ void destroy_world();
+
+}
+
+
+} // namesace Shared
+} // namespace Ingen
+
+#endif // INGEN_MODULE_H
+