summaryrefslogtreecommitdiffstats
path: root/src/libs/engine/events
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2006-09-08 03:58:00 +0000
committerDavid Robillard <d@drobilla.net>2006-09-08 03:58:00 +0000
commit48f87f1f1649fb7e169fdaac2cd38370e8a4a1fa (patch)
tree9da4b4b075791ac1ec78b499dbcbec6101f54690 /src/libs/engine/events
parentacbe9a26ec3ab689e430225d15e95e73a7378aa9 (diff)
downloadingen-48f87f1f1649fb7e169fdaac2cd38370e8a4a1fa.tar.gz
ingen-48f87f1f1649fb7e169fdaac2cd38370e8a4a1fa.tar.bz2
ingen-48f87f1f1649fb7e169fdaac2cd38370e8a4a1fa.zip
De-singleton-ified Engine
Slight rework of Responder/ClientKey/ClientInterface for Requests git-svn-id: http://svn.drobilla.net/lad/ingen@119 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/engine/events')
-rw-r--r--src/libs/engine/events/ActivateEvent.cpp6
-rw-r--r--src/libs/engine/events/ActivateEvent.h2
-rw-r--r--src/libs/engine/events/AddNodeEvent.cpp26
-rw-r--r--src/libs/engine/events/AddNodeEvent.h4
-rw-r--r--src/libs/engine/events/AddPortEvent.cpp24
-rw-r--r--src/libs/engine/events/AddPortEvent.h4
-rw-r--r--src/libs/engine/events/AllNotesOffEvent.cpp12
-rw-r--r--src/libs/engine/events/AllNotesOffEvent.h6
-rw-r--r--src/libs/engine/events/ClearPatchEvent.cpp23
-rw-r--r--src/libs/engine/events/ClearPatchEvent.h4
-rw-r--r--src/libs/engine/events/ConnectionEvent.cpp32
-rw-r--r--src/libs/engine/events/ConnectionEvent.h8
-rw-r--r--src/libs/engine/events/CreatePatchEvent.cpp26
-rw-r--r--src/libs/engine/events/CreatePatchEvent.h4
-rw-r--r--src/libs/engine/events/DSSIConfigureEvent.cpp10
-rw-r--r--src/libs/engine/events/DSSIConfigureEvent.h4
-rw-r--r--src/libs/engine/events/DSSIControlEvent.cpp8
-rw-r--r--src/libs/engine/events/DSSIControlEvent.h4
-rw-r--r--src/libs/engine/events/DSSIProgramEvent.cpp10
-rw-r--r--src/libs/engine/events/DSSIProgramEvent.h4
-rw-r--r--src/libs/engine/events/DSSIUpdateEvent.cpp10
-rw-r--r--src/libs/engine/events/DSSIUpdateEvent.h4
-rw-r--r--src/libs/engine/events/DeactivateEvent.cpp10
-rw-r--r--src/libs/engine/events/DeactivateEvent.h4
-rw-r--r--src/libs/engine/events/DestroyEvent.cpp32
-rw-r--r--src/libs/engine/events/DestroyEvent.h6
-rw-r--r--src/libs/engine/events/DisablePatchEvent.cpp14
-rw-r--r--src/libs/engine/events/DisablePatchEvent.h4
-rw-r--r--src/libs/engine/events/DisconnectNodeEvent.cpp20
-rw-r--r--src/libs/engine/events/DisconnectNodeEvent.h6
-rw-r--r--src/libs/engine/events/DisconnectPortEvent.cpp22
-rw-r--r--src/libs/engine/events/DisconnectPortEvent.h6
-rw-r--r--src/libs/engine/events/DisconnectionEvent.cpp44
-rw-r--r--src/libs/engine/events/DisconnectionEvent.h10
-rw-r--r--src/libs/engine/events/EnablePatchEvent.cpp14
-rw-r--r--src/libs/engine/events/EnablePatchEvent.h4
-rw-r--r--src/libs/engine/events/LashRestoreDoneEvent.h2
-rw-r--r--src/libs/engine/events/LoadPluginsEvent.cpp6
-rw-r--r--src/libs/engine/events/LoadPluginsEvent.h2
-rw-r--r--src/libs/engine/events/MidiLearnEvent.cpp14
-rw-r--r--src/libs/engine/events/MidiLearnEvent.h8
-rw-r--r--src/libs/engine/events/NoteOffEvent.cpp18
-rw-r--r--src/libs/engine/events/NoteOffEvent.h6
-rw-r--r--src/libs/engine/events/NoteOnEvent.cpp18
-rw-r--r--src/libs/engine/events/NoteOnEvent.h6
-rw-r--r--src/libs/engine/events/PingQueuedEvent.h2
-rw-r--r--src/libs/engine/events/RegisterClientEvent.cpp6
-rw-r--r--src/libs/engine/events/RegisterClientEvent.h2
-rw-r--r--src/libs/engine/events/RenameEvent.cpp14
-rw-r--r--src/libs/engine/events/RenameEvent.h4
-rw-r--r--src/libs/engine/events/RequestAllObjectsEvent.cpp17
-rw-r--r--src/libs/engine/events/RequestAllObjectsEvent.h2
-rw-r--r--src/libs/engine/events/RequestMetadataEvent.cpp8
-rw-r--r--src/libs/engine/events/RequestMetadataEvent.h2
-rw-r--r--src/libs/engine/events/RequestPluginsEvent.cpp15
-rw-r--r--src/libs/engine/events/RequestPluginsEvent.h5
-rw-r--r--src/libs/engine/events/RequestPortValueEvent.cpp18
-rw-r--r--src/libs/engine/events/RequestPortValueEvent.h4
-rw-r--r--src/libs/engine/events/SetMetadataEvent.cpp12
-rw-r--r--src/libs/engine/events/SetMetadataEvent.h4
-rw-r--r--src/libs/engine/events/SetPortValueEvent.cpp22
-rw-r--r--src/libs/engine/events/SetPortValueEvent.h6
-rw-r--r--src/libs/engine/events/SetPortValueQueuedEvent.cpp24
-rw-r--r--src/libs/engine/events/SetPortValueQueuedEvent.h6
-rw-r--r--src/libs/engine/events/UnregisterClientEvent.cpp6
-rw-r--r--src/libs/engine/events/UnregisterClientEvent.h2
66 files changed, 360 insertions, 332 deletions
diff --git a/src/libs/engine/events/ActivateEvent.cpp b/src/libs/engine/events/ActivateEvent.cpp
index 31a218ad..9d8162ec 100644
--- a/src/libs/engine/events/ActivateEvent.cpp
+++ b/src/libs/engine/events/ActivateEvent.cpp
@@ -21,8 +21,8 @@
namespace Ingen {
-ActivateEvent::ActivateEvent(CountedPtr<Responder> responder, SampleCount timestamp)
-: QueuedEvent(responder, timestamp)
+ActivateEvent::ActivateEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp)
+: QueuedEvent(engine, responder, timestamp)
{
}
@@ -32,7 +32,7 @@ ActivateEvent::pre_process()
{
QueuedEvent::pre_process();
- Engine::instance().activate();
+ _engine.activate();
}
diff --git a/src/libs/engine/events/ActivateEvent.h b/src/libs/engine/events/ActivateEvent.h
index de47ddf3..26ee5b84 100644
--- a/src/libs/engine/events/ActivateEvent.h
+++ b/src/libs/engine/events/ActivateEvent.h
@@ -29,7 +29,7 @@ namespace Ingen {
class ActivateEvent : public QueuedEvent
{
public:
- ActivateEvent(CountedPtr<Responder> responder, SampleCount timestamp);
+ ActivateEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp);
void pre_process();
void post_process();
diff --git a/src/libs/engine/events/AddNodeEvent.cpp b/src/libs/engine/events/AddNodeEvent.cpp
index a5dc7538..5287c7cd 100644
--- a/src/libs/engine/events/AddNodeEvent.cpp
+++ b/src/libs/engine/events/AddNodeEvent.cpp
@@ -33,8 +33,8 @@
namespace Ingen {
-AddNodeEvent::AddNodeEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& path, Plugin* plugin, bool poly)
-: QueuedEvent(responder, timestamp),
+AddNodeEvent::AddNodeEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, const string& path, Plugin* plugin, bool poly)
+: QueuedEvent(engine, responder, timestamp),
m_path(path),
m_plugin(plugin),
m_poly(poly),
@@ -55,19 +55,19 @@ AddNodeEvent::~AddNodeEvent()
void
AddNodeEvent::pre_process()
{
- if (Engine::instance().object_store()->find(m_path) != NULL) {
+ if (_engine.object_store()->find(m_path) != NULL) {
m_node_already_exists = true;
QueuedEvent::pre_process();
return;
}
- m_patch = Engine::instance().object_store()->find_patch(m_path.parent());
+ m_patch = _engine.object_store()->find_patch(m_path.parent());
if (m_patch != NULL) {
if (m_poly)
- m_node = Engine::instance().node_factory()->load_plugin(m_plugin, m_path.name(), m_patch->internal_poly(), m_patch);
+ m_node = _engine.node_factory()->load_plugin(m_plugin, m_path.name(), m_patch->internal_poly(), m_patch);
else
- m_node = Engine::instance().node_factory()->load_plugin(m_plugin, m_path.name(), 1, m_patch);
+ m_node = _engine.node_factory()->load_plugin(m_plugin, m_path.name(), 1, m_patch);
if (m_node != NULL) {
m_node->activate();
@@ -75,9 +75,9 @@ AddNodeEvent::pre_process()
// This can be done here because the audio thread doesn't touch the
// node tree - just the process order array
m_patch->add_node(new ListNode<Node*>(m_node));
- m_node->add_to_store();
+ m_node->add_to_store(_engine.object_store());
- if (m_patch->process())
+ if (m_patch->enabled())
m_process_order = m_patch->build_process_order();
}
}
@@ -86,15 +86,15 @@ AddNodeEvent::pre_process()
void
-AddNodeEvent::execute(SampleCount offset)
+AddNodeEvent::execute(SampleCount nframes, FrameTime start, FrameTime end)
{
- QueuedEvent::execute(offset);
+ QueuedEvent::execute(nframes, start, end);
if (m_node != NULL) {
m_node->add_to_patch();
if (m_patch->process_order() != NULL)
- Engine::instance().maid()->push(m_patch->process_order());
+ _engine.maid()->push(m_patch->process_order());
m_patch->process_order(m_process_order);
}
}
@@ -117,8 +117,8 @@ AddNodeEvent::post_process()
_responder->respond_error(msg);
} else {
_responder->respond_ok();
- //Engine::instance().client_broadcaster()->send_node_creation_messages(m_node);
- Engine::instance().client_broadcaster()->send_node(m_node);
+ //_engine.client_broadcaster()->send_node_creation_messages(m_node);
+ _engine.client_broadcaster()->send_node(m_node);
}
}
diff --git a/src/libs/engine/events/AddNodeEvent.h b/src/libs/engine/events/AddNodeEvent.h
index c2ec043a..c7616c2b 100644
--- a/src/libs/engine/events/AddNodeEvent.h
+++ b/src/libs/engine/events/AddNodeEvent.h
@@ -39,11 +39,11 @@ class Plugin;
class AddNodeEvent : public QueuedEvent
{
public:
- AddNodeEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& path, Plugin* plugin, bool poly);
+ AddNodeEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, const string& path, Plugin* plugin, bool poly);
~AddNodeEvent();
void pre_process();
- void execute(SampleCount offset);
+ void execute(SampleCount nframes, FrameTime start, FrameTime end);
void post_process();
private:
diff --git a/src/libs/engine/events/AddPortEvent.cpp b/src/libs/engine/events/AddPortEvent.cpp
index cf40b45f..7b034f43 100644
--- a/src/libs/engine/events/AddPortEvent.cpp
+++ b/src/libs/engine/events/AddPortEvent.cpp
@@ -36,8 +36,8 @@
namespace Ingen {
-AddPortEvent::AddPortEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& path, const string& type, bool is_output)
-: QueuedEvent(responder, timestamp),
+AddPortEvent::AddPortEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, const string& path, const string& type, bool is_output)
+: QueuedEvent(engine, responder, timestamp),
_path(path),
_type(type),
_is_output(is_output),
@@ -57,21 +57,21 @@ AddPortEvent::AddPortEvent(CountedPtr<Responder> responder, SampleCount timestam
void
AddPortEvent::pre_process()
{
- if (Engine::instance().object_store()->find(_path) != NULL) {
+ if (_engine.object_store()->find(_path) != NULL) {
QueuedEvent::pre_process();
return;
}
// FIXME: this is just a mess :/
- _patch = Engine::instance().object_store()->find_patch(_path.parent());
+ _patch = _engine.object_store()->find_patch(_path.parent());
if (_patch != NULL) {
assert(_patch->path() == _path.parent());
size_t buffer_size = 1;
if (_type == "AUDIO" || _type == "MIDI")
- buffer_size = Engine::instance().audio_driver()->buffer_size();
+ buffer_size = _engine.audio_driver()->buffer_size();
_patch_port = _patch->create_port(_path.name(), _data_type, buffer_size, _is_output);
if (_patch_port) {
@@ -86,14 +86,14 @@ AddPortEvent::pre_process()
_ports_array = new Array<Port*>(_patch->num_ports() + 1, NULL);
_ports_array->at(_patch->num_ports()) = _patch_port;
- Engine::instance().object_store()->add(_patch_port);
+ _engine.object_store()->add(_patch_port);
if (!_patch->parent()) {
if (_type == "AUDIO")
- _driver_port = Engine::instance().audio_driver()->create_port(
+ _driver_port = _engine.audio_driver()->create_port(
dynamic_cast<DuplexPort<Sample>*>(_patch_port));
else if (_type == "MIDI")
- _driver_port = Engine::instance().midi_driver()->create_port(
+ _driver_port = _engine.midi_driver()->create_port(
dynamic_cast<DuplexPort<MidiMessage>*>(_patch_port));
}
}
@@ -103,12 +103,12 @@ AddPortEvent::pre_process()
void
-AddPortEvent::execute(SampleCount offset)
+AddPortEvent::execute(SampleCount nframes, FrameTime start, FrameTime end)
{
- QueuedEvent::execute(offset);
+ QueuedEvent::execute(nframes, start, end);
if (_patch_port) {
- Engine::instance().maid()->push(_patch->external_ports());
+ _engine.maid()->push(_patch->external_ports());
//_patch->add_port(_port);
_patch->external_ports(_ports_array);
}
@@ -126,7 +126,7 @@ AddPortEvent::post_process()
_responder->respond_error(msg);
} else {
_responder->respond_ok();
- Engine::instance().client_broadcaster()->send_port(_patch_port);
+ _engine.client_broadcaster()->send_port(_patch_port);
}
}
diff --git a/src/libs/engine/events/AddPortEvent.h b/src/libs/engine/events/AddPortEvent.h
index 9643bd13..070d07df 100644
--- a/src/libs/engine/events/AddPortEvent.h
+++ b/src/libs/engine/events/AddPortEvent.h
@@ -41,10 +41,10 @@ class DriverPort;
class AddPortEvent : public QueuedEvent
{
public:
- AddPortEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& path, const string& type, bool is_output);
+ AddPortEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, const string& path, const string& type, bool is_output);
void pre_process();
- void execute(SampleCount offset);
+ void execute(SampleCount nframes, FrameTime start, FrameTime end);
void post_process();
private:
diff --git a/src/libs/engine/events/AllNotesOffEvent.cpp b/src/libs/engine/events/AllNotesOffEvent.cpp
index 349c6cd5..b26f1315 100644
--- a/src/libs/engine/events/AllNotesOffEvent.cpp
+++ b/src/libs/engine/events/AllNotesOffEvent.cpp
@@ -24,8 +24,8 @@ namespace Ingen {
/** Note off with patch explicitly passed - triggered by MIDI.
*/
-AllNotesOffEvent::AllNotesOffEvent(CountedPtr<Responder> responder, SampleCount timestamp, Patch* patch)
-: Event(responder, timestamp),
+AllNotesOffEvent::AllNotesOffEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, Patch* patch)
+: Event(engine, responder, timestamp),
m_patch(patch)
{
}
@@ -33,8 +33,8 @@ AllNotesOffEvent::AllNotesOffEvent(CountedPtr<Responder> responder, SampleCount
/** Note off event with lookup - triggered by OSC.
*/
-AllNotesOffEvent::AllNotesOffEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& patch_path)
-: Event(responder, timestamp),
+AllNotesOffEvent::AllNotesOffEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, const string& patch_path)
+: Event(engine, responder, timestamp),
m_patch(NULL),
m_patch_path(patch_path)
{
@@ -42,10 +42,10 @@ AllNotesOffEvent::AllNotesOffEvent(CountedPtr<Responder> responder, SampleCount
void
-AllNotesOffEvent::execute(SampleCount offset)
+AllNotesOffEvent::execute(SampleCount nframes, FrameTime start, FrameTime end)
{
if (m_patch == NULL && m_patch_path != "")
- m_patch = Engine::instance().object_store()->find_patch(m_patch_path);
+ m_patch = _engine.object_store()->find_patch(m_patch_path);
//if (m_patch != NULL)
// for (List<MidiInNode*>::iterator j = m_patch->midi_in_nodes().begin(); j != m_patch->midi_in_nodes().end(); ++j)
diff --git a/src/libs/engine/events/AllNotesOffEvent.h b/src/libs/engine/events/AllNotesOffEvent.h
index 56d52a25..5c8f46f0 100644
--- a/src/libs/engine/events/AllNotesOffEvent.h
+++ b/src/libs/engine/events/AllNotesOffEvent.h
@@ -33,10 +33,10 @@ class Patch;
class AllNotesOffEvent : public Event
{
public:
- AllNotesOffEvent(CountedPtr<Responder> responder, SampleCount timestamp, Patch* patch);
- AllNotesOffEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& patch_path);
+ AllNotesOffEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, Patch* patch);
+ AllNotesOffEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, const string& patch_path);
- void execute(SampleCount offset);
+ void execute(SampleCount nframes, FrameTime start, FrameTime end);
void post_process();
private:
diff --git a/src/libs/engine/events/ClearPatchEvent.cpp b/src/libs/engine/events/ClearPatchEvent.cpp
index 3cd8faab..e73fd376 100644
--- a/src/libs/engine/events/ClearPatchEvent.cpp
+++ b/src/libs/engine/events/ClearPatchEvent.cpp
@@ -30,8 +30,8 @@
namespace Ingen {
-ClearPatchEvent::ClearPatchEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& patch_path)
-: QueuedEvent(responder, true),
+ClearPatchEvent::ClearPatchEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, const string& patch_path)
+: QueuedEvent(engine, responder, true),
m_patch_path(patch_path),
m_patch(NULL),
m_process(false)
@@ -42,11 +42,11 @@ ClearPatchEvent::ClearPatchEvent(CountedPtr<Responder> responder, SampleCount ti
void
ClearPatchEvent::pre_process()
{
- m_patch = Engine::instance().object_store()->find_patch(m_patch_path);
+ m_patch = _engine.object_store()->find_patch(m_patch_path);
if (m_patch != NULL) {
- m_process = m_patch->process();
+ m_process = m_patch->enabled();
for (List<Node*>::const_iterator i = m_patch->nodes().begin(); i != m_patch->nodes().end(); ++i)
(*i)->remove_from_store();
@@ -57,21 +57,21 @@ ClearPatchEvent::pre_process()
void
-ClearPatchEvent::execute(SampleCount offset)
+ClearPatchEvent::execute(SampleCount nframes, FrameTime start, FrameTime end)
{
if (m_patch != NULL) {
- m_patch->process(false);
+ m_patch->disable();
for (List<Node*>::const_iterator i = m_patch->nodes().begin(); i != m_patch->nodes().end(); ++i)
(*i)->remove_from_patch();
if (m_patch->process_order() != NULL) {
- Engine::instance().maid()->push(m_patch->process_order());
+ _engine.maid()->push(m_patch->process_order());
m_patch->process_order(NULL);
}
}
- QueuedEvent::execute(offset);
+ QueuedEvent::execute(nframes, start, end);
}
@@ -92,7 +92,10 @@ ClearPatchEvent::post_process()
m_patch->connections().clear();
// Restore patch's run state
- m_patch->process(m_process);
+ if (m_process)
+ m_patch->enable();
+ else
+ m_patch->disable();
// Make sure everything's sane
assert(m_patch->nodes().size() == 0);
@@ -100,7 +103,7 @@ ClearPatchEvent::post_process()
// Reply
_responder->respond_ok();
- Engine::instance().client_broadcaster()->send_patch_cleared(m_patch_path);
+ _engine.client_broadcaster()->send_patch_cleared(m_patch_path);
} else {
_responder->respond_error(string("Patch ") + m_patch_path + " not found");
}
diff --git a/src/libs/engine/events/ClearPatchEvent.h b/src/libs/engine/events/ClearPatchEvent.h
index bef90477..0eb9b495 100644
--- a/src/libs/engine/events/ClearPatchEvent.h
+++ b/src/libs/engine/events/ClearPatchEvent.h
@@ -35,10 +35,10 @@ class Patch;
class ClearPatchEvent : public QueuedEvent
{
public:
- ClearPatchEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& patch_path);
+ ClearPatchEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, const string& patch_path);
void pre_process();
- void execute(SampleCount offset);
+ void execute(SampleCount nframes, FrameTime start, FrameTime end);
void post_process();
private:
diff --git a/src/libs/engine/events/ConnectionEvent.cpp b/src/libs/engine/events/ConnectionEvent.cpp
index bf64df0a..b873bccb 100644
--- a/src/libs/engine/events/ConnectionEvent.cpp
+++ b/src/libs/engine/events/ConnectionEvent.cpp
@@ -36,8 +36,8 @@ namespace Ingen {
//// ConnectionEvent ////
-ConnectionEvent::ConnectionEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& src_port_path, const string& dst_port_path)
-: QueuedEvent(responder, timestamp),
+ConnectionEvent::ConnectionEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, const string& src_port_path, const string& dst_port_path)
+: QueuedEvent(engine, responder, timestamp),
m_src_port_path(src_port_path),
m_dst_port_path(dst_port_path),
m_patch(NULL),
@@ -66,7 +66,7 @@ ConnectionEvent::pre_process()
return;
}
- /*m_patch = Engine::instance().object_store()->find_patch(m_src_port_path.parent().parent());
+ /*m_patch = _engine.object_store()->find_patch(m_src_port_path.parent().parent());
if (m_patch == NULL) {
m_error = PORT_NOT_FOUND;
@@ -74,8 +74,8 @@ ConnectionEvent::pre_process()
return;
}*/
- m_src_port = Engine::instance().object_store()->find_port(m_src_port_path);
- m_dst_port = Engine::instance().object_store()->find_port(m_dst_port_path);
+ m_src_port = _engine.object_store()->find_port(m_src_port_path);
+ m_dst_port = _engine.object_store()->find_port(m_dst_port_path);
if (m_src_port == NULL || m_dst_port == NULL) {
m_error = PORT_NOT_FOUND;
@@ -104,10 +104,10 @@ ConnectionEvent::pre_process()
// Create the typed event to actually do the work
const DataType type = m_src_port->type();
if (type == DataType::FLOAT) {
- m_typed_event = new TypedConnectionEvent<Sample>(_responder, _time_stamp,
+ m_typed_event = new TypedConnectionEvent<Sample>(_engine, _responder, _time,
dynamic_cast<OutputPort<Sample>*>(m_src_port), dynamic_cast<InputPort<Sample>*>(m_dst_port));
} else if (type == DataType::MIDI) {
- m_typed_event = new TypedConnectionEvent<MidiMessage>(_responder, _time_stamp,
+ m_typed_event = new TypedConnectionEvent<MidiMessage>(_engine, _responder, _time,
dynamic_cast<OutputPort<MidiMessage>*>(m_src_port), dynamic_cast<InputPort<MidiMessage>*>(m_dst_port));
} else {
m_error = TYPE_MISMATCH;
@@ -122,12 +122,12 @@ ConnectionEvent::pre_process()
void
-ConnectionEvent::execute(SampleCount offset)
+ConnectionEvent::execute(SampleCount nframes, FrameTime start, FrameTime end)
{
- QueuedEvent::execute(offset);
+ QueuedEvent::execute(nframes, start, end);
if (m_error == NO_ERROR)
- m_typed_event->execute(offset);
+ m_typed_event->execute(nframes, start, end);
}
@@ -150,8 +150,8 @@ ConnectionEvent::post_process()
template <typename T>
-TypedConnectionEvent<T>::TypedConnectionEvent(CountedPtr<Responder> responder, SampleCount timestamp, OutputPort<T>* src_port, InputPort<T>* dst_port)
-: QueuedEvent(responder, timestamp),
+TypedConnectionEvent<T>::TypedConnectionEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, OutputPort<T>* src_port, InputPort<T>* dst_port)
+: QueuedEvent(engine, responder, timestamp),
m_src_port(src_port),
m_dst_port(dst_port),
m_patch(NULL),
@@ -221,21 +221,21 @@ TypedConnectionEvent<T>::pre_process()
src_node->dependants()->push_back(new ListNode<Node*>(dst_node));
}
- if (m_patch->process())
+ if (m_patch->enabled())
m_process_order = m_patch->build_process_order();
}
template <typename T>
void
-TypedConnectionEvent<T>::execute(SampleCount offset)
+TypedConnectionEvent<T>::execute(SampleCount nframes, FrameTime start, FrameTime end)
{
if (m_succeeded) {
// These must be inserted here, since they're actually used by the audio thread
m_dst_port->add_connection(m_port_listnode);
m_patch->add_connection(m_patch_listnode);
if (m_patch->process_order() != NULL)
- Engine::instance().maid()->push(m_patch->process_order());
+ _engine.maid()->push(m_patch->process_order());
m_patch->process_order(m_process_order);
}
}
@@ -250,7 +250,7 @@ TypedConnectionEvent<T>::post_process()
_responder->respond_ok();
- Engine::instance().client_broadcaster()->send_connection(m_connection);
+ _engine.client_broadcaster()->send_connection(m_connection);
} else {
_responder->respond_error("Unable to make connection.");
}
diff --git a/src/libs/engine/events/ConnectionEvent.h b/src/libs/engine/events/ConnectionEvent.h
index d5a580a5..2f65eb3a 100644
--- a/src/libs/engine/events/ConnectionEvent.h
+++ b/src/libs/engine/events/ConnectionEvent.h
@@ -46,11 +46,11 @@ template <typename T> class TypedConnectionEvent; // helper, defined below
class ConnectionEvent : public QueuedEvent
{
public:
- ConnectionEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& src_port_path, const string& dst_port_path);
+ ConnectionEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, const string& src_port_path, const string& dst_port_path);
~ConnectionEvent();
void pre_process();
- void execute(SampleCount offset);
+ void execute(SampleCount nframes, FrameTime start, FrameTime end);
void post_process();
private:
@@ -80,10 +80,10 @@ template <typename T>
class TypedConnectionEvent : public QueuedEvent
{
public:
- TypedConnectionEvent(CountedPtr<Responder> responder, SampleCount timestamp, OutputPort<T>* src_port, InputPort<T>* dst_port);
+ TypedConnectionEvent(Engine& engine, CountedPtr<Responder> responder, FrameTime time, OutputPort<T>* src_port, InputPort<T>* dst_port);
void pre_process();
- void execute(SampleCount offset);
+ void execute(SampleCount nframes, FrameTime start, FrameTime end);
void post_process();
private:
diff --git a/src/libs/engine/events/CreatePatchEvent.cpp b/src/libs/engine/events/CreatePatchEvent.cpp
index 65e2106d..d66a3ff9 100644
--- a/src/libs/engine/events/CreatePatchEvent.cpp
+++ b/src/libs/engine/events/CreatePatchEvent.cpp
@@ -30,8 +30,8 @@
namespace Ingen {
-CreatePatchEvent::CreatePatchEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& path, int poly)
-: QueuedEvent(responder, timestamp),
+CreatePatchEvent::CreatePatchEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, const string& path, int poly)
+: QueuedEvent(engine, responder, timestamp),
m_path(path),
m_patch(NULL),
m_parent(NULL),
@@ -45,7 +45,7 @@ CreatePatchEvent::CreatePatchEvent(CountedPtr<Responder> responder, SampleCount
void
CreatePatchEvent::pre_process()
{
- if (Engine::instance().object_store()->find(m_path) != NULL) {
+ if (_engine.object_store()->find(m_path) != NULL) {
m_error = OBJECT_EXISTS;
QueuedEvent::pre_process();
return;
@@ -58,7 +58,7 @@ CreatePatchEvent::pre_process()
}
if (m_path != "/") {
- m_parent = Engine::instance().object_store()->find_patch(m_path.parent());
+ m_parent = _engine.object_store()->find_patch(m_path.parent());
if (m_parent == NULL) {
m_error = PARENT_NOT_FOUND;
QueuedEvent::pre_process();
@@ -70,34 +70,34 @@ CreatePatchEvent::pre_process()
if (m_parent != NULL && m_poly > 1 && m_poly == static_cast<int>(m_parent->internal_poly()))
poly = m_poly;
- m_patch = new Patch(m_path.name(), poly, m_parent, Engine::instance().audio_driver()->sample_rate(), Engine::instance().audio_driver()->buffer_size(), m_poly);
+ m_patch = new Patch(m_path.name(), poly, m_parent, _engine.audio_driver()->sample_rate(), _engine.audio_driver()->buffer_size(), m_poly);
if (m_parent != NULL) {
m_parent->add_node(new ListNode<Node*>(m_patch));
- if (m_parent->process())
+ if (m_parent->enabled())
m_process_order = m_parent->build_process_order();
}
m_patch->activate();
// Insert into ObjectStore
- m_patch->add_to_store();
+ m_patch->add_to_store(_engine.object_store());
QueuedEvent::pre_process();
}
void
-CreatePatchEvent::execute(SampleCount offset)
+CreatePatchEvent::execute(SampleCount nframes, FrameTime start, FrameTime end)
{
- QueuedEvent::execute(offset);
+ QueuedEvent::execute(nframes, start, end);
if (m_patch != NULL) {
if (m_parent == NULL) {
assert(m_path == "/");
assert(m_patch->parent_patch() == NULL);
- Engine::instance().audio_driver()->set_root_patch(m_patch);
+ _engine.audio_driver()->set_root_patch(m_patch);
} else {
assert(m_parent != NULL);
assert(m_path != "/");
@@ -105,7 +105,7 @@ CreatePatchEvent::execute(SampleCount offset)
m_patch->add_to_patch();
if (m_parent->process_order() != NULL)
- Engine::instance().maid()->push(m_parent->process_order());
+ _engine.maid()->push(m_parent->process_order());
m_parent->process_order(m_process_order);
}
}
@@ -121,10 +121,10 @@ CreatePatchEvent::post_process()
_responder->respond_ok();
// Don't want to send nodes that have been added since prepare()
- //Engine::instance().client_broadcaster()->send_node_creation_messages(m_patch);
+ //_engine.client_broadcaster()->send_node_creation_messages(m_patch);
// Patches are always empty on creation, so this is fine
- Engine::instance().client_broadcaster()->send_patch(m_patch);
+ _engine.client_broadcaster()->send_patch(m_patch);
} else if (m_error == OBJECT_EXISTS) {
string msg = "Unable to create patch: ";
diff --git a/src/libs/engine/events/CreatePatchEvent.h b/src/libs/engine/events/CreatePatchEvent.h
index 581bb381..63a33271 100644
--- a/src/libs/engine/events/CreatePatchEvent.h
+++ b/src/libs/engine/events/CreatePatchEvent.h
@@ -39,10 +39,10 @@ class Plugin;
class CreatePatchEvent : public QueuedEvent
{
public:
- CreatePatchEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& path, int poly);
+ CreatePatchEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, const string& path, int poly);
void pre_process();
- void execute(SampleCount offset);
+ void execute(SampleCount nframes, FrameTime start, FrameTime end);
void post_process();
private:
diff --git a/src/libs/engine/events/DSSIConfigureEvent.cpp b/src/libs/engine/events/DSSIConfigureEvent.cpp
index 59a7401c..de79a083 100644
--- a/src/libs/engine/events/DSSIConfigureEvent.cpp
+++ b/src/libs/engine/events/DSSIConfigureEvent.cpp
@@ -24,8 +24,8 @@
namespace Ingen {
-DSSIConfigureEvent::DSSIConfigureEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& node_path, const string& key, const string& val)
-: QueuedEvent(responder, timestamp),
+DSSIConfigureEvent::DSSIConfigureEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, const string& node_path, const string& key, const string& val)
+: QueuedEvent(engine, responder, timestamp),
m_node_path(node_path),
m_key(key),
m_val(val),
@@ -37,7 +37,7 @@ DSSIConfigureEvent::DSSIConfigureEvent(CountedPtr<Responder> responder, SampleCo
void
DSSIConfigureEvent::pre_process()
{
- Node* node = Engine::instance().object_store()->find_node(m_node_path);
+ Node* node = _engine.object_store()->find_node(m_node_path);
if (node != NULL && node->plugin()->type() == Plugin::DSSI) {
m_node = (DSSINode*)node;
@@ -49,7 +49,7 @@ DSSIConfigureEvent::pre_process()
void
-DSSIConfigureEvent::execute(SampleCount offset)
+DSSIConfigureEvent::execute(SampleCount nframes, FrameTime start, FrameTime end)
{
// Nothing.
}
@@ -63,7 +63,7 @@ DSSIConfigureEvent::post_process()
} else {
string key = "dssi-configure--";
key += m_key;
- Engine::instance().client_broadcaster()->send_metadata_update(m_node_path, key, m_val);
+ _engine.client_broadcaster()->send_metadata_update(m_node_path, key, m_val);
}
}
diff --git a/src/libs/engine/events/DSSIConfigureEvent.h b/src/libs/engine/events/DSSIConfigureEvent.h
index 80769929..bef3fbb7 100644
--- a/src/libs/engine/events/DSSIConfigureEvent.h
+++ b/src/libs/engine/events/DSSIConfigureEvent.h
@@ -30,10 +30,10 @@ namespace Ingen {
class DSSIConfigureEvent : public QueuedEvent
{
public:
- DSSIConfigureEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& node_path, const string& key, const string& val);
+ DSSIConfigureEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, const string& node_path, const string& key, const string& val);
void pre_process();
- void execute(SampleCount offset);
+ void execute(SampleCount nframes, FrameTime start, FrameTime end);
void post_process();
private:
diff --git a/src/libs/engine/events/DSSIControlEvent.cpp b/src/libs/engine/events/DSSIControlEvent.cpp
index 5ba8a87e..9ae4274b 100644
--- a/src/libs/engine/events/DSSIControlEvent.cpp
+++ b/src/libs/engine/events/DSSIControlEvent.cpp
@@ -23,8 +23,8 @@
namespace Ingen {
-DSSIControlEvent::DSSIControlEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& node_path, int port_num, Sample val)
-: QueuedEvent(responder, timestamp),
+DSSIControlEvent::DSSIControlEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, const string& node_path, int port_num, Sample val)
+: QueuedEvent(engine, responder, timestamp),
m_node_path(node_path),
m_port_num(port_num),
m_val(val),
@@ -36,7 +36,7 @@ DSSIControlEvent::DSSIControlEvent(CountedPtr<Responder> responder, SampleCount
void
DSSIControlEvent::pre_process()
{
- Node* node = Engine::instance().object_store()->find_node(m_node_path);
+ Node* node = _engine.object_store()->find_node(m_node_path);
if (node->plugin()->type() != Plugin::DSSI)
m_node = NULL;
@@ -48,7 +48,7 @@ DSSIControlEvent::pre_process()
void
-DSSIControlEvent::execute(SampleCount offset)
+DSSIControlEvent::execute(SampleCount nframes, FrameTime start, FrameTime end)
{
if (m_node != NULL)
m_node->set_control(m_port_num, m_val);
diff --git a/src/libs/engine/events/DSSIControlEvent.h b/src/libs/engine/events/DSSIControlEvent.h
index e7c8605d..9eeeb136 100644
--- a/src/libs/engine/events/DSSIControlEvent.h
+++ b/src/libs/engine/events/DSSIControlEvent.h
@@ -32,10 +32,10 @@ namespace Ingen {
class DSSIControlEvent : public QueuedEvent
{
public:
- DSSIControlEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& node_path, int port_num, Sample val);
+ DSSIControlEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, const string& node_path, int port_num, Sample val);
void pre_process();
- void execute(SampleCount offset);
+ void execute(SampleCount nframes, FrameTime start, FrameTime end);
void post_process();
private:
diff --git a/src/libs/engine/events/DSSIProgramEvent.cpp b/src/libs/engine/events/DSSIProgramEvent.cpp
index 3d62e5b8..4545268a 100644
--- a/src/libs/engine/events/DSSIProgramEvent.cpp
+++ b/src/libs/engine/events/DSSIProgramEvent.cpp
@@ -28,8 +28,8 @@ using std::cout; using std::cerr; using std::endl;
namespace Ingen {
-DSSIProgramEvent::DSSIProgramEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& node_path, int bank, int program)
-: QueuedEvent(responder, timestamp),
+DSSIProgramEvent::DSSIProgramEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, const string& node_path, int bank, int program)
+: QueuedEvent(engine, responder, timestamp),
m_node_path(node_path),
m_bank(bank),
m_program(program),
@@ -41,7 +41,7 @@ DSSIProgramEvent::DSSIProgramEvent(CountedPtr<Responder> responder, SampleCount
void
DSSIProgramEvent::pre_process()
{
- Node* node = Engine::instance().object_store()->find_node(m_node_path);
+ Node* node = _engine.object_store()->find_node(m_node_path);
if (node != NULL && node->plugin()->type() == Plugin::DSSI)
m_node = (DSSINode*)node;
@@ -51,7 +51,7 @@ DSSIProgramEvent::pre_process()
void
-DSSIProgramEvent::execute(SampleCount offset)
+DSSIProgramEvent::execute(SampleCount nframes, FrameTime start, FrameTime end)
{
if (m_node != NULL)
m_node->program(m_bank, m_program);
@@ -67,7 +67,7 @@ DSSIProgramEvent::post_process()
// sends program as metadata in the form bank/program
char* temp_buf = new char[16];
snprintf(temp_buf, 16, "%d/%d", m_bank, m_program);
- Engine::instance().client_broadcaster()->send_metadata_update(m_node_path, "dssi-program", temp_buf);
+ _engine.client_broadcaster()->send_metadata_update(m_node_path, "dssi-program", temp_buf);
}
}
diff --git a/src/libs/engine/events/DSSIProgramEvent.h b/src/libs/engine/events/DSSIProgramEvent.h
index 864110f4..51967cf0 100644
--- a/src/libs/engine/events/DSSIProgramEvent.h
+++ b/src/libs/engine/events/DSSIProgramEvent.h
@@ -30,10 +30,10 @@ namespace Ingen {
class DSSIProgramEvent : public QueuedEvent
{
public:
- DSSIProgramEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& node_path, int bank, int program);
+ DSSIProgramEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, const string& node_path, int bank, int program);
void pre_process();
- void execute(SampleCount offset);
+ void execute(SampleCount nframes, FrameTime start, FrameTime end);
void post_process();
private:
diff --git a/src/libs/engine/events/DSSIUpdateEvent.cpp b/src/libs/engine/events/DSSIUpdateEvent.cpp
index 48590917..d2953a9b 100644
--- a/src/libs/engine/events/DSSIUpdateEvent.cpp
+++ b/src/libs/engine/events/DSSIUpdateEvent.cpp
@@ -27,8 +27,8 @@ using std::cerr; using std::endl;
namespace Ingen {
-DSSIUpdateEvent::DSSIUpdateEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& path, const string& url)
-: QueuedEvent(responder, timestamp),
+DSSIUpdateEvent::DSSIUpdateEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, const string& path, const string& url)
+: QueuedEvent(engine, responder, timestamp),
m_path(path),
m_url(url),
m_node(NULL)
@@ -39,7 +39,7 @@ DSSIUpdateEvent::DSSIUpdateEvent(CountedPtr<Responder> responder, SampleCount ti
void
DSSIUpdateEvent::pre_process()
{
- Node* node = Engine::instance().object_store()->find_node(m_path);
+ Node* node = _engine.object_store()->find_node(m_path);
if (node == NULL || node->plugin()->type() != Plugin::DSSI) {
m_node = NULL;
@@ -54,13 +54,13 @@ DSSIUpdateEvent::pre_process()
void
-DSSIUpdateEvent::execute(SampleCount offset)
+DSSIUpdateEvent::execute(SampleCount nframes, FrameTime start, FrameTime end)
{
if (m_node != NULL) {
m_node->set_ui_url(m_url);
}
- QueuedEvent::execute(offset);
+ QueuedEvent::execute(nframes, start, end);
}
diff --git a/src/libs/engine/events/DSSIUpdateEvent.h b/src/libs/engine/events/DSSIUpdateEvent.h
index bddbc21d..91163efe 100644
--- a/src/libs/engine/events/DSSIUpdateEvent.h
+++ b/src/libs/engine/events/DSSIUpdateEvent.h
@@ -36,10 +36,10 @@ class DSSINode;
class DSSIUpdateEvent : public QueuedEvent
{
public:
- DSSIUpdateEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& path, const string& url);
+ DSSIUpdateEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, const string& path, const string& url);
void pre_process();
- void execute(SampleCount offset);
+ void execute(SampleCount nframes, FrameTime start, FrameTime end);
void post_process();
private:
diff --git a/src/libs/engine/events/DeactivateEvent.cpp b/src/libs/engine/events/DeactivateEvent.cpp
index e1c0541e..ff1740dc 100644
--- a/src/libs/engine/events/DeactivateEvent.cpp
+++ b/src/libs/engine/events/DeactivateEvent.cpp
@@ -21,8 +21,8 @@
namespace Ingen {
-DeactivateEvent::DeactivateEvent(CountedPtr<Responder> responder, SampleCount timestamp)
-: QueuedEvent(responder, timestamp)
+DeactivateEvent::DeactivateEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp)
+: QueuedEvent(engine, responder, timestamp)
{
}
@@ -35,9 +35,9 @@ DeactivateEvent::pre_process()
void
-DeactivateEvent::execute(SampleCount offset)
+DeactivateEvent::execute(SampleCount nframes, FrameTime start, FrameTime end)
{
- QueuedEvent::execute(offset);
+ QueuedEvent::execute(nframes, start, end);
}
@@ -45,7 +45,7 @@ void
DeactivateEvent::post_process()
{
_responder->respond_ok();
- Engine::instance().deactivate();
+ _engine.deactivate();
}
diff --git a/src/libs/engine/events/DeactivateEvent.h b/src/libs/engine/events/DeactivateEvent.h
index 0fd79d32..ddeb75f5 100644
--- a/src/libs/engine/events/DeactivateEvent.h
+++ b/src/libs/engine/events/DeactivateEvent.h
@@ -29,10 +29,10 @@ namespace Ingen {
class DeactivateEvent : public QueuedEvent
{
public:
- DeactivateEvent(CountedPtr<Responder> responder, SampleCount timestamp);
+ DeactivateEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp);
void pre_process();
- void execute(SampleCount offset);
+ void execute(SampleCount nframes, FrameTime start, FrameTime end);
void post_process();
};
diff --git a/src/libs/engine/events/DestroyEvent.cpp b/src/libs/engine/events/DestroyEvent.cpp
index d55a2935..dd172e7f 100644
--- a/src/libs/engine/events/DestroyEvent.cpp
+++ b/src/libs/engine/events/DestroyEvent.cpp
@@ -34,8 +34,8 @@
namespace Ingen {
-DestroyEvent::DestroyEvent(CountedPtr<Responder> responder, SampleCount timestamp, QueuedEventSource* source, const string& path, bool lock_mutex)
-: QueuedEvent(responder, true, source),
+DestroyEvent::DestroyEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, QueuedEventSource* source, const string& path, bool lock_mutex)
+: QueuedEvent(engine, responder, true, source),
m_path(path),
m_node(NULL),
m_patch_listnode(NULL),
@@ -47,8 +47,8 @@ DestroyEvent::DestroyEvent(CountedPtr<Responder> responder, SampleCount timestam
}
-DestroyEvent::DestroyEvent(CountedPtr<Responder> responder, SampleCount timestamp, Node* node, bool lock_mutex)
-: QueuedEvent(responder, true),
+DestroyEvent::DestroyEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, Node* node, bool lock_mutex)
+: QueuedEvent(engine, responder, true),
m_path(node->path()),
m_node(node),
m_patch_listnode(NULL),
@@ -71,7 +71,7 @@ void
DestroyEvent::pre_process()
{
if (m_node == NULL)
- m_node = Engine::instance().object_store()->find_node(m_path);
+ m_node = _engine.object_store()->find_node(m_path);
if (m_node != NULL && m_path != "/") {
assert(m_node->parent_patch() != NULL);
@@ -82,7 +82,7 @@ DestroyEvent::pre_process()
m_node->remove_from_store();
if (m_node->providers()->size() != 0 || m_node->dependants()->size() != 0) {
- m_disconnect_event = new DisconnectNodeEvent(m_node);
+ m_disconnect_event = new DisconnectNodeEvent(_engine, m_node);
m_disconnect_event->pre_process();
}
@@ -90,11 +90,11 @@ DestroyEvent::pre_process()
cerr << "FIXME: Destroy bridge\n";
/*Port* parent_port = m_patch_listnode->elem()->as_port();
if (parent_port != NULL) { // Bridge node
- m_parent_disconnect_event = new DisconnectPortEvent(parent_port);
+ m_parent_disconnect_event = new DisconnectPortEvent(Engine& engine, parent_port);
m_parent_disconnect_event->pre_process();
}*/
- if (m_node->parent_patch()->process()) {
+ if (m_node->parent_patch()->enabled()) {
m_process_order = m_node->parent_patch()->build_process_order();
// Remove node to be removed from the process order so it isn't executed by
// Patch::run and can safely be destroyed
@@ -116,20 +116,20 @@ DestroyEvent::pre_process()
void
-DestroyEvent::execute(SampleCount offset)
+DestroyEvent::execute(SampleCount nframes, FrameTime start, FrameTime end)
{
- QueuedEvent::execute(offset);
+ QueuedEvent::execute(nframes, start, end);
if (m_patch_listnode != NULL) {
m_node->remove_from_patch();
if (m_disconnect_event != NULL)
- m_disconnect_event->execute(offset);
+ m_disconnect_event->execute(nframes, start, end);
if (m_parent_disconnect_event != NULL)
- m_parent_disconnect_event->execute(offset);
+ m_parent_disconnect_event->execute(nframes, start, end);
if (m_node->parent_patch()->process_order() != NULL)
- Engine::instance().maid()->push(m_node->parent_patch()->process_order());
+ _engine.maid()->push(m_node->parent_patch()->process_order());
m_node->parent_patch()->process_order(m_process_order);
}
}
@@ -153,9 +153,9 @@ DestroyEvent::post_process()
m_disconnect_event->post_process();
if (m_parent_disconnect_event != NULL)
m_parent_disconnect_event->post_process();
- Engine::instance().client_broadcaster()->send_destroyed(m_path);
- Engine::instance().maid()->push(m_patch_listnode);
- Engine::instance().maid()->push(m_node);
+ _engine.client_broadcaster()->send_destroyed(m_path);
+ _engine.maid()->push(m_patch_listnode);
+ _engine.maid()->push(m_node);
} else {
_responder->respond_error("Unable to destroy object");
}
diff --git a/src/libs/engine/events/DestroyEvent.h b/src/libs/engine/events/DestroyEvent.h
index de4686c1..6eda8006 100644
--- a/src/libs/engine/events/DestroyEvent.h
+++ b/src/libs/engine/events/DestroyEvent.h
@@ -44,12 +44,12 @@ class DisconnectPortEvent;
class DestroyEvent : public QueuedEvent
{
public:
- DestroyEvent(CountedPtr<Responder> responder, SampleCount timestamp, QueuedEventSource* source, const string& path, bool lock_mutex = true);
- DestroyEvent(CountedPtr<Responder> responder, SampleCount timestamp, Node* node, bool lock_mutex = true);
+ DestroyEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, QueuedEventSource* source, const string& path, bool lock_mutex = true);
+ DestroyEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, Node* node, bool lock_mutex = true);
~DestroyEvent();
void pre_process();
- void execute(SampleCount offset);
+ void execute(SampleCount nframes, FrameTime start, FrameTime end);
void post_process();
private:
diff --git a/src/libs/engine/events/DisablePatchEvent.cpp b/src/libs/engine/events/DisablePatchEvent.cpp
index 45b19f54..299e4fdc 100644
--- a/src/libs/engine/events/DisablePatchEvent.cpp
+++ b/src/libs/engine/events/DisablePatchEvent.cpp
@@ -26,8 +26,8 @@
namespace Ingen {
-DisablePatchEvent::DisablePatchEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& patch_path)
-: QueuedEvent(responder, timestamp),
+DisablePatchEvent::DisablePatchEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, const string& patch_path)
+: QueuedEvent(engine, responder, timestamp),
m_patch_path(patch_path),
m_patch(NULL)
{
@@ -37,19 +37,19 @@ DisablePatchEvent::DisablePatchEvent(CountedPtr<Responder> responder, SampleCoun
void
DisablePatchEvent::pre_process()
{
- m_patch = Engine::instance().object_store()->find_patch(m_patch_path);
+ m_patch = _engine.object_store()->find_patch(m_patch_path);
QueuedEvent::pre_process();
}
void
-DisablePatchEvent::execute(SampleCount offset)
+DisablePatchEvent::execute(SampleCount nframes, FrameTime start, FrameTime end)
{
if (m_patch != NULL)
- m_patch->process(false);
+ m_patch->disable();
- QueuedEvent::execute(offset);
+ QueuedEvent::execute(nframes, start, end);
}
@@ -58,7 +58,7 @@ DisablePatchEvent::post_process()
{
if (m_patch != NULL) {
_responder->respond_ok();
- Engine::instance().client_broadcaster()->send_patch_disable(m_patch_path);
+ _engine.client_broadcaster()->send_patch_disable(m_patch_path);
} else {
_responder->respond_error(string("Patch ") + m_patch_path + " not found");
}
diff --git a/src/libs/engine/events/DisablePatchEvent.h b/src/libs/engine/events/DisablePatchEvent.h
index 10721825..09347b08 100644
--- a/src/libs/engine/events/DisablePatchEvent.h
+++ b/src/libs/engine/events/DisablePatchEvent.h
@@ -34,10 +34,10 @@ class Patch;
class DisablePatchEvent : public QueuedEvent
{
public:
- DisablePatchEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& patch_path);
+ DisablePatchEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, const string& patch_path);
void pre_process();
- void execute(SampleCount offset);
+ void execute(SampleCount nframes, FrameTime start, FrameTime end);
void post_process();
private:
diff --git a/src/libs/engine/events/DisconnectNodeEvent.cpp b/src/libs/engine/events/DisconnectNodeEvent.cpp
index 7955f602..c1a965ad 100644
--- a/src/libs/engine/events/DisconnectNodeEvent.cpp
+++ b/src/libs/engine/events/DisconnectNodeEvent.cpp
@@ -38,8 +38,8 @@ using std::cerr; using std::endl;
namespace Ingen {
-DisconnectNodeEvent::DisconnectNodeEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& node_path)
-: QueuedEvent(responder, timestamp),
+DisconnectNodeEvent::DisconnectNodeEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, const string& node_path)
+: QueuedEvent(engine, responder, timestamp),
m_node_path(node_path),
m_patch(NULL),
m_node(NULL),
@@ -51,8 +51,8 @@ DisconnectNodeEvent::DisconnectNodeEvent(CountedPtr<Responder> responder, Sample
/** Internal version, disconnects parent port as well (in the case of InputNode, etc).
*/
-DisconnectNodeEvent::DisconnectNodeEvent(Node* node)
-: QueuedEvent(),
+DisconnectNodeEvent::DisconnectNodeEvent(Engine& engine, Node* node)
+: QueuedEvent(engine),
m_node_path(""),
m_patch(node->parent_patch()),
m_node(node),
@@ -77,7 +77,7 @@ DisconnectNodeEvent::pre_process()
// cerr << "Preparing disconnection event...\n";
if (m_lookup) {
- m_patch = Engine::instance().object_store()->find_patch(m_node_path.parent());
+ m_patch = _engine.object_store()->find_patch(m_node_path.parent());
if (m_patch == NULL) {
m_succeeded = false;
@@ -85,7 +85,7 @@ DisconnectNodeEvent::pre_process()
return;
}
- m_node = Engine::instance().object_store()->find_node(m_node_path);
+ m_node = _engine.object_store()->find_node(m_node_path);
if (m_node == NULL) {
m_succeeded = false;
@@ -98,7 +98,7 @@ DisconnectNodeEvent::pre_process()
for (ConnectionListIterator i = m_patch->connections().begin(); i != m_patch->connections().end(); ++i) {
c = (*i);
if ((c->src_port()->parent_node() == m_node || c->dst_port()->parent_node() == m_node) && !c->pending_disconnection()) {
- DisconnectionEvent* ev = new DisconnectionEvent(CountedPtr<Responder>(new Responder()), _time_stamp,
+ DisconnectionEvent* ev = new DisconnectionEvent(_engine, CountedPtr<Responder>(new Responder()), _time,
c->src_port(), c->dst_port());
ev->pre_process();
m_disconnection_events.push_back(new ListNode<DisconnectionEvent*>(ev));
@@ -112,14 +112,14 @@ DisconnectNodeEvent::pre_process()
void
-DisconnectNodeEvent::execute(SampleCount offset)
+DisconnectNodeEvent::execute(SampleCount nframes, FrameTime start, FrameTime end)
{
if (m_succeeded) {
for (List<DisconnectionEvent*>::iterator i = m_disconnection_events.begin(); i != m_disconnection_events.end(); ++i)
- (*i)->execute(offset);
+ (*i)->execute(nframes, start, end);
}
- QueuedEvent::execute(offset);
+ QueuedEvent::execute(nframes, start, end);
}
diff --git a/src/libs/engine/events/DisconnectNodeEvent.h b/src/libs/engine/events/DisconnectNodeEvent.h
index d45fff39..90aeabed 100644
--- a/src/libs/engine/events/DisconnectNodeEvent.h
+++ b/src/libs/engine/events/DisconnectNodeEvent.h
@@ -42,12 +42,12 @@ template <typename T> class OutputPort;
class DisconnectNodeEvent : public QueuedEvent
{
public:
- DisconnectNodeEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& node_path);
- DisconnectNodeEvent(Node* node);
+ DisconnectNodeEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, const string& node_path);
+ DisconnectNodeEvent(Engine& engine, Node* node);
~DisconnectNodeEvent();
void pre_process();
- void execute(SampleCount offset);
+ void execute(SampleCount nframes, FrameTime start, FrameTime end);
void post_process();
private:
diff --git a/src/libs/engine/events/DisconnectPortEvent.cpp b/src/libs/engine/events/DisconnectPortEvent.cpp
index 2126dffd..41ceff8b 100644
--- a/src/libs/engine/events/DisconnectPortEvent.cpp
+++ b/src/libs/engine/events/DisconnectPortEvent.cpp
@@ -38,8 +38,8 @@ using std::cerr; using std::endl;
namespace Ingen {
-DisconnectPortEvent::DisconnectPortEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& port_path)
-: QueuedEvent(responder, timestamp),
+DisconnectPortEvent::DisconnectPortEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, const string& port_path)
+: QueuedEvent(engine, responder, timestamp),
m_port_path(port_path),
m_patch(NULL),
m_port(NULL),
@@ -50,8 +50,8 @@ DisconnectPortEvent::DisconnectPortEvent(CountedPtr<Responder> responder, Sample
}
-DisconnectPortEvent::DisconnectPortEvent(Port* port)
-: QueuedEvent(),
+DisconnectPortEvent::DisconnectPortEvent(Engine& engine, Port* port)
+: QueuedEvent(engine),
m_port_path(""),
m_patch((port->parent_node() == NULL) ? NULL : port->parent_node()->parent_patch()),
m_port(port),
@@ -59,7 +59,7 @@ DisconnectPortEvent::DisconnectPortEvent(Port* port)
m_succeeded(true),
m_lookup(false)
{
- //cerr << "DisconnectPortEvent()\n";
+ //cerr << "DisconnectPortEvent(Engine& engine, )\n";
}
@@ -76,7 +76,7 @@ DisconnectPortEvent::pre_process()
// cerr << "Preparing disconnection event...\n";
if (m_lookup) {
- m_patch = Engine::instance().object_store()->find_patch(m_port_path.parent().parent());
+ m_patch = _engine.object_store()->find_patch(m_port_path.parent().parent());
if (m_patch == NULL) {
m_succeeded = false;
@@ -84,7 +84,7 @@ DisconnectPortEvent::pre_process()
return;
}
- m_port = Engine::instance().object_store()->find_port(m_port_path);
+ m_port = _engine.object_store()->find_port(m_port_path);
if (m_port == NULL) {
m_succeeded = false;
@@ -103,7 +103,7 @@ DisconnectPortEvent::pre_process()
for (List<Connection*>::const_iterator i = m_patch->connections().begin(); i != m_patch->connections().end(); ++i) {
c = (*i);
if ((c->src_port() == m_port || c->dst_port() == m_port) && !c->pending_disconnection()) {
- DisconnectionEvent* ev = new DisconnectionEvent(CountedPtr<Responder>(new Responder()), _time_stamp,
+ DisconnectionEvent* ev = new DisconnectionEvent(_engine, CountedPtr<Responder>(new Responder()), _time,
c->src_port(), c->dst_port());
ev->pre_process();
m_disconnection_events.push_back(new ListNode<DisconnectionEvent*>(ev));
@@ -117,14 +117,14 @@ DisconnectPortEvent::pre_process()
void
-DisconnectPortEvent::execute(SampleCount offset)
+DisconnectPortEvent::execute(SampleCount nframes, FrameTime start, FrameTime end)
{
if (m_succeeded) {
for (List<DisconnectionEvent*>::iterator i = m_disconnection_events.begin(); i != m_disconnection_events.end(); ++i)
- (*i)->execute(offset);
+ (*i)->execute(nframes, start, end);
}
- QueuedEvent::execute(offset);
+ QueuedEvent::execute(nframes, start, end);
}
diff --git a/src/libs/engine/events/DisconnectPortEvent.h b/src/libs/engine/events/DisconnectPortEvent.h
index 639de102..0c185317 100644
--- a/src/libs/engine/events/DisconnectPortEvent.h
+++ b/src/libs/engine/events/DisconnectPortEvent.h
@@ -43,12 +43,12 @@ using std::string;
class DisconnectPortEvent : public QueuedEvent
{
public:
- DisconnectPortEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& port_path);
- DisconnectPortEvent(Port* port);
+ DisconnectPortEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, const string& port_path);
+ DisconnectPortEvent(Engine& engine, Port* port);
~DisconnectPortEvent();
void pre_process();
- void execute(SampleCount offset);
+ void execute(SampleCount nframes, FrameTime start, FrameTime end);
void post_process();
private:
diff --git a/src/libs/engine/events/DisconnectionEvent.cpp b/src/libs/engine/events/DisconnectionEvent.cpp
index 431061a2..c246e9dc 100644
--- a/src/libs/engine/events/DisconnectionEvent.cpp
+++ b/src/libs/engine/events/DisconnectionEvent.cpp
@@ -35,8 +35,8 @@ namespace Ingen {
//// DisconnectionEvent ////
-DisconnectionEvent::DisconnectionEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& src_port_path, const string& dst_port_path)
-: QueuedEvent(responder, timestamp),
+DisconnectionEvent::DisconnectionEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, const string& src_port_path, const string& dst_port_path)
+: QueuedEvent(engine, responder, timestamp),
m_src_port_path(src_port_path),
m_dst_port_path(dst_port_path),
m_patch(NULL),
@@ -49,8 +49,8 @@ DisconnectionEvent::DisconnectionEvent(CountedPtr<Responder> responder, SampleCo
}
-DisconnectionEvent::DisconnectionEvent(CountedPtr<Responder> responder, SampleCount timestamp, Port* const src_port, Port* const dst_port)
-: QueuedEvent(responder, timestamp),
+DisconnectionEvent::DisconnectionEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, Port* const src_port, Port* const dst_port)
+: QueuedEvent(engine, responder, timestamp),
m_src_port_path(src_port->path()),
m_dst_port_path(dst_port->path()),
m_patch(src_port->parent_node()->parent_patch()),
@@ -85,7 +85,7 @@ DisconnectionEvent::pre_process()
return;
}
- /*m_patch = Engine::instance().object_store()->find_patch(m_src_port_path.parent().parent());
+ /*m_patch = _engine.object_store()->find_patch(m_src_port_path.parent().parent());
if (m_patch == NULL) {
m_error = PORT_NOT_FOUND;
@@ -93,8 +93,8 @@ DisconnectionEvent::pre_process()
return;
}*/
- m_src_port = Engine::instance().object_store()->find_port(m_src_port_path);
- m_dst_port = Engine::instance().object_store()->find_port(m_dst_port_path);
+ m_src_port = _engine.object_store()->find_port(m_src_port_path);
+ m_dst_port = _engine.object_store()->find_port(m_dst_port_path);
}
if (m_src_port == NULL || m_dst_port == NULL) {
@@ -112,10 +112,10 @@ DisconnectionEvent::pre_process()
// Create the typed event to actually do the work
const DataType type = m_src_port->type();
if (type == DataType::FLOAT) {
- m_typed_event = new TypedDisconnectionEvent<Sample>(_responder, _time_stamp,
+ m_typed_event = new TypedDisconnectionEvent<Sample>(_engine, _responder, _time,
dynamic_cast<OutputPort<Sample>*>(m_src_port), dynamic_cast<InputPort<Sample>*>(m_dst_port));
} else if (type == DataType::MIDI) {
- m_typed_event = new TypedDisconnectionEvent<MidiMessage>(_responder, _time_stamp,
+ m_typed_event = new TypedDisconnectionEvent<MidiMessage>(_engine, _responder, _time,
dynamic_cast<OutputPort<MidiMessage>*>(m_src_port), dynamic_cast<InputPort<MidiMessage>*>(m_dst_port));
} else {
m_error = TYPE_MISMATCH;
@@ -131,12 +131,12 @@ DisconnectionEvent::pre_process()
void
-DisconnectionEvent::execute(SampleCount offset)
+DisconnectionEvent::execute(SampleCount nframes, FrameTime start, FrameTime end)
{
- QueuedEvent::execute(offset);
+ QueuedEvent::execute(nframes, start, end);
if (m_error == NO_ERROR)
- m_typed_event->execute(offset);
+ m_typed_event->execute(nframes, start, end);
}
@@ -159,8 +159,8 @@ DisconnectionEvent::post_process()
template <typename T>
-TypedDisconnectionEvent<T>::TypedDisconnectionEvent(CountedPtr<Responder> responder, SampleCount timestamp, OutputPort<T>* src_port, InputPort<T>* dst_port)
-: QueuedEvent(responder, timestamp),
+TypedDisconnectionEvent<T>::TypedDisconnectionEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, OutputPort<T>* src_port, InputPort<T>* dst_port)
+: QueuedEvent(engine, responder, timestamp),
m_src_port(src_port),
m_dst_port(dst_port),
m_patch(NULL),
@@ -223,7 +223,7 @@ TypedDisconnectionEvent<T>::pre_process()
break;
}
- if (m_patch->process())
+ if (m_patch->enabled())
m_process_order = m_patch->build_process_order();
m_succeeded = true;
@@ -233,7 +233,7 @@ TypedDisconnectionEvent<T>::pre_process()
template <typename T>
void
-TypedDisconnectionEvent<T>::execute(SampleCount offset)
+TypedDisconnectionEvent<T>::execute(SampleCount nframes, FrameTime start, FrameTime end)
{
if (m_succeeded) {
@@ -248,18 +248,18 @@ TypedDisconnectionEvent<T>::execute(SampleCount offset)
assert((Connection*)port_connection->elem() == patch_connection->elem());
// Clean up both the list node and the connection itself...
- Engine::instance().maid()->push(port_connection);
- Engine::instance().maid()->push(patch_connection);
- Engine::instance().maid()->push(port_connection->elem());
+ _engine.maid()->push(port_connection);
+ _engine.maid()->push(patch_connection);
+ _engine.maid()->push(port_connection->elem());
if (m_patch->process_order() != NULL)
- Engine::instance().maid()->push(m_patch->process_order());
+ _engine.maid()->push(m_patch->process_order());
m_patch->process_order(m_process_order);
} else {
m_succeeded = false; // Ports weren't connected
}
}
- QueuedEvent::execute(offset);
+ QueuedEvent::execute(nframes, start, end);
}
@@ -271,7 +271,7 @@ TypedDisconnectionEvent<T>::post_process()
_responder->respond_ok();
- Engine::instance().client_broadcaster()->send_disconnection(m_src_port->path(), m_dst_port->path());
+ _engine.client_broadcaster()->send_disconnection(m_src_port->path(), m_dst_port->path());
} else {
_responder->respond_error("Unable to disconnect ports.");
}
diff --git a/src/libs/engine/events/DisconnectionEvent.h b/src/libs/engine/events/DisconnectionEvent.h
index 3108f2f8..1dc53d13 100644
--- a/src/libs/engine/events/DisconnectionEvent.h
+++ b/src/libs/engine/events/DisconnectionEvent.h
@@ -46,12 +46,12 @@ template <typename T> class TypedDisconnectionEvent; // helper, defined below
class DisconnectionEvent : public QueuedEvent
{
public:
- DisconnectionEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& src_port_path, const string& dst_port_path);
- DisconnectionEvent(CountedPtr<Responder> responder, SampleCount timestamp, Port* const src_port, Port* const dst_port);
+ DisconnectionEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, const string& src_port_path, const string& dst_port_path);
+ DisconnectionEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, Port* const src_port, Port* const dst_port);
~DisconnectionEvent();
void pre_process();
- void execute(SampleCount offset);
+ void execute(SampleCount nframes, FrameTime start, FrameTime end);
void post_process();
private:
@@ -82,10 +82,10 @@ template <typename T>
class TypedDisconnectionEvent : public QueuedEvent
{
public:
- TypedDisconnectionEvent(CountedPtr<Responder> responder, SampleCount timestamp, OutputPort<T>* src_port, InputPort<T>* dst_port);
+ TypedDisconnectionEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, OutputPort<T>* src_port, InputPort<T>* dst_port);
void pre_process();
- void execute(SampleCount offset);
+ void execute(SampleCount nframes, FrameTime start, FrameTime end);
void post_process();
private:
diff --git a/src/libs/engine/events/EnablePatchEvent.cpp b/src/libs/engine/events/EnablePatchEvent.cpp
index b2b3ee08..132aefcc 100644
--- a/src/libs/engine/events/EnablePatchEvent.cpp
+++ b/src/libs/engine/events/EnablePatchEvent.cpp
@@ -25,8 +25,8 @@
namespace Ingen {
-EnablePatchEvent::EnablePatchEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& patch_path)
-: QueuedEvent(responder, timestamp),
+EnablePatchEvent::EnablePatchEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, const string& patch_path)
+: QueuedEvent(engine, responder, timestamp),
m_patch_path(patch_path),
m_patch(NULL),
m_process_order(NULL)
@@ -37,7 +37,7 @@ EnablePatchEvent::EnablePatchEvent(CountedPtr<Responder> responder, SampleCount
void
EnablePatchEvent::pre_process()
{
- m_patch = Engine::instance().object_store()->find_patch(m_patch_path);
+ m_patch = _engine.object_store()->find_patch(m_patch_path);
if (m_patch != NULL) {
/* Any event that requires a new process order will set the patch's
@@ -52,16 +52,16 @@ EnablePatchEvent::pre_process()
void
-EnablePatchEvent::execute(SampleCount offset)
+EnablePatchEvent::execute(SampleCount nframes, FrameTime start, FrameTime end)
{
if (m_patch != NULL) {
- m_patch->process(true);
+ m_patch->enable();
if (m_patch->process_order() == NULL)
m_patch->process_order(m_process_order);
}
- QueuedEvent::execute(offset);
+ QueuedEvent::execute(nframes, start, end);
}
@@ -70,7 +70,7 @@ EnablePatchEvent::post_process()
{
if (m_patch != NULL) {
_responder->respond_ok();
- Engine::instance().client_broadcaster()->send_patch_enable(m_patch_path);
+ _engine.client_broadcaster()->send_patch_enable(m_patch_path);
} else {
_responder->respond_error(string("Patch ") + m_patch_path + " not found");
}
diff --git a/src/libs/engine/events/EnablePatchEvent.h b/src/libs/engine/events/EnablePatchEvent.h
index 4ae93099..8e39e3a7 100644
--- a/src/libs/engine/events/EnablePatchEvent.h
+++ b/src/libs/engine/events/EnablePatchEvent.h
@@ -37,10 +37,10 @@ class Node;
class EnablePatchEvent : public QueuedEvent
{
public:
- EnablePatchEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& patch_path);
+ EnablePatchEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, const string& patch_path);
void pre_process();
- void execute(SampleCount offset);
+ void execute(SampleCount nframes, FrameTime start, FrameTime end);
void post_process();
private:
diff --git a/src/libs/engine/events/LashRestoreDoneEvent.h b/src/libs/engine/events/LashRestoreDoneEvent.h
index b543905c..be07bed0 100644
--- a/src/libs/engine/events/LashRestoreDoneEvent.h
+++ b/src/libs/engine/events/LashRestoreDoneEvent.h
@@ -39,7 +39,7 @@ class Port;
class LashRestoreDoneEvent : public QueuedEvent
{
public:
- LashRestoreDoneEvent(CountedPtr<Responder> responder, SampleCount timestamp) : QueuedEvent(responder, timestamp) {}
+ LashRestoreDoneEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp) : QueuedEvent(engine, responder, timestamp) {}
void post_process()
{
diff --git a/src/libs/engine/events/LoadPluginsEvent.cpp b/src/libs/engine/events/LoadPluginsEvent.cpp
index cae25733..6962387b 100644
--- a/src/libs/engine/events/LoadPluginsEvent.cpp
+++ b/src/libs/engine/events/LoadPluginsEvent.cpp
@@ -25,11 +25,11 @@ using std::cerr;
namespace Ingen {
-LoadPluginsEvent::LoadPluginsEvent(CountedPtr<Responder> responder, SampleCount timestamp)
-: QueuedEvent(responder, timestamp)
+LoadPluginsEvent::LoadPluginsEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp)
+: QueuedEvent(engine, responder, timestamp)
{
cerr << "LOADING PLUGINS\n";
- Engine::instance().node_factory()->load_plugins();
+ _engine.node_factory()->load_plugins();
}
diff --git a/src/libs/engine/events/LoadPluginsEvent.h b/src/libs/engine/events/LoadPluginsEvent.h
index 0e40ca7e..ae784e3a 100644
--- a/src/libs/engine/events/LoadPluginsEvent.h
+++ b/src/libs/engine/events/LoadPluginsEvent.h
@@ -29,7 +29,7 @@ namespace Ingen {
class LoadPluginsEvent : public QueuedEvent
{
public:
- LoadPluginsEvent(CountedPtr<Responder> responder, SampleCount timestamp);
+ LoadPluginsEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp);
void post_process();
};
diff --git a/src/libs/engine/events/MidiLearnEvent.cpp b/src/libs/engine/events/MidiLearnEvent.cpp
index 814ecdb5..822573e0 100644
--- a/src/libs/engine/events/MidiLearnEvent.cpp
+++ b/src/libs/engine/events/MidiLearnEvent.cpp
@@ -30,15 +30,15 @@ namespace Ingen {
void
MidiLearnResponseEvent::post_process()
{
- Engine::instance().client_broadcaster()->send_control_change(m_port_path, m_value);
+ _engine.client_broadcaster()->send_control_change(m_port_path, m_value);
}
// MidiLearnEvent
-MidiLearnEvent::MidiLearnEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& node_path)
-: QueuedEvent(responder, timestamp),
+MidiLearnEvent::MidiLearnEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, const string& node_path)
+: QueuedEvent(engine, responder, timestamp),
m_node_path(node_path),
m_node(NULL),
m_response_event(NULL)
@@ -49,17 +49,17 @@ MidiLearnEvent::MidiLearnEvent(CountedPtr<Responder> responder, SampleCount time
void
MidiLearnEvent::pre_process()
{
- m_node = Engine::instance().object_store()->find_node(m_node_path);
- m_response_event = new MidiLearnResponseEvent(m_node_path + "/Controller_Number", _time_stamp);
+ m_node = _engine.object_store()->find_node(m_node_path);
+ m_response_event = new MidiLearnResponseEvent(_engine, m_node_path + "/Controller_Number", _time);
QueuedEvent::pre_process();
}
void
-MidiLearnEvent::execute(SampleCount offset)
+MidiLearnEvent::execute(SampleCount nframes, FrameTime start, FrameTime end)
{
- QueuedEvent::execute(offset);
+ QueuedEvent::execute(nframes, start, end);
// FIXME: this isn't very good at all.
if (m_node != NULL && m_node->plugin()->type() == Plugin::Internal
diff --git a/src/libs/engine/events/MidiLearnEvent.h b/src/libs/engine/events/MidiLearnEvent.h
index 558261a8..7a36706c 100644
--- a/src/libs/engine/events/MidiLearnEvent.h
+++ b/src/libs/engine/events/MidiLearnEvent.h
@@ -37,8 +37,8 @@ class ControlChangeEvent;
class MidiLearnResponseEvent : public Event
{
public:
- MidiLearnResponseEvent(const string& port_path, SampleCount timestamp)
- : Event(NULL, timestamp),
+ MidiLearnResponseEvent(Engine& engine, const string& port_path, SampleCount timestamp)
+ : Event(engine, NULL, timestamp),
m_port_path(port_path),
m_value(0.0f)
{}
@@ -64,10 +64,10 @@ private:
class MidiLearnEvent : public QueuedEvent
{
public:
- MidiLearnEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& node_path);
+ MidiLearnEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, const string& node_path);
void pre_process();
- void execute(SampleCount offset);
+ void execute(SampleCount nframes, FrameTime start, FrameTime end);
void post_process();
private:
diff --git a/src/libs/engine/events/NoteOffEvent.cpp b/src/libs/engine/events/NoteOffEvent.cpp
index 027e9f1f..8145c208 100644
--- a/src/libs/engine/events/NoteOffEvent.cpp
+++ b/src/libs/engine/events/NoteOffEvent.cpp
@@ -27,8 +27,8 @@ namespace Ingen {
/** Note off with patch explicitly passed - triggered by MIDI.
*/
-NoteOffEvent::NoteOffEvent(CountedPtr<Responder> responder, SampleCount timestamp, Node* node, uchar note_num)
-: Event(responder, timestamp),
+NoteOffEvent::NoteOffEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, Node* node, uchar note_num)
+: Event(engine, responder, timestamp),
m_node(node),
m_note_num(note_num)
{
@@ -37,8 +37,8 @@ NoteOffEvent::NoteOffEvent(CountedPtr<Responder> responder, SampleCount timestam
/** Note off event with lookup - triggered by OSC.
*/
-NoteOffEvent::NoteOffEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& node_path, uchar note_num)
-: Event(responder, timestamp),
+NoteOffEvent::NoteOffEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, const string& node_path, uchar note_num)
+: Event(engine, responder, timestamp),
m_node(NULL),
m_node_path(node_path),
m_note_num(note_num)
@@ -47,17 +47,19 @@ NoteOffEvent::NoteOffEvent(CountedPtr<Responder> responder, SampleCount timestam
void
-NoteOffEvent::execute(SampleCount offset)
+NoteOffEvent::execute(SampleCount nframes, FrameTime start, FrameTime end)
{
+ assert(_time >= start && _time <= end);
+
if (m_node == NULL && m_node_path != "")
- m_node = Engine::instance().object_store()->find_node(m_node_path);
+ m_node = _engine.object_store()->find_node(m_node_path);
// FIXME: this isn't very good at all.
if (m_node != NULL && m_node->plugin()->type() == Plugin::Internal) {
if (m_node->plugin()->plug_label() == "note_in")
- ((MidiNoteNode*)m_node)->note_off(m_note_num, offset);
+ ((MidiNoteNode*)m_node)->note_off(m_note_num, _time, nframes, start, end);
else if (m_node->plugin()->plug_label() == "trigger_in")
- ((MidiTriggerNode*)m_node)->note_off(m_note_num, offset);
+ ((MidiTriggerNode*)m_node)->note_off(m_note_num, _time, nframes, start, end);
}
}
diff --git a/src/libs/engine/events/NoteOffEvent.h b/src/libs/engine/events/NoteOffEvent.h
index 707077a1..e3e9a56b 100644
--- a/src/libs/engine/events/NoteOffEvent.h
+++ b/src/libs/engine/events/NoteOffEvent.h
@@ -34,10 +34,10 @@ class Node;
class NoteOffEvent : public Event
{
public:
- NoteOffEvent(CountedPtr<Responder> responder, SampleCount timestamp, Node* node, uchar note_num);
- NoteOffEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& node_path, uchar note_num);
+ NoteOffEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, Node* node, uchar note_num);
+ NoteOffEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, const string& node_path, uchar note_num);
- void execute(SampleCount offset);
+ void execute(SampleCount nframes, FrameTime start, FrameTime end);
void post_process();
private:
diff --git a/src/libs/engine/events/NoteOnEvent.cpp b/src/libs/engine/events/NoteOnEvent.cpp
index cbbc0e1d..7a98c58d 100644
--- a/src/libs/engine/events/NoteOnEvent.cpp
+++ b/src/libs/engine/events/NoteOnEvent.cpp
@@ -30,8 +30,8 @@ namespace Ingen {
*
* Used to be triggered by MIDI. Not used anymore.
*/
-NoteOnEvent::NoteOnEvent(CountedPtr<Responder> responder, SampleCount timestamp, Node* patch, uchar note_num, uchar velocity)
-: Event(responder, timestamp),
+NoteOnEvent::NoteOnEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, Node* patch, uchar note_num, uchar velocity)
+: Event(engine, responder, timestamp),
m_node(patch),
m_note_num(note_num),
m_velocity(velocity),
@@ -44,8 +44,8 @@ NoteOnEvent::NoteOnEvent(CountedPtr<Responder> responder, SampleCount timestamp,
*
* Triggered by OSC.
*/
-NoteOnEvent::NoteOnEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& node_path, uchar note_num, uchar velocity)
-: Event(responder, timestamp),
+NoteOnEvent::NoteOnEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, const string& node_path, uchar note_num, uchar velocity)
+: Event(engine, responder, timestamp),
m_node(NULL),
m_node_path(node_path),
m_note_num(note_num),
@@ -56,18 +56,20 @@ NoteOnEvent::NoteOnEvent(CountedPtr<Responder> responder, SampleCount timestamp,
void
-NoteOnEvent::execute(SampleCount offset)
+NoteOnEvent::execute(SampleCount nframes, FrameTime start, FrameTime end)
{
+ assert(_time >= start && _time <= end);
+
// Lookup if neccessary
if (m_is_osc_triggered)
- m_node = Engine::instance().object_store()->find_node(m_node_path);
+ m_node = _engine.object_store()->find_node(m_node_path);
// FIXME: this isn't very good at all.
if (m_node != NULL && m_node->plugin()->type() == Plugin::Internal) {
if (m_node->plugin()->plug_label() == "note_in")
- ((MidiNoteNode*)m_node)->note_on(m_note_num, m_velocity, offset);
+ ((MidiNoteNode*)m_node)->note_on(m_note_num, m_velocity, _time, nframes, start, end);
else if (m_node->plugin()->plug_label() == "trigger_in")
- ((MidiTriggerNode*)m_node)->note_on(m_note_num, m_velocity, offset);
+ ((MidiTriggerNode*)m_node)->note_on(m_note_num, m_velocity, _time, nframes, start, end);
}
}
diff --git a/src/libs/engine/events/NoteOnEvent.h b/src/libs/engine/events/NoteOnEvent.h
index 209e7137..92ffbca5 100644
--- a/src/libs/engine/events/NoteOnEvent.h
+++ b/src/libs/engine/events/NoteOnEvent.h
@@ -34,10 +34,10 @@ class Node;
class NoteOnEvent : public Event
{
public:
- NoteOnEvent(CountedPtr<Responder> responder, SampleCount timestamp, Node* patch, uchar note_num, uchar velocity);
- NoteOnEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& node_path, uchar note_num, uchar velocity);
+ NoteOnEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, Node* patch, uchar note_num, uchar velocity);
+ NoteOnEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, const string& node_path, uchar note_num, uchar velocity);
- void execute(SampleCount offset);
+ void execute(SampleCount nframes, FrameTime start, FrameTime end);
void post_process();
private:
diff --git a/src/libs/engine/events/PingQueuedEvent.h b/src/libs/engine/events/PingQueuedEvent.h
index 10e3a3bb..883ee818 100644
--- a/src/libs/engine/events/PingQueuedEvent.h
+++ b/src/libs/engine/events/PingQueuedEvent.h
@@ -34,7 +34,7 @@ class Port;
class PingQueuedEvent : public QueuedEvent
{
public:
- PingQueuedEvent(CountedPtr<Responder> responder, SampleCount timestamp) : QueuedEvent(responder, timestamp) {}
+ PingQueuedEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp) : QueuedEvent(engine, responder, timestamp) {}
void post_process() { _responder->respond_ok(); }
};
diff --git a/src/libs/engine/events/RegisterClientEvent.cpp b/src/libs/engine/events/RegisterClientEvent.cpp
index ab076059..e35b7fdb 100644
--- a/src/libs/engine/events/RegisterClientEvent.cpp
+++ b/src/libs/engine/events/RegisterClientEvent.cpp
@@ -22,11 +22,11 @@
namespace Ingen {
-RegisterClientEvent::RegisterClientEvent(CountedPtr<Responder> responder,
+RegisterClientEvent::RegisterClientEvent(Engine& engine, CountedPtr<Responder> responder,
SampleCount timestamp,
ClientKey key,
CountedPtr<ClientInterface> client)
-: QueuedEvent(responder, timestamp)
+: QueuedEvent(engine, responder, timestamp)
, _key(key)
, _client(client)
{
@@ -36,7 +36,7 @@ RegisterClientEvent::RegisterClientEvent(CountedPtr<Responder> responder,
void
RegisterClientEvent::pre_process()
{
- Engine::instance().client_broadcaster()->register_client(_key, _client);
+ _engine.client_broadcaster()->register_client(_key, _client);
QueuedEvent::pre_process();
}
diff --git a/src/libs/engine/events/RegisterClientEvent.h b/src/libs/engine/events/RegisterClientEvent.h
index bc26c3bb..d68a0f83 100644
--- a/src/libs/engine/events/RegisterClientEvent.h
+++ b/src/libs/engine/events/RegisterClientEvent.h
@@ -35,7 +35,7 @@ namespace Ingen {
class RegisterClientEvent : public QueuedEvent
{
public:
- RegisterClientEvent(CountedPtr<Responder> responder,
+ RegisterClientEvent(Engine& engine, CountedPtr<Responder> responder,
SampleCount timestamp,
ClientKey key,
CountedPtr<ClientInterface> client);
diff --git a/src/libs/engine/events/RenameEvent.cpp b/src/libs/engine/events/RenameEvent.cpp
index 25a54285..465f4946 100644
--- a/src/libs/engine/events/RenameEvent.cpp
+++ b/src/libs/engine/events/RenameEvent.cpp
@@ -27,8 +27,8 @@
namespace Ingen {
-RenameEvent::RenameEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& path, const string& name)
-: QueuedEvent(responder, timestamp),
+RenameEvent::RenameEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, const string& path, const string& name)
+: QueuedEvent(engine, responder, timestamp),
m_old_path(path),
m_name(name),
m_new_path(m_old_path.parent().base_path() + name),
@@ -58,13 +58,13 @@ RenameEvent::pre_process()
return;
}
- if (Engine::instance().object_store()->find(m_new_path)) {
+ if (_engine.object_store()->find(m_new_path)) {
m_error = OBJECT_EXISTS;
QueuedEvent::pre_process();
return;
}
- GraphObject* obj = Engine::instance().object_store()->find(m_old_path);
+ GraphObject* obj = _engine.object_store()->find(m_old_path);
if (obj == NULL) {
m_error = OBJECT_NOT_FOUND;
@@ -89,10 +89,10 @@ RenameEvent::pre_process()
void
-RenameEvent::execute(SampleCount offset)
+RenameEvent::execute(SampleCount nframes, FrameTime start, FrameTime end)
{
//cout << "Executing rename event...";
- QueuedEvent::execute(offset);
+ QueuedEvent::execute(nframes, start, end);
}
@@ -103,7 +103,7 @@ RenameEvent::post_process()
if (m_error == NO_ERROR) {
_responder->respond_ok();
- Engine::instance().client_broadcaster()->send_rename(m_old_path, m_new_path);
+ _engine.client_broadcaster()->send_rename(m_old_path, m_new_path);
} else {
if (m_error == OBJECT_EXISTS)
msg.append("Object already exists at ").append(m_new_path);
diff --git a/src/libs/engine/events/RenameEvent.h b/src/libs/engine/events/RenameEvent.h
index d13efea9..fd01820b 100644
--- a/src/libs/engine/events/RenameEvent.h
+++ b/src/libs/engine/events/RenameEvent.h
@@ -42,11 +42,11 @@ class DisconnectPortEvent;
class RenameEvent : public QueuedEvent
{
public:
- RenameEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& path, const string& name);
+ RenameEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, const string& path, const string& name);
~RenameEvent();
void pre_process();
- void execute(SampleCount offset);
+ void execute(SampleCount nframes, FrameTime start, FrameTime end);
void post_process();
private:
diff --git a/src/libs/engine/events/RequestAllObjectsEvent.cpp b/src/libs/engine/events/RequestAllObjectsEvent.cpp
index b28294cc..5eb780b3 100644
--- a/src/libs/engine/events/RequestAllObjectsEvent.cpp
+++ b/src/libs/engine/events/RequestAllObjectsEvent.cpp
@@ -18,12 +18,14 @@
#include "Responder.h"
#include "Engine.h"
#include "ObjectSender.h"
+#include "ClientBroadcaster.h"
+#include "ObjectStore.h"
namespace Ingen {
-RequestAllObjectsEvent::RequestAllObjectsEvent(CountedPtr<Responder> responder, SampleCount timestamp)
-: QueuedEvent(responder, timestamp),
+RequestAllObjectsEvent::RequestAllObjectsEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp)
+: QueuedEvent(engine, responder, timestamp),
m_client(CountedPtr<ClientInterface>(NULL))
{
}
@@ -32,7 +34,7 @@ RequestAllObjectsEvent::RequestAllObjectsEvent(CountedPtr<Responder> responder,
void
RequestAllObjectsEvent::pre_process()
{
- m_client = _responder->find_client();
+ m_client = _engine.client_broadcaster()->client(_responder->client_key());
QueuedEvent::pre_process();
}
@@ -43,9 +45,14 @@ RequestAllObjectsEvent::post_process()
{
if (m_client) {
_responder->respond_ok();
- ObjectSender::send_all(m_client.get());
+
+ // Everything is a child of the root patch, so this sends it all
+ Patch* root = _engine.object_store()->find_patch("/");
+ if (root)
+ ObjectSender::send_patch(m_client.get(), root);
+
} else {
- _responder->respond_error("Invalid URL");
+ _responder->respond_error("Unable to find client to send all objects");
}
}
diff --git a/src/libs/engine/events/RequestAllObjectsEvent.h b/src/libs/engine/events/RequestAllObjectsEvent.h
index 760a06ea..7651700f 100644
--- a/src/libs/engine/events/RequestAllObjectsEvent.h
+++ b/src/libs/engine/events/RequestAllObjectsEvent.h
@@ -35,7 +35,7 @@ namespace Shared {
class RequestAllObjectsEvent : public QueuedEvent
{
public:
- RequestAllObjectsEvent(CountedPtr<Responder> responder, SampleCount timestamp);
+ RequestAllObjectsEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp);
void pre_process();
void post_process();
diff --git a/src/libs/engine/events/RequestMetadataEvent.cpp b/src/libs/engine/events/RequestMetadataEvent.cpp
index e8112797..03d84d7f 100644
--- a/src/libs/engine/events/RequestMetadataEvent.cpp
+++ b/src/libs/engine/events/RequestMetadataEvent.cpp
@@ -27,8 +27,8 @@ using std::string;
namespace Ingen {
-RequestMetadataEvent::RequestMetadataEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& node_path, const string& key)
-: QueuedEvent(responder, timestamp),
+RequestMetadataEvent::RequestMetadataEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, const string& node_path, const string& key)
+: QueuedEvent(engine, responder, timestamp),
m_path(node_path),
m_key(key),
m_value(""),
@@ -41,10 +41,10 @@ RequestMetadataEvent::RequestMetadataEvent(CountedPtr<Responder> responder, Samp
void
RequestMetadataEvent::pre_process()
{
- m_client = _responder->find_client();
+ m_client = _engine.client_broadcaster()->client(_responder->client_key());
if (m_client) {
- m_object = Engine::instance().object_store()->find(m_path);
+ m_object = _engine.object_store()->find(m_path);
if (m_object == NULL) {
QueuedEvent::pre_process();
return;
diff --git a/src/libs/engine/events/RequestMetadataEvent.h b/src/libs/engine/events/RequestMetadataEvent.h
index 0b1cc267..4f99e023 100644
--- a/src/libs/engine/events/RequestMetadataEvent.h
+++ b/src/libs/engine/events/RequestMetadataEvent.h
@@ -37,7 +37,7 @@ namespace Shared {
class RequestMetadataEvent : public QueuedEvent
{
public:
- RequestMetadataEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& path, const string& key);
+ RequestMetadataEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, const string& path, const string& key);
void pre_process();
void post_process();
diff --git a/src/libs/engine/events/RequestPluginsEvent.cpp b/src/libs/engine/events/RequestPluginsEvent.cpp
index 65dfb7aa..9efb2388 100644
--- a/src/libs/engine/events/RequestPluginsEvent.cpp
+++ b/src/libs/engine/events/RequestPluginsEvent.cpp
@@ -18,12 +18,13 @@
#include "Responder.h"
#include "Engine.h"
#include "ClientBroadcaster.h"
+#include "NodeFactory.h"
namespace Ingen {
-RequestPluginsEvent::RequestPluginsEvent(CountedPtr<Responder> responder, SampleCount timestamp)
-: QueuedEvent(responder, timestamp),
+RequestPluginsEvent::RequestPluginsEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp)
+: QueuedEvent(engine, responder, timestamp),
m_client(CountedPtr<ClientInterface>(NULL))
{
}
@@ -32,8 +33,12 @@ RequestPluginsEvent::RequestPluginsEvent(CountedPtr<Responder> responder, Sample
void
RequestPluginsEvent::pre_process()
{
- m_client = _responder->find_client();
+ m_client = _engine.client_broadcaster()->client(_responder->client_key());
+ // Take a copy to send in the post processing thread (to avoid problems
+ // because std::list isn't thread safe)
+ m_plugins = _engine.node_factory()->plugins();
+
QueuedEvent::pre_process();
}
@@ -42,10 +47,10 @@ void
RequestPluginsEvent::post_process()
{
if (m_client) {
- Engine::instance().client_broadcaster()->send_plugins_to(m_client.get());
+ _engine.client_broadcaster()->send_plugins_to(m_client.get(), m_plugins);
_responder->respond_ok();
} else {
- _responder->respond_error("Invalid URL");
+ _responder->respond_error("Unable to find client to send plugins");
}
}
diff --git a/src/libs/engine/events/RequestPluginsEvent.h b/src/libs/engine/events/RequestPluginsEvent.h
index 0a35a1ad..cd2d05fc 100644
--- a/src/libs/engine/events/RequestPluginsEvent.h
+++ b/src/libs/engine/events/RequestPluginsEvent.h
@@ -18,11 +18,13 @@
#define REQUESTPLUGINSEVENT_H
#include <string>
+#include <list>
#include "QueuedEvent.h"
using std::string;
namespace Ingen {
+class Plugin;
class Responder;
namespace Shared {
class ClientInterface;
@@ -36,13 +38,14 @@ namespace Shared {
class RequestPluginsEvent : public QueuedEvent
{
public:
- RequestPluginsEvent(CountedPtr<Responder> responder, SampleCount timestamp);
+ RequestPluginsEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp);
void pre_process();
void post_process();
private:
CountedPtr<ClientInterface> m_client;
+ std::list<Plugin*> m_plugins;
};
diff --git a/src/libs/engine/events/RequestPortValueEvent.cpp b/src/libs/engine/events/RequestPortValueEvent.cpp
index d02eed6a..830ef852 100644
--- a/src/libs/engine/events/RequestPortValueEvent.cpp
+++ b/src/libs/engine/events/RequestPortValueEvent.cpp
@@ -28,8 +28,8 @@ using std::string;
namespace Ingen {
-RequestPortValueEvent::RequestPortValueEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& port_path)
-: QueuedEvent(responder, timestamp),
+RequestPortValueEvent::RequestPortValueEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, const string& port_path)
+: QueuedEvent(engine, responder, timestamp),
m_port_path(port_path),
m_port(NULL),
m_value(0.0),
@@ -41,22 +41,24 @@ RequestPortValueEvent::RequestPortValueEvent(CountedPtr<Responder> responder, Sa
void
RequestPortValueEvent::pre_process()
{
- m_client = _responder->find_client();
- m_port = Engine::instance().object_store()->find_port(m_port_path);
+ m_client = _engine.client_broadcaster()->client(_responder->client_key());
+ m_port = _engine.object_store()->find_port(m_port_path);
QueuedEvent::pre_process();
}
void
-RequestPortValueEvent::execute(SampleCount offset)
+RequestPortValueEvent::execute(SampleCount nframes, FrameTime start, FrameTime end)
{
+ assert(_time >= start && _time <= end);
+
if (m_port != NULL && m_port->type() == DataType::FLOAT)
- m_value = ((TypedPort<Sample>*)m_port)->buffer(0)->value_at(offset);
+ m_value = ((TypedPort<Sample>*)m_port)->buffer(0)->value_at(_time - start);
else
m_port = NULL; // triggers error response
- QueuedEvent::execute(offset);
+ QueuedEvent::execute(nframes, start, end);
}
@@ -70,7 +72,7 @@ RequestPortValueEvent::post_process()
_responder->respond_ok();
m_client->control_change(m_port_path, m_value);
} else {
- _responder->respond_error("Invalid URL");
+ _responder->respond_error("Unable to find client to send port value");
}
}
diff --git a/src/libs/engine/events/RequestPortValueEvent.h b/src/libs/engine/events/RequestPortValueEvent.h
index 9b809b3d..204f1911 100644
--- a/src/libs/engine/events/RequestPortValueEvent.h
+++ b/src/libs/engine/events/RequestPortValueEvent.h
@@ -37,10 +37,10 @@ using Shared::ClientInterface;
class RequestPortValueEvent : public QueuedEvent
{
public:
- RequestPortValueEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& port_path);
+ RequestPortValueEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, const string& port_path);
void pre_process();
- void execute(SampleCount offset);
+ void execute(SampleCount nframes, FrameTime start, FrameTime end);
void post_process();
private:
diff --git a/src/libs/engine/events/SetMetadataEvent.cpp b/src/libs/engine/events/SetMetadataEvent.cpp
index 3d77b77b..1ce5d6f4 100644
--- a/src/libs/engine/events/SetMetadataEvent.cpp
+++ b/src/libs/engine/events/SetMetadataEvent.cpp
@@ -27,8 +27,8 @@ using std::string;
namespace Ingen {
-SetMetadataEvent::SetMetadataEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& path, const string& key, const string& value)
-: QueuedEvent(responder, timestamp),
+SetMetadataEvent::SetMetadataEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, const string& path, const string& key, const string& value)
+: QueuedEvent(engine, responder, timestamp),
m_path(path),
m_key(key),
m_value(value),
@@ -40,7 +40,7 @@ SetMetadataEvent::SetMetadataEvent(CountedPtr<Responder> responder, SampleCount
void
SetMetadataEvent::pre_process()
{
- m_object = Engine::instance().object_store()->find(m_path);
+ m_object = _engine.object_store()->find(m_path);
if (m_object == NULL) {
QueuedEvent::pre_process();
return;
@@ -53,11 +53,11 @@ SetMetadataEvent::pre_process()
void
-SetMetadataEvent::execute(SampleCount offset)
+SetMetadataEvent::execute(SampleCount nframes, FrameTime start, FrameTime end)
{
// Do nothing
- QueuedEvent::execute(offset);
+ QueuedEvent::execute(nframes, start, end);
}
@@ -70,7 +70,7 @@ SetMetadataEvent::post_process()
_responder->respond_error(msg);
} else {
_responder->respond_ok();
- Engine::instance().client_broadcaster()->send_metadata_update(m_path, m_key, m_value);
+ _engine.client_broadcaster()->send_metadata_update(m_path, m_key, m_value);
}
}
diff --git a/src/libs/engine/events/SetMetadataEvent.h b/src/libs/engine/events/SetMetadataEvent.h
index 7ea534a1..855aeb62 100644
--- a/src/libs/engine/events/SetMetadataEvent.h
+++ b/src/libs/engine/events/SetMetadataEvent.h
@@ -34,10 +34,10 @@ class GraphObject;
class SetMetadataEvent : public QueuedEvent
{
public:
- SetMetadataEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& path, const string& key, const string& value);
+ SetMetadataEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, const string& path, const string& key, const string& value);
void pre_process();
- void execute(SampleCount offset);
+ void execute(SampleCount nframes, FrameTime start, FrameTime end);
void post_process();
private:
diff --git a/src/libs/engine/events/SetPortValueEvent.cpp b/src/libs/engine/events/SetPortValueEvent.cpp
index 6331a4b5..4018139a 100644
--- a/src/libs/engine/events/SetPortValueEvent.cpp
+++ b/src/libs/engine/events/SetPortValueEvent.cpp
@@ -27,8 +27,8 @@ namespace Ingen {
/** Voice-specific control setting
*/
-SetPortValueEvent::SetPortValueEvent(CountedPtr<Responder> responder, SampleCount timestamp, size_t voice_num, const string& port_path, Sample val)
-: Event(responder, timestamp),
+SetPortValueEvent::SetPortValueEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, size_t voice_num, const string& port_path, Sample val)
+: Event(engine, responder, timestamp),
m_voice_num(voice_num),
m_port_path(port_path),
m_val(val),
@@ -38,8 +38,8 @@ SetPortValueEvent::SetPortValueEvent(CountedPtr<Responder> responder, SampleCoun
}
-SetPortValueEvent::SetPortValueEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& port_path, Sample val)
-: Event(responder, timestamp),
+SetPortValueEvent::SetPortValueEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, const string& port_path, Sample val)
+: Event(engine, responder, timestamp),
m_voice_num(-1),
m_port_path(port_path),
m_val(val),
@@ -50,10 +50,12 @@ SetPortValueEvent::SetPortValueEvent(CountedPtr<Responder> responder, SampleCoun
void
-SetPortValueEvent::execute(SampleCount offset)
+SetPortValueEvent::execute(SampleCount nframes, FrameTime start, FrameTime end)
{
+ assert(_time >= start && _time <= end);
+
if (m_port == NULL)
- m_port = Engine::instance().object_store()->find_port(m_port_path);
+ m_port = _engine.object_store()->find_port(m_port_path);
if (m_port == NULL) {
m_error = PORT_NOT_FOUND;
@@ -61,9 +63,9 @@ SetPortValueEvent::execute(SampleCount offset)
m_error = TYPE_MISMATCH;
} else {
if (m_voice_num == -1)
- ((TypedPort<Sample>*)m_port)->set_value(m_val, offset);
+ ((TypedPort<Sample>*)m_port)->set_value(m_val, _time - start);
else
- ((TypedPort<Sample>*)m_port)->set_value(m_voice_num, m_val, offset);
+ ((TypedPort<Sample>*)m_port)->set_value(m_voice_num, m_val, _time - start);
//((TypedPort<Sample>*)m_port)->buffer(m_voice_num)->set(m_val, offset); // FIXME: check range
}
}
@@ -76,13 +78,13 @@ SetPortValueEvent::post_process()
assert(m_port != NULL);
_responder->respond_ok();
- Engine::instance().client_broadcaster()->send_control_change(m_port_path, m_val);
+ _engine.client_broadcaster()->send_control_change(m_port_path, m_val);
// Send patch port control change, if this is a bridge port
/*Port* parent_port = m_port->parent_node()->as_port();
if (parent_port != NULL) {
assert(parent_port->type() == DataType::FLOAT);
- Engine::instance().client_broadcaster()->send_control_change(parent_port->path(), m_val);
+ _engine.client_broadcaster()->send_control_change(parent_port->path(), m_val);
}*/
} else if (m_error == PORT_NOT_FOUND) {
diff --git a/src/libs/engine/events/SetPortValueEvent.h b/src/libs/engine/events/SetPortValueEvent.h
index ecd1557a..2572df55 100644
--- a/src/libs/engine/events/SetPortValueEvent.h
+++ b/src/libs/engine/events/SetPortValueEvent.h
@@ -34,10 +34,10 @@ class Port;
class SetPortValueEvent : public Event
{
public:
- SetPortValueEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& port_path, Sample val);
- SetPortValueEvent(CountedPtr<Responder> responder, SampleCount timestamp, size_t voice_num, const string& port_path, Sample val);
+ SetPortValueEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, const string& port_path, Sample val);
+ SetPortValueEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, size_t voice_num, const string& port_path, Sample val);
- void execute(SampleCount offset);
+ void execute(SampleCount nframes, FrameTime start, FrameTime end);
void post_process();
private:
diff --git a/src/libs/engine/events/SetPortValueQueuedEvent.cpp b/src/libs/engine/events/SetPortValueQueuedEvent.cpp
index 8a5afc65..caee68a6 100644
--- a/src/libs/engine/events/SetPortValueQueuedEvent.cpp
+++ b/src/libs/engine/events/SetPortValueQueuedEvent.cpp
@@ -28,8 +28,8 @@ namespace Ingen {
/** Voice-specific control setting
*/
-SetPortValueQueuedEvent::SetPortValueQueuedEvent(CountedPtr<Responder> responder, SampleCount timestamp, size_t voice_num, const string& port_path, Sample val)
-: QueuedEvent(responder, timestamp),
+SetPortValueQueuedEvent::SetPortValueQueuedEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, size_t voice_num, const string& port_path, Sample val)
+: QueuedEvent(engine, responder, timestamp),
m_voice_num(voice_num),
m_port_path(port_path),
m_val(val),
@@ -39,8 +39,8 @@ SetPortValueQueuedEvent::SetPortValueQueuedEvent(CountedPtr<Responder> responder
}
-SetPortValueQueuedEvent::SetPortValueQueuedEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& port_path, Sample val)
-: QueuedEvent(responder, timestamp),
+SetPortValueQueuedEvent::SetPortValueQueuedEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, const string& port_path, Sample val)
+: QueuedEvent(engine, responder, timestamp),
m_voice_num(-1),
m_port_path(port_path),
m_val(val),
@@ -54,7 +54,7 @@ void
SetPortValueQueuedEvent::pre_process()
{
if (m_port == NULL)
- m_port = Engine::instance().object_store()->find_port(m_port_path);
+ m_port = _engine.object_store()->find_port(m_port_path);
if (m_port == NULL) {
m_error = PORT_NOT_FOUND;
@@ -67,16 +67,18 @@ SetPortValueQueuedEvent::pre_process()
void
-SetPortValueQueuedEvent::execute(SampleCount offset)
+SetPortValueQueuedEvent::execute(SampleCount nframes, FrameTime start, FrameTime end)
{
- QueuedEvent::execute(offset);
+ assert(_time >= start && _time <= end);
+
+ QueuedEvent::execute(nframes, start, end);
if (m_error == NO_ERROR) {
assert(m_port != NULL);
if (m_voice_num == -1)
- ((TypedPort<Sample>*)m_port)->set_value(m_val, offset);
+ ((TypedPort<Sample>*)m_port)->set_value(m_val, _time - start);
else
- ((TypedPort<Sample>*)m_port)->buffer(m_voice_num)->set(m_val, offset); // FIXME: check range
+ ((TypedPort<Sample>*)m_port)->buffer(m_voice_num)->set(m_val, _time - start); // FIXME: check range
}
}
@@ -88,13 +90,13 @@ SetPortValueQueuedEvent::post_process()
assert(m_port != NULL);
_responder->respond_ok();
- Engine::instance().client_broadcaster()->send_control_change(m_port_path, m_val);
+ _engine.client_broadcaster()->send_control_change(m_port_path, m_val);
// Send patch port control change, if this is a bridge port
/*Port* parent_port = m_port->parent_node()->as_port();
if (parent_port != NULL) {
assert(parent_port->type() == DataType::FLOAT);
- Engine::instance().client_broadcaster()->send_control_change(parent_port->path(), m_val);
+ _engine.client_broadcaster()->send_control_change(parent_port->path(), m_val);
}*/
} else if (m_error == PORT_NOT_FOUND) {
diff --git a/src/libs/engine/events/SetPortValueQueuedEvent.h b/src/libs/engine/events/SetPortValueQueuedEvent.h
index 9e83e045..dc5add84 100644
--- a/src/libs/engine/events/SetPortValueQueuedEvent.h
+++ b/src/libs/engine/events/SetPortValueQueuedEvent.h
@@ -34,11 +34,11 @@ class Port;
class SetPortValueQueuedEvent : public QueuedEvent
{
public:
- SetPortValueQueuedEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& port_path, Sample val);
- SetPortValueQueuedEvent(CountedPtr<Responder> responder, SampleCount timestamp, size_t voice_num, const string& port_path, Sample val);
+ SetPortValueQueuedEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, const string& port_path, Sample val);
+ SetPortValueQueuedEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, size_t voice_num, const string& port_path, Sample val);
void pre_process();
- void execute(SampleCount offset);
+ void execute(SampleCount nframes, FrameTime start, FrameTime end);
void post_process();
private:
diff --git a/src/libs/engine/events/UnregisterClientEvent.cpp b/src/libs/engine/events/UnregisterClientEvent.cpp
index 5e720a24..13709959 100644
--- a/src/libs/engine/events/UnregisterClientEvent.cpp
+++ b/src/libs/engine/events/UnregisterClientEvent.cpp
@@ -23,8 +23,8 @@
namespace Ingen {
-UnregisterClientEvent::UnregisterClientEvent(CountedPtr<Responder> responder, SampleCount timestamp, ClientKey key)
-: QueuedEvent(responder, timestamp)
+UnregisterClientEvent::UnregisterClientEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, ClientKey key)
+: QueuedEvent(engine, responder, timestamp)
, _key(key)
{
}
@@ -33,7 +33,7 @@ UnregisterClientEvent::UnregisterClientEvent(CountedPtr<Responder> responder, Sa
void
UnregisterClientEvent::post_process()
{
- if (Engine::instance().client_broadcaster()->unregister_client(_key))
+ if (_engine.client_broadcaster()->unregister_client(_key))
_responder->respond_ok();
else
_responder->respond_error("Unable to unregister client");
diff --git a/src/libs/engine/events/UnregisterClientEvent.h b/src/libs/engine/events/UnregisterClientEvent.h
index 1523394e..29166345 100644
--- a/src/libs/engine/events/UnregisterClientEvent.h
+++ b/src/libs/engine/events/UnregisterClientEvent.h
@@ -39,7 +39,7 @@ using Shared::ClientKey;
class UnregisterClientEvent : public QueuedEvent
{
public:
- UnregisterClientEvent(CountedPtr<Responder> responder, SampleCount timestamp, ClientKey key);
+ UnregisterClientEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, ClientKey key);
void post_process();