summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/engine/Engine.cpp6
-rw-r--r--src/engine/EventSource.hpp3
-rw-r--r--src/engine/HTTPEngineReceiver.cpp21
-rw-r--r--src/engine/HTTPEngineReceiver.hpp3
-rw-r--r--src/engine/OSCEngineReceiver.cpp23
-rw-r--r--src/engine/OSCEngineReceiver.hpp3
-rw-r--r--src/engine/QueuedEngineInterface.cpp15
-rw-r--r--src/engine/QueuedEngineInterface.hpp2
8 files changed, 18 insertions, 58 deletions
diff --git a/src/engine/Engine.cpp b/src/engine/Engine.cpp
index 72f04f69..31f4fc2a 100644
--- a/src/engine/Engine.cpp
+++ b/src/engine/Engine.cpp
@@ -141,9 +141,6 @@ Engine::activate()
_message_context->Thread::start();
- for (EventSources::iterator i = _event_sources.begin(); i != _event_sources.end(); ++i)
- (*i)->activate_source();
-
const Ingen::Shared::LV2URIMap& uris = *world()->uris().get();
// Create root patch
@@ -204,9 +201,6 @@ Engine::activate()
void
Engine::deactivate()
{
- for (EventSources::iterator i = _event_sources.begin(); i != _event_sources.end(); ++i)
- (*i)->deactivate_source();
-
_driver->deactivate();
_driver->root_patch()->deactivate();
diff --git a/src/engine/EventSource.hpp b/src/engine/EventSource.hpp
index e05b3500..52bb08f6 100644
--- a/src/engine/EventSource.hpp
+++ b/src/engine/EventSource.hpp
@@ -42,9 +42,6 @@ public:
explicit EventSource(size_t queue_size);
virtual ~EventSource();
- virtual void activate_source() { Slave::start(); }
- virtual void deactivate_source() { Slave::stop(); }
-
void process(PostProcessor& dest, ProcessContext& context, bool limit=true);
bool empty() { return _events.empty(); }
diff --git a/src/engine/HTTPEngineReceiver.cpp b/src/engine/HTTPEngineReceiver.cpp
index 9ee54319..00d6a629 100644
--- a/src/engine/HTTPEngineReceiver.cpp
+++ b/src/engine/HTTPEngineReceiver.cpp
@@ -64,13 +64,15 @@ HTTPEngineReceiver::HTTPEngineReceiver(Engine& engine, uint16_t port)
engine.world()->load_module("ingen_serialisation");
Thread::set_name("HTTPEngineReceiver");
+ start();
+ _receive_thread->set_name("HTTPEngineReceiver Listener");
+ _receive_thread->start();
}
HTTPEngineReceiver::~HTTPEngineReceiver()
{
- deactivate();
- stop();
_receive_thread->stop();
+ stop();
delete _receive_thread;
if (_server) {
@@ -80,21 +82,6 @@ HTTPEngineReceiver::~HTTPEngineReceiver()
}
void
-HTTPEngineReceiver::activate_source()
-{
- EventSource::activate_source();
- _receive_thread->set_name("HTTPEngineReceiver Listener");
- _receive_thread->start();
-}
-
-void
-HTTPEngineReceiver::deactivate_source()
-{
- _receive_thread->stop();
- EventSource::deactivate_source();
-}
-
-void
HTTPEngineReceiver::message_callback(SoupServer* server,
SoupMessage* msg,
const char* path_str,
diff --git a/src/engine/HTTPEngineReceiver.hpp b/src/engine/HTTPEngineReceiver.hpp
index 0c6bcfd7..0241270a 100644
--- a/src/engine/HTTPEngineReceiver.hpp
+++ b/src/engine/HTTPEngineReceiver.hpp
@@ -37,9 +37,6 @@ public:
HTTPEngineReceiver(Engine& engine, uint16_t port);
~HTTPEngineReceiver();
- void activate_source();
- void deactivate_source();
-
private:
struct ReceiveThread : public Raul::Thread {
explicit ReceiveThread(HTTPEngineReceiver& receiver) : _receiver(receiver) {}
diff --git a/src/engine/OSCEngineReceiver.cpp b/src/engine/OSCEngineReceiver.cpp
index a957d863..bf03b29d 100644
--- a/src/engine/OSCEngineReceiver.cpp
+++ b/src/engine/OSCEngineReceiver.cpp
@@ -118,13 +118,16 @@ OSCEngineReceiver::OSCEngineReceiver(Engine& engine, size_t queue_size, uint16_t
lo_server_add_method(_server, NULL, NULL, unknown_cb, NULL);
Thread::set_name("OSCEngineReceiver");
+ start();
+ _receive_thread->set_name("OSCEngineReceiver Listener");
+ _receive_thread->start();
+ _receive_thread->set_scheduling(SCHED_FIFO, 5);
}
OSCEngineReceiver::~OSCEngineReceiver()
{
- deactivate();
- stop();
_receive_thread->stop();
+ stop();
delete _receive_thread;
if (_server != NULL) {
@@ -136,22 +139,6 @@ OSCEngineReceiver::~OSCEngineReceiver()
}
}
-void
-OSCEngineReceiver::activate_source()
-{
- EventSource::activate_source();
- _receive_thread->set_name("OSCEngineReceiver Listener");
- _receive_thread->start();
- _receive_thread->set_scheduling(SCHED_FIFO, 5); // Jack default appears to be 10
-}
-
-void
-OSCEngineReceiver::deactivate_source()
-{
- _receive_thread->stop();
- EventSource::deactivate_source();
-}
-
/** Override the semaphore driven _run method of QueuedEngineInterface
* to wait on OSC messages and prepare them right away in the same thread.
*/
diff --git a/src/engine/OSCEngineReceiver.hpp b/src/engine/OSCEngineReceiver.hpp
index a94ca396..e32cd4ae 100644
--- a/src/engine/OSCEngineReceiver.hpp
+++ b/src/engine/OSCEngineReceiver.hpp
@@ -60,9 +60,6 @@ public:
OSCEngineReceiver(Engine& engine, size_t queue_size, uint16_t port);
~OSCEngineReceiver();
- void activate_source();
- void deactivate_source();
-
private:
struct ReceiveThread : public Raul::Thread {
explicit ReceiveThread(OSCEngineReceiver& receiver) : _receiver(receiver) {}
diff --git a/src/engine/QueuedEngineInterface.cpp b/src/engine/QueuedEngineInterface.cpp
index ba48b5c5..210c6374 100644
--- a/src/engine/QueuedEngineInterface.cpp
+++ b/src/engine/QueuedEngineInterface.cpp
@@ -40,6 +40,13 @@ QueuedEngineInterface::QueuedEngineInterface(Engine& engine, size_t queue_size)
, _engine(engine)
, _in_bundle(false)
{
+ start();
+}
+
+
+QueuedEngineInterface::~QueuedEngineInterface()
+{
+ stop();
}
SampleCount
@@ -96,14 +103,8 @@ QueuedEngineInterface::unregister_client(const URI& uri)
void
QueuedEngineInterface::activate()
{
- static bool in_activate = false;
- if (!in_activate) {
- in_activate = true;
- _engine.activate();
- }
- EventSource::activate_source();
+ _engine.activate();
push_queued(new Events::Ping(_engine, _request, now()));
- in_activate = false;
}
void
diff --git a/src/engine/QueuedEngineInterface.hpp b/src/engine/QueuedEngineInterface.hpp
index e4338dbc..8dbb1548 100644
--- a/src/engine/QueuedEngineInterface.hpp
+++ b/src/engine/QueuedEngineInterface.hpp
@@ -50,7 +50,7 @@ class QueuedEngineInterface : public EventSource,
{
public:
QueuedEngineInterface(Engine& engine, size_t queue_size);
- virtual ~QueuedEngineInterface() {}
+ virtual ~QueuedEngineInterface();
Raul::URI uri() const { return "http://drobilla.net/ns/ingen#internal"; }