diff options
author | David Robillard <d@drobilla.net> | 2006-07-14 22:24:00 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2006-07-14 22:24:00 +0000 |
commit | 5dc6649496e938b32a5fe9f341de6cce962d3731 (patch) | |
tree | c4b1832581c32b867b653afd0a7bd4bb05883b36 /src/libs/engine/events | |
parent | 7e013dc6986fa9d6dc8616d494d9de5d192c4c69 (diff) | |
download | ingen-5dc6649496e938b32a5fe9f341de6cce962d3731.tar.gz ingen-5dc6649496e938b32a5fe9f341de6cce962d3731.tar.bz2 ingen-5dc6649496e938b32a5fe9f341de6cce962d3731.zip |
Enforced OSC path restrictions on Path for spec conformance (since GraphObject
paths will soon be part of OSC paths)
git-svn-id: http://svn.drobilla.net/lad/ingen@88 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/engine/events')
66 files changed, 218 insertions, 211 deletions
diff --git a/src/libs/engine/events/ActivateEvent.cpp b/src/libs/engine/events/ActivateEvent.cpp index 716a0326..06dabddd 100644 --- a/src/libs/engine/events/ActivateEvent.cpp +++ b/src/libs/engine/events/ActivateEvent.cpp @@ -22,8 +22,8 @@ namespace Om { -ActivateEvent::ActivateEvent(CountedPtr<Responder> responder) -: QueuedEvent(responder) +ActivateEvent::ActivateEvent(CountedPtr<Responder> responder, samplecount timestamp) +: QueuedEvent(responder, timestamp) { } @@ -42,9 +42,9 @@ void ActivateEvent::post_process() { if (om != NULL) - m_responder->respond_ok(); + _responder->respond_ok(); else - m_responder->respond_error("Not ready to activate yet."); + _responder->respond_error("Not ready to activate yet."); } diff --git a/src/libs/engine/events/ActivateEvent.h b/src/libs/engine/events/ActivateEvent.h index 65831f05..a144fb88 100644 --- a/src/libs/engine/events/ActivateEvent.h +++ b/src/libs/engine/events/ActivateEvent.h @@ -29,7 +29,7 @@ namespace Om { class ActivateEvent : public QueuedEvent { public: - ActivateEvent(CountedPtr<Responder> responder); + ActivateEvent(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 1ad693dc..08011223 100644 --- a/src/libs/engine/events/AddNodeEvent.cpp +++ b/src/libs/engine/events/AddNodeEvent.cpp @@ -34,8 +34,8 @@ namespace Om { -AddNodeEvent::AddNodeEvent(CountedPtr<Responder> responder, const string& path, Plugin* plugin, bool poly) -: QueuedEvent(responder), +AddNodeEvent::AddNodeEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& path, Plugin* plugin, bool poly) +: QueuedEvent(responder, timestamp), m_path(path), m_plugin(plugin), m_poly(poly), @@ -107,17 +107,17 @@ AddNodeEvent::post_process() string msg; if (m_node_already_exists) { msg = string("Could not create node - ").append(m_path);// + " already exists."; - m_responder->respond_error(msg); + _responder->respond_error(msg); } else if (m_patch == NULL) { msg = "Could not find patch '" + m_path.parent() +"' for add_node."; - m_responder->respond_error(msg); + _responder->respond_error(msg); } else if (m_node == NULL) { msg = "Unable to load node "; msg.append(m_path).append(" (you're missing the plugin \"").append( m_plugin->lib_name()).append(":").append(m_plugin->plug_label()).append("\")");; - m_responder->respond_error(msg); + _responder->respond_error(msg); } else { - m_responder->respond_ok(); + _responder->respond_ok(); //om->client_broadcaster()->send_node_creation_messages(m_node); om->client_broadcaster()->send_node(m_node); } diff --git a/src/libs/engine/events/AddNodeEvent.h b/src/libs/engine/events/AddNodeEvent.h index eb02ddd5..cc5cc294 100644 --- a/src/libs/engine/events/AddNodeEvent.h +++ b/src/libs/engine/events/AddNodeEvent.h @@ -39,7 +39,7 @@ class Plugin; class AddNodeEvent : public QueuedEvent { public: - AddNodeEvent(CountedPtr<Responder> responder, const string& path, Plugin* plugin, bool poly); + AddNodeEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& path, Plugin* plugin, bool poly); ~AddNodeEvent(); void pre_process(); diff --git a/src/libs/engine/events/AddPortEvent.cpp b/src/libs/engine/events/AddPortEvent.cpp index 4c530227..ba7b28f8 100644 --- a/src/libs/engine/events/AddPortEvent.cpp +++ b/src/libs/engine/events/AddPortEvent.cpp @@ -37,8 +37,8 @@ namespace Om { -AddPortEvent::AddPortEvent(CountedPtr<Responder> responder, const string& path, const string& type, bool is_output) -: QueuedEvent(responder), +AddPortEvent::AddPortEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& path, const string& type, bool is_output) +: QueuedEvent(responder, timestamp), _path(path), _type(type), _is_output(is_output), @@ -124,9 +124,9 @@ AddPortEvent::post_process() { if (!_patch_port) { const string msg = string("Could not create port - ").append(_path); - m_responder->respond_error(msg); + _responder->respond_error(msg); } else { - m_responder->respond_ok(); + _responder->respond_ok(); om->client_broadcaster()->send_port(_patch_port); } } diff --git a/src/libs/engine/events/AddPortEvent.h b/src/libs/engine/events/AddPortEvent.h index 2ccf2f78..afc02a51 100644 --- a/src/libs/engine/events/AddPortEvent.h +++ b/src/libs/engine/events/AddPortEvent.h @@ -41,7 +41,7 @@ class DriverPort; class AddPortEvent : public QueuedEvent { public: - AddPortEvent(CountedPtr<Responder> responder, const string& path, const string& type, bool is_output); + AddPortEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& path, const string& type, bool is_output); void pre_process(); void execute(samplecount offset); diff --git a/src/libs/engine/events/AllNotesOffEvent.cpp b/src/libs/engine/events/AllNotesOffEvent.cpp index ae411ab9..4fe6a1d2 100644 --- a/src/libs/engine/events/AllNotesOffEvent.cpp +++ b/src/libs/engine/events/AllNotesOffEvent.cpp @@ -25,8 +25,8 @@ namespace Om { /** Note off with patch explicitly passed - triggered by MIDI. */ -AllNotesOffEvent::AllNotesOffEvent(CountedPtr<Responder> responder, Patch* patch) -: Event(responder), +AllNotesOffEvent::AllNotesOffEvent(CountedPtr<Responder> responder, samplecount timestamp, Patch* patch) +: Event(responder, timestamp), m_patch(patch) { } @@ -34,8 +34,8 @@ AllNotesOffEvent::AllNotesOffEvent(CountedPtr<Responder> responder, Patch* patch /** Note off event with lookup - triggered by OSC. */ -AllNotesOffEvent::AllNotesOffEvent(CountedPtr<Responder> responder, const string& patch_path) -: Event(responder), +AllNotesOffEvent::AllNotesOffEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& patch_path) +: Event(responder, timestamp), m_patch(NULL), m_patch_path(patch_path) { @@ -58,7 +58,7 @@ void AllNotesOffEvent::post_process() { if (m_patch != NULL) - m_responder->respond_ok(); + _responder->respond_ok(); } diff --git a/src/libs/engine/events/AllNotesOffEvent.h b/src/libs/engine/events/AllNotesOffEvent.h index 51d33b26..dc6aeb90 100644 --- a/src/libs/engine/events/AllNotesOffEvent.h +++ b/src/libs/engine/events/AllNotesOffEvent.h @@ -33,8 +33,8 @@ class Patch; class AllNotesOffEvent : public Event { public: - AllNotesOffEvent(CountedPtr<Responder> responder, Patch* patch); - AllNotesOffEvent(CountedPtr<Responder> responder, const string& patch_path); + AllNotesOffEvent(CountedPtr<Responder> responder, samplecount timestamp, Patch* patch); + AllNotesOffEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& patch_path); void execute(samplecount offset); void post_process(); diff --git a/src/libs/engine/events/ClearPatchEvent.cpp b/src/libs/engine/events/ClearPatchEvent.cpp index 1f60a5a7..e72e554a 100644 --- a/src/libs/engine/events/ClearPatchEvent.cpp +++ b/src/libs/engine/events/ClearPatchEvent.cpp @@ -31,7 +31,7 @@ namespace Om { -ClearPatchEvent::ClearPatchEvent(CountedPtr<Responder> responder, const string& patch_path) +ClearPatchEvent::ClearPatchEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& patch_path) : QueuedEvent(responder, true), m_patch_path(patch_path), m_patch(NULL), @@ -100,13 +100,13 @@ ClearPatchEvent::post_process() assert(m_patch->connections().size() == 0); // Reply - m_responder->respond_ok(); + _responder->respond_ok(); om->client_broadcaster()->send_patch_cleared(m_patch_path); } else { - m_responder->respond_error(string("Patch ") + m_patch_path + " not found"); + _responder->respond_error(string("Patch ") + m_patch_path + " not found"); } - m_source->unblock(); + _source->unblock(); } diff --git a/src/libs/engine/events/ClearPatchEvent.h b/src/libs/engine/events/ClearPatchEvent.h index d0b17fe0..88effdce 100644 --- a/src/libs/engine/events/ClearPatchEvent.h +++ b/src/libs/engine/events/ClearPatchEvent.h @@ -35,7 +35,7 @@ class Patch; class ClearPatchEvent : public QueuedEvent { public: - ClearPatchEvent(CountedPtr<Responder> responder, const string& patch_path); + ClearPatchEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& patch_path); void pre_process(); void execute(samplecount offset); diff --git a/src/libs/engine/events/ConnectionEvent.cpp b/src/libs/engine/events/ConnectionEvent.cpp index 0faff865..17e43147 100644 --- a/src/libs/engine/events/ConnectionEvent.cpp +++ b/src/libs/engine/events/ConnectionEvent.cpp @@ -17,6 +17,7 @@ #include "ConnectionEvent.h" #include <string> #include "Responder.h" +#include "types.h" #include "Om.h" #include "OmApp.h" #include "TypedConnection.h" @@ -36,8 +37,8 @@ namespace Om { //// ConnectionEvent //// -ConnectionEvent::ConnectionEvent(CountedPtr<Responder> responder, const string& src_port_path, const string& dst_port_path) -: QueuedEvent(responder), +ConnectionEvent::ConnectionEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& src_port_path, const string& dst_port_path) +: QueuedEvent(responder, timestamp), m_src_port_path(src_port_path), m_dst_port_path(dst_port_path), m_patch(NULL), @@ -104,10 +105,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>(m_responder, + m_typed_event = new TypedConnectionEvent<sample>(_responder, _time_stamp, 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>(m_responder, + m_typed_event = new TypedConnectionEvent<MidiMessage>(_responder, _time_stamp, dynamic_cast<OutputPort<MidiMessage>*>(m_src_port), dynamic_cast<InputPort<MidiMessage>*>(m_dst_port)); } else { m_error = TYPE_MISMATCH; @@ -140,7 +141,7 @@ ConnectionEvent::post_process() // FIXME: better error messages string msg = "Unable to make connection "; msg.append(m_src_port_path + " -> " + m_dst_port_path); - m_responder->respond_error(msg); + _responder->respond_error(msg); } } @@ -150,8 +151,8 @@ ConnectionEvent::post_process() template <typename T> -TypedConnectionEvent<T>::TypedConnectionEvent(CountedPtr<Responder> responder, OutputPort<T>* src_port, InputPort<T>* dst_port) -: QueuedEvent(responder), +TypedConnectionEvent<T>::TypedConnectionEvent(CountedPtr<Responder> responder, samplecount timestamp, OutputPort<T>* src_port, InputPort<T>* dst_port) +: QueuedEvent(responder, timestamp), m_src_port(src_port), m_dst_port(dst_port), m_patch(NULL), @@ -248,11 +249,11 @@ TypedConnectionEvent<T>::post_process() if (m_succeeded) { assert(m_connection != NULL); - m_responder->respond_ok(); + _responder->respond_ok(); om->client_broadcaster()->send_connection(m_connection); } else { - m_responder->respond_error("Unable to make connection."); + _responder->respond_error("Unable to make connection."); } } diff --git a/src/libs/engine/events/ConnectionEvent.h b/src/libs/engine/events/ConnectionEvent.h index 23bedcef..ea380130 100644 --- a/src/libs/engine/events/ConnectionEvent.h +++ b/src/libs/engine/events/ConnectionEvent.h @@ -46,7 +46,7 @@ template <typename T> class TypedConnectionEvent; // helper, defined below class ConnectionEvent : public QueuedEvent { public: - ConnectionEvent(CountedPtr<Responder> responder, const string& src_port_path, const string& dst_port_path); + ConnectionEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& src_port_path, const string& dst_port_path); ~ConnectionEvent(); void pre_process(); @@ -80,7 +80,7 @@ template <typename T> class TypedConnectionEvent : public QueuedEvent { public: - TypedConnectionEvent(CountedPtr<Responder> responder, OutputPort<T>* src_port, InputPort<T>* dst_port); + TypedConnectionEvent(CountedPtr<Responder> responder, samplecount timestamp, OutputPort<T>* src_port, InputPort<T>* dst_port); void pre_process(); void execute(samplecount offset); diff --git a/src/libs/engine/events/CreatePatchEvent.cpp b/src/libs/engine/events/CreatePatchEvent.cpp index 61bd2827..56720b06 100644 --- a/src/libs/engine/events/CreatePatchEvent.cpp +++ b/src/libs/engine/events/CreatePatchEvent.cpp @@ -31,8 +31,8 @@ namespace Om { -CreatePatchEvent::CreatePatchEvent(CountedPtr<Responder> responder, const string& path, int poly) -: QueuedEvent(responder), +CreatePatchEvent::CreatePatchEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& path, int poly) +: QueuedEvent(responder, timestamp), m_path(path), m_patch(NULL), m_parent(NULL), @@ -116,10 +116,10 @@ CreatePatchEvent::execute(samplecount offset) void CreatePatchEvent::post_process() { - if (m_responder.get()) { + if (_responder.get()) { if (m_error == NO_ERROR) { - m_responder->respond_ok(); + _responder->respond_ok(); // Don't want to send nodes that have been added since prepare() //om->client_broadcaster()->send_node_creation_messages(m_patch); @@ -130,17 +130,17 @@ CreatePatchEvent::post_process() } else if (m_error == OBJECT_EXISTS) { string msg = "Unable to create patch: "; msg += m_path += " already exists."; - m_responder->respond_error(msg); + _responder->respond_error(msg); } else if (m_error == PARENT_NOT_FOUND) { string msg = "Unable to create patch: Parent "; msg += m_path.parent() += " not found."; - m_responder->respond_error(msg); + _responder->respond_error(msg); } else if (m_error == INVALID_POLY) { string msg = "Unable to create patch "; msg.append(m_path).append(": ").append("Invalid polyphony respondered."); - m_responder->respond_error(msg); + _responder->respond_error(msg); } else { - m_responder->respond_error("Unable to load patch."); + _responder->respond_error("Unable to load patch."); } } } diff --git a/src/libs/engine/events/CreatePatchEvent.h b/src/libs/engine/events/CreatePatchEvent.h index 4583efd9..f83def15 100644 --- a/src/libs/engine/events/CreatePatchEvent.h +++ b/src/libs/engine/events/CreatePatchEvent.h @@ -39,7 +39,7 @@ class Plugin; class CreatePatchEvent : public QueuedEvent { public: - CreatePatchEvent(CountedPtr<Responder> responder, const string& path, int poly); + CreatePatchEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& path, int poly); void pre_process(); void execute(samplecount offset); diff --git a/src/libs/engine/events/DSSIConfigureEvent.cpp b/src/libs/engine/events/DSSIConfigureEvent.cpp index a16ebe4c..9e045c9c 100644 --- a/src/libs/engine/events/DSSIConfigureEvent.cpp +++ b/src/libs/engine/events/DSSIConfigureEvent.cpp @@ -25,8 +25,8 @@ namespace Om { -DSSIConfigureEvent::DSSIConfigureEvent(CountedPtr<Responder> responder, const string& node_path, const string& key, const string& val) -: QueuedEvent(responder), +DSSIConfigureEvent::DSSIConfigureEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& node_path, const string& key, const string& val) +: QueuedEvent(responder, timestamp), m_node_path(node_path), m_key(key), m_val(val), diff --git a/src/libs/engine/events/DSSIConfigureEvent.h b/src/libs/engine/events/DSSIConfigureEvent.h index f8ef2aa6..19baf7d6 100644 --- a/src/libs/engine/events/DSSIConfigureEvent.h +++ b/src/libs/engine/events/DSSIConfigureEvent.h @@ -30,7 +30,7 @@ namespace Om { class DSSIConfigureEvent : public QueuedEvent { public: - DSSIConfigureEvent(CountedPtr<Responder> responder, const string& node_path, const string& key, const string& val); + DSSIConfigureEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& node_path, const string& key, const string& val); void pre_process(); void execute(samplecount offset); diff --git a/src/libs/engine/events/DSSIControlEvent.cpp b/src/libs/engine/events/DSSIControlEvent.cpp index f326ca72..fc7dc6b5 100644 --- a/src/libs/engine/events/DSSIControlEvent.cpp +++ b/src/libs/engine/events/DSSIControlEvent.cpp @@ -24,8 +24,8 @@ namespace Om { -DSSIControlEvent::DSSIControlEvent(CountedPtr<Responder> responder, const string& node_path, int port_num, sample val) -: QueuedEvent(responder), +DSSIControlEvent::DSSIControlEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& node_path, int port_num, sample val) +: QueuedEvent(responder, timestamp), m_node_path(node_path), m_port_num(port_num), m_val(val), diff --git a/src/libs/engine/events/DSSIControlEvent.h b/src/libs/engine/events/DSSIControlEvent.h index de636445..95048d0a 100644 --- a/src/libs/engine/events/DSSIControlEvent.h +++ b/src/libs/engine/events/DSSIControlEvent.h @@ -32,7 +32,7 @@ namespace Om { class DSSIControlEvent : public QueuedEvent { public: - DSSIControlEvent(CountedPtr<Responder> responder, const string& node_path, int port_num, sample val); + DSSIControlEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& node_path, int port_num, sample val); void pre_process(); void execute(samplecount offset); diff --git a/src/libs/engine/events/DSSIProgramEvent.cpp b/src/libs/engine/events/DSSIProgramEvent.cpp index 9a869c73..3f64d3d2 100644 --- a/src/libs/engine/events/DSSIProgramEvent.cpp +++ b/src/libs/engine/events/DSSIProgramEvent.cpp @@ -29,8 +29,8 @@ using std::cout; using std::cerr; using std::endl; namespace Om { -DSSIProgramEvent::DSSIProgramEvent(CountedPtr<Responder> responder, const string& node_path, int bank, int program) -: QueuedEvent(responder), +DSSIProgramEvent::DSSIProgramEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& node_path, int bank, int program) +: QueuedEvent(responder, timestamp), m_node_path(node_path), m_bank(bank), m_program(program), diff --git a/src/libs/engine/events/DSSIProgramEvent.h b/src/libs/engine/events/DSSIProgramEvent.h index 49207ca1..9868d2ce 100644 --- a/src/libs/engine/events/DSSIProgramEvent.h +++ b/src/libs/engine/events/DSSIProgramEvent.h @@ -30,7 +30,7 @@ namespace Om { class DSSIProgramEvent : public QueuedEvent { public: - DSSIProgramEvent(CountedPtr<Responder> responder, const string& node_path, int bank, int program); + DSSIProgramEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& node_path, int bank, int program); void pre_process(); void execute(samplecount offset); diff --git a/src/libs/engine/events/DSSIUpdateEvent.cpp b/src/libs/engine/events/DSSIUpdateEvent.cpp index d32466d4..8cb7e4bc 100644 --- a/src/libs/engine/events/DSSIUpdateEvent.cpp +++ b/src/libs/engine/events/DSSIUpdateEvent.cpp @@ -28,8 +28,8 @@ using std::cerr; using std::endl; namespace Om { -DSSIUpdateEvent::DSSIUpdateEvent(CountedPtr<Responder> responder, const string& path, const string& url) -: QueuedEvent(responder), +DSSIUpdateEvent::DSSIUpdateEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& path, const string& url) +: QueuedEvent(responder, timestamp), m_path(path), m_url(url), m_node(NULL) diff --git a/src/libs/engine/events/DSSIUpdateEvent.h b/src/libs/engine/events/DSSIUpdateEvent.h index 25a77f02..a48cd7b4 100644 --- a/src/libs/engine/events/DSSIUpdateEvent.h +++ b/src/libs/engine/events/DSSIUpdateEvent.h @@ -36,7 +36,7 @@ class DSSINode; class DSSIUpdateEvent : public QueuedEvent { public: - DSSIUpdateEvent(CountedPtr<Responder> responder, const string& path, const string& url); + DSSIUpdateEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& path, const string& url); void pre_process(); void execute(samplecount offset); diff --git a/src/libs/engine/events/DeactivateEvent.cpp b/src/libs/engine/events/DeactivateEvent.cpp index 22434cbe..fef3ece6 100644 --- a/src/libs/engine/events/DeactivateEvent.cpp +++ b/src/libs/engine/events/DeactivateEvent.cpp @@ -22,8 +22,8 @@ namespace Om { -DeactivateEvent::DeactivateEvent(CountedPtr<Responder> responder) -: QueuedEvent(responder) +DeactivateEvent::DeactivateEvent(CountedPtr<Responder> responder, samplecount timestamp) +: QueuedEvent(responder, timestamp) { } @@ -45,7 +45,7 @@ DeactivateEvent::execute(samplecount offset) void DeactivateEvent::post_process() { - m_responder->respond_ok(); + _responder->respond_ok(); om->deactivate(); } diff --git a/src/libs/engine/events/DeactivateEvent.h b/src/libs/engine/events/DeactivateEvent.h index 35c96e78..7e540ba8 100644 --- a/src/libs/engine/events/DeactivateEvent.h +++ b/src/libs/engine/events/DeactivateEvent.h @@ -29,7 +29,7 @@ namespace Om { class DeactivateEvent : public QueuedEvent { public: - DeactivateEvent(CountedPtr<Responder> responder); + DeactivateEvent(CountedPtr<Responder> responder, samplecount timestamp); void pre_process(); void execute(samplecount offset); diff --git a/src/libs/engine/events/DestroyEvent.cpp b/src/libs/engine/events/DestroyEvent.cpp index 383f1d34..fec3f3c0 100644 --- a/src/libs/engine/events/DestroyEvent.cpp +++ b/src/libs/engine/events/DestroyEvent.cpp @@ -35,7 +35,7 @@ namespace Om { -DestroyEvent::DestroyEvent(CountedPtr<Responder> responder, QueuedEventSource* source, const string& path, bool lock_mutex) +DestroyEvent::DestroyEvent(CountedPtr<Responder> responder, samplecount timestamp, QueuedEventSource* source, const string& path, bool lock_mutex) : QueuedEvent(responder, true, source), m_path(path), m_node(NULL), @@ -48,7 +48,7 @@ DestroyEvent::DestroyEvent(CountedPtr<Responder> responder, QueuedEventSource* s } -DestroyEvent::DestroyEvent(CountedPtr<Responder> responder, Node* node, bool lock_mutex) +DestroyEvent::DestroyEvent(CountedPtr<Responder> responder, samplecount timestamp, Node* node, bool lock_mutex) : QueuedEvent(responder, true), m_path(node->path()), m_node(node), @@ -139,17 +139,17 @@ DestroyEvent::execute(samplecount offset) void DestroyEvent::post_process() { - assert(m_source); - m_source->unblock(); + assert(_source); + _source->unblock(); if (m_node == NULL) { if (m_path == "/") - m_responder->respond_error("You can not destroy the root patch (/)"); + _responder->respond_error("You can not destroy the root patch (/)"); else - m_responder->respond_error("Could not find node to destroy"); + _responder->respond_error("Could not find node to destroy"); } else if (m_patch_listnode != NULL) { m_node->deactivate(); - m_responder->respond_ok(); + _responder->respond_ok(); if (m_disconnect_event != NULL) m_disconnect_event->post_process(); if (m_parent_disconnect_event != NULL) @@ -158,7 +158,7 @@ DestroyEvent::post_process() om->maid()->push(m_patch_listnode); om->maid()->push(m_node); } else { - m_responder->respond_error("Unable to destroy object"); + _responder->respond_error("Unable to destroy object"); } } diff --git a/src/libs/engine/events/DestroyEvent.h b/src/libs/engine/events/DestroyEvent.h index 1f26ed90..1fcbd171 100644 --- a/src/libs/engine/events/DestroyEvent.h +++ b/src/libs/engine/events/DestroyEvent.h @@ -44,8 +44,8 @@ class DisconnectPortEvent; class DestroyEvent : public QueuedEvent { public: - DestroyEvent(CountedPtr<Responder> responder, QueuedEventSource* source, const string& path, bool lock_mutex = true); - DestroyEvent(CountedPtr<Responder> responder, Node* node, bool lock_mutex = true); + 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(); void pre_process(); diff --git a/src/libs/engine/events/DisablePatchEvent.cpp b/src/libs/engine/events/DisablePatchEvent.cpp index c896d943..67f84fa2 100644 --- a/src/libs/engine/events/DisablePatchEvent.cpp +++ b/src/libs/engine/events/DisablePatchEvent.cpp @@ -27,8 +27,8 @@ namespace Om { -DisablePatchEvent::DisablePatchEvent(CountedPtr<Responder> responder, const string& patch_path) -: QueuedEvent(responder), +DisablePatchEvent::DisablePatchEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& patch_path) +: QueuedEvent(responder, timestamp), m_patch_path(patch_path), m_patch(NULL) { @@ -58,10 +58,10 @@ void DisablePatchEvent::post_process() { if (m_patch != NULL) { - m_responder->respond_ok(); + _responder->respond_ok(); om->client_broadcaster()->send_patch_disable(m_patch_path); } else { - m_responder->respond_error(string("Patch ") + m_patch_path + " not found"); + _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 708e269b..6df64e40 100644 --- a/src/libs/engine/events/DisablePatchEvent.h +++ b/src/libs/engine/events/DisablePatchEvent.h @@ -34,7 +34,7 @@ class Patch; class DisablePatchEvent : public QueuedEvent { public: - DisablePatchEvent(CountedPtr<Responder> responder, const string& patch_path); + DisablePatchEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& patch_path); void pre_process(); void execute(samplecount offset); diff --git a/src/libs/engine/events/DisconnectNodeEvent.cpp b/src/libs/engine/events/DisconnectNodeEvent.cpp index 22c2459e..5f2a483a 100644 --- a/src/libs/engine/events/DisconnectNodeEvent.cpp +++ b/src/libs/engine/events/DisconnectNodeEvent.cpp @@ -39,8 +39,8 @@ using std::cerr; using std::endl; namespace Om { -DisconnectNodeEvent::DisconnectNodeEvent(CountedPtr<Responder> responder, const string& node_path) -: QueuedEvent(responder), +DisconnectNodeEvent::DisconnectNodeEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& node_path) +: QueuedEvent(responder, timestamp), m_node_path(node_path), m_patch(NULL), m_node(NULL), @@ -99,7 +99,8 @@ 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()), c->src_port(), c->dst_port()); + DisconnectionEvent* ev = new DisconnectionEvent(CountedPtr<Responder>(new Responder()), _time_stamp, + c->src_port(), c->dst_port()); ev->pre_process(); m_disconnection_events.push_back(new ListNode<DisconnectionEvent*>(ev)); c->pending_disconnection(true); @@ -127,13 +128,13 @@ void DisconnectNodeEvent::post_process() { if (m_succeeded) { - if (m_responder) - m_responder->respond_ok(); + if (_responder) + _responder->respond_ok(); for (List<DisconnectionEvent*>::iterator i = m_disconnection_events.begin(); i != m_disconnection_events.end(); ++i) (*i)->post_process(); } else { - if (m_responder) - m_responder->respond_error("Unable to disconnect all ports."); + if (_responder) + _responder->respond_error("Unable to disconnect all ports."); } } diff --git a/src/libs/engine/events/DisconnectNodeEvent.h b/src/libs/engine/events/DisconnectNodeEvent.h index 40e6c086..31c32f2e 100644 --- a/src/libs/engine/events/DisconnectNodeEvent.h +++ b/src/libs/engine/events/DisconnectNodeEvent.h @@ -42,7 +42,7 @@ template <typename T> class OutputPort; class DisconnectNodeEvent : public QueuedEvent { public: - DisconnectNodeEvent(CountedPtr<Responder> responder, const string& node_path); + DisconnectNodeEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& node_path); DisconnectNodeEvent(Node* node); ~DisconnectNodeEvent(); diff --git a/src/libs/engine/events/DisconnectPortEvent.cpp b/src/libs/engine/events/DisconnectPortEvent.cpp index 2ec408d6..bfb238c6 100644 --- a/src/libs/engine/events/DisconnectPortEvent.cpp +++ b/src/libs/engine/events/DisconnectPortEvent.cpp @@ -39,8 +39,8 @@ using std::cerr; using std::endl; namespace Om { -DisconnectPortEvent::DisconnectPortEvent(CountedPtr<Responder> responder, const string& port_path) -: QueuedEvent(responder), +DisconnectPortEvent::DisconnectPortEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& port_path) +: QueuedEvent(responder, timestamp), m_port_path(port_path), m_patch(NULL), m_port(NULL), @@ -104,7 +104,8 @@ 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()), c->src_port(), c->dst_port()); + DisconnectionEvent* ev = new DisconnectionEvent(CountedPtr<Responder>(new Responder()), _time_stamp, + c->src_port(), c->dst_port()); ev->pre_process(); m_disconnection_events.push_back(new ListNode<DisconnectionEvent*>(ev)); c->pending_disconnection(true); @@ -132,11 +133,11 @@ void DisconnectPortEvent::post_process() { if (m_succeeded) { - m_responder->respond_ok(); + _responder->respond_ok(); for (List<DisconnectionEvent*>::iterator i = m_disconnection_events.begin(); i != m_disconnection_events.end(); ++i) (*i)->post_process(); } else { - m_responder->respond_error("Unable to disconnect port."); + _responder->respond_error("Unable to disconnect port."); } } diff --git a/src/libs/engine/events/DisconnectPortEvent.h b/src/libs/engine/events/DisconnectPortEvent.h index 82e0ef90..31113a63 100644 --- a/src/libs/engine/events/DisconnectPortEvent.h +++ b/src/libs/engine/events/DisconnectPortEvent.h @@ -43,7 +43,7 @@ using std::string; class DisconnectPortEvent : public QueuedEvent { public: - DisconnectPortEvent(CountedPtr<Responder> responder, const string& port_path); + DisconnectPortEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& port_path); DisconnectPortEvent(Port* port); ~DisconnectPortEvent(); diff --git a/src/libs/engine/events/DisconnectionEvent.cpp b/src/libs/engine/events/DisconnectionEvent.cpp index 3d7a16d8..7bd5edd9 100644 --- a/src/libs/engine/events/DisconnectionEvent.cpp +++ b/src/libs/engine/events/DisconnectionEvent.cpp @@ -36,8 +36,8 @@ namespace Om { //// DisconnectionEvent //// -DisconnectionEvent::DisconnectionEvent(CountedPtr<Responder> responder, const string& src_port_path, const string& dst_port_path) -: QueuedEvent(responder), +DisconnectionEvent::DisconnectionEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& src_port_path, const string& dst_port_path) +: QueuedEvent(responder, timestamp), m_src_port_path(src_port_path), m_dst_port_path(dst_port_path), m_patch(NULL), @@ -50,8 +50,8 @@ DisconnectionEvent::DisconnectionEvent(CountedPtr<Responder> responder, const st } -DisconnectionEvent::DisconnectionEvent(CountedPtr<Responder> responder, Port* const src_port, Port* const dst_port) -: QueuedEvent(responder), +DisconnectionEvent::DisconnectionEvent(CountedPtr<Responder> responder, samplecount timestamp, Port* const src_port, Port* const dst_port) +: QueuedEvent(responder, timestamp), m_src_port_path(src_port->path()), m_dst_port_path(dst_port->path()), m_patch(src_port->parent_node()->parent_patch()), @@ -113,10 +113,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>(m_responder, + m_typed_event = new TypedDisconnectionEvent<sample>(_responder, _time_stamp, 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>(m_responder, + m_typed_event = new TypedDisconnectionEvent<MidiMessage>(_responder, _time_stamp, dynamic_cast<OutputPort<MidiMessage>*>(m_src_port), dynamic_cast<InputPort<MidiMessage>*>(m_dst_port)); } else { m_error = TYPE_MISMATCH; @@ -150,7 +150,7 @@ DisconnectionEvent::post_process() // FIXME: better error messages string msg = "Unable to disconnect "; msg.append(m_src_port_path + " -> " + m_dst_port_path); - m_responder->respond_error(msg); + _responder->respond_error(msg); } } @@ -160,8 +160,8 @@ DisconnectionEvent::post_process() template <typename T> -TypedDisconnectionEvent<T>::TypedDisconnectionEvent(CountedPtr<Responder> responder, OutputPort<T>* src_port, InputPort<T>* dst_port) -: QueuedEvent(responder), +TypedDisconnectionEvent<T>::TypedDisconnectionEvent(CountedPtr<Responder> responder, samplecount timestamp, OutputPort<T>* src_port, InputPort<T>* dst_port) +: QueuedEvent(responder, timestamp), m_src_port(src_port), m_dst_port(dst_port), m_patch(NULL), @@ -270,11 +270,11 @@ TypedDisconnectionEvent<T>::post_process() { if (m_succeeded) { - m_responder->respond_ok(); + _responder->respond_ok(); om->client_broadcaster()->send_disconnection(m_src_port->path(), m_dst_port->path()); } else { - m_responder->respond_error("Unable to disconnect ports."); + _responder->respond_error("Unable to disconnect ports."); } } diff --git a/src/libs/engine/events/DisconnectionEvent.h b/src/libs/engine/events/DisconnectionEvent.h index 43b2d841..cf37976d 100644 --- a/src/libs/engine/events/DisconnectionEvent.h +++ b/src/libs/engine/events/DisconnectionEvent.h @@ -46,8 +46,8 @@ template <typename T> class TypedDisconnectionEvent; // helper, defined below class DisconnectionEvent : public QueuedEvent { public: - DisconnectionEvent(CountedPtr<Responder> responder, const string& src_port_path, const string& dst_port_path); - DisconnectionEvent(CountedPtr<Responder> responder, Port* const src_port, Port* const dst_port); + 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(); void pre_process(); @@ -82,7 +82,7 @@ template <typename T> class TypedDisconnectionEvent : public QueuedEvent { public: - TypedDisconnectionEvent(CountedPtr<Responder> responder, OutputPort<T>* src_port, InputPort<T>* dst_port); + TypedDisconnectionEvent(CountedPtr<Responder> responder, samplecount timestamp, OutputPort<T>* src_port, InputPort<T>* dst_port); void pre_process(); void execute(samplecount offset); diff --git a/src/libs/engine/events/EnablePatchEvent.cpp b/src/libs/engine/events/EnablePatchEvent.cpp index eee50dac..7ce7dd27 100644 --- a/src/libs/engine/events/EnablePatchEvent.cpp +++ b/src/libs/engine/events/EnablePatchEvent.cpp @@ -26,8 +26,8 @@ namespace Om { -EnablePatchEvent::EnablePatchEvent(CountedPtr<Responder> responder, const string& patch_path) -: QueuedEvent(responder), +EnablePatchEvent::EnablePatchEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& patch_path) +: QueuedEvent(responder, timestamp), m_patch_path(patch_path), m_patch(NULL), m_process_order(NULL) @@ -70,10 +70,10 @@ void EnablePatchEvent::post_process() { if (m_patch != NULL) { - m_responder->respond_ok(); + _responder->respond_ok(); om->client_broadcaster()->send_patch_enable(m_patch_path); } else { - m_responder->respond_error(string("Patch ") + m_patch_path + " not found"); + _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 0c86a100..75b751aa 100644 --- a/src/libs/engine/events/EnablePatchEvent.h +++ b/src/libs/engine/events/EnablePatchEvent.h @@ -37,7 +37,7 @@ class Node; class EnablePatchEvent : public QueuedEvent { public: - EnablePatchEvent(CountedPtr<Responder> responder, const string& patch_path); + EnablePatchEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& patch_path); void pre_process(); void execute(samplecount offset); diff --git a/src/libs/engine/events/LashRestoreDoneEvent.h b/src/libs/engine/events/LashRestoreDoneEvent.h index ed3933a5..31713c4b 100644 --- a/src/libs/engine/events/LashRestoreDoneEvent.h +++ b/src/libs/engine/events/LashRestoreDoneEvent.h @@ -39,11 +39,11 @@ class Port; class LashRestoreDoneEvent : public QueuedEvent { public: - LashRestoreDoneEvent(CountedPtr<Responder> responder) : QueuedEvent(responder) {} + LashRestoreDoneEvent(CountedPtr<Responder> responder, samplecount timestamp) : QueuedEvent(responder, timestamp) {} void post_process() { - m_responder->respond_ok(); + _responder->respond_ok(); lash_driver->restore_finished(); } }; diff --git a/src/libs/engine/events/LoadPluginsEvent.cpp b/src/libs/engine/events/LoadPluginsEvent.cpp index 93099ef0..d1939a6b 100644 --- a/src/libs/engine/events/LoadPluginsEvent.cpp +++ b/src/libs/engine/events/LoadPluginsEvent.cpp @@ -20,23 +20,24 @@ #include "OmApp.h" #include "NodeFactory.h" +#include <iostream> +using std::cerr; + namespace Om { -LoadPluginsEvent::LoadPluginsEvent(CountedPtr<Responder> responder) -: QueuedEvent(responder) +LoadPluginsEvent::LoadPluginsEvent(CountedPtr<Responder> responder, samplecount timestamp) +: QueuedEvent(responder, timestamp) { + cerr << "LOADING PLUGINS\n"; + om->node_factory()->load_plugins(); } void LoadPluginsEvent::post_process() { - // Why is this done here and not in pre_process()??? - om->node_factory()->load_plugins(); - m_responder->respond_ok(); - - //cerr << "Load plugins post finished\n"; + _responder->respond_ok(); } diff --git a/src/libs/engine/events/LoadPluginsEvent.h b/src/libs/engine/events/LoadPluginsEvent.h index 10970cec..b17eb262 100644 --- a/src/libs/engine/events/LoadPluginsEvent.h +++ b/src/libs/engine/events/LoadPluginsEvent.h @@ -29,7 +29,7 @@ namespace Om { class LoadPluginsEvent : public QueuedEvent { public: - LoadPluginsEvent(CountedPtr<Responder> responder); + LoadPluginsEvent(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 cd9fd8f2..6c7c8613 100644 --- a/src/libs/engine/events/MidiLearnEvent.cpp +++ b/src/libs/engine/events/MidiLearnEvent.cpp @@ -38,8 +38,8 @@ MidiLearnResponseEvent::post_process() // MidiLearnEvent -MidiLearnEvent::MidiLearnEvent(CountedPtr<Responder> responder, const string& node_path) -: QueuedEvent(responder), +MidiLearnEvent::MidiLearnEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& node_path) +: QueuedEvent(responder, timestamp), m_node_path(node_path), m_node(NULL), m_response_event(NULL) @@ -51,7 +51,7 @@ void MidiLearnEvent::pre_process() { m_node = om->object_store()->find_node(m_node_path); - m_response_event = new MidiLearnResponseEvent(m_node_path + "/Controller Number"); + m_response_event = new MidiLearnResponseEvent(m_node_path + "/Controller_Number", _time_stamp); QueuedEvent::pre_process(); } @@ -74,11 +74,11 @@ void MidiLearnEvent::post_process() { if (m_node != NULL) { - m_responder->respond_ok(); + _responder->respond_ok(); } else { string msg = "Did not find node '"; msg.append(m_node_path).append("' for MIDI learn."); - m_responder->respond_error(msg); + _responder->respond_error(msg); } } diff --git a/src/libs/engine/events/MidiLearnEvent.h b/src/libs/engine/events/MidiLearnEvent.h index de0dfbe3..320b20c3 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) - : Event(CountedPtr<Responder>(NULL)), + MidiLearnResponseEvent(const string& port_path, samplecount timestamp) + : Event(NULL, timestamp), m_port_path(port_path), m_value(0.0f) {} @@ -64,7 +64,7 @@ private: class MidiLearnEvent : public QueuedEvent { public: - MidiLearnEvent(CountedPtr<Responder> responder, const string& node_path); + MidiLearnEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& node_path); void pre_process(); void execute(samplecount offset); diff --git a/src/libs/engine/events/NoteOffEvent.cpp b/src/libs/engine/events/NoteOffEvent.cpp index a84317a5..f4a54d13 100644 --- a/src/libs/engine/events/NoteOffEvent.cpp +++ b/src/libs/engine/events/NoteOffEvent.cpp @@ -28,8 +28,8 @@ namespace Om { /** Note off with patch explicitly passed - triggered by MIDI. */ -NoteOffEvent::NoteOffEvent(CountedPtr<Responder> responder, Node* node, uchar note_num) -: Event(responder), +NoteOffEvent::NoteOffEvent(CountedPtr<Responder> responder, samplecount timestamp, Node* node, uchar note_num) +: Event(responder, timestamp), m_node(node), m_note_num(note_num) { @@ -38,8 +38,8 @@ NoteOffEvent::NoteOffEvent(CountedPtr<Responder> responder, Node* node, uchar no /** Note off event with lookup - triggered by OSC. */ -NoteOffEvent::NoteOffEvent(CountedPtr<Responder> responder, const string& node_path, uchar note_num) -: Event(responder), +NoteOffEvent::NoteOffEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& node_path, uchar note_num) +: Event(responder, timestamp), m_node(NULL), m_node_path(node_path), m_note_num(note_num) @@ -67,9 +67,9 @@ void NoteOffEvent::post_process() { if (m_node != NULL) - m_responder->respond_ok(); + _responder->respond_ok(); else - m_responder->respond_error("Did not find node for note_off"); + _responder->respond_error("Did not find node for note_off"); } diff --git a/src/libs/engine/events/NoteOffEvent.h b/src/libs/engine/events/NoteOffEvent.h index 3a9f715f..05a34a0e 100644 --- a/src/libs/engine/events/NoteOffEvent.h +++ b/src/libs/engine/events/NoteOffEvent.h @@ -34,8 +34,8 @@ class Node; class NoteOffEvent : public Event { public: - NoteOffEvent(CountedPtr<Responder> responder, Node* node, uchar note_num); - NoteOffEvent(CountedPtr<Responder> responder, const string& node_path, uchar note_num); + NoteOffEvent(CountedPtr<Responder> responder, samplecount timestamp, Node* node, uchar note_num); + NoteOffEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& node_path, uchar note_num); void execute(samplecount offset); void post_process(); diff --git a/src/libs/engine/events/NoteOnEvent.cpp b/src/libs/engine/events/NoteOnEvent.cpp index 4a0ba141..7eeaa597 100644 --- a/src/libs/engine/events/NoteOnEvent.cpp +++ b/src/libs/engine/events/NoteOnEvent.cpp @@ -31,8 +31,8 @@ namespace Om { * * Used to be triggered by MIDI. Not used anymore. */ -NoteOnEvent::NoteOnEvent(CountedPtr<Responder> responder, Node* patch, uchar note_num, uchar velocity) -: Event(responder), +NoteOnEvent::NoteOnEvent(CountedPtr<Responder> responder, samplecount timestamp, Node* patch, uchar note_num, uchar velocity) +: Event(responder, timestamp), m_node(patch), m_note_num(note_num), m_velocity(velocity), @@ -45,8 +45,8 @@ NoteOnEvent::NoteOnEvent(CountedPtr<Responder> responder, Node* patch, uchar not * * Triggered by OSC. */ -NoteOnEvent::NoteOnEvent(CountedPtr<Responder> responder, const string& node_path, uchar note_num, uchar velocity) -: Event(responder), +NoteOnEvent::NoteOnEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& node_path, uchar note_num, uchar velocity) +: Event(responder, timestamp), m_node(NULL), m_node_path(node_path), m_note_num(note_num), @@ -78,9 +78,9 @@ NoteOnEvent::post_process() { if (m_is_osc_triggered) { if (m_node != NULL) - m_responder->respond_ok(); + _responder->respond_ok(); else - m_responder->respond_error("Did not find node for note_on"); + _responder->respond_error("Did not find node for note_on"); } } diff --git a/src/libs/engine/events/NoteOnEvent.h b/src/libs/engine/events/NoteOnEvent.h index af6251e9..8f57eb38 100644 --- a/src/libs/engine/events/NoteOnEvent.h +++ b/src/libs/engine/events/NoteOnEvent.h @@ -34,8 +34,8 @@ class Node; class NoteOnEvent : public Event { public: - NoteOnEvent(CountedPtr<Responder> responder, Node* patch, uchar note_num, uchar velocity); - NoteOnEvent(CountedPtr<Responder> responder, const string& node_path, uchar note_num, uchar velocity); + 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); void execute(samplecount offset); void post_process(); diff --git a/src/libs/engine/events/PingQueuedEvent.h b/src/libs/engine/events/PingQueuedEvent.h index 790cf7cc..9f575eea 100644 --- a/src/libs/engine/events/PingQueuedEvent.h +++ b/src/libs/engine/events/PingQueuedEvent.h @@ -26,16 +26,17 @@ namespace Om { class Port; -/** A "blocking" ping that travels through the event queue before responding. +/** A ping that travels through the pre-processed event queue before responding + * (useful for the order guarantee). * * \ingroup engine */ class PingQueuedEvent : public QueuedEvent { public: - PingQueuedEvent(CountedPtr<Responder> responder) : QueuedEvent(responder) {} + PingQueuedEvent(CountedPtr<Responder> responder, samplecount timestamp) : QueuedEvent(responder, timestamp) {} - void post_process() { m_responder->respond_ok(); } + void post_process() { _responder->respond_ok(); } }; diff --git a/src/libs/engine/events/RegisterClientEvent.cpp b/src/libs/engine/events/RegisterClientEvent.cpp index d2ea41ab..53a9cda9 100644 --- a/src/libs/engine/events/RegisterClientEvent.cpp +++ b/src/libs/engine/events/RegisterClientEvent.cpp @@ -24,9 +24,10 @@ namespace Om { RegisterClientEvent::RegisterClientEvent(CountedPtr<Responder> responder, + samplecount timestamp, ClientKey key, CountedPtr<ClientInterface> client) -: QueuedEvent(responder) +: QueuedEvent(responder, timestamp) , _key(key) , _client(client) { @@ -45,7 +46,7 @@ RegisterClientEvent::pre_process() void RegisterClientEvent::post_process() { - m_responder->respond_ok(); + _responder->respond_ok(); } diff --git a/src/libs/engine/events/RegisterClientEvent.h b/src/libs/engine/events/RegisterClientEvent.h index 6399e5be..2e0bfe16 100644 --- a/src/libs/engine/events/RegisterClientEvent.h +++ b/src/libs/engine/events/RegisterClientEvent.h @@ -36,6 +36,7 @@ class RegisterClientEvent : public QueuedEvent { public: RegisterClientEvent(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 52002774..2f654569 100644 --- a/src/libs/engine/events/RenameEvent.cpp +++ b/src/libs/engine/events/RenameEvent.cpp @@ -28,8 +28,8 @@ namespace Om { -RenameEvent::RenameEvent(CountedPtr<Responder> responder, const string& path, const string& name) -: QueuedEvent(responder), +RenameEvent::RenameEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& path, const string& name) +: QueuedEvent(responder, timestamp), m_old_path(path), m_name(name), m_new_path(m_old_path.parent().base_path() + name), @@ -103,7 +103,7 @@ RenameEvent::post_process() string msg = "Unable to rename object - "; if (m_error == NO_ERROR) { - m_responder->respond_ok(); + _responder->respond_ok(); om->client_broadcaster()->send_rename(m_old_path, m_new_path); } else { if (m_error == OBJECT_EXISTS) @@ -115,7 +115,7 @@ RenameEvent::post_process() else if (m_error == INVALID_NAME) msg.append(m_name).append(" is not a valid name"); - m_responder->respond_error(msg); + _responder->respond_error(msg); } } diff --git a/src/libs/engine/events/RenameEvent.h b/src/libs/engine/events/RenameEvent.h index 41e5eec0..40f40d3c 100644 --- a/src/libs/engine/events/RenameEvent.h +++ b/src/libs/engine/events/RenameEvent.h @@ -42,7 +42,7 @@ class DisconnectPortEvent; class RenameEvent : public QueuedEvent { public: - RenameEvent(CountedPtr<Responder> responder, const string& path, const string& name); + RenameEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& path, const string& name); ~RenameEvent(); void pre_process(); diff --git a/src/libs/engine/events/RequestAllObjectsEvent.cpp b/src/libs/engine/events/RequestAllObjectsEvent.cpp index 0b8f6255..5e215914 100644 --- a/src/libs/engine/events/RequestAllObjectsEvent.cpp +++ b/src/libs/engine/events/RequestAllObjectsEvent.cpp @@ -23,8 +23,8 @@ namespace Om { -RequestAllObjectsEvent::RequestAllObjectsEvent(CountedPtr<Responder> responder) -: QueuedEvent(responder), +RequestAllObjectsEvent::RequestAllObjectsEvent(CountedPtr<Responder> responder, samplecount timestamp) +: QueuedEvent(responder, timestamp), m_client(CountedPtr<ClientInterface>(NULL)) { } @@ -33,7 +33,7 @@ RequestAllObjectsEvent::RequestAllObjectsEvent(CountedPtr<Responder> responder) void RequestAllObjectsEvent::pre_process() { - m_client = m_responder->find_client(); + m_client = _responder->find_client(); QueuedEvent::pre_process(); } @@ -43,10 +43,10 @@ void RequestAllObjectsEvent::post_process() { if (m_client) { - m_responder->respond_ok(); + _responder->respond_ok(); ObjectSender::send_all(m_client.get()); } else { - m_responder->respond_error("Invalid URL"); + _responder->respond_error("Invalid URL"); } } diff --git a/src/libs/engine/events/RequestAllObjectsEvent.h b/src/libs/engine/events/RequestAllObjectsEvent.h index b5d43f59..70dbc4a3 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); + RequestAllObjectsEvent(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 0590f3b3..c492d0dd 100644 --- a/src/libs/engine/events/RequestMetadataEvent.cpp +++ b/src/libs/engine/events/RequestMetadataEvent.cpp @@ -28,8 +28,8 @@ using std::string; namespace Om { -RequestMetadataEvent::RequestMetadataEvent(CountedPtr<Responder> responder, const string& node_path, const string& key) -: QueuedEvent(responder), +RequestMetadataEvent::RequestMetadataEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& node_path, const string& key) +: QueuedEvent(responder, timestamp), m_path(node_path), m_key(key), m_value(""), @@ -42,7 +42,7 @@ RequestMetadataEvent::RequestMetadataEvent(CountedPtr<Responder> responder, cons void RequestMetadataEvent::pre_process() { - m_client = m_responder->find_client(); + m_client = _responder->find_client(); if (m_client) { m_object = om->object_store()->find(m_path); @@ -65,13 +65,13 @@ RequestMetadataEvent::post_process() if (m_value == "") { string msg = "Unable to find object "; msg += m_path; - m_responder->respond_error(msg); + _responder->respond_error(msg); } else { - m_responder->respond_ok(); + _responder->respond_ok(); m_client->metadata_update(m_path, m_key, m_value); } } else { - m_responder->respond_error("Unknown client"); + _responder->respond_error("Unknown client"); } } diff --git a/src/libs/engine/events/RequestMetadataEvent.h b/src/libs/engine/events/RequestMetadataEvent.h index d086d7da..97ac46ab 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, const string& path, const string& key); + RequestMetadataEvent(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 984bddf6..fc29c846 100644 --- a/src/libs/engine/events/RequestPluginsEvent.cpp +++ b/src/libs/engine/events/RequestPluginsEvent.cpp @@ -23,8 +23,8 @@ namespace Om { -RequestPluginsEvent::RequestPluginsEvent(CountedPtr<Responder> responder) -: QueuedEvent(responder), +RequestPluginsEvent::RequestPluginsEvent(CountedPtr<Responder> responder, samplecount timestamp) +: QueuedEvent(responder, timestamp), m_client(CountedPtr<ClientInterface>(NULL)) { } @@ -33,7 +33,7 @@ RequestPluginsEvent::RequestPluginsEvent(CountedPtr<Responder> responder) void RequestPluginsEvent::pre_process() { - m_client = m_responder->find_client(); + m_client = _responder->find_client(); QueuedEvent::pre_process(); } @@ -44,9 +44,9 @@ RequestPluginsEvent::post_process() { if (m_client) { om->client_broadcaster()->send_plugins_to(m_client.get()); - m_responder->respond_ok(); + _responder->respond_ok(); } else { - m_responder->respond_error("Invalid URL"); + _responder->respond_error("Invalid URL"); } } diff --git a/src/libs/engine/events/RequestPluginsEvent.h b/src/libs/engine/events/RequestPluginsEvent.h index b8c76362..0d97deaf 100644 --- a/src/libs/engine/events/RequestPluginsEvent.h +++ b/src/libs/engine/events/RequestPluginsEvent.h @@ -36,7 +36,7 @@ namespace Shared { class RequestPluginsEvent : public QueuedEvent { public: - RequestPluginsEvent(CountedPtr<Responder> responder); + RequestPluginsEvent(CountedPtr<Responder> responder, samplecount timestamp); void pre_process(); void post_process(); diff --git a/src/libs/engine/events/RequestPortValueEvent.cpp b/src/libs/engine/events/RequestPortValueEvent.cpp index ac690883..f8036447 100644 --- a/src/libs/engine/events/RequestPortValueEvent.cpp +++ b/src/libs/engine/events/RequestPortValueEvent.cpp @@ -29,8 +29,8 @@ using std::string; namespace Om { -RequestPortValueEvent::RequestPortValueEvent(CountedPtr<Responder> responder, const string& port_path) -: QueuedEvent(responder), +RequestPortValueEvent::RequestPortValueEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& port_path) +: QueuedEvent(responder, timestamp), m_port_path(port_path), m_port(NULL), m_value(0.0), @@ -42,7 +42,7 @@ RequestPortValueEvent::RequestPortValueEvent(CountedPtr<Responder> responder, co void RequestPortValueEvent::pre_process() { - m_client = m_responder->find_client(); + m_client = _responder->find_client(); m_port = om->object_store()->find_port(m_port_path); QueuedEvent::pre_process(); @@ -66,12 +66,12 @@ RequestPortValueEvent::post_process() { string msg; if (m_port) { - m_responder->respond_error("Unable to find port for get_value responder."); + _responder->respond_error("Unable to find port for get_value responder."); } else if (m_client) { - m_responder->respond_ok(); + _responder->respond_ok(); m_client->control_change(m_port_path, m_value); } else { - m_responder->respond_error("Invalid URL"); + _responder->respond_error("Invalid URL"); } } diff --git a/src/libs/engine/events/RequestPortValueEvent.h b/src/libs/engine/events/RequestPortValueEvent.h index fd915c3b..bfb87790 100644 --- a/src/libs/engine/events/RequestPortValueEvent.h +++ b/src/libs/engine/events/RequestPortValueEvent.h @@ -37,7 +37,7 @@ using Shared::ClientInterface; class RequestPortValueEvent : public QueuedEvent { public: - RequestPortValueEvent(CountedPtr<Responder> responder, const string& port_path); + RequestPortValueEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& port_path); void pre_process(); void execute(samplecount offset); diff --git a/src/libs/engine/events/SetMetadataEvent.cpp b/src/libs/engine/events/SetMetadataEvent.cpp index 37e164c1..35ea2b47 100644 --- a/src/libs/engine/events/SetMetadataEvent.cpp +++ b/src/libs/engine/events/SetMetadataEvent.cpp @@ -28,8 +28,8 @@ using std::string; namespace Om { -SetMetadataEvent::SetMetadataEvent(CountedPtr<Responder> responder, const string& path, const string& key, const string& value) -: QueuedEvent(responder), +SetMetadataEvent::SetMetadataEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& path, const string& key, const string& value) +: QueuedEvent(responder, timestamp), m_path(path), m_key(key), m_value(value), @@ -68,9 +68,9 @@ SetMetadataEvent::post_process() if (m_object == NULL) { string msg = "Unable to find object "; msg += m_path; - m_responder->respond_error(msg); + _responder->respond_error(msg); } else { - m_responder->respond_ok(); + _responder->respond_ok(); om->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 faa9ae72..82e14ea2 100644 --- a/src/libs/engine/events/SetMetadataEvent.h +++ b/src/libs/engine/events/SetMetadataEvent.h @@ -34,7 +34,7 @@ class GraphObject; class SetMetadataEvent : public QueuedEvent { public: - SetMetadataEvent(CountedPtr<Responder> responder, const string& path, const string& key, const string& value); + SetMetadataEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& path, const string& key, const string& value); void pre_process(); void execute(samplecount offset); diff --git a/src/libs/engine/events/SetPortValueEvent.cpp b/src/libs/engine/events/SetPortValueEvent.cpp index 6401689b..8b861a58 100644 --- a/src/libs/engine/events/SetPortValueEvent.cpp +++ b/src/libs/engine/events/SetPortValueEvent.cpp @@ -28,8 +28,8 @@ namespace Om { /** Voice-specific control setting */ -SetPortValueEvent::SetPortValueEvent(CountedPtr<Responder> responder, size_t voice_num, const string& port_path, sample val) -: Event(responder), +SetPortValueEvent::SetPortValueEvent(CountedPtr<Responder> responder, samplecount timestamp, size_t voice_num, const string& port_path, sample val) +: Event(responder, timestamp), m_voice_num(voice_num), m_port_path(port_path), m_val(val), @@ -39,8 +39,8 @@ SetPortValueEvent::SetPortValueEvent(CountedPtr<Responder> responder, size_t voi } -SetPortValueEvent::SetPortValueEvent(CountedPtr<Responder> responder, const string& port_path, sample val) -: Event(responder), +SetPortValueEvent::SetPortValueEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& port_path, sample val) +: Event(responder, timestamp), m_voice_num(-1), m_port_path(port_path), m_val(val), @@ -76,7 +76,7 @@ SetPortValueEvent::post_process() if (m_error == NO_ERROR) { assert(m_port != NULL); - m_responder->respond_ok(); + _responder->respond_ok(); om->client_broadcaster()->send_control_change(m_port_path, m_val); // Send patch port control change, if this is a bridge port @@ -89,12 +89,12 @@ SetPortValueEvent::post_process() } else if (m_error == PORT_NOT_FOUND) { string msg = "Unable to find port "; msg.append(m_port_path).append(" for set_port_value"); - m_responder->respond_error(msg); + _responder->respond_error(msg); } else if (m_error == TYPE_MISMATCH) { string msg = "Attempt to set "; msg.append(m_port_path).append(" to incompatible type"); - m_responder->respond_error(msg); + _responder->respond_error(msg); } } diff --git a/src/libs/engine/events/SetPortValueEvent.h b/src/libs/engine/events/SetPortValueEvent.h index 0606e546..33c9cbd9 100644 --- a/src/libs/engine/events/SetPortValueEvent.h +++ b/src/libs/engine/events/SetPortValueEvent.h @@ -34,8 +34,8 @@ class Port; class SetPortValueEvent : public Event { public: - SetPortValueEvent(CountedPtr<Responder> responder, const string& port_path, sample val); - SetPortValueEvent(CountedPtr<Responder> responder, size_t voice_num, const string& port_path, sample val); + 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); void execute(samplecount offset); void post_process(); diff --git a/src/libs/engine/events/SetPortValueQueuedEvent.cpp b/src/libs/engine/events/SetPortValueQueuedEvent.cpp index 6ef39d55..21c1d104 100644 --- a/src/libs/engine/events/SetPortValueQueuedEvent.cpp +++ b/src/libs/engine/events/SetPortValueQueuedEvent.cpp @@ -29,8 +29,8 @@ namespace Om { /** Voice-specific control setting */ -SetPortValueQueuedEvent::SetPortValueQueuedEvent(CountedPtr<Responder> responder, size_t voice_num, const string& port_path, sample val) -: QueuedEvent(responder), +SetPortValueQueuedEvent::SetPortValueQueuedEvent(CountedPtr<Responder> responder, samplecount timestamp, size_t voice_num, const string& port_path, sample val) +: QueuedEvent(responder, timestamp), m_voice_num(voice_num), m_port_path(port_path), m_val(val), @@ -40,8 +40,8 @@ SetPortValueQueuedEvent::SetPortValueQueuedEvent(CountedPtr<Responder> responder } -SetPortValueQueuedEvent::SetPortValueQueuedEvent(CountedPtr<Responder> responder, const string& port_path, sample val) -: QueuedEvent(responder), +SetPortValueQueuedEvent::SetPortValueQueuedEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& port_path, sample val) +: QueuedEvent(responder, timestamp), m_voice_num(-1), m_port_path(port_path), m_val(val), @@ -88,7 +88,7 @@ SetPortValueQueuedEvent::post_process() if (m_error == NO_ERROR) { assert(m_port != NULL); - m_responder->respond_ok(); + _responder->respond_ok(); om->client_broadcaster()->send_control_change(m_port_path, m_val); // Send patch port control change, if this is a bridge port @@ -101,12 +101,12 @@ SetPortValueQueuedEvent::post_process() } else if (m_error == PORT_NOT_FOUND) { string msg = "Unable to find port "; msg.append(m_port_path).append(" for set_port_value_slow"); - m_responder->respond_error(msg); + _responder->respond_error(msg); } else if (m_error == TYPE_MISMATCH) { string msg = "Attempt to set "; msg.append(m_port_path).append(" to incompatible type"); - m_responder->respond_error(msg); + _responder->respond_error(msg); } } diff --git a/src/libs/engine/events/SetPortValueQueuedEvent.h b/src/libs/engine/events/SetPortValueQueuedEvent.h index d29f424b..035cb414 100644 --- a/src/libs/engine/events/SetPortValueQueuedEvent.h +++ b/src/libs/engine/events/SetPortValueQueuedEvent.h @@ -34,8 +34,8 @@ class Port; class SetPortValueQueuedEvent : public QueuedEvent { public: - SetPortValueQueuedEvent(CountedPtr<Responder> responder, const string& port_path, sample val); - SetPortValueQueuedEvent(CountedPtr<Responder> responder, size_t voice_num, const string& port_path, sample val); + 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); void pre_process(); void execute(samplecount offset); diff --git a/src/libs/engine/events/UnregisterClientEvent.cpp b/src/libs/engine/events/UnregisterClientEvent.cpp index 10696640..175543c9 100644 --- a/src/libs/engine/events/UnregisterClientEvent.cpp +++ b/src/libs/engine/events/UnregisterClientEvent.cpp @@ -24,8 +24,8 @@ namespace Om { -UnregisterClientEvent::UnregisterClientEvent(CountedPtr<Responder> responder, ClientKey key) -: QueuedEvent(responder) +UnregisterClientEvent::UnregisterClientEvent(CountedPtr<Responder> responder, samplecount timestamp, ClientKey key) +: QueuedEvent(responder, timestamp) , _key(key) { } @@ -35,9 +35,9 @@ void UnregisterClientEvent::post_process() { if (om->client_broadcaster()->unregister_client(_key)) - m_responder->respond_ok(); + _responder->respond_ok(); else - m_responder->respond_error("Unable to unregister client"); + _responder->respond_error("Unable to unregister client"); } diff --git a/src/libs/engine/events/UnregisterClientEvent.h b/src/libs/engine/events/UnregisterClientEvent.h index 56556629..e7c6a996 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, ClientKey key); + UnregisterClientEvent(CountedPtr<Responder> responder, samplecount timestamp, ClientKey key); void post_process(); |