summaryrefslogtreecommitdiffstats
path: root/src/libs/engine
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs/engine')
-rw-r--r--src/libs/engine/ClientBroadcaster.h2
-rw-r--r--src/libs/engine/DirectResponder.h2
-rw-r--r--src/libs/engine/Driver.h2
-rw-r--r--src/libs/engine/Engine.cpp33
-rw-r--r--src/libs/engine/Engine.h18
-rw-r--r--src/libs/engine/Event.h2
-rw-r--r--src/libs/engine/GraphObject.h4
-rw-r--r--src/libs/engine/Makefile.am24
-rw-r--r--src/libs/engine/OSCClientSender.cpp2
-rw-r--r--src/libs/engine/OSCEngineReceiver.cpp16
-rw-r--r--src/libs/engine/OSCEngineReceiver.h4
-rw-r--r--src/libs/engine/ObjectStore.h2
-rw-r--r--src/libs/engine/PostProcessor.h4
-rw-r--r--src/libs/engine/QueuedEngineInterface.cpp66
-rw-r--r--src/libs/engine/QueuedEngineInterface.h6
-rw-r--r--src/libs/engine/QueuedEventSource.h6
-rw-r--r--src/libs/engine/Responder.h2
-rw-r--r--src/libs/engine/ThreadManager.h2
-rw-r--r--src/libs/engine/engine.cpp42
-rw-r--r--src/libs/engine/engine.h38
-rw-r--r--src/libs/engine/events/AddNodeEvent.cpp4
-rw-r--r--src/libs/engine/events/AddNodeEvent.h2
-rw-r--r--src/libs/engine/events/AddPortEvent.cpp4
-rw-r--r--src/libs/engine/events/ConnectionEvent.h2
-rw-r--r--src/libs/engine/events/CreatePatchEvent.cpp2
-rw-r--r--src/libs/engine/events/DestroyEvent.cpp2
-rw-r--r--src/libs/engine/events/DisconnectNodeEvent.cpp2
-rw-r--r--src/libs/engine/events/DisconnectPortEvent.h2
-rw-r--r--src/libs/engine/events/RenameEvent.cpp2
-rw-r--r--src/libs/engine/events/RequestMetadataEvent.h2
-rw-r--r--src/libs/engine/events/SetMetadataEvent.h2
31 files changed, 206 insertions, 97 deletions
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 <pthread.h>
#include "types.h"
#include "interface/ClientInterface.h"
-#include "raul/SharedPtr.h"
+#include <raul/SharedPtr.h>
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 <raul/SharedPtr.h>
#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 <string>
#include <boost/utility.hpp>
-#include "raul/Path.h"
+#include <raul/Path.h>
#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<AudioDriver>(new JackAudioDriver(*this));
+}
+
+
+void
+Engine::start_osc_driver(const std::string& port)
+{
+ _event_source = SharedPtr<EventSource>(new OSCEngineReceiver(
+ *this, pre_processor_queue_size, port.c_str()));
+}
+
+
+void
+Engine::set_event_source(SharedPtr<EventSource> source)
+{
+ _event_source = source;
+}
+
+
bool
-Engine::activate(SharedPtr<AudioDriver> ad, SharedPtr<EventSource> 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<AudioDriver> ad, SharedPtr<EventSource> 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<EventSource> source);
- bool activate(SharedPtr<AudioDriver> ad, SharedPtr<EventSource> 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 <cassert>
-#include "raul/SharedPtr.h"
+#include <raul/SharedPtr.h>
#include "types.h"
#include <raul/Deletable.h>
#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 <cstddef>
#include <cassert>
#include <raul/Deletable.h>
-#include "raul/Path.h"
-#include "raul/Atom.h"
+#include <raul/Path.h>
+#include <raul/Atom.h>
#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 <raul/AtomLiblo.h>
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 <iostream>
#include <cstdlib>
#include <string>
#include <lo/lo.h>
#include "types.h"
-#include "raul/SharedPtr.h"
-#include "raul/AtomLiblo.h"
-#include "QueuedEventSource.h"
+#include <raul/SharedPtr.h>
+#include <raul/AtomLiblo.h>
#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> 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<OSCResponder>(
- 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<OSCResponder>(new OSCResponder(me->_engine->broadcaster(), id, url));
+ me->_osc_responder = SharedPtr<OSCResponder>(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<ClientInterface> client = me->_engine->broadcaster()->client(
+ SharedPtr<ClientInterface> 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 <string>
#include <lo/lo.h>
-#include "raul/SharedPtr.h"
+#include <raul/SharedPtr.h>
#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> 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 <string>
-#include "raul/Path.h"
+#include <raul/Path.h>
#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 <pthread.h>
#include "types.h"
-#include "raul/SRSWQueue.h"
-#include "raul/Slave.h"
+#include <raul/SRSWQueue.h>
+#include <raul/Slave.h>
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> 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<Responder>(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<ClientInterface> 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 <inttypes.h>
#include <string>
#include <memory>
-#include "raul/SharedPtr.h"
+#include <raul/SharedPtr.h>
#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> 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> _responder;
- SharedPtr<Engine> _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 <cstdlib>
#include <pthread.h>
#include "types.h"
-#include "raul/Semaphore.h"
-#include "raul/SRSWQueue.h"
-#include "raul/Slave.h"
+#include <raul/Semaphore.h>
+#include <raul/SRSWQueue.h>
+#include <raul/Slave.h>
#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 <inttypes.h>
#include <string>
-#include "raul/SharedPtr.h"
+#include <raul/SharedPtr.h>
#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 <raul/Thread.h>
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 <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 "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 <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_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 <raul/Maid.h>
-#include "raul/Path.h"
+#include <raul/Path.h>
#include "ObjectStore.h"
-#include "raul/Path.h"
+#include <raul/Path.h>
#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 <raul/Path.h>
#include <string>
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 <raul/Maid.h>
-#include "raul/Path.h"
+#include <raul/Path.h>
#include "QueuedEventSource.h"
#include "ObjectStore.h"
#include "ClientBroadcaster.h"
-#include "raul/Path.h"
+#include <raul/Path.h>
#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 <string>
#include "QueuedEvent.h"
-#include "raul/Path.h"
+#include <raul/Path.h>
#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 <raul/Maid.h>
#include "ClientBroadcaster.h"
#include "AudioDriver.h"
-#include "raul/Path.h"
+#include <raul/Path.h>
#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 <raul/Maid.h>
#include "ObjectStore.h"
-#include "raul/Path.h"
+#include <raul/Path.h>
#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 <raul/Path.h>
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 <string>
-#include "raul/Path.h"
+#include <raul/Path.h>
#include "QueuedEvent.h"
#include <raul/List.h>
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 <raul/Path.h>
#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 <string>
#include "QueuedEvent.h"
-#include "raul/Atom.h"
+#include <raul/Atom.h>
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 <string>
#include "QueuedEvent.h"
-#include "raul/Atom.h"
+#include <raul/Atom.h>
using std::string;