summaryrefslogtreecommitdiffstats
path: root/src/libs/engine
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-07-25 06:07:42 +0000
committerDavid Robillard <d@drobilla.net>2007-07-25 06:07:42 +0000
commit75911e8ae28f011727ce303961a1adb56643689d (patch)
treeed83fcfc6bf11a6c5d48ef2337f7458fe29ea7a3 /src/libs/engine
parent68861e30d860010424112ebaacf960a7839a009a (diff)
downloadingen-75911e8ae28f011727ce303961a1adb56643689d.tar.gz
ingen-75911e8ae28f011727ce303961a1adb56643689d.tar.bz2
ingen-75911e8ae28f011727ce303961a1adb56643689d.zip
Fix running with ingen -eg.
Start basic framework of an Ingen "Core" system/library (in module library for now). git-svn-id: http://svn.drobilla.net/lad/ingen@624 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/engine')
-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
7 files changed, 35 insertions, 35 deletions
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