From 188e34375827915a9832ddb1db4b94494bbee455 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 1 Aug 2007 14:10:46 +0000 Subject: Clean up engine/client interfaces. Hide Response, now an internal engine implementation detail (and not a problem for script bindings anymore). git-svn-id: http://svn.drobilla.net/lad/ingen@666 a436a847-0d15-0410-975c-d299462d15a1 --- src/bindings/Client.hpp | 92 ++++++------- src/common/interface/ClientInterface.hpp | 89 +++++++------ src/common/interface/EngineInterface.hpp | 11 +- src/common/interface/Responder.hpp | 71 ----------- src/libs/client/OSCClientReceiver.cpp | 40 +++--- src/libs/client/OSCClientReceiver.hpp | 8 +- src/libs/client/OSCEngineSender.cpp | 2 +- src/libs/client/OSCEngineSender.hpp | 5 +- src/libs/client/SigClientInterface.hpp | 42 +++--- src/libs/client/ThreadedSigClientInterface.hpp | 45 ++++--- src/libs/engine/ClientBroadcaster.hpp | 1 - src/libs/engine/DirectResponder.hpp | 53 -------- src/libs/engine/Event.hpp | 17 +-- src/libs/engine/Makefile.am | 4 +- src/libs/engine/OSCClientSender.cpp | 142 ++++++++++++--------- src/libs/engine/OSCClientSender.hpp | 97 +++++++------- src/libs/engine/OSCEngineReceiver.cpp | 63 ++------- src/libs/engine/OSCEngineReceiver.hpp | 5 +- src/libs/engine/OSCResponder.cpp | 98 -------------- src/libs/engine/OSCResponder.hpp | 70 ---------- src/libs/engine/QueuedEngineInterface.cpp | 33 +++-- src/libs/engine/QueuedEngineInterface.hpp | 15 +-- src/libs/engine/QueuedEvent.hpp | 12 +- src/libs/engine/Responder.hpp | 71 +++++++++++ src/libs/engine/events/AddNodeEvent.cpp | 12 +- src/libs/engine/events/AddNodeEvent.hpp | 26 ++-- src/libs/engine/events/AddPortEvent.cpp | 4 +- src/libs/engine/events/AddPortEvent.hpp | 18 +-- src/libs/engine/events/AllNotesOffEvent.cpp | 6 +- src/libs/engine/events/AllNotesOffEvent.hpp | 4 +- src/libs/engine/events/ClearPatchEvent.cpp | 4 +- src/libs/engine/events/ClearPatchEvent.hpp | 2 +- src/libs/engine/events/ConnectionEvent.cpp | 4 +- src/libs/engine/events/ConnectionEvent.hpp | 2 +- src/libs/engine/events/CreatePatchEvent.cpp | 4 +- src/libs/engine/events/CreatePatchEvent.hpp | 4 +- src/libs/engine/events/DSSIConfigureEvent.cpp | 2 +- src/libs/engine/events/DSSIConfigureEvent.hpp | 2 +- src/libs/engine/events/DSSIControlEvent.cpp | 2 +- src/libs/engine/events/DSSIControlEvent.hpp | 2 +- src/libs/engine/events/DSSIProgramEvent.cpp | 2 +- src/libs/engine/events/DSSIProgramEvent.hpp | 2 +- src/libs/engine/events/DSSIUpdateEvent.cpp | 2 +- src/libs/engine/events/DSSIUpdateEvent.hpp | 2 +- src/libs/engine/events/DeactivateEvent.cpp | 4 +- src/libs/engine/events/DeactivateEvent.hpp | 2 +- src/libs/engine/events/DestroyEvent.cpp | 6 +- src/libs/engine/events/DestroyEvent.hpp | 4 +- src/libs/engine/events/DisablePatchEvent.cpp | 4 +- src/libs/engine/events/DisablePatchEvent.hpp | 2 +- src/libs/engine/events/DisconnectNodeEvent.cpp | 6 +- src/libs/engine/events/DisconnectNodeEvent.hpp | 8 +- src/libs/engine/events/DisconnectPortEvent.cpp | 6 +- src/libs/engine/events/DisconnectPortEvent.hpp | 2 +- src/libs/engine/events/DisconnectionEvent.cpp | 6 +- src/libs/engine/events/DisconnectionEvent.hpp | 8 +- src/libs/engine/events/EnablePatchEvent.cpp | 4 +- src/libs/engine/events/EnablePatchEvent.hpp | 2 +- src/libs/engine/events/LoadPluginsEvent.cpp | 4 +- src/libs/engine/events/LoadPluginsEvent.hpp | 2 +- src/libs/engine/events/MidiLearnEvent.cpp | 4 +- src/libs/engine/events/MidiLearnEvent.hpp | 4 +- src/libs/engine/events/NoteOffEvent.cpp | 6 +- src/libs/engine/events/NoteOffEvent.hpp | 4 +- src/libs/engine/events/NoteOnEvent.cpp | 6 +- src/libs/engine/events/NoteOnEvent.hpp | 4 +- src/libs/engine/events/PingQueuedEvent.hpp | 4 +- src/libs/engine/events/RegisterClientEvent.cpp | 4 +- src/libs/engine/events/RegisterClientEvent.hpp | 4 +- src/libs/engine/events/RenameEvent.cpp | 4 +- src/libs/engine/events/RenameEvent.hpp | 2 +- src/libs/engine/events/RequestAllObjectsEvent.cpp | 12 +- src/libs/engine/events/RequestAllObjectsEvent.hpp | 5 +- src/libs/engine/events/RequestMetadataEvent.cpp | 15 +-- src/libs/engine/events/RequestMetadataEvent.hpp | 3 +- src/libs/engine/events/RequestObjectEvent.cpp | 13 +- src/libs/engine/events/RequestObjectEvent.hpp | 7 +- src/libs/engine/events/RequestPluginEvent.cpp | 9 +- src/libs/engine/events/RequestPluginEvent.hpp | 7 +- src/libs/engine/events/RequestPluginsEvent.cpp | 10 +- src/libs/engine/events/RequestPluginsEvent.hpp | 5 +- src/libs/engine/events/RequestPortValueEvent.cpp | 9 +- src/libs/engine/events/RequestPortValueEvent.hpp | 9 +- src/libs/engine/events/SetMetadataEvent.cpp | 4 +- src/libs/engine/events/SetMetadataEvent.hpp | 2 +- src/libs/engine/events/SetPortValueEvent.cpp | 6 +- src/libs/engine/events/SetPortValueEvent.hpp | 4 +- src/libs/engine/events/SetPortValueQueuedEvent.cpp | 6 +- src/libs/engine/events/SetPortValueQueuedEvent.hpp | 4 +- src/libs/engine/events/UnregisterClientEvent.cpp | 4 +- src/libs/engine/events/UnregisterClientEvent.hpp | 2 +- src/libs/gui/App.cpp | 2 + src/libs/gui/ConnectWindow.cpp | 19 +-- src/libs/gui/ConnectWindow.hpp | 2 +- 94 files changed, 604 insertions(+), 863 deletions(-) delete mode 100644 src/common/interface/Responder.hpp delete mode 100644 src/libs/engine/DirectResponder.hpp delete mode 100644 src/libs/engine/OSCResponder.cpp delete mode 100644 src/libs/engine/OSCResponder.hpp create mode 100644 src/libs/engine/Responder.hpp diff --git a/src/bindings/Client.hpp b/src/bindings/Client.hpp index aeca11d7..c160f3fa 100644 --- a/src/bindings/Client.hpp +++ b/src/bindings/Client.hpp @@ -5,86 +5,86 @@ class Client : public Ingen::Shared::ClientInterface { public: - //Client() : Ingen::Shared::ClientInterface() {} - /** Wrapper for engine->register_client to appease SWIG */ virtual void subscribe(Ingen::Shared::EngineInterface* engine) { - engine->register_client("FIXME", this); + engine->register_client(this); } - virtual void response(int32_t id, bool success, std::string msg) {} + virtual void response_ok(int32_t id) {} + + virtual void response_error(int32_t id, const std::string& msg) {} - virtual void enable() {} + virtual void enable() {} /** Signifies the client does not wish to receive any messages until * enable is called. Useful for performance and avoiding feedback. */ - virtual void disable() {} + virtual void disable() {} /** Bundles are a group of messages that are guaranteed to be in an * atomic unit with guaranteed order (eg a packet). For datagram * protocols (like UDP) there is likely an upper limit on bundle size. */ - virtual void bundle_begin() {} - virtual void bundle_end() {} + virtual void bundle_begin() {} + virtual void bundle_end() {} /** Transfers are 'weak' bundles. These are used to break a large group * of similar/related messages into larger chunks (solely for communication * efficiency). A bunch of messages in a transfer will arrive as 1 or more - * bundles (so a transfer can exceep the maximum bundle (packet) size). + * bundles (so a transfer can exceed the maximum bundle (packet) size). */ - virtual void transfer_begin() {} - virtual void transfer_end() {} + virtual void transfer_begin() {} + virtual void transfer_end() {} - virtual void error(std::string msg) {} + virtual void error(const std::string& msg) {} - virtual void num_plugins(uint32_t num_plugins) {} + virtual void num_plugins(uint32_t num_plugins) {} - virtual void new_plugin(std::string uri, - std::string type_uri, - std::string name) {} + virtual void new_plugin(const std::string& uri, + const std::string& type_uri, + const std::string& name) {} - virtual void new_patch(std::string path, uint32_t poly) {} + virtual void new_patch(const std::string& path, uint32_t poly) {} - virtual void new_node(std::string plugin_uri, - std::string node_path, - bool is_polyphonic, - uint32_t num_ports) {} + virtual void new_node(const std::string& plugin_uri, + const std::string& node_path, + bool is_polyphonic, + uint32_t num_ports) {} - virtual void new_port(std::string path, - std::string data_type, - bool is_output) {} + virtual void new_port(const std::string& path, + const std::string& data_type, + bool is_output) {} - virtual void patch_enabled(std::string path) {} + virtual void patch_enabled(const std::string& path) {} - virtual void patch_disabled(std::string path) {} + virtual void patch_disabled(const std::string& path) {} - virtual void patch_cleared(std::string path) {} + virtual void patch_cleared(const std::string& path) {} - virtual void object_renamed(std::string old_path, - std::string new_path) {} + virtual void object_renamed(const std::string& old_path, + const std::string& new_path) {} - virtual void object_destroyed(std::string path) {} + virtual void object_destroyed(const std::string& path) {} - virtual void connection(std::string src_port_path, - std::string dst_port_path) {} + virtual void connection(const std::string& src_port_path, + const std::string& dst_port_path) {} - virtual void disconnection(std::string src_port_path, - std::string dst_port_path) {} + virtual void disconnection(const std::string& src_port_path, + const std::string& dst_port_path) {} - virtual void metadata_update(std::string subject_path, - std::string predicate, - Raul::Atom value) {} + virtual void metadata_update(const std::string& subject_path, + const std::string& predicate, + const Raul::Atom& value) {} - virtual void control_change(std::string port_path, - float value) {} + virtual void control_change(const std::string& port_path, + float value) {} - virtual void program_add(std::string node_path, - uint32_t bank, - uint32_t program, - std::string program_name) {} + virtual void program_add(const std::string& node_path, + uint32_t bank, + uint32_t program, + const std::string& program_name) {} - virtual void program_remove(std::string node_path, - uint32_t bank, - uint32_t program) {} + virtual void program_remove(const std::string& node_path, + uint32_t bank, + uint32_t program) {} }; diff --git a/src/common/interface/ClientInterface.hpp b/src/common/interface/ClientInterface.hpp index a13b870c..4993c4f5 100644 --- a/src/common/interface/ClientInterface.hpp +++ b/src/common/interface/ClientInterface.hpp @@ -18,6 +18,7 @@ #ifndef CLIENTINTERFACE_H #define CLIENTINTERFACE_H +#include #include #include #include @@ -38,10 +39,11 @@ public: virtual ~ClientInterface() {} - /** Wrapper for engine->register_client to appease SWIG */ - virtual void subscribe(EngineInterface* engine) = 0; - - virtual void response(int32_t id, bool success, std::string msg) = 0; + inline const std::string& uri() const { return _uri; } + + virtual void response_ok(int32_t id) = 0; + + virtual void response_error(int32_t id, const std::string& msg) = 0; virtual void enable() = 0; @@ -60,65 +62,72 @@ public: /** Transfers are 'weak' bundles. These are used to break a large group * of similar/related messages into larger chunks (solely for communication * efficiency). A bunch of messages in a transfer will arrive as 1 or more - * bundles (so a transfer can exceep the maximum bundle (packet) size). + * bundles (so a transfer can exceed the maximum bundle (packet) size). */ virtual void transfer_begin() = 0; virtual void transfer_end() = 0; - virtual void error(std::string msg) = 0; + virtual void error(const std::string& msg) = 0; virtual void num_plugins(uint32_t num_plugins) = 0; - virtual void new_plugin(std::string uri, - std::string type_uri, - std::string name) = 0; + virtual void new_plugin(const std::string& uri, + const std::string& type_uri, + const std::string& name) = 0; - virtual void new_patch(std::string path, uint32_t poly) = 0; + virtual void new_patch(const std::string& path, uint32_t poly) = 0; - virtual void new_node(std::string plugin_uri, - std::string node_path, - bool is_polyphonic, - uint32_t num_ports) = 0; + virtual void new_node(const std::string& plugin_uri, + const std::string& node_path, + bool is_polyphonic, + uint32_t num_ports) = 0; - virtual void new_port(std::string path, - std::string data_type, - bool is_output) = 0; + virtual void new_port(const std::string& path, + const std::string& data_type, + bool is_output) = 0; - virtual void patch_enabled(std::string path) = 0; + virtual void patch_enabled(const std::string& path) = 0; - virtual void patch_disabled(std::string path) = 0; + virtual void patch_disabled(const std::string& path) = 0; - virtual void patch_cleared(std::string path) = 0; + virtual void patch_cleared(const std::string& path) = 0; - virtual void object_renamed(std::string old_path, - std::string new_path) = 0; + virtual void object_renamed(const std::string& old_path, + const std::string& new_path) = 0; - virtual void object_destroyed(std::string path) = 0; + virtual void object_destroyed(const std::string& path) = 0; - virtual void connection(std::string src_port_path, - std::string dst_port_path) = 0; + virtual void connection(const std::string& src_port_path, + const std::string& dst_port_path) = 0; - virtual void disconnection(std::string src_port_path, - std::string dst_port_path) = 0; + virtual void disconnection(const std::string& src_port_path, + const std::string& dst_port_path) = 0; - virtual void metadata_update(std::string subject_path, - std::string predicate, - Raul::Atom value) = 0; + virtual void metadata_update(const std::string& subject_path, + const std::string& predicate, + const Raul::Atom& value) = 0; - virtual void control_change(std::string port_path, - float value) = 0; + virtual void control_change(const std::string& port_path, + float value) = 0; - virtual void program_add(std::string node_path, - uint32_t bank, - uint32_t program, - std::string program_name) = 0; + virtual void program_add(const std::string& node_path, + uint32_t bank, + uint32_t program, + const std::string& program_name) = 0; - virtual void program_remove(std::string node_path, - uint32_t bank, - uint32_t program) = 0; + virtual void program_remove(const std::string& node_path, + uint32_t bank, + uint32_t program) = 0; protected: - ClientInterface() {} + ClientInterface(const std::string& uri) : _uri(uri) {} + ClientInterface() { + static char uri_buf[20]; + snprintf(uri_buf, 127, "%p", this); + _uri = uri_buf; + } + + std::string _uri; }; diff --git a/src/common/interface/EngineInterface.hpp b/src/common/interface/EngineInterface.hpp index 09860e31..192357a7 100644 --- a/src/common/interface/EngineInterface.hpp +++ b/src/common/interface/EngineInterface.hpp @@ -29,8 +29,6 @@ namespace Ingen { /** Shared code used on both client side and engine side (abstract interfaces). */ namespace Shared { -class Responder; - /** The (only) interface clients use to communicate with the engine. * @@ -42,12 +40,11 @@ public: virtual ~EngineInterface() {} // Responses - virtual void set_responder(SharedPtr responder) = 0; virtual void set_next_response_id(int32_t id) = 0; virtual void disable_responses() = 0; // Client registration - virtual void register_client(const string& uri, ClientInterface* client) = 0; + virtual void register_client(ClientInterface* client) = 0; virtual void unregister_client(const string& uri) = 0; @@ -112,9 +109,9 @@ public: virtual void midi_learn(const string& node_path) = 0; - virtual void set_metadata(const string& path, - const string& predicate, - const Raul::Atom& value) = 0; + virtual void set_metadata(const string& path, + const string& predicate, + const Raul::Atom& value) = 0; // Requests // diff --git a/src/common/interface/Responder.hpp b/src/common/interface/Responder.hpp deleted file mode 100644 index 463a3471..00000000 --- a/src/common/interface/Responder.hpp +++ /dev/null @@ -1,71 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef RESPONDER_H -#define RESPONDER_H - -#include -#include -#include -#include "interface/ClientInterface.hpp" - -namespace Ingen { -namespace Shared { - - -/** Class to handle responding to clients. - * - * This is an abstract base class to fully abstract the details of client - * communication from the internals of the engine. - * - * Note that this class only handles sending responses to commands from - * clients, (ie OK or an error), not notifications (ie new node, - * disconnection) - that's what ClientInterface is for. If a command is - * a request, the Responder can be used to find the ClientInterface - * (by URI) which should receive the response. - * - * ClientInterface and Responder are seperate because responding might not - * actually get exposed to the client interface (eg in simulated blocking - * interfaces that wait for responses before returning). - * - * Note for messages that have a "response" and some broadcasted effect - * (eg setting a port value) the "response" MUST be sent first since Responder - * is responsible for controlling whether the client wishes to receive the - * notification. - */ -class Responder -{ -public: - Responder() {} - virtual ~Responder() {} - - virtual std::string client_uri() { return ""; } - - virtual ClientInterface* client() { return NULL; } - - virtual void set_id(int32_t id) {} - - virtual void respond_ok() {} - virtual void respond_error(const std::string& msg) {} -}; - - -} // namespace Shared -} // namespace Ingen - -#endif // RESPONDER_H - diff --git a/src/libs/client/OSCClientReceiver.cpp b/src/libs/client/OSCClientReceiver.cpp index 96533db2..0479cea9 100644 --- a/src/libs/client/OSCClientReceiver.cpp +++ b/src/libs/client/OSCClientReceiver.cpp @@ -21,8 +21,9 @@ #include #include #include +#include -using std::cerr; using std::cout; using std::endl; +using namespace std; using namespace Raul; namespace Ingen { @@ -30,14 +31,14 @@ namespace Client { OSCClientReceiver::OSCClientReceiver(int listen_port) -: _listen_port(listen_port), +: ClientInterface("localhost"), _st(NULL)//, // _receiving_node(false), // _receiving_node_model(NULL), // _receiving_node_num_ports(0), // _num_received_ports(0) { - start(); + start(false); } @@ -48,7 +49,7 @@ OSCClientReceiver::~OSCClientReceiver() void -OSCClientReceiver::start() +OSCClientReceiver::start(bool dump_osc) { if (_st != NULL) return; @@ -57,12 +58,12 @@ OSCClientReceiver::start() if (_listen_port != 0) { char port_str[8]; snprintf(port_str, 8, "%d", _listen_port); - _st = lo_server_thread_new(port_str, error_cb); + _st = lo_server_thread_new(port_str, lo_error_cb); } // Find a free port if (!_st) { - _st = lo_server_thread_new(NULL, error_cb); + _st = lo_server_thread_new(NULL, lo_error_cb); _listen_port = lo_server_thread_get_port(_st); } @@ -74,11 +75,9 @@ OSCClientReceiver::start() } // Print all incoming messages - lo_server_thread_add_method(_st, NULL, NULL, generic_cb, NULL); + if (dump_osc) + lo_server_thread_add_method(_st, NULL, NULL, generic_cb, NULL); - //lo_server_thread_add_method(_st, "/ingen/response/ok", "i", om_response_ok_cb, this); - //lo_server_thread_add_method(_st, "/ingen/response/error", "is", om_responseerror_cb, this); - setup_callbacks(); // Display any uncaught messages to the console @@ -122,7 +121,7 @@ OSCClientReceiver::generic_cb(const char* path, const char* types, lo_arg** argv void -OSCClientReceiver::error_cb(int num, const char* msg, const char* path) +OSCClientReceiver::lo_error_cb(int num, const char* msg, const char* path) { cerr << "Got error from server: " << msg << endl; } @@ -144,7 +143,8 @@ OSCClientReceiver::unknown_cb(const char* path, const char* types, lo_arg** argv void OSCClientReceiver::setup_callbacks() { - lo_server_thread_add_method(_st, "/ingen/response", "iis", response_cb, this); + lo_server_thread_add_method(_st, "/ingen/ok", "i", response_ok_cb, this); + lo_server_thread_add_method(_st, "/ingen/error", "is", response_error_cb, this); lo_server_thread_add_method(_st, "/ingen/num_plugins", "i", num_plugins_cb, this); lo_server_thread_add_method(_st, "/ingen/plugin", "sss", plugin_cb, this); lo_server_thread_add_method(_st, "/ingen/new_patch", "si", new_patch_cb, this); @@ -366,10 +366,20 @@ OSCClientReceiver::_control_change_cb(const char* path, const char* types, lo_ar int -OSCClientReceiver::_response_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg) +OSCClientReceiver::_response_ok_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg) +{ + assert(!strcmp(types, "i")); + response_ok(argv[0]->i); + + return 0; +} + + +int +OSCClientReceiver::_response_error_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg) { - assert(!strcmp(types, "iis")); - response(argv[0]->i, argv[1]->i, &argv[2]->s); + assert(!strcmp(types, "is")); + response_error(argv[0]->i, &argv[1]->s); return 0; } diff --git a/src/libs/client/OSCClientReceiver.hpp b/src/libs/client/OSCClientReceiver.hpp index b27e7f78..45273201 100644 --- a/src/libs/client/OSCClientReceiver.hpp +++ b/src/libs/client/OSCClientReceiver.hpp @@ -66,7 +66,7 @@ public: //void enable() {} //void disable() {} - void start(); + void start(bool dump_osc); void stop(); int listen_port() { return _listen_port; } @@ -75,7 +75,8 @@ public: private: void setup_callbacks(); - static void error_cb(int num, const char* msg, const char* path); + static void lo_error_cb(int num, const char* msg, const char* path); + static int generic_cb(const char* path, const char* types, lo_arg** argv, int argc, void* data, void* user_data); static int unknown_cb(const char* path, const char* types, lo_arg** argv, int argc, void* data, void* osc_receiver); @@ -83,7 +84,8 @@ private: lo_server_thread _st; LO_HANDLER(error); - LO_HANDLER(response); + LO_HANDLER(response_ok); + LO_HANDLER(response_error); LO_HANDLER(num_plugins); LO_HANDLER(plugin); LO_HANDLER(plugin_list_end); diff --git a/src/libs/client/OSCEngineSender.cpp b/src/libs/client/OSCEngineSender.cpp index 553b073c..76b094a0 100644 --- a/src/libs/client/OSCEngineSender.cpp +++ b/src/libs/client/OSCEngineSender.cpp @@ -107,7 +107,7 @@ OSCEngineSender::attach(int32_t ping_id, bool block) * traversal. It is a parameter to remain compatible with EngineInterface. */ void -OSCEngineSender::register_client(const string& uri, ClientInterface* client) +OSCEngineSender::register_client(ClientInterface* client) { // FIXME: use parameters.. er, somehow. assert(_engine_addr); diff --git a/src/libs/client/OSCEngineSender.hpp b/src/libs/client/OSCEngineSender.hpp index b1a3ae1e..fc3c100d 100644 --- a/src/libs/client/OSCEngineSender.hpp +++ b/src/libs/client/OSCEngineSender.hpp @@ -22,11 +22,9 @@ #include #include #include "interface/EngineInterface.hpp" -#include "interface/Responder.hpp" using std::string; using Ingen::Shared::EngineInterface; using Ingen::Shared::ClientInterface; -using Ingen::Shared::Responder; namespace Ingen { namespace Client { @@ -51,7 +49,6 @@ public: inline size_t next_id() { int32_t ret = (_id == -1) ? -1 : _id++; return ret; } - void set_responder(SharedPtr responder) { throw; } void set_next_response_id(int32_t id) { _id = id; } void disable_responses() { _id = -1; } @@ -61,7 +58,7 @@ public: /* *** EngineInterface implementation below here *** */ // Client registration - void register_client(const string& uri, ClientInterface* client); + void register_client(ClientInterface* client); void unregister_client(const string& uri); diff --git a/src/libs/client/SigClientInterface.hpp b/src/libs/client/SigClientInterface.hpp index 58a3297a..bdb1ff23 100644 --- a/src/libs/client/SigClientInterface.hpp +++ b/src/libs/client/SigClientInterface.hpp @@ -43,7 +43,8 @@ public: // Signal parameters match up directly with ClientInterface calls - sigc::signal response_sig; + sigc::signal response_ok_sig; + sigc::signal response_error_sig; sigc::signal bundle_begin_sig; sigc::signal bundle_end_sig; sigc::signal error_sig; @@ -80,55 +81,58 @@ protected: void num_plugins(uint32_t num) { num_plugins_sig.emit(num); } - void response(int32_t id, bool success, string msg) - { response_sig.emit(id, success, msg); } + void response_ok(int32_t id) + { response_ok_sig.emit(id); } - void error(string msg) + void response_error(int32_t id, const string& msg) + { response_error_sig.emit(id, msg); } + + void error(const string& msg) { error_sig.emit(msg); } - void new_plugin(string uri, string type_uri, string name) + void new_plugin(const string& uri, const string& type_uri, const string& name) { new_plugin_sig.emit(uri, type_uri, name); } - void new_patch(string path, uint32_t poly) + void new_patch(const string& path, uint32_t poly) { new_patch_sig.emit(path, poly); } - void new_node(string plugin_uri, string node_path, bool is_polyphonic, uint32_t num_ports) + void new_node(const string& plugin_uri, const string& node_path, bool is_polyphonic, uint32_t num_ports) { new_node_sig.emit(plugin_uri, node_path, is_polyphonic, num_ports); } - void new_port(string path, string data_type, bool is_output) + void new_port(const string& path, const string& data_type, bool is_output) { new_port_sig.emit(path, data_type, is_output); } - void connection(string src_port_path, string dst_port_path) + void connection(const string& src_port_path, const string& dst_port_path) { connection_sig.emit(src_port_path, dst_port_path); } - void object_destroyed(string path) + void object_destroyed(const string& path) { object_destroyed_sig.emit(path); } - void patch_enabled(string path) + void patch_enabled(const string& path) { patch_enabled_sig.emit(path); } - void patch_disabled(string path) + void patch_disabled(const string& path) { patch_disabled_sig.emit(path); } - void patch_cleared(string path) + void patch_cleared(const string& path) { patch_cleared_sig.emit(path); } - void object_renamed(string old_path, string new_path) + void object_renamed(const string& old_path, const string& new_path) { object_renamed_sig.emit(old_path, new_path); } - void disconnection(string src_port_path, string dst_port_path) + void disconnection(const string& src_port_path, const string& dst_port_path) { disconnection_sig.emit(src_port_path, dst_port_path); } - void metadata_update(string path, string key, Raul::Atom value) + void metadata_update(const string& path, const string& key, const Raul::Atom& value) { metadata_update_sig.emit(path, key, value); } - void control_change(string port_path, float value) + void control_change(const string& port_path, float value) { control_change_sig.emit(port_path, value); } - void program_add(string path, uint32_t bank, uint32_t program, string name) + void program_add(const string& path, uint32_t bank, uint32_t program, const string& name) { program_add_sig.emit(path, bank, program, name); } - void program_remove(string path, uint32_t bank, uint32_t program) + void program_remove(const string& path, uint32_t bank, uint32_t program) { program_remove_sig.emit(path, bank, program); } protected: diff --git a/src/libs/client/ThreadedSigClientInterface.hpp b/src/libs/client/ThreadedSigClientInterface.hpp index af321cab..ed9f0ed4 100644 --- a/src/libs/client/ThreadedSigClientInterface.hpp +++ b/src/libs/client/ThreadedSigClientInterface.hpp @@ -47,7 +47,8 @@ public: ThreadedSigClientInterface(uint32_t queue_size) : _enabled(true) , _sigs(queue_size) - , response_slot(response_sig.make_slot()) + , response_ok_slot(response_ok_sig.make_slot()) + , response_error_slot(response_error_sig.make_slot()) , error_slot(error_sig.make_slot()) , new_plugin_slot(new_plugin_sig.make_slot()) , new_patch_slot(new_patch_sig.make_slot()) @@ -82,55 +83,58 @@ public: void num_plugins(uint32_t num) { _num_plugins = num; } - void response(int32_t id, bool success, string msg) - { push_sig(sigc::bind(response_slot, id, success, msg)); } + void response_ok(int32_t id) + { push_sig(sigc::bind(response_ok_slot, id)); } + + void response_error(int32_t id, const string& msg) + { push_sig(sigc::bind(response_error_slot, id, msg)); } - void error(string msg) + void error(const string& msg) { push_sig(sigc::bind(error_slot, msg)); } - void new_plugin(string uri, string type_uri, string name) + void new_plugin(const string& uri, const string& type_uri, const string& name) { push_sig(sigc::bind(new_plugin_slot, uri, type_uri, name)); } - void new_patch(string path, uint32_t poly) + void new_patch(const string& path, uint32_t poly) { push_sig(sigc::bind(new_patch_slot, path, poly)); } - void new_node(string plugin_uri, string node_path, bool is_polyphonic, uint32_t num_ports) + void new_node(const string& plugin_uri, const string& node_path, bool is_polyphonic, uint32_t num_ports) { push_sig(sigc::bind(new_node_slot, plugin_uri, node_path, is_polyphonic, num_ports)); } - void new_port(string path, string data_type, bool is_output) + void new_port(const string& path, const string& data_type, bool is_output) { push_sig(sigc::bind(new_port_slot, path, data_type, is_output)); } - void connection(string src_port_path, string dst_port_path) + void connection(const string& src_port_path, const string& dst_port_path) { push_sig(sigc::bind(connection_slot, src_port_path, dst_port_path)); } - void object_destroyed(string path) + void object_destroyed(const string& path) { push_sig(sigc::bind(object_destroyed_slot, path)); } - void patch_enabled(string path) + void patch_enabled(const string& path) { push_sig(sigc::bind(patch_enabled_slot, path)); } - void patch_disabled(string path) + void patch_disabled(const string& path) { push_sig(sigc::bind(patch_disabled_slot, path)); } - void patch_cleared(string path) + void patch_cleared(const string& path) { push_sig(sigc::bind(patch_cleared_slot, path)); } - void object_renamed(string old_path, string new_path) + void object_renamed(const string& old_path, const string& new_path) { push_sig(sigc::bind(object_renamed_slot, old_path, new_path)); } - void disconnection(string src_port_path, string dst_port_path) + void disconnection(const string& src_port_path, const string& dst_port_path) { push_sig(sigc::bind(disconnection_slot, src_port_path, dst_port_path)); } - void metadata_update(string path, string key, Raul::Atom value) + void metadata_update(const string& path, const string& key, const Raul::Atom& value) { push_sig(sigc::bind(metadata_update_slot, path, key, value)); } - void control_change(string port_path, float value) + void control_change(const string& port_path, float value) { push_sig(sigc::bind(control_change_slot, port_path, value)); } - void program_add(string path, uint32_t bank, uint32_t program, string name) + void program_add(const string& path, uint32_t bank, uint32_t program, const string& name) { push_sig(sigc::bind(program_add_slot, path, bank, program, name)); } - void program_remove(string path, uint32_t bank, uint32_t program) + void program_remove(const string& path, uint32_t bank, uint32_t program) { push_sig(sigc::bind(program_remove_slot, path, bank, program)); } /** Process all queued events - Called from GTK thread to emit signals. */ @@ -147,7 +151,8 @@ private: sigc::slot bundle_begin_slot; sigc::slot bundle_end_slot; sigc::slot num_plugins_slot; - sigc::slot response_slot; + sigc::slot response_ok_slot; + sigc::slot response_error_slot; sigc::slot error_slot; sigc::slot new_plugin_slot; sigc::slot new_patch_slot; diff --git a/src/libs/engine/ClientBroadcaster.hpp b/src/libs/engine/ClientBroadcaster.hpp index 034476f5..40fef365 100644 --- a/src/libs/engine/ClientBroadcaster.hpp +++ b/src/libs/engine/ClientBroadcaster.hpp @@ -37,7 +37,6 @@ class Port; class Plugin; class Patch; class Connection; -namespace Shared { class Responder; } using Shared::ClientInterface; diff --git a/src/libs/engine/DirectResponder.hpp b/src/libs/engine/DirectResponder.hpp deleted file mode 100644 index 7bd35dcd..00000000 --- a/src/libs/engine/DirectResponder.hpp +++ /dev/null @@ -1,53 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef DIRECTRESPONDER_H -#define DIRECTRESPONDER_H - -#include -#include "interface/ClientInterface.hpp" -#include "interface/Responder.hpp" - -namespace Ingen { - - -/** Responder for Direct clients (directly calls methods on a ClientInterface). - */ -class DirectResponder : public Shared::Responder -{ -public: - DirectResponder(Shared::ClientInterface* client, int32_t id) - : _client(client), _id(id) - {} - - void set_id(int32_t id) { _id = id; } - - void respond_ok() { _client->response(_id, true, ""); } - void respond_error(const string& msg) { _client->response(_id, false, msg); } - - Shared::ClientInterface* client() { return _client; } - -private: - Shared::ClientInterface* _client; - int32_t _id; -}; - - -} // namespace Ingen - -#endif // DIRECTRESPONDER_H - diff --git a/src/libs/engine/Event.hpp b/src/libs/engine/Event.hpp index 8814cbae..fe0112d3 100644 --- a/src/libs/engine/Event.hpp +++ b/src/libs/engine/Event.hpp @@ -21,18 +21,13 @@ #include #include #include -#include "interface/Responder.hpp" #include "types.hpp" #include "ThreadManager.hpp" -namespace Raul { class Path; } -using Raul::Path; - -using Ingen::Shared::Responder; - namespace Ingen { class Engine; +class Responder; /** Base class for all events (both realtime and QueuedEvent). @@ -75,17 +70,17 @@ public: inline SampleCount time() { return _time; } protected: - Event(Engine& engine, SharedPtr responder, FrameTime time) + Event(Engine& engine, SharedPtr responder, FrameTime time) : _engine(engine) , _responder(responder) , _time(time) , _executed(false) {} - Engine& _engine; - SharedPtr _responder; - FrameTime _time; - bool _executed; + Engine& _engine; + SharedPtr _responder; + FrameTime _time; + bool _executed; }; diff --git a/src/libs/engine/Makefile.am b/src/libs/engine/Makefile.am index 72cea433..7f87c479 100644 --- a/src/libs/engine/Makefile.am +++ b/src/libs/engine/Makefile.am @@ -31,7 +31,6 @@ libingen_engine_la_SOURCES = \ Connection.cpp \ Connection.hpp \ DataType.hpp \ - DirectResponder.hpp \ Driver.hpp \ DuplexPort.cpp \ DuplexPort.hpp \ @@ -69,8 +68,7 @@ libingen_engine_la_SOURCES = \ OSCDriver.hpp \ OSCEngineReceiver.cpp \ OSCEngineReceiver.hpp \ - OSCResponder.cpp \ - OSCResponder.hpp \ + Responder.hpp \ ObjectSender.cpp \ ObjectSender.hpp \ ObjectStore.cpp \ diff --git a/src/libs/engine/OSCClientSender.cpp b/src/libs/engine/OSCClientSender.cpp index 23144978..66b1ed02 100644 --- a/src/libs/engine/OSCClientSender.cpp +++ b/src/libs/engine/OSCClientSender.cpp @@ -30,8 +30,8 @@ #include "Connection.hpp" #include "AudioDriver.hpp" #include "interface/ClientInterface.hpp" -#include "interface/Responder.hpp" -using std::cout; using std::cerr; using std::endl; + +using namespace std; namespace Ingen { @@ -96,23 +96,39 @@ OSCClientSender::transfer_end() * \n *

Control Band

*/ + +/** \page client_osc_namespace + *

\b /ingen/ok - Respond to a successful user command + * \arg \b response-id (int) - Request ID this is a response to + *

\n \n + */ +void +OSCClientSender::response_ok(int32_t id) +{ + if (!_enabled) + return; + + if (lo_send(_address, "/ingen/ok", "i", id) < 0) { + cerr << "Unable to send ok " << id << "! (" + << lo_address_errstr(_address) << ")" << endl; + } +} /** \page client_osc_namespace *

\b /ingen/response - Respond to a user command * \arg \b response-id (int) - Request ID this is a response to - * \arg \b success (boolean int) - Whether response is affirmative or an error - * \arg \b message (string) - Error message (natural language text) + * \arg \b message (const std::string&) - Error message (natural language text) *

\n \n */ void -OSCClientSender::response(int32_t id, bool success, string msg) +OSCClientSender::response_error(int32_t id, const std::string& msg) { if (!_enabled) return; - if (lo_send(_address, "/ingen/response", "iis", id, success ? 1 : 0, msg.c_str()) < 0) { - cerr << "Unable to send response " << id << "! (" + if (lo_send(_address, "/ingen/error", "is", id, msg.c_str()) < 0) { + cerr << "Unable to send error " << id << "! (" << lo_address_errstr(_address) << ")" << endl; } } @@ -126,12 +142,12 @@ OSCClientSender::response(int32_t id, bool success, string msg) /** \page client_osc_namespace *

\b /ingen/error - Notification that an error has occurred - * \arg \b message (string) - Error message (natural language text) \n\n + * \arg \b message (const std::string&) - Error message (natural language text) \n\n * \li This is for notification of errors that aren't a direct response to a * user command, ie "unexpected" errors.

\n \n */ void -OSCClientSender::error(string msg) +OSCClientSender::error(const std::string& msg) { if (!_enabled) return; @@ -168,11 +184,11 @@ OSCClientSender::num_plugins(uint32_t num) /** \page client_osc_namespace *

\b /ingen/plugin - Notification of the existance of a plugin - * \arg \b type (string) - Type if plugin ("LADSPA", "DSSI", or "Internal") - * \arg \b uri (string) - URI of the plugin (see engine namespace documentation) \n - * \arg \b lib-name (string) - Name of shared library plugin resides in (ie "cmt.so") - * \arg \b plug-label (string) - Label of the plugin (ie "dahdsr_iaoa") - * \arg \b name (string) - Descriptive human-readable name of plugin (ie "ADSR Envelope") + * \arg \b type (const std::string&) - Type if plugin ("LADSPA", "DSSI", or "Internal") + * \arg \b uri (const std::string&) - URI of the plugin (see engine namespace documentation) \n + * \arg \b lib-name (const std::string&) - Name of shared library plugin resides in (ie "cmt.so") + * \arg \b plug-label (const std::string&) - Label of the plugin (ie "dahdsr_iaoa") + * \arg \b name (const std::string&) - Descriptive human-readable name of plugin (ie "ADSR Envelope") *

\n \n */ /* @@ -198,7 +214,7 @@ OSCClientSender::plugins() plugin = (*j); m = lo_message_new(); - lo_message_add_string(m, plugin->type_string()); + lo_message_add_string(m, plugin->type_const std::string&()); lo_message_add_string(m, plugin->uri().c_str()); lo_message_add_string(m, plugin->plug_label().c_str()); lo_message_add_string(m, plugin->name().c_str()); @@ -226,16 +242,16 @@ OSCClientSender::plugins() /** \page client_osc_namespace *

\b /ingen/new_node - Notification of a new node's creation. - * \arg \b plug-uri (string) - URI of the plugin new node is an instance of - * \arg \b path (string) - Path of the new node + * \arg \b plug-uri (const std::string&) - URI of the plugin new node is an instance of + * \arg \b path (const std::string&) - Path of the new node * \arg \b polyphonic (integer-boolean) - Node is polyphonic (1 = yes, 0 = no) * \arg \b num-ports (integer) - Number of ports (number of new_port messages to expect)\n\n * \li New nodes are sent as a bundle. The first message in the bundle will be * this one (/ingen/new_node), followed by a series of /ingen/new_port commands, * followed by /ingen/new_node_end.

\n \n */ -void OSCClientSender::new_node(string plugin_uri, - string node_path, +void OSCClientSender::new_node(const std::string& plugin_uri, + const std::string& node_path, bool is_polyphonic, uint32_t num_ports) { @@ -278,9 +294,9 @@ void OSCClientSender::new_node(string plugin_uri, m = lo_message_new(); lo_message_add_string(m, port->path().c_str()); - lo_message_add_string(m, info->type_string().c_str()); - lo_message_add_string(m, info->direction_string().c_str()); - lo_message_add_string(m, info->hint_string().c_str()); + lo_message_add_string(m, info->type_const std::string&().c_str()); + lo_message_add_string(m, info->direction_const std::string&().c_str()); + lo_message_add_string(m, info->hint_const std::string&().c_str()); lo_message_add_float(m, info->default_val()); lo_message_add_float(m, info->min_val()); lo_message_add_float(m, info->max_val()); @@ -309,17 +325,17 @@ void OSCClientSender::new_node(string plugin_uri, usleep(100); */ /* - const map& data = node->metadata(); + const map& data = node->metadata(); // Send node metadata - for (map::const_iterator i = data.begin(); i != data.end(); ++i) + for (map::const_iterator i = data.begin(); i != data.end(); ++i) metadata_update(node->path(), (*i).first, (*i).second); // Send port metadata for (size_t j=0; j < ports.size(); ++j) { port = ports.at(j); - const map& data = port->metadata(); - for (map::const_iterator i = data.begin(); i != data.end(); ++i) + const map& data = port->metadata(); + for (map::const_iterator i = data.begin(); i != data.end(); ++i) metadata_update(port->path(), (*i).first, (*i).second); } @@ -337,8 +353,8 @@ void OSCClientSender::new_node(string plugin_uri, /** \page client_osc_namespace *

\b /ingen/new_port - Notification of a new port's creation. - * \arg \b path (string) - Path of new port - * \arg \b data-type (string) - Type of port (ingen:audio, ingen:control, ingen:midi, or ingen:osc) + * \arg \b path (const std::string&) - Path of new port + * \arg \b data-type (const std::string&) - Type of port (ingen:audio, ingen:control, ingen:midi, or ingen:osc) * \arg \b direction ("is-output") (integer) - Direction of data flow (Input = 0, Output = 1) * * \li Note that in the event of loading a patch, this message could be @@ -350,8 +366,8 @@ void OSCClientSender::new_node(string plugin_uri, * as metadata.

\n \n */ void -OSCClientSender::new_port(string path, - string data_type, +OSCClientSender::new_port(const std::string& path, + const std::string& data_type, bool is_output) { if (!_enabled) @@ -363,10 +379,10 @@ OSCClientSender::new_port(string path, /** \page client_osc_namespace *

\b /ingen/destroyed - Notification an object has been destroyed - * \arg \b path (string) - Path of object (which no longer exists)

\n \n + * \arg \b path (const std::string&) - Path of object (which no longer exists)

\n \n */ void -OSCClientSender::object_destroyed(string path) +OSCClientSender::object_destroyed(const std::string& path) { if (!_enabled) return; @@ -379,10 +395,10 @@ OSCClientSender::object_destroyed(string path) /** \page client_osc_namespace *

\b /ingen/patch_cleared - Notification a patch has been cleared (all children destroyed) - * \arg \b path (string) - Path of patch (which is now empty)

\n \n + * \arg \b path (const std::string&) - Path of patch (which is now empty)

\n \n */ void -OSCClientSender::patch_cleared(string patch_path) +OSCClientSender::patch_cleared(const std::string& patch_path) { if (!_enabled) return; @@ -393,10 +409,10 @@ OSCClientSender::patch_cleared(string patch_path) /** \page client_osc_namespace *

\b /ingen/patch_enabled - Notification a patch's DSP processing has been enabled. - * \arg \b path (string) - Path of enabled patch

\n \n + * \arg \b path (const std::string&) - Path of enabled patch

\n \n */ void -OSCClientSender::patch_enabled(string patch_path) +OSCClientSender::patch_enabled(const std::string& patch_path) { if (!_enabled) return; @@ -407,10 +423,10 @@ OSCClientSender::patch_enabled(string patch_path) /** \page client_osc_namespace *

\b /ingen/patch_disabled - Notification a patch's DSP processing has been disabled. - * \arg \b path (string) - Path of disabled patch

\n \n + * \arg \b path (const std::string&) - Path of disabled patch

\n \n */ void -OSCClientSender::patch_disabled(string patch_path) +OSCClientSender::patch_disabled(const std::string& patch_path) { if (!_enabled) return; @@ -421,11 +437,11 @@ OSCClientSender::patch_disabled(string patch_path) /** \page client_osc_namespace *

\b /ingen/new_connection - Notification a new connection has been made. - * \arg \b src-path (string) - Path of the source port - * \arg \b dst-path (string) - Path of the destination port

\n \n + * \arg \b src-path (const std::string&) - Path of the source port + * \arg \b dst-path (const std::string&) - Path of the destination port

\n \n */ void -OSCClientSender::connection(string src_port_path, string dst_port_path) +OSCClientSender::connection(const std::string& src_port_path, const std::string& dst_port_path) { if (!_enabled) return; @@ -436,11 +452,11 @@ OSCClientSender::connection(string src_port_path, string dst_port_path) /** \page client_osc_namespace *

\b /ingen/disconnection - Notification a connection has been unmade. - * \arg \b src-path (string) - Path of the source port - * \arg \b dst-path (string) - Path of the destination port

\n \n + * \arg \b src-path (const std::string&) - Path of the source port + * \arg \b dst-path (const std::string&) - Path of the destination port

\n \n */ void -OSCClientSender::disconnection(string src_port_path, string dst_port_path) +OSCClientSender::disconnection(const std::string& src_port_path, const std::string& dst_port_path) { if (!_enabled) return; @@ -451,12 +467,12 @@ OSCClientSender::disconnection(string src_port_path, string dst_port_path) /** \page client_osc_namespace *

\b /ingen/metadata_update - Notification of a piece of metadata. - * \arg \b path (string) - Path of the object associated with metadata (can be a node, patch, or port) - * \arg \b key (string) - * \arg \b value (string)

\n \n + * \arg \b path (const std::string&) - Path of the object associated with metadata (can be a node, patch, or port) + * \arg \b key (const std::string&) + * \arg \b value (const std::string&)

\n \n */ void -OSCClientSender::metadata_update(string path, string key, Atom value) +OSCClientSender::metadata_update(const std::string& path, const std::string& key, const Atom& value) { if (!_enabled) return; @@ -471,14 +487,14 @@ OSCClientSender::metadata_update(string path, string key, Atom value) /** \page client_osc_namespace *

\b /ingen/control_change - Notification the value of a port has changed - * \arg \b path (string) - Path of port + * \arg \b path (const std::string&) - Path of port * \arg \b value (float) - New value of port * * \li This will only send updates for values set by clients of course - not values * changing because of connections to other ports!

\n \n */ void -OSCClientSender::control_change(string port_path, float value) +OSCClientSender::control_change(const std::string& port_path, float value) { if (!_enabled) return; @@ -489,12 +505,12 @@ OSCClientSender::control_change(string port_path, float value) /** \page client_osc_namespace *

\b /ingen/plugin - Notification of the existance of a plugin - * \arg \b type (string) - Type of plugin ("LADSPA", "DSSI", or "Internal") - * \arg \b uri (string) - Type of plugin ("LADSPA", "DSSI", or "Internal") - * \arg \b name (string) - Descriptive human-readable name of plugin (ie "ADSR Envelope") + * \arg \b type (const std::string&) - Type of plugin ("LADSPA", "DSSI", or "Internal") + * \arg \b uri (const std::string&) - Type of plugin ("LADSPA", "DSSI", or "Internal") + * \arg \b name (const std::string&) - Descriptive human-readable name of plugin (ie "ADSR Envelope") */ void -OSCClientSender::new_plugin(string uri, string type_uri, string name) +OSCClientSender::new_plugin(const std::string& uri, const std::string& type_uri, const std::string& name) { if (!_enabled) return; @@ -525,11 +541,11 @@ OSCClientSender::new_plugin(string uri, string type_uri, string name) /** \page client_osc_namespace *

\b /ingen/new_patch - Notification of a new patch - * \arg \b path (string) - Path of new patch + * \arg \b path (const std::string&) - Path of new patch * \arg \b poly (int) - Polyphony of new patch (\em not a boolean like new_node)

\n \n */ void -OSCClientSender::new_patch(string path, uint32_t poly) +OSCClientSender::new_patch(const std::string& path, uint32_t poly) { if (!_enabled) return; @@ -541,8 +557,8 @@ OSCClientSender::new_patch(string path, uint32_t poly) patch_enabled(p->path()); // Send metadata - const map& data = p->metadata(); - for (map::const_iterator i = data.begin(); i != data.end(); ++i) { + const map& data = p->metadata(); + for (map::const_iterator i = data.begin(); i != data.end(); ++i) { metadata_update(p->path(), (*i).first, (*i).second); } */ @@ -551,11 +567,11 @@ OSCClientSender::new_patch(string path, uint32_t poly) /** \page client_osc_namespace *

\b /ingen/object_renamed - Notification of an object's renaming - * \arg \b old-path (string) - Old path of object - * \arg \b new-path (string) - New path of object

\n \n + * \arg \b old-path (const std::string&) - Old path of object + * \arg \b new-path (const std::string&) - New path of object

\n \n */ void -OSCClientSender::object_renamed(string old_path, string new_path) +OSCClientSender::object_renamed(const std::string& old_path, const std::string& new_path) { if (!_enabled) return; @@ -567,7 +583,7 @@ OSCClientSender::object_renamed(string old_path, string new_path) /** Sends information about a program associated with a DSSI plugin node. */ void -OSCClientSender::program_add(string node_path, uint32_t bank, uint32_t program, string name) +OSCClientSender::program_add(const std::string& node_path, uint32_t bank, uint32_t program, const std::string& name) { if (!_enabled) return; @@ -578,7 +594,7 @@ OSCClientSender::program_add(string node_path, uint32_t bank, uint32_t program, void -OSCClientSender::program_remove(string node_path, uint32_t bank, uint32_t program) +OSCClientSender::program_remove(const std::string& node_path, uint32_t bank, uint32_t program) { if (!_enabled) return; diff --git a/src/libs/engine/OSCClientSender.hpp b/src/libs/engine/OSCClientSender.hpp index 6cf8abbe..1930e708 100644 --- a/src/libs/engine/OSCClientSender.hpp +++ b/src/libs/engine/OSCClientSender.hpp @@ -27,7 +27,8 @@ #include "types.hpp" #include "interface/ClientInterface.hpp" -using std::list; using std::string; +using std::list; +using std::string; using std::cerr; namespace Ingen { @@ -40,29 +41,23 @@ namespace Ingen { class OSCClientSender : public Shared::ClientInterface { public: - OSCClientSender(const string& url) - : _url(url), - _address(lo_address_new_from_url(url.c_str())), - _transfer(NULL), - _enabled(true) + OSCClientSender(const std::string& url) + : Shared::ClientInterface(url) + , _address(lo_address_new_from_url(url.c_str())) + , _transfer(NULL) + , _enabled(true) {} virtual ~OSCClientSender() { lo_address_free(_address); } - const string& url() const { return _url; } - const lo_address address() const { return _address; } + const lo_address address() const { return _address; } void subscribe(Shared::EngineInterface* engine) { } - //void plugins(); // FIXME remove - - - /* *** ClientInterface Implementation Below *** */ - - //void client_registration(string url, int client_id); + //void client_registration(const std::string& url, int client_id); void enable() { _enabled = true; } void disable() { _enabled = false; } @@ -73,63 +68,63 @@ public: void transfer_begin(); void transfer_end(); - void response(int32_t id, bool success, string msg); + void response_ok(int32_t id); + void response_error(int32_t id, const std::string& msg); void num_plugins(uint32_t num); - void error(string msg); + void error(const std::string& msg); - virtual void new_plugin(string uri, - string type_uri, - string name); + virtual void new_plugin(const std::string& uri, + const std::string& type_uri, + const std::string& name); - virtual void new_patch(string path, uint32_t poly); + virtual void new_patch(const std::string& path, uint32_t poly); - virtual void new_node(string plugin_uri, - string node_path, - bool is_polyphonic, - uint32_t num_ports); + virtual void new_node(const std::string& plugin_uri, + const std::string& node_path, + bool is_polyphonic, + uint32_t num_ports); - virtual void new_port(string path, - string data_type, - bool is_output); + virtual void new_port(const std::string& path, + const std::string& data_type, + bool is_output); - virtual void patch_enabled(string path); + virtual void patch_enabled(const std::string& path); - virtual void patch_disabled(string path); + virtual void patch_disabled(const std::string& path); - virtual void patch_cleared(string path); + virtual void patch_cleared(const std::string& path); - virtual void object_destroyed(string path); + virtual void object_destroyed(const std::string& path); - virtual void object_renamed(string old_path, - string new_path); + virtual void object_renamed(const std::string& old_path, + const std::string& new_path); - virtual void connection(string src_port_path, - string dst_port_path); + virtual void connection(const std::string& src_port_path, + const std::string& dst_port_path); - virtual void disconnection(string src_port_path, - string dst_port_path); + virtual void disconnection(const std::string& src_port_path, + const std::string& dst_port_path); - virtual void metadata_update(string subject_path, - string predicate, - Raul::Atom value); + virtual void metadata_update(const std::string& subject_path, + const std::string& predicate, + const Raul::Atom& value); - virtual void control_change(string port_path, - float value); + virtual void control_change(const std::string& port_path, + float value); - virtual void program_add(string node_path, - uint32_t bank, - uint32_t program, - string program_name); + virtual void program_add(const std::string& node_path, + uint32_t bank, + uint32_t program, + const std::string& program_name); - virtual void program_remove(string node_path, - uint32_t bank, - uint32_t program); + virtual void program_remove(const std::string& node_path, + uint32_t bank, + uint32_t program); private: - string _url; - lo_address _address; + lo_address _address; lo_bundle _transfer; diff --git a/src/libs/engine/OSCEngineReceiver.cpp b/src/libs/engine/OSCEngineReceiver.cpp index a2b98017..75be643c 100644 --- a/src/libs/engine/OSCEngineReceiver.cpp +++ b/src/libs/engine/OSCEngineReceiver.cpp @@ -26,10 +26,9 @@ #include "OSCEngineReceiver.hpp" #include "QueuedEventSource.hpp" #include "OSCClientSender.hpp" -#include "OSCResponder.hpp" #include "ClientBroadcaster.hpp" -using std::cerr; using std::cout; using std::endl; +using namespace std; namespace Ingen { @@ -46,9 +45,8 @@ namespace Ingen { OSCEngineReceiver::OSCEngineReceiver(Engine& engine, size_t queue_size, uint16_t port) -: QueuedEngineInterface(engine, queue_size, queue_size), // FIXME - _server(NULL), - _osc_responder(SharedPtr()) + : QueuedEngineInterface(engine, queue_size, queue_size) // FIXME + , _server(NULL) { char port_str[6]; snprintf(port_str, 6, "%u", port); @@ -205,60 +203,27 @@ OSCEngineReceiver::set_response_address_cb(const char* path, const char* types, { OSCEngineReceiver* const me = reinterpret_cast(user_data); - //cerr << "SET RESPONSE\n"; - if (argc < 1 || types[0] != 'i') // Not a valid Ingen message return 0; // Save liblo the trouble - //cerr << "** valid msg\n"; - const int id = argv[0]->i; const lo_address addr = lo_message_get_source(msg); char* const url = lo_address_get_url(addr); - - // Need to respond - if (id != -1) { - //cerr << "** need to respond\n"; - - // Currently have an OSC responder, check if it's still okay - if (me->_responder == me->_osc_responder) { - //cerr << "** osc responder\n"; - if (!strcmp(url, me->_osc_responder->url())) { - // Nice one, same address, do nothing (just set the ID below) - //cerr << "** Using cached response address, hooray" << endl; - } else { - // Shitty deal, make a new one - //cerr << "** Setting response address to " << url << "(2)" << endl; - me->_osc_responder = SharedPtr( - new OSCResponder(me->_engine.broadcaster(), id, url)); - - me->set_responder(me->_osc_responder); - - // (responder takes ownership of url, no leak) - } - - // Otherwise we have a NULL responder, definitely need to set a new one - } else { - //cerr << "** null responder\n"; - me->_osc_responder = SharedPtr(new OSCResponder(me->_engine.broadcaster(), id, url)); - me->set_responder(me->_osc_responder); - //cerr << "** Setting response address to " << url << "(2)" << endl; - } + const SharedPtr r = me->_responder; - me->set_next_response_id(id); + /* Different address than last time, have to do a lookup */ + if (!r || !r->client() || strcmp(url, r->client()->uri().c_str())) + me->_responder = SharedPtr( + new Responder(me->_engine.broadcaster()->client(url), id)); - // Don't respond + if (id != -1) { + me->set_next_response_id(id); } else { me->disable_responses(); - ClientInterface* client = me->_engine.broadcaster()->client(url); - if (client) - client->disable(); - else - cerr << "UNKNOWN CLIENT!\n"; - - //cerr << "** Not responding." << endl; + if (me->_responder->client()) + me->_responder->client()->disable(); } // If this returns 0 no OSC commands will work @@ -330,7 +295,7 @@ OSCEngineReceiver::_register_client_cb(const char* path, const char* types, lo_a char* const url = lo_address_get_url(addr); ClientInterface* client = new OSCClientSender((const char*)url); - register_client(url, client); + register_client(client); free(url); return 0; @@ -928,7 +893,7 @@ OSCEngineReceiver::unknown_cb(const char* path, const char* types, lo_arg** argv string error_msg = "Unknown command: "; error_msg.append(path).append(" ").append(types); - OSCResponder(NULL, 0, url).respond_error(error_msg); + OSCClientSender(url).error(error_msg); return 0; } diff --git a/src/libs/engine/OSCEngineReceiver.hpp b/src/libs/engine/OSCEngineReceiver.hpp index a9e76ece..c08386ec 100644 --- a/src/libs/engine/OSCEngineReceiver.hpp +++ b/src/libs/engine/OSCEngineReceiver.hpp @@ -24,7 +24,7 @@ #include #include #include "QueuedEngineInterface.hpp" -#include "OSCResponder.hpp" +#include "Responder.hpp" using std::string; namespace Ingen { @@ -117,9 +117,6 @@ private: #endif lo_server _server; - - /** Cached OSC responder (for most recent incoming message) */ - SharedPtr _osc_responder; }; diff --git a/src/libs/engine/OSCResponder.cpp b/src/libs/engine/OSCResponder.cpp deleted file mode 100644 index e43ba49a..00000000 --- a/src/libs/engine/OSCResponder.cpp +++ /dev/null @@ -1,98 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "OSCResponder.hpp" -#include "ClientBroadcaster.hpp" -#include -#include -#include -#include - -using std::cout; using std::cerr; using std::endl; - -namespace Ingen { - - -/** Construct an OSCResponder from \a addr. - * Takes ownership of @a url. - */ -OSCResponder::OSCResponder(ClientBroadcaster* broadcaster, int32_t id, char* url) -: Responder() -, _broadcaster(broadcaster) -, _id(id) -, _url(url) -, _addr(NULL) -{ - // If ID is -1 this shouldn't have even been created - assert(id != -1); -} - - -OSCResponder::~OSCResponder() -{ - //cerr << "DELETING " << _url << " RESPONDER\n"; - - if (_addr) - lo_address_free(_addr); -} - - -void -OSCResponder::respond_ok() -{ - ClientInterface* client = this->client(); - if (client) - client->enable(); - - _addr = lo_address_new_from_url(_url); - - //cerr << "OK " << _id << endl; - if (lo_send(_addr, "/ingen/response", "iis", _id, 1, "") < 0) { - cerr << "Unable to send response " << _id << "! (" - << lo_address_errstr(_addr) << ")" << endl; - } -} - - -void -OSCResponder::respond_error(const string& msg) -{ - ClientInterface* client = this->client(); - if (client) - client->enable(); - - _addr = lo_address_new_from_url(_url); - - //cerr << "ERR " << _id << endl; - if (lo_send(_addr, "/ingen/response", "iis",_id, 0, msg.c_str()) < 0) { - cerr << "Unable to send response " << _id << "! (" - << lo_address_errstr(_addr) << endl; - } -} - - -ClientInterface* -OSCResponder::client() -{ - if (_broadcaster) - return _broadcaster->client(client_uri()); - else - return NULL; -} - -} // namespace OM - diff --git a/src/libs/engine/OSCResponder.hpp b/src/libs/engine/OSCResponder.hpp deleted file mode 100644 index e4049160..00000000 --- a/src/libs/engine/OSCResponder.hpp +++ /dev/null @@ -1,70 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef OSCRESPONDER_H -#define OSCRESPONDER_H - -#include -#include -#include -#include -#include "interface/Responder.hpp" - -namespace Ingen { - -class ClientBroadcaster; - - -/** Responder for (liblo) OSC clients. - * - * OSC Clients use request IDs to be able to associate replies with sent - * events. If the ID is -1, a response will not be sent (and the overhead - * of searching for the client's record will be skipped). Any other integer - * is a valid response ID and will be responded to. - * - * Creation of the lo_address is deferred until needed to avoid bogging down - * the receiving thread as much as possible. - */ -class OSCResponder : public Shared::Responder -{ -public: - OSCResponder(ClientBroadcaster* broadcaster, int32_t id, char* url); - ~OSCResponder(); - - void set_id(int32_t id) { _id = id; } - - void respond_ok(); - void respond_error(const std::string& msg); - - const char* url() const { return _url; } - - std::string client_uri() { return _url; } - - Shared::ClientInterface* client(); - -private: - ClientBroadcaster* _broadcaster; - int32_t _id; - char* const _url; - lo_address _addr; -}; - - -} // namespace Ingen - -#endif // OSCRESPONDER_H - diff --git a/src/libs/engine/QueuedEngineInterface.cpp b/src/libs/engine/QueuedEngineInterface.cpp index a27a55f5..511246da 100644 --- a/src/libs/engine/QueuedEngineInterface.cpp +++ b/src/libs/engine/QueuedEngineInterface.cpp @@ -26,7 +26,7 @@ namespace Ingen { QueuedEngineInterface::QueuedEngineInterface(Engine& engine, size_t queued_size, size_t stamped_size) : QueuedEventSource(queued_size, stamped_size) - , _responder(SharedPtr(new Shared::Responder())) // NULL responder + , _responder(new Responder(NULL, 0)) , _engine(engine) { } @@ -41,18 +41,6 @@ QueuedEngineInterface::now() const } -/** Set the Responder to send responses to commands with, once the commands - * are preprocessed and ready to be executed (or not). - * - * Ownership of @a responder is taken. - */ -void -QueuedEngineInterface::set_responder(SharedPtr responder) -{ - _responder = responder; -} - - void QueuedEngineInterface::set_next_response_id(int32_t id) { @@ -64,9 +52,8 @@ QueuedEngineInterface::set_next_response_id(int32_t id) void QueuedEngineInterface::disable_responses() { - static SharedPtr null_responder(new Shared::Responder()); - //cerr << "DISABLE\n"; - set_responder(null_responder); + _responder->set_client(NULL); + _responder->set_id(0); } @@ -74,9 +61,15 @@ QueuedEngineInterface::disable_responses() void -QueuedEngineInterface::register_client(const string& uri, ClientInterface* client) +QueuedEngineInterface::register_client(ClientInterface* client) { - push_queued(new RegisterClientEvent(_engine, _responder, now(), uri, client)); + push_queued(new RegisterClientEvent(_engine, _responder, now(), client->uri(), client)); + if (!_responder) { + _responder = SharedPtr(new Responder(client, 1)); + } else { + _responder->set_id(1); + _responder->set_client(client); + } } @@ -84,6 +77,10 @@ void QueuedEngineInterface::unregister_client(const string& uri) { push_queued(new UnregisterClientEvent(_engine, _responder, now(), uri)); + if (_responder && _responder->client() && _responder->client()->uri() == uri) { + _responder->set_id(0); + _responder->set_client(NULL); + } } diff --git a/src/libs/engine/QueuedEngineInterface.hpp b/src/libs/engine/QueuedEngineInterface.hpp index 9d48074e..eb19923e 100644 --- a/src/libs/engine/QueuedEngineInterface.hpp +++ b/src/libs/engine/QueuedEngineInterface.hpp @@ -24,7 +24,7 @@ #include #include "interface/EngineInterface.hpp" #include "interface/ClientInterface.hpp" -#include "interface/Responder.hpp" +#include "Responder.hpp" #include "QueuedEventSource.hpp" #include "Engine.hpp" using std::string; @@ -64,11 +64,8 @@ public: void set_next_response_id(int32_t id); - virtual void set_responder(SharedPtr responder); - virtual void disable_responses(); - // Client registration - virtual void register_client(const string& uri, ClientInterface* client); + virtual void register_client(ClientInterface* client); virtual void unregister_client(const string& uri); @@ -154,11 +151,11 @@ public: virtual void request_all_objects(); protected: + + virtual void disable_responses(); - /** Where responses to current messages will go. */ - SharedPtr _responder; - - Engine& _engine; + SharedPtr _responder; ///< NULL if responding disabled + Engine& _engine; private: SampleCount now() const; diff --git a/src/libs/engine/QueuedEvent.hpp b/src/libs/engine/QueuedEvent.hpp index 4afe509d..69baefe4 100644 --- a/src/libs/engine/QueuedEvent.hpp +++ b/src/libs/engine/QueuedEvent.hpp @@ -70,11 +70,11 @@ public: bool is_prepared() { return _pre_processed; } protected: - QueuedEvent(Engine& engine, - SharedPtr responder, - FrameTime time, - bool blocking = false, - QueuedEventSource* source = NULL) + QueuedEvent(Engine& engine, + SharedPtr responder, + FrameTime time, + bool blocking = false, + QueuedEventSource* source = NULL) : Event(engine, responder, time) , _pre_processed(false), _blocking(blocking), _source(source) { @@ -84,7 +84,7 @@ protected: // NULL event base (for internal events only!) QueuedEvent(Engine& engine) - : Event(engine, SharedPtr(), 0) + : Event(engine, SharedPtr(), 0) , _pre_processed(false), _blocking(false), _source(NULL) {} diff --git a/src/libs/engine/Responder.hpp b/src/libs/engine/Responder.hpp new file mode 100644 index 00000000..80d2e24c --- /dev/null +++ b/src/libs/engine/Responder.hpp @@ -0,0 +1,71 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef RESPONDER_H +#define RESPONDER_H + +#include +#include +#include +#include "interface/ClientInterface.hpp" + +namespace Ingen { + + +/** Class to handle responding to clients. + * + * This is a glorified std::pair for replying + * to numbered messages from a client. + * + * For responses that involve more messages, the response will come first + * followed by the messages (eg object notifications, values, errors, etc.) + * in a bundle (or "transfer" if too large). + */ +class Responder +{ +public: + Responder(Shared::ClientInterface* client=0, int32_t id=1) + : _client(client) + , _id(id) + {} + + int32_t id() const { return _id; } + void set_id(int32_t id) { _id = id; } + + Shared::ClientInterface* client() const { return _client; } + void set_client(Shared::ClientInterface* client) { _client = client; } + + void respond_ok() { + if (_client) + _client->response_ok(_id); + } + + void respond_error(const std::string& msg) { + if (_client) + _client->response_error(_id, msg); + } + +private: + Shared::ClientInterface* _client; + int32_t _id; +}; + + +} // namespace Ingen + +#endif // RESPONDER_H + diff --git a/src/libs/engine/events/AddNodeEvent.cpp b/src/libs/engine/events/AddNodeEvent.cpp index f1aa3aed..e692a8ee 100644 --- a/src/libs/engine/events/AddNodeEvent.cpp +++ b/src/libs/engine/events/AddNodeEvent.cpp @@ -15,8 +15,11 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include +#include +#include #include "AddNodeEvent.hpp" -#include "interface/Responder.hpp" +#include "Responder.hpp" #include "Patch.hpp" #include "Node.hpp" #include "Tree.hpp" @@ -25,16 +28,13 @@ #include "Patch.hpp" #include "NodeFactory.hpp" #include "ClientBroadcaster.hpp" -#include -#include #include "ObjectStore.hpp" -#include #include "Port.hpp" namespace Ingen { -AddNodeEvent::AddNodeEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& path, +AddNodeEvent::AddNodeEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& path, const string& plugin_uri, bool poly) : QueuedEvent(engine, responder, timestamp), _path(path), @@ -52,7 +52,7 @@ AddNodeEvent::AddNodeEvent(Engine& engine, SharedPtr responde * * Do not use. */ -AddNodeEvent::AddNodeEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& path, +AddNodeEvent::AddNodeEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& path, const string& plugin_type, const string& plugin_lib, const string& plugin_label, bool poly) : QueuedEvent(engine, responder, timestamp), _path(path), diff --git a/src/libs/engine/events/AddNodeEvent.hpp b/src/libs/engine/events/AddNodeEvent.hpp index 0a64c93a..28df137c 100644 --- a/src/libs/engine/events/AddNodeEvent.hpp +++ b/src/libs/engine/events/AddNodeEvent.hpp @@ -41,7 +41,7 @@ class AddNodeEvent : public QueuedEvent { public: AddNodeEvent(Engine& engine, - SharedPtr responder, + SharedPtr responder, SampleCount timestamp, const string& node_path, const string& plugin_uri, @@ -49,7 +49,7 @@ public: // DEPRECATED AddNodeEvent(Engine& engine, - SharedPtr responder, + SharedPtr responder, SampleCount timestamp, const string& node_path, const string& plugin_type, @@ -62,17 +62,17 @@ public: void post_process(); private: - string _patch_name; - Path _path; - string _plugin_uri; ///< If nonempty then type, library, label, are ignored - string _plugin_type; - string _plugin_lib; - string _plugin_label; - bool _poly; - Patch* _patch; - Node* _node; - Raul::Array* _process_order; ///< Patch's new process order - bool _node_already_exists; + string _patch_name; + Raul::Path _path; + string _plugin_uri; ///< If nonempty then type, library, label, are ignored + string _plugin_type; + string _plugin_lib; + string _plugin_label; + bool _poly; + Patch* _patch; + Node* _node; + Raul::Array* _process_order; ///< Patch's new process order + bool _node_already_exists; }; diff --git a/src/libs/engine/events/AddPortEvent.cpp b/src/libs/engine/events/AddPortEvent.cpp index c4da0cbf..1d016c5d 100644 --- a/src/libs/engine/events/AddPortEvent.cpp +++ b/src/libs/engine/events/AddPortEvent.cpp @@ -19,7 +19,7 @@ #include #include #include -#include "interface/Responder.hpp" +#include "Responder.hpp" #include "AddPortEvent.hpp" #include "Patch.hpp" #include "Tree.hpp" @@ -39,7 +39,7 @@ namespace Ingen { AddPortEvent::AddPortEvent(Engine& engine, - SharedPtr responder, + SharedPtr responder, SampleCount timestamp, const string& path, const string& type, diff --git a/src/libs/engine/events/AddPortEvent.hpp b/src/libs/engine/events/AddPortEvent.hpp index 803e0910..8b40d370 100644 --- a/src/libs/engine/events/AddPortEvent.hpp +++ b/src/libs/engine/events/AddPortEvent.hpp @@ -42,22 +42,22 @@ class DriverPort; class AddPortEvent : public QueuedEvent { public: - AddPortEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& path, const string& type, bool is_output, QueuedEventSource* source); + AddPortEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& path, const string& type, bool is_output, QueuedEventSource* source); void pre_process(); void execute(SampleCount nframes, FrameTime start, FrameTime end); void post_process(); private: - Path _path; - string _type; - bool _is_output; - DataType _data_type; - Patch* _patch; - Port* _patch_port; + Raul::Path _path; + string _type; + bool _is_output; + DataType _data_type; + Patch* _patch; + Port* _patch_port; Raul::Array* _ports_array; ///< New (external) ports array for Patch - DriverPort* _driver_port; ///< Driver (eg Jack) port if this is a toplevel port - bool _succeeded; + DriverPort* _driver_port; ///< Driver (eg Jack) port if this is a toplevel port + bool _succeeded; }; diff --git a/src/libs/engine/events/AllNotesOffEvent.cpp b/src/libs/engine/events/AllNotesOffEvent.cpp index 6be698c6..130fb794 100644 --- a/src/libs/engine/events/AllNotesOffEvent.cpp +++ b/src/libs/engine/events/AllNotesOffEvent.cpp @@ -16,7 +16,7 @@ */ #include "AllNotesOffEvent.hpp" -#include "interface/Responder.hpp" +#include "Responder.hpp" #include "Engine.hpp" #include "ObjectStore.hpp" @@ -25,7 +25,7 @@ namespace Ingen { /** Note off with patch explicitly passed - triggered by MIDI. */ -AllNotesOffEvent::AllNotesOffEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, Patch* patch) +AllNotesOffEvent::AllNotesOffEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, Patch* patch) : Event(engine, responder, timestamp), _patch(patch) { @@ -34,7 +34,7 @@ AllNotesOffEvent::AllNotesOffEvent(Engine& engine, SharedPtr /** Note off event with lookup - triggered by OSC. */ -AllNotesOffEvent::AllNotesOffEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& patch_path) +AllNotesOffEvent::AllNotesOffEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& patch_path) : Event(engine, responder, timestamp), _patch(NULL), _patch_path(patch_path) diff --git a/src/libs/engine/events/AllNotesOffEvent.hpp b/src/libs/engine/events/AllNotesOffEvent.hpp index 5e29f780..c9263a40 100644 --- a/src/libs/engine/events/AllNotesOffEvent.hpp +++ b/src/libs/engine/events/AllNotesOffEvent.hpp @@ -34,8 +34,8 @@ class Patch; class AllNotesOffEvent : public Event { public: - AllNotesOffEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, Patch* patch); - AllNotesOffEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& patch_path); + AllNotesOffEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, Patch* patch); + AllNotesOffEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& patch_path); void execute(SampleCount nframes, FrameTime start, FrameTime end); void post_process(); diff --git a/src/libs/engine/events/ClearPatchEvent.cpp b/src/libs/engine/events/ClearPatchEvent.cpp index 0269aaa7..2c991cf7 100644 --- a/src/libs/engine/events/ClearPatchEvent.cpp +++ b/src/libs/engine/events/ClearPatchEvent.cpp @@ -16,7 +16,7 @@ */ #include "ClearPatchEvent.hpp" -#include "interface/Responder.hpp" +#include "Responder.hpp" #include "Engine.hpp" #include "Patch.hpp" #include "ClientBroadcaster.hpp" @@ -31,7 +31,7 @@ namespace Ingen { -ClearPatchEvent::ClearPatchEvent(Engine& engine, SharedPtr responder, FrameTime time, QueuedEventSource* source, const string& patch_path) +ClearPatchEvent::ClearPatchEvent(Engine& engine, SharedPtr responder, FrameTime time, QueuedEventSource* source, const string& patch_path) : QueuedEvent(engine, responder, time, true, source), _patch_path(patch_path), _patch(NULL), diff --git a/src/libs/engine/events/ClearPatchEvent.hpp b/src/libs/engine/events/ClearPatchEvent.hpp index 4d631f07..dbcad25b 100644 --- a/src/libs/engine/events/ClearPatchEvent.hpp +++ b/src/libs/engine/events/ClearPatchEvent.hpp @@ -36,7 +36,7 @@ class Patch; class ClearPatchEvent : public QueuedEvent { public: - ClearPatchEvent(Engine& engine, SharedPtr responder, FrameTime time, QueuedEventSource* source, const string& patch_path); + ClearPatchEvent(Engine& engine, SharedPtr responder, FrameTime time, QueuedEventSource* source, const string& patch_path); void pre_process(); void execute(SampleCount nframes, FrameTime start, FrameTime end); diff --git a/src/libs/engine/events/ConnectionEvent.cpp b/src/libs/engine/events/ConnectionEvent.cpp index 554a974f..a8c5dc13 100644 --- a/src/libs/engine/events/ConnectionEvent.cpp +++ b/src/libs/engine/events/ConnectionEvent.cpp @@ -19,7 +19,7 @@ #include #include #include -#include "interface/Responder.hpp" +#include "Responder.hpp" #include "types.hpp" #include "Engine.hpp" #include "Connection.hpp" @@ -34,7 +34,7 @@ using std::string; namespace Ingen { -ConnectionEvent::ConnectionEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& src_port_path, const string& dst_port_path) +ConnectionEvent::ConnectionEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& src_port_path, const string& dst_port_path) : QueuedEvent(engine, responder, timestamp), _src_port_path(src_port_path), _dst_port_path(dst_port_path), diff --git a/src/libs/engine/events/ConnectionEvent.hpp b/src/libs/engine/events/ConnectionEvent.hpp index f2903b94..1efcee1b 100644 --- a/src/libs/engine/events/ConnectionEvent.hpp +++ b/src/libs/engine/events/ConnectionEvent.hpp @@ -48,7 +48,7 @@ class OutputPort; class ConnectionEvent : public QueuedEvent { public: - ConnectionEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& src_port_path, const string& dst_port_path); + ConnectionEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& src_port_path, const string& dst_port_path); void pre_process(); void execute(SampleCount nframes, FrameTime start, FrameTime end); diff --git a/src/libs/engine/events/CreatePatchEvent.cpp b/src/libs/engine/events/CreatePatchEvent.cpp index 93d56c86..6c0cd0e8 100644 --- a/src/libs/engine/events/CreatePatchEvent.cpp +++ b/src/libs/engine/events/CreatePatchEvent.cpp @@ -16,7 +16,7 @@ */ #include "CreatePatchEvent.hpp" -#include "interface/Responder.hpp" +#include "Responder.hpp" #include "Patch.hpp" #include "Node.hpp" #include "Tree.hpp" @@ -31,7 +31,7 @@ namespace Ingen { -CreatePatchEvent::CreatePatchEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& path, int poly) +CreatePatchEvent::CreatePatchEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& path, int poly) : QueuedEvent(engine, responder, timestamp), _path(path), _patch(NULL), diff --git a/src/libs/engine/events/CreatePatchEvent.hpp b/src/libs/engine/events/CreatePatchEvent.hpp index 977abbaa..1e45b353 100644 --- a/src/libs/engine/events/CreatePatchEvent.hpp +++ b/src/libs/engine/events/CreatePatchEvent.hpp @@ -41,7 +41,7 @@ class Plugin; class CreatePatchEvent : public QueuedEvent { public: - CreatePatchEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& path, int poly); + CreatePatchEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& path, int poly); void pre_process(); void execute(SampleCount nframes, FrameTime start, FrameTime end); @@ -50,7 +50,7 @@ public: private: enum ErrorType { NO_ERROR, OBJECT_EXISTS, PARENT_NOT_FOUND, INVALID_POLY }; - Path _path; + Raul::Path _path; Patch* _patch; Patch* _parent; Raul::Array* _process_order; diff --git a/src/libs/engine/events/DSSIConfigureEvent.cpp b/src/libs/engine/events/DSSIConfigureEvent.cpp index 9a0142c8..3c325f35 100644 --- a/src/libs/engine/events/DSSIConfigureEvent.cpp +++ b/src/libs/engine/events/DSSIConfigureEvent.cpp @@ -25,7 +25,7 @@ namespace Ingen { -DSSIConfigureEvent::DSSIConfigureEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& node_path, const string& key, const string& val) +DSSIConfigureEvent::DSSIConfigureEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& node_path, const string& key, const string& val) : QueuedEvent(engine, responder, timestamp), _node_path(node_path), _key(key), diff --git a/src/libs/engine/events/DSSIConfigureEvent.hpp b/src/libs/engine/events/DSSIConfigureEvent.hpp index ef37c5cd..1ef43b50 100644 --- a/src/libs/engine/events/DSSIConfigureEvent.hpp +++ b/src/libs/engine/events/DSSIConfigureEvent.hpp @@ -31,7 +31,7 @@ namespace Ingen { class DSSIConfigureEvent : public QueuedEvent { public: - DSSIConfigureEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& node_path, const string& key, const string& val); + DSSIConfigureEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& node_path, const string& key, const string& val); void pre_process(); void execute(SampleCount nframes, FrameTime start, FrameTime end); diff --git a/src/libs/engine/events/DSSIControlEvent.cpp b/src/libs/engine/events/DSSIControlEvent.cpp index eef5054b..f0c261b0 100644 --- a/src/libs/engine/events/DSSIControlEvent.cpp +++ b/src/libs/engine/events/DSSIControlEvent.cpp @@ -24,7 +24,7 @@ namespace Ingen { -DSSIControlEvent::DSSIControlEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& node_path, int port_num, Sample val) +DSSIControlEvent::DSSIControlEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& node_path, int port_num, Sample val) : QueuedEvent(engine, responder, timestamp), _node_path(node_path), _port_num(port_num), diff --git a/src/libs/engine/events/DSSIControlEvent.hpp b/src/libs/engine/events/DSSIControlEvent.hpp index ab48607a..68314fd7 100644 --- a/src/libs/engine/events/DSSIControlEvent.hpp +++ b/src/libs/engine/events/DSSIControlEvent.hpp @@ -33,7 +33,7 @@ namespace Ingen { class DSSIControlEvent : public QueuedEvent { public: - DSSIControlEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& node_path, int port_num, Sample val); + DSSIControlEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& node_path, int port_num, Sample val); void pre_process(); void execute(SampleCount nframes, FrameTime start, FrameTime end); diff --git a/src/libs/engine/events/DSSIProgramEvent.cpp b/src/libs/engine/events/DSSIProgramEvent.cpp index 66ad9c1f..9e12255d 100644 --- a/src/libs/engine/events/DSSIProgramEvent.cpp +++ b/src/libs/engine/events/DSSIProgramEvent.cpp @@ -29,7 +29,7 @@ using std::cout; using std::cerr; using std::endl; namespace Ingen { -DSSIProgramEvent::DSSIProgramEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& node_path, int bank, int program) +DSSIProgramEvent::DSSIProgramEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& node_path, int bank, int program) : QueuedEvent(engine, responder, timestamp), _node_path(node_path), _bank(bank), diff --git a/src/libs/engine/events/DSSIProgramEvent.hpp b/src/libs/engine/events/DSSIProgramEvent.hpp index 2f853961..fa4760ce 100644 --- a/src/libs/engine/events/DSSIProgramEvent.hpp +++ b/src/libs/engine/events/DSSIProgramEvent.hpp @@ -31,7 +31,7 @@ namespace Ingen { class DSSIProgramEvent : public QueuedEvent { public: - DSSIProgramEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& node_path, int bank, int program); + DSSIProgramEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& node_path, int bank, int program); void pre_process(); void execute(SampleCount nframes, FrameTime start, FrameTime end); diff --git a/src/libs/engine/events/DSSIUpdateEvent.cpp b/src/libs/engine/events/DSSIUpdateEvent.cpp index 055be90c..bfb8f8fc 100644 --- a/src/libs/engine/events/DSSIUpdateEvent.cpp +++ b/src/libs/engine/events/DSSIUpdateEvent.cpp @@ -28,7 +28,7 @@ using std::cerr; using std::endl; namespace Ingen { -DSSIUpdateEvent::DSSIUpdateEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& path, const string& url) +DSSIUpdateEvent::DSSIUpdateEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& path, const string& url) : QueuedEvent(engine, responder, timestamp), _path(path), _url(url), diff --git a/src/libs/engine/events/DSSIUpdateEvent.hpp b/src/libs/engine/events/DSSIUpdateEvent.hpp index 699df4c2..08c5a31a 100644 --- a/src/libs/engine/events/DSSIUpdateEvent.hpp +++ b/src/libs/engine/events/DSSIUpdateEvent.hpp @@ -37,7 +37,7 @@ class DSSINode; class DSSIUpdateEvent : public QueuedEvent { public: - DSSIUpdateEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& path, const string& url); + DSSIUpdateEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& path, const string& url); void pre_process(); void execute(SampleCount nframes, FrameTime start, FrameTime end); diff --git a/src/libs/engine/events/DeactivateEvent.cpp b/src/libs/engine/events/DeactivateEvent.cpp index 311cf287..a7842a0d 100644 --- a/src/libs/engine/events/DeactivateEvent.cpp +++ b/src/libs/engine/events/DeactivateEvent.cpp @@ -16,13 +16,13 @@ */ #include "DeactivateEvent.hpp" -#include "interface/Responder.hpp" +#include "Responder.hpp" #include "Engine.hpp" namespace Ingen { -DeactivateEvent::DeactivateEvent(Engine& engine, SharedPtr responder, SampleCount timestamp) +DeactivateEvent::DeactivateEvent(Engine& engine, SharedPtr responder, SampleCount timestamp) : QueuedEvent(engine, responder, timestamp) { } diff --git a/src/libs/engine/events/DeactivateEvent.hpp b/src/libs/engine/events/DeactivateEvent.hpp index 1f87e271..e0ee2ea8 100644 --- a/src/libs/engine/events/DeactivateEvent.hpp +++ b/src/libs/engine/events/DeactivateEvent.hpp @@ -30,7 +30,7 @@ namespace Ingen { class DeactivateEvent : public QueuedEvent { public: - DeactivateEvent(Engine& engine, SharedPtr responder, SampleCount timestamp); + DeactivateEvent(Engine& engine, SharedPtr responder, SampleCount timestamp); void pre_process(); void execute(SampleCount nframes, FrameTime start, FrameTime end); diff --git a/src/libs/engine/events/DestroyEvent.cpp b/src/libs/engine/events/DestroyEvent.cpp index acc4a86d..a30bb3ae 100644 --- a/src/libs/engine/events/DestroyEvent.cpp +++ b/src/libs/engine/events/DestroyEvent.cpp @@ -16,7 +16,7 @@ */ #include "DestroyEvent.hpp" -#include "interface/Responder.hpp" +#include "Responder.hpp" #include "Engine.hpp" #include "Patch.hpp" #include "Tree.hpp" @@ -37,7 +37,7 @@ namespace Ingen { -DestroyEvent::DestroyEvent(Engine& engine, SharedPtr responder, FrameTime time, QueuedEventSource* source, const string& path, bool block) +DestroyEvent::DestroyEvent(Engine& engine, SharedPtr responder, FrameTime time, QueuedEventSource* source, const string& path, bool block) : QueuedEvent(engine, responder, time, source, source), _path(path), _store_iterator(engine.object_store()->objects().end()), @@ -55,7 +55,7 @@ DestroyEvent::DestroyEvent(Engine& engine, SharedPtr responde } #if 0 -DestroyEvent::DestroyEvent(Engine& engine, SharedPtr responder, FrameTime time, QueuedEventSource* source, Node* node, bool block) +DestroyEvent::DestroyEvent(Engine& engine, SharedPtr responder, FrameTime time, QueuedEventSource* source, Node* node, bool block) : QueuedEvent(engine, responder, block, source), _path(node->path()), _store_iterator(engine.object_store()->objects().end()) diff --git a/src/libs/engine/events/DestroyEvent.hpp b/src/libs/engine/events/DestroyEvent.hpp index 70616ac1..a858ee0b 100644 --- a/src/libs/engine/events/DestroyEvent.hpp +++ b/src/libs/engine/events/DestroyEvent.hpp @@ -50,8 +50,8 @@ class DisconnectPortEvent; class DestroyEvent : public QueuedEvent { public: - DestroyEvent(Engine& engine, SharedPtr responder, FrameTime timestamp, QueuedEventSource* source, const string& path, bool block = true); - //DestroyEvent(Engine& engine, SharedPtr responder, FrameTime timestamp, QueuedEventSource* source, Node* node, bool block = true); + DestroyEvent(Engine& engine, SharedPtr responder, FrameTime timestamp, QueuedEventSource* source, const string& path, bool block = true); + //DestroyEvent(Engine& engine, SharedPtr responder, FrameTime timestamp, QueuedEventSource* source, Node* node, bool block = true); ~DestroyEvent(); void pre_process(); diff --git a/src/libs/engine/events/DisablePatchEvent.cpp b/src/libs/engine/events/DisablePatchEvent.cpp index 80ea96fa..146364d8 100644 --- a/src/libs/engine/events/DisablePatchEvent.cpp +++ b/src/libs/engine/events/DisablePatchEvent.cpp @@ -16,7 +16,7 @@ */ #include "DisablePatchEvent.hpp" -#include "interface/Responder.hpp" +#include "Responder.hpp" #include "Engine.hpp" #include "Patch.hpp" #include "ClientBroadcaster.hpp" @@ -27,7 +27,7 @@ namespace Ingen { -DisablePatchEvent::DisablePatchEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& patch_path) +DisablePatchEvent::DisablePatchEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& patch_path) : QueuedEvent(engine, responder, timestamp), _patch_path(patch_path), _patch(NULL) diff --git a/src/libs/engine/events/DisablePatchEvent.hpp b/src/libs/engine/events/DisablePatchEvent.hpp index 1552fffe..00cb5ce7 100644 --- a/src/libs/engine/events/DisablePatchEvent.hpp +++ b/src/libs/engine/events/DisablePatchEvent.hpp @@ -35,7 +35,7 @@ class Patch; class DisablePatchEvent : public QueuedEvent { public: - DisablePatchEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& patch_path); + DisablePatchEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& patch_path); void pre_process(); void execute(SampleCount nframes, FrameTime start, FrameTime end); diff --git a/src/libs/engine/events/DisconnectNodeEvent.cpp b/src/libs/engine/events/DisconnectNodeEvent.cpp index abdad386..97dfc3d5 100644 --- a/src/libs/engine/events/DisconnectNodeEvent.cpp +++ b/src/libs/engine/events/DisconnectNodeEvent.cpp @@ -20,7 +20,7 @@ #include #include #include -#include "interface/Responder.hpp" +#include "Responder.hpp" #include "Engine.hpp" #include "Node.hpp" #include "Connection.hpp" @@ -39,7 +39,7 @@ using std::cerr; using std::endl; namespace Ingen { -DisconnectNodeEvent::DisconnectNodeEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& node_path) +DisconnectNodeEvent::DisconnectNodeEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& node_path) : QueuedEvent(engine, responder, timestamp), _node_path(node_path), _patch(NULL), @@ -99,7 +99,7 @@ DisconnectNodeEvent::pre_process() for (ConnectionListIterator i = _patch->connections().begin(); i != _patch->connections().end(); ++i) { c = (*i); if ((c->src_port()->parent_node() == _node || c->dst_port()->parent_node() == _node) && !c->pending_disconnection()) { - DisconnectionEvent* ev = new DisconnectionEvent(_engine, SharedPtr(new Responder()), _time, + DisconnectionEvent* ev = new DisconnectionEvent(_engine, SharedPtr(new Responder()), _time, c->src_port(), c->dst_port()); ev->pre_process(); _disconnection_events.push_back(new Raul::ListNode(ev)); diff --git a/src/libs/engine/events/DisconnectNodeEvent.hpp b/src/libs/engine/events/DisconnectNodeEvent.hpp index e14f87fa..9ed7cb3a 100644 --- a/src/libs/engine/events/DisconnectNodeEvent.hpp +++ b/src/libs/engine/events/DisconnectNodeEvent.hpp @@ -43,7 +43,7 @@ class OutputPort; class DisconnectNodeEvent : public QueuedEvent { public: - DisconnectNodeEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& node_path); + DisconnectNodeEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& node_path); DisconnectNodeEvent(Engine& engine, Node* node); ~DisconnectNodeEvent(); @@ -52,9 +52,9 @@ public: void post_process(); private: - Path _node_path; - Patch* _patch; - Node* _node; + Raul::Path _node_path; + Patch* _patch; + Node* _node; Raul::List _disconnection_events; bool _succeeded; diff --git a/src/libs/engine/events/DisconnectPortEvent.cpp b/src/libs/engine/events/DisconnectPortEvent.cpp index 0956ca8f..75f44e9f 100644 --- a/src/libs/engine/events/DisconnectPortEvent.cpp +++ b/src/libs/engine/events/DisconnectPortEvent.cpp @@ -20,7 +20,7 @@ #include #include #include -#include "interface/Responder.hpp" +#include "Responder.hpp" #include "Engine.hpp" #include "Node.hpp" #include "Connection.hpp" @@ -39,7 +39,7 @@ using std::cerr; using std::endl; namespace Ingen { -DisconnectPortEvent::DisconnectPortEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& port_path) +DisconnectPortEvent::DisconnectPortEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& port_path) : QueuedEvent(engine, responder, timestamp), _port_path(port_path), _patch(NULL), @@ -104,7 +104,7 @@ DisconnectPortEvent::pre_process() for (Raul::List::const_iterator i = _patch->connections().begin(); i != _patch->connections().end(); ++i) { c = (*i); if ((c->src_port() == _port || c->dst_port() == _port) && !c->pending_disconnection()) { - DisconnectionEvent* ev = new DisconnectionEvent(_engine, SharedPtr(new Responder()), _time, + DisconnectionEvent* ev = new DisconnectionEvent(_engine, SharedPtr(new Responder()), _time, c->src_port(), c->dst_port()); ev->pre_process(); _disconnection_events.push_back(new Raul::ListNode(ev)); diff --git a/src/libs/engine/events/DisconnectPortEvent.hpp b/src/libs/engine/events/DisconnectPortEvent.hpp index 95644098..2ce91b85 100644 --- a/src/libs/engine/events/DisconnectPortEvent.hpp +++ b/src/libs/engine/events/DisconnectPortEvent.hpp @@ -44,7 +44,7 @@ using std::string; class DisconnectPortEvent : public QueuedEvent { public: - DisconnectPortEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& port_path); + DisconnectPortEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& port_path); DisconnectPortEvent(Engine& engine, Port* port); ~DisconnectPortEvent(); diff --git a/src/libs/engine/events/DisconnectionEvent.cpp b/src/libs/engine/events/DisconnectionEvent.cpp index dc78a118..794399b3 100644 --- a/src/libs/engine/events/DisconnectionEvent.cpp +++ b/src/libs/engine/events/DisconnectionEvent.cpp @@ -19,7 +19,7 @@ #include #include #include -#include "interface/Responder.hpp" +#include "Responder.hpp" #include "Engine.hpp" #include "Connection.hpp" #include "InputPort.hpp" @@ -36,7 +36,7 @@ namespace Ingen { //// DisconnectionEvent //// -DisconnectionEvent::DisconnectionEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& src_port_path, const string& dst_port_path) +DisconnectionEvent::DisconnectionEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& src_port_path, const string& dst_port_path) : QueuedEvent(engine, responder, timestamp), _src_port_path(src_port_path), _dst_port_path(dst_port_path), @@ -50,7 +50,7 @@ DisconnectionEvent::DisconnectionEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, Port* const src_port, Port* const dst_port) +DisconnectionEvent::DisconnectionEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, Port* const src_port, Port* const dst_port) : QueuedEvent(engine, responder, timestamp), _src_port_path(src_port->path()), _dst_port_path(dst_port->path()), diff --git a/src/libs/engine/events/DisconnectionEvent.hpp b/src/libs/engine/events/DisconnectionEvent.hpp index 9c5b7490..5a30b7f1 100644 --- a/src/libs/engine/events/DisconnectionEvent.hpp +++ b/src/libs/engine/events/DisconnectionEvent.hpp @@ -48,8 +48,8 @@ class OutputPort; class DisconnectionEvent : public QueuedEvent { public: - DisconnectionEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& src_port_path, const string& dst_port_path); - DisconnectionEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, Port* const src_port, Port* const dst_port); + DisconnectionEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& src_port_path, const string& dst_port_path); + DisconnectionEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, Port* const src_port, Port* const dst_port); void pre_process(); void execute(SampleCount nframes, FrameTime start, FrameTime end); @@ -67,8 +67,8 @@ private: CONNECTION_NOT_FOUND }; - Path _src_port_path; - Path _dst_port_path; + Raul::Path _src_port_path; + Raul::Path _dst_port_path; Patch* _patch; Port* _src_port; diff --git a/src/libs/engine/events/EnablePatchEvent.cpp b/src/libs/engine/events/EnablePatchEvent.cpp index 1921b301..ed39ae04 100644 --- a/src/libs/engine/events/EnablePatchEvent.cpp +++ b/src/libs/engine/events/EnablePatchEvent.cpp @@ -16,7 +16,7 @@ */ #include "EnablePatchEvent.hpp" -#include "interface/Responder.hpp" +#include "Responder.hpp" #include "Engine.hpp" #include "Patch.hpp" #include "util.hpp" @@ -26,7 +26,7 @@ namespace Ingen { -EnablePatchEvent::EnablePatchEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& patch_path) +EnablePatchEvent::EnablePatchEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& patch_path) : QueuedEvent(engine, responder, timestamp), _patch_path(patch_path), _patch(NULL), diff --git a/src/libs/engine/events/EnablePatchEvent.hpp b/src/libs/engine/events/EnablePatchEvent.hpp index 0a74c082..d187594b 100644 --- a/src/libs/engine/events/EnablePatchEvent.hpp +++ b/src/libs/engine/events/EnablePatchEvent.hpp @@ -38,7 +38,7 @@ class Node; class EnablePatchEvent : public QueuedEvent { public: - EnablePatchEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& patch_path); + EnablePatchEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& patch_path); void pre_process(); void execute(SampleCount nframes, FrameTime start, FrameTime end); diff --git a/src/libs/engine/events/LoadPluginsEvent.cpp b/src/libs/engine/events/LoadPluginsEvent.cpp index 04db153c..2eae055a 100644 --- a/src/libs/engine/events/LoadPluginsEvent.cpp +++ b/src/libs/engine/events/LoadPluginsEvent.cpp @@ -16,7 +16,7 @@ */ #include "LoadPluginsEvent.hpp" -#include "interface/Responder.hpp" +#include "Responder.hpp" #include "Engine.hpp" #include "NodeFactory.hpp" #include "ClientBroadcaster.hpp" @@ -28,7 +28,7 @@ using std::cerr; namespace Ingen { -LoadPluginsEvent::LoadPluginsEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, QueuedEventSource* source) +LoadPluginsEvent::LoadPluginsEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, QueuedEventSource* source) : QueuedEvent(engine, responder, timestamp, true, source) { /* Not sure why this has to be blocking, but it fixes some nasty bugs.. */ diff --git a/src/libs/engine/events/LoadPluginsEvent.hpp b/src/libs/engine/events/LoadPluginsEvent.hpp index c6f886f7..966e3275 100644 --- a/src/libs/engine/events/LoadPluginsEvent.hpp +++ b/src/libs/engine/events/LoadPluginsEvent.hpp @@ -34,7 +34,7 @@ class LoadPluginsEvent : public QueuedEvent { public: LoadPluginsEvent(Engine& engine, - SharedPtr responder, + SharedPtr responder, SampleCount timestamp, QueuedEventSource* source); diff --git a/src/libs/engine/events/MidiLearnEvent.cpp b/src/libs/engine/events/MidiLearnEvent.cpp index 8bc05b4f..441236fc 100644 --- a/src/libs/engine/events/MidiLearnEvent.cpp +++ b/src/libs/engine/events/MidiLearnEvent.cpp @@ -16,7 +16,7 @@ */ #include "MidiLearnEvent.hpp" -#include "interface/Responder.hpp" +#include "Responder.hpp" #include "Engine.hpp" #include "ObjectStore.hpp" #include "Node.hpp" @@ -38,7 +38,7 @@ MidiLearnResponseEvent::post_process() // MidiLearnEvent -MidiLearnEvent::MidiLearnEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& node_path) +MidiLearnEvent::MidiLearnEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& node_path) : QueuedEvent(engine, responder, timestamp), _node_path(node_path), _node(NULL), diff --git a/src/libs/engine/events/MidiLearnEvent.hpp b/src/libs/engine/events/MidiLearnEvent.hpp index c5a0902f..bbb0c9a5 100644 --- a/src/libs/engine/events/MidiLearnEvent.hpp +++ b/src/libs/engine/events/MidiLearnEvent.hpp @@ -39,7 +39,7 @@ class MidiLearnResponseEvent : public Event { public: MidiLearnResponseEvent(Engine& engine, const string& port_path, SampleCount timestamp) - : Event(engine, SharedPtr(), timestamp), + : Event(engine, SharedPtr(), timestamp), _port_path(port_path), _value(0.0f) {} @@ -65,7 +65,7 @@ private: class MidiLearnEvent : public QueuedEvent { public: - MidiLearnEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& node_path); + MidiLearnEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& node_path); void pre_process(); void execute(SampleCount nframes, FrameTime start, FrameTime end); diff --git a/src/libs/engine/events/NoteOffEvent.cpp b/src/libs/engine/events/NoteOffEvent.cpp index a8da7669..5768e265 100644 --- a/src/libs/engine/events/NoteOffEvent.cpp +++ b/src/libs/engine/events/NoteOffEvent.cpp @@ -16,7 +16,7 @@ */ #include "NoteOffEvent.hpp" -#include "interface/Responder.hpp" +#include "Responder.hpp" #include "Engine.hpp" #include "ObjectStore.hpp" #include "Node.hpp" @@ -28,7 +28,7 @@ namespace Ingen { /** Note off with patch explicitly passed - triggered by MIDI. */ -NoteOffEvent::NoteOffEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, Node* node, uchar note_num) +NoteOffEvent::NoteOffEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, Node* node, uchar note_num) : Event(engine, responder, timestamp), _node(node), _note_num(note_num) @@ -38,7 +38,7 @@ NoteOffEvent::NoteOffEvent(Engine& engine, SharedPtr responde /** Note off event with lookup - triggered by OSC. */ -NoteOffEvent::NoteOffEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& node_path, uchar note_num) +NoteOffEvent::NoteOffEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& node_path, uchar note_num) : Event(engine, responder, timestamp), _node(NULL), _node_path(node_path), diff --git a/src/libs/engine/events/NoteOffEvent.hpp b/src/libs/engine/events/NoteOffEvent.hpp index 4186cbed..c9301f5b 100644 --- a/src/libs/engine/events/NoteOffEvent.hpp +++ b/src/libs/engine/events/NoteOffEvent.hpp @@ -35,8 +35,8 @@ class Node; class NoteOffEvent : public Event { public: - NoteOffEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, Node* node, uchar note_num); - NoteOffEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& node_path, uchar note_num); + NoteOffEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, Node* node, uchar note_num); + NoteOffEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& node_path, uchar note_num); void execute(SampleCount nframes, FrameTime start, FrameTime end); void post_process(); diff --git a/src/libs/engine/events/NoteOnEvent.cpp b/src/libs/engine/events/NoteOnEvent.cpp index 5bd57d93..22e85972 100644 --- a/src/libs/engine/events/NoteOnEvent.cpp +++ b/src/libs/engine/events/NoteOnEvent.cpp @@ -16,7 +16,7 @@ */ #include "NoteOnEvent.hpp" -#include "interface/Responder.hpp" +#include "Responder.hpp" #include "Engine.hpp" #include "ObjectStore.hpp" #include "Node.hpp" @@ -31,7 +31,7 @@ namespace Ingen { * * Used to be triggered by MIDI. Not used anymore. */ -NoteOnEvent::NoteOnEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, Node* patch, uchar note_num, uchar velocity) +NoteOnEvent::NoteOnEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, Node* patch, uchar note_num, uchar velocity) : Event(engine, responder, timestamp), _node(patch), _note_num(note_num), @@ -45,7 +45,7 @@ NoteOnEvent::NoteOnEvent(Engine& engine, SharedPtr responder, * * Triggered by OSC. */ -NoteOnEvent::NoteOnEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& node_path, uchar note_num, uchar velocity) +NoteOnEvent::NoteOnEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& node_path, uchar note_num, uchar velocity) : Event(engine, responder, timestamp), _node(NULL), _node_path(node_path), diff --git a/src/libs/engine/events/NoteOnEvent.hpp b/src/libs/engine/events/NoteOnEvent.hpp index 3a641a55..175623bf 100644 --- a/src/libs/engine/events/NoteOnEvent.hpp +++ b/src/libs/engine/events/NoteOnEvent.hpp @@ -35,8 +35,8 @@ class Node; class NoteOnEvent : public Event { public: - NoteOnEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, Node* patch, uchar note_num, uchar velocity); - NoteOnEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& node_path, uchar note_num, uchar velocity); + NoteOnEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, Node* patch, uchar note_num, uchar velocity); + NoteOnEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& node_path, uchar note_num, uchar velocity); void execute(SampleCount nframes, FrameTime start, FrameTime end); void post_process(); diff --git a/src/libs/engine/events/PingQueuedEvent.hpp b/src/libs/engine/events/PingQueuedEvent.hpp index 9712a904..88c03aaa 100644 --- a/src/libs/engine/events/PingQueuedEvent.hpp +++ b/src/libs/engine/events/PingQueuedEvent.hpp @@ -20,7 +20,7 @@ #include "QueuedEvent.hpp" #include "types.hpp" -#include "interface/Responder.hpp" +#include "Responder.hpp" namespace Ingen { @@ -35,7 +35,7 @@ class Port; class PingQueuedEvent : public QueuedEvent { public: - PingQueuedEvent(Engine& engine, SharedPtr responder, SampleCount timestamp) + PingQueuedEvent(Engine& engine, SharedPtr responder, SampleCount timestamp) : QueuedEvent(engine, responder, timestamp) {} diff --git a/src/libs/engine/events/RegisterClientEvent.cpp b/src/libs/engine/events/RegisterClientEvent.cpp index ac38d88c..a8f68e21 100644 --- a/src/libs/engine/events/RegisterClientEvent.cpp +++ b/src/libs/engine/events/RegisterClientEvent.cpp @@ -15,7 +15,7 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "interface/Responder.hpp" +#include "Responder.hpp" #include "RegisterClientEvent.hpp" #include "Engine.hpp" #include "ClientBroadcaster.hpp" @@ -24,7 +24,7 @@ namespace Ingen { RegisterClientEvent::RegisterClientEvent(Engine& engine, - SharedPtr responder, + SharedPtr responder, SampleCount timestamp, const string& uri, ClientInterface* client) diff --git a/src/libs/engine/events/RegisterClientEvent.hpp b/src/libs/engine/events/RegisterClientEvent.hpp index a653a8bd..9e12b5ba 100644 --- a/src/libs/engine/events/RegisterClientEvent.hpp +++ b/src/libs/engine/events/RegisterClientEvent.hpp @@ -23,7 +23,7 @@ #include using std::string; using Ingen::Shared::ClientInterface; -using Ingen::Shared::Responder; +using Ingen::Responder; namespace Ingen { @@ -36,7 +36,7 @@ class RegisterClientEvent : public QueuedEvent { public: RegisterClientEvent(Engine& engine, - SharedPtr responder, + SharedPtr responder, SampleCount timestamp, const string& uri, ClientInterface* client); diff --git a/src/libs/engine/events/RenameEvent.cpp b/src/libs/engine/events/RenameEvent.cpp index a7dc4874..a731314b 100644 --- a/src/libs/engine/events/RenameEvent.cpp +++ b/src/libs/engine/events/RenameEvent.cpp @@ -16,7 +16,7 @@ */ #include "RenameEvent.hpp" -#include "interface/Responder.hpp" +#include "Responder.hpp" #include "Patch.hpp" #include "Node.hpp" #include "Tree.hpp" @@ -30,7 +30,7 @@ using namespace std; namespace Ingen { -RenameEvent::RenameEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& path, const string& name) +RenameEvent::RenameEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& path, const string& name) : QueuedEvent(engine, responder, timestamp), _old_path(path), _name(name), diff --git a/src/libs/engine/events/RenameEvent.hpp b/src/libs/engine/events/RenameEvent.hpp index 52a3050e..da7d642a 100644 --- a/src/libs/engine/events/RenameEvent.hpp +++ b/src/libs/engine/events/RenameEvent.hpp @@ -45,7 +45,7 @@ class DisconnectPortEvent; class RenameEvent : public QueuedEvent { public: - RenameEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& path, const string& name); + RenameEvent(Engine& engine, SharedPtr 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 d82b6779..e4d0f083 100644 --- a/src/libs/engine/events/RequestAllObjectsEvent.cpp +++ b/src/libs/engine/events/RequestAllObjectsEvent.cpp @@ -16,7 +16,7 @@ */ #include "RequestAllObjectsEvent.hpp" -#include "interface/Responder.hpp" +#include "Responder.hpp" #include "Engine.hpp" #include "ObjectSender.hpp" #include "ClientBroadcaster.hpp" @@ -25,7 +25,7 @@ namespace Ingen { -RequestAllObjectsEvent::RequestAllObjectsEvent(Engine& engine, SharedPtr responder, SampleCount timestamp) +RequestAllObjectsEvent::RequestAllObjectsEvent(Engine& engine, SharedPtr responder, SampleCount timestamp) : QueuedEvent(engine, responder, timestamp) { } @@ -34,8 +34,6 @@ RequestAllObjectsEvent::RequestAllObjectsEvent(Engine& engine, SharedPtrclient(_responder->client_uri()); - QueuedEvent::pre_process(); } @@ -43,13 +41,13 @@ RequestAllObjectsEvent::pre_process() void RequestAllObjectsEvent::post_process() { - if (_client) { + if (_responder->client()) { _responder->respond_ok(); // 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(_client, root, true); + if (root && _responder->client()) + ObjectSender::send_patch(_responder->client(), root, true); } else { _responder->respond_error("Unable to find client to send all objects"); diff --git a/src/libs/engine/events/RequestAllObjectsEvent.hpp b/src/libs/engine/events/RequestAllObjectsEvent.hpp index 016e35c7..0537575a 100644 --- a/src/libs/engine/events/RequestAllObjectsEvent.hpp +++ b/src/libs/engine/events/RequestAllObjectsEvent.hpp @@ -36,13 +36,10 @@ namespace Shared { class RequestAllObjectsEvent : public QueuedEvent { public: - RequestAllObjectsEvent(Engine& engine, SharedPtr responder, SampleCount timestamp); + RequestAllObjectsEvent(Engine& engine, SharedPtr responder, SampleCount timestamp); void pre_process(); void post_process(); - -private: - ClientInterface* _client; }; diff --git a/src/libs/engine/events/RequestMetadataEvent.cpp b/src/libs/engine/events/RequestMetadataEvent.cpp index fa0ecafb..fdd0ded3 100644 --- a/src/libs/engine/events/RequestMetadataEvent.cpp +++ b/src/libs/engine/events/RequestMetadataEvent.cpp @@ -17,7 +17,7 @@ #include "RequestMetadataEvent.hpp" #include -#include "interface/Responder.hpp" +#include "Responder.hpp" #include "Engine.hpp" #include "GraphObject.hpp" #include "ObjectStore.hpp" @@ -28,12 +28,11 @@ using std::string; namespace Ingen { -RequestMetadataEvent::RequestMetadataEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& node_path, const string& key) +RequestMetadataEvent::RequestMetadataEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& node_path, const string& key) : QueuedEvent(engine, responder, timestamp), _path(node_path), _key(key), - _object(NULL), - _client(NULL) + _object(NULL) { } @@ -41,9 +40,7 @@ RequestMetadataEvent::RequestMetadataEvent(Engine& engine, SharedPtrclient(_responder->client_uri()); - - if (_client) { + if (_responder->client()) { _object = _engine.object_store()->find_object(_path); if (_object == NULL) { QueuedEvent::pre_process(); @@ -60,14 +57,14 @@ RequestMetadataEvent::pre_process() void RequestMetadataEvent::post_process() { - if (_client) { + if (_responder->client()) { if (!_object) { string msg = "Unable to find metadata subject "; msg += _path; _responder->respond_error(msg); } else { _responder->respond_ok(); - _client->metadata_update(_path, _key, _value); + _responder->client()->metadata_update(_path, _key, _value); } } else { _responder->respond_error("Unknown client"); diff --git a/src/libs/engine/events/RequestMetadataEvent.hpp b/src/libs/engine/events/RequestMetadataEvent.hpp index db41fd32..714b1ec3 100644 --- a/src/libs/engine/events/RequestMetadataEvent.hpp +++ b/src/libs/engine/events/RequestMetadataEvent.hpp @@ -38,7 +38,7 @@ namespace Shared { class RequestMetadataEvent : public QueuedEvent { public: - RequestMetadataEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& path, const string& key); + RequestMetadataEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& path, const string& key); void pre_process(); void post_process(); @@ -48,7 +48,6 @@ private: string _key; Raul::Atom _value; GraphObject* _object; - ClientInterface* _client; }; diff --git a/src/libs/engine/events/RequestObjectEvent.cpp b/src/libs/engine/events/RequestObjectEvent.cpp index f8343df0..62651e63 100644 --- a/src/libs/engine/events/RequestObjectEvent.cpp +++ b/src/libs/engine/events/RequestObjectEvent.cpp @@ -18,7 +18,7 @@ #include "RequestObjectEvent.hpp" #include #include "interface/ClientInterface.hpp" -#include "interface/Responder.hpp" +#include "Responder.hpp" #include "Engine.hpp" #include "ObjectStore.hpp" #include "ClientBroadcaster.hpp" @@ -32,7 +32,7 @@ using std::string; namespace Ingen { -RequestObjectEvent::RequestObjectEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& path) +RequestObjectEvent::RequestObjectEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& path) : QueuedEvent(engine, responder, timestamp), _path(path), _object(NULL) @@ -43,7 +43,6 @@ RequestObjectEvent::RequestObjectEvent(Engine& engine, SharedPtrclient(_responder->client_uri()); _object = _engine.object_store()->find_object(_path); QueuedEvent::pre_process(); @@ -64,25 +63,25 @@ RequestObjectEvent::post_process() if (!_object) { _responder->respond_error("Unable to find object requested."); - } else if (_client) { + } else if (_responder->client()) { Patch* const patch = dynamic_cast(_object); if (patch) { _responder->respond_ok(); - ObjectSender::send_patch(_client, patch, true); + ObjectSender::send_patch(_responder->client(), patch, true); return; } Node* const node = dynamic_cast(_object); if (node) { _responder->respond_ok(); - ObjectSender::send_node(_client, node, true); + ObjectSender::send_node(_responder->client(), node, true); return; } Port* const port = dynamic_cast(_object); if (port) { _responder->respond_ok(); - ObjectSender::send_port(_client, port); + ObjectSender::send_port(_responder->client(), port); return; } diff --git a/src/libs/engine/events/RequestObjectEvent.hpp b/src/libs/engine/events/RequestObjectEvent.hpp index 58f7d73e..1997cabe 100644 --- a/src/libs/engine/events/RequestObjectEvent.hpp +++ b/src/libs/engine/events/RequestObjectEvent.hpp @@ -38,16 +38,15 @@ using Shared::ClientInterface; class RequestObjectEvent : public QueuedEvent { public: - RequestObjectEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& port_path); + RequestObjectEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& port_path); void pre_process(); void execute(SampleCount nframes, FrameTime start, FrameTime end); void post_process(); private: - string _path; - GraphObject* _object; - ClientInterface* _client; + string _path; + GraphObject* _object; }; diff --git a/src/libs/engine/events/RequestPluginEvent.cpp b/src/libs/engine/events/RequestPluginEvent.cpp index 981c98e7..693a021a 100644 --- a/src/libs/engine/events/RequestPluginEvent.cpp +++ b/src/libs/engine/events/RequestPluginEvent.cpp @@ -18,7 +18,7 @@ #include "RequestPluginEvent.hpp" #include #include "interface/ClientInterface.hpp" -#include "interface/Responder.hpp" +#include "Responder.hpp" #include "Engine.hpp" #include "Port.hpp" #include "ObjectStore.hpp" @@ -31,7 +31,7 @@ using std::string; namespace Ingen { -RequestPluginEvent::RequestPluginEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& uri) +RequestPluginEvent::RequestPluginEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& uri) : QueuedEvent(engine, responder, timestamp), _uri(uri), _plugin(NULL) @@ -42,7 +42,6 @@ RequestPluginEvent::RequestPluginEvent(Engine& engine, SharedPtrclient(_responder->client_uri()); _plugin = _engine.node_factory()->plugin(_uri); QueuedEvent::pre_process(); @@ -63,11 +62,11 @@ RequestPluginEvent::post_process() if (!_plugin) { _responder->respond_error("Unable to find plugin requested."); - } else if (_client) { + } else if (_responder->client()) { _responder->respond_ok(); assert(_plugin->uri() == _uri); - _client->new_plugin(_uri, _plugin->type_uri(), _plugin->name()); + _responder->client()->new_plugin(_uri, _plugin->type_uri(), _plugin->name()); } else { _responder->respond_error("Unable to find client to send plugin."); diff --git a/src/libs/engine/events/RequestPluginEvent.hpp b/src/libs/engine/events/RequestPluginEvent.hpp index 8c927ed5..978aa5ff 100644 --- a/src/libs/engine/events/RequestPluginEvent.hpp +++ b/src/libs/engine/events/RequestPluginEvent.hpp @@ -38,16 +38,15 @@ using Shared::ClientInterface; class RequestPluginEvent : public QueuedEvent { public: - RequestPluginEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& uri); + RequestPluginEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& uri); void pre_process(); void execute(SampleCount nframes, FrameTime start, FrameTime end); void post_process(); private: - string _uri; - const Plugin* _plugin; - ClientInterface* _client; + string _uri; + const Plugin* _plugin; }; diff --git a/src/libs/engine/events/RequestPluginsEvent.cpp b/src/libs/engine/events/RequestPluginsEvent.cpp index 50271b7f..005048ea 100644 --- a/src/libs/engine/events/RequestPluginsEvent.cpp +++ b/src/libs/engine/events/RequestPluginsEvent.cpp @@ -16,7 +16,7 @@ */ #include "RequestPluginsEvent.hpp" -#include "interface/Responder.hpp" +#include "Responder.hpp" #include "Engine.hpp" #include "ClientBroadcaster.hpp" #include "NodeFactory.hpp" @@ -24,7 +24,7 @@ namespace Ingen { -RequestPluginsEvent::RequestPluginsEvent(Engine& engine, SharedPtr responder, SampleCount timestamp) +RequestPluginsEvent::RequestPluginsEvent(Engine& engine, SharedPtr responder, SampleCount timestamp) : QueuedEvent(engine, responder, timestamp) { } @@ -33,8 +33,6 @@ RequestPluginsEvent::RequestPluginsEvent(Engine& engine, SharedPtrclient(_responder->client_uri()); - // Take a copy to send in the post processing thread (to avoid problems // because std::list isn't thread safe) _plugins = _engine.node_factory()->plugins(); @@ -46,8 +44,8 @@ RequestPluginsEvent::pre_process() void RequestPluginsEvent::post_process() { - if (_client) { - _engine.broadcaster()->send_plugins_to(_client, _plugins); + if (_responder->client()) { + _engine.broadcaster()->send_plugins_to(_responder->client(), _plugins); _responder->respond_ok(); } else { _responder->respond_error("Unable to find client to send plugins"); diff --git a/src/libs/engine/events/RequestPluginsEvent.hpp b/src/libs/engine/events/RequestPluginsEvent.hpp index 489478e4..92a042f9 100644 --- a/src/libs/engine/events/RequestPluginsEvent.hpp +++ b/src/libs/engine/events/RequestPluginsEvent.hpp @@ -26,7 +26,7 @@ using std::string; namespace Ingen { class Plugin; -class Shared::Responder; +class Responder; namespace Shared { class ClientInterface; } using Shared::ClientInterface; @@ -39,13 +39,12 @@ namespace Shared { class RequestPluginsEvent : public QueuedEvent { public: - RequestPluginsEvent(Engine& engine, SharedPtr responder, SampleCount timestamp); + RequestPluginsEvent(Engine& engine, SharedPtr responder, SampleCount timestamp); void pre_process(); void post_process(); private: - ClientInterface* _client; std::list _plugins; }; diff --git a/src/libs/engine/events/RequestPortValueEvent.cpp b/src/libs/engine/events/RequestPortValueEvent.cpp index 113369b3..992c1615 100644 --- a/src/libs/engine/events/RequestPortValueEvent.cpp +++ b/src/libs/engine/events/RequestPortValueEvent.cpp @@ -18,7 +18,7 @@ #include "RequestPortValueEvent.hpp" #include #include "interface/ClientInterface.hpp" -#include "interface/Responder.hpp" +#include "Responder.hpp" #include "Engine.hpp" #include "Port.hpp" #include "ObjectStore.hpp" @@ -30,7 +30,7 @@ using std::string; namespace Ingen { -RequestPortValueEvent::RequestPortValueEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& port_path) +RequestPortValueEvent::RequestPortValueEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& port_path) : QueuedEvent(engine, responder, timestamp), _port_path(port_path), _port(NULL), @@ -42,7 +42,6 @@ RequestPortValueEvent::RequestPortValueEvent(Engine& engine, SharedPtrclient(_responder->client_uri()); _port = _engine.object_store()->find_port(_port_path); QueuedEvent::pre_process(); @@ -68,9 +67,9 @@ RequestPortValueEvent::post_process() string msg; if (!_port) { _responder->respond_error("Unable to find port for get_value responder."); - } else if (_client) { + } else if (_responder->client()) { _responder->respond_ok(); - _client->control_change(_port_path, _value); + _responder->client()->control_change(_port_path, _value); } else { _responder->respond_error("Unable to find client to send port value"); } diff --git a/src/libs/engine/events/RequestPortValueEvent.hpp b/src/libs/engine/events/RequestPortValueEvent.hpp index da843947..f7170153 100644 --- a/src/libs/engine/events/RequestPortValueEvent.hpp +++ b/src/libs/engine/events/RequestPortValueEvent.hpp @@ -38,17 +38,16 @@ using Shared::ClientInterface; class RequestPortValueEvent : public QueuedEvent { public: - RequestPortValueEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& port_path); + RequestPortValueEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& port_path); void pre_process(); void execute(SampleCount nframes, FrameTime start, FrameTime end); void post_process(); private: - string _port_path; - Port* _port; - Sample _value; - ClientInterface* _client; + string _port_path; + Port* _port; + Sample _value; }; diff --git a/src/libs/engine/events/SetMetadataEvent.cpp b/src/libs/engine/events/SetMetadataEvent.cpp index 4a93bed6..8e848aa6 100644 --- a/src/libs/engine/events/SetMetadataEvent.cpp +++ b/src/libs/engine/events/SetMetadataEvent.cpp @@ -17,7 +17,7 @@ #include "SetMetadataEvent.hpp" #include -#include "interface/Responder.hpp" +#include "Responder.hpp" #include "Engine.hpp" #include "ClientBroadcaster.hpp" #include "GraphObject.hpp" @@ -28,7 +28,7 @@ using std::string; namespace Ingen { -SetMetadataEvent::SetMetadataEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& path, const string& key, const Atom& value) +SetMetadataEvent::SetMetadataEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& path, const string& key, const Atom& value) : QueuedEvent(engine, responder, timestamp), _path(path), _key(key), diff --git a/src/libs/engine/events/SetMetadataEvent.hpp b/src/libs/engine/events/SetMetadataEvent.hpp index c5476eed..51af36f7 100644 --- a/src/libs/engine/events/SetMetadataEvent.hpp +++ b/src/libs/engine/events/SetMetadataEvent.hpp @@ -36,7 +36,7 @@ class GraphObject; class SetMetadataEvent : public QueuedEvent { public: - SetMetadataEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& path, const string& key, const Raul::Atom& value); + SetMetadataEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& path, const string& key, const Raul::Atom& value); void pre_process(); void execute(SampleCount nframes, FrameTime start, FrameTime end); diff --git a/src/libs/engine/events/SetPortValueEvent.cpp b/src/libs/engine/events/SetPortValueEvent.cpp index d4de64b3..581defa6 100644 --- a/src/libs/engine/events/SetPortValueEvent.cpp +++ b/src/libs/engine/events/SetPortValueEvent.cpp @@ -15,7 +15,7 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "interface/Responder.hpp" +#include "Responder.hpp" #include "SetPortValueEvent.hpp" #include "Engine.hpp" #include "Port.hpp" @@ -29,7 +29,7 @@ namespace Ingen { /** Voice-specific control setting */ -SetPortValueEvent::SetPortValueEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, size_t voice_num, const string& port_path, Sample val) +SetPortValueEvent::SetPortValueEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, size_t voice_num, const string& port_path, Sample val) : Event(engine, responder, timestamp), _voice_num(voice_num), _port_path(port_path), @@ -40,7 +40,7 @@ SetPortValueEvent::SetPortValueEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& port_path, Sample val) +SetPortValueEvent::SetPortValueEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& port_path, Sample val) : Event(engine, responder, timestamp), _voice_num(-1), _port_path(port_path), diff --git a/src/libs/engine/events/SetPortValueEvent.hpp b/src/libs/engine/events/SetPortValueEvent.hpp index 2f2f35e7..da378347 100644 --- a/src/libs/engine/events/SetPortValueEvent.hpp +++ b/src/libs/engine/events/SetPortValueEvent.hpp @@ -35,8 +35,8 @@ class Port; class SetPortValueEvent : public Event { public: - SetPortValueEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& port_path, Sample val); - SetPortValueEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, size_t voice_num, const string& port_path, Sample val); + SetPortValueEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& port_path, Sample val); + SetPortValueEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, size_t voice_num, const string& port_path, Sample val); void execute(SampleCount nframes, FrameTime start, FrameTime end); void post_process(); diff --git a/src/libs/engine/events/SetPortValueQueuedEvent.cpp b/src/libs/engine/events/SetPortValueQueuedEvent.cpp index a1a93a08..35c2f270 100644 --- a/src/libs/engine/events/SetPortValueQueuedEvent.cpp +++ b/src/libs/engine/events/SetPortValueQueuedEvent.cpp @@ -16,7 +16,7 @@ */ #include "SetPortValueQueuedEvent.hpp" -#include "interface/Responder.hpp" +#include "Responder.hpp" #include "Engine.hpp" #include "Port.hpp" #include "ClientBroadcaster.hpp" @@ -30,7 +30,7 @@ namespace Ingen { /** Voice-specific control setting */ -SetPortValueQueuedEvent::SetPortValueQueuedEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, size_t voice_num, const string& port_path, Sample val) +SetPortValueQueuedEvent::SetPortValueQueuedEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, size_t voice_num, const string& port_path, Sample val) : QueuedEvent(engine, responder, timestamp), _voice_num(voice_num), _port_path(port_path), @@ -41,7 +41,7 @@ SetPortValueQueuedEvent::SetPortValueQueuedEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& port_path, Sample val) +SetPortValueQueuedEvent::SetPortValueQueuedEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& port_path, Sample val) : QueuedEvent(engine, responder, timestamp), _voice_num(-1), _port_path(port_path), diff --git a/src/libs/engine/events/SetPortValueQueuedEvent.hpp b/src/libs/engine/events/SetPortValueQueuedEvent.hpp index a0e01910..43e3d0f8 100644 --- a/src/libs/engine/events/SetPortValueQueuedEvent.hpp +++ b/src/libs/engine/events/SetPortValueQueuedEvent.hpp @@ -35,8 +35,8 @@ class Port; class SetPortValueQueuedEvent : public QueuedEvent { public: - SetPortValueQueuedEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& port_path, Sample val); - SetPortValueQueuedEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, size_t voice_num, const string& port_path, Sample val); + SetPortValueQueuedEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& port_path, Sample val); + SetPortValueQueuedEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, size_t voice_num, const string& port_path, Sample val); void pre_process(); void execute(SampleCount nframes, FrameTime start, FrameTime end); diff --git a/src/libs/engine/events/UnregisterClientEvent.cpp b/src/libs/engine/events/UnregisterClientEvent.cpp index 11424003..72ab8048 100644 --- a/src/libs/engine/events/UnregisterClientEvent.cpp +++ b/src/libs/engine/events/UnregisterClientEvent.cpp @@ -16,7 +16,7 @@ */ #include "interface/ClientInterface.hpp" -#include "interface/Responder.hpp" +#include "Responder.hpp" #include "UnregisterClientEvent.hpp" #include "Engine.hpp" #include "ClientBroadcaster.hpp" @@ -24,7 +24,7 @@ namespace Ingen { -UnregisterClientEvent::UnregisterClientEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& uri) +UnregisterClientEvent::UnregisterClientEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& uri) : QueuedEvent(engine, responder, timestamp) , _uri(uri) { diff --git a/src/libs/engine/events/UnregisterClientEvent.hpp b/src/libs/engine/events/UnregisterClientEvent.hpp index 500c1250..c21bc5da 100644 --- a/src/libs/engine/events/UnregisterClientEvent.hpp +++ b/src/libs/engine/events/UnregisterClientEvent.hpp @@ -38,7 +38,7 @@ class UnregisterClientEvent : public QueuedEvent { public: UnregisterClientEvent(Engine& engine, - SharedPtr responder, + SharedPtr responder, SampleCount timestamp, const string& uri); diff --git a/src/libs/gui/App.cpp b/src/libs/gui/App.cpp index add26d8c..c2d835f3 100644 --- a/src/libs/gui/App.cpp +++ b/src/libs/gui/App.cpp @@ -138,6 +138,8 @@ App::attach(const SharedPtr& engine, const SharedPtrregister_client(client.get()); _engine = engine; _client = client; diff --git a/src/libs/gui/ConnectWindow.cpp b/src/libs/gui/ConnectWindow.cpp index f5a3fdea..2b986b37 100644 --- a/src/libs/gui/ConnectWindow.cpp +++ b/src/libs/gui/ConnectWindow.cpp @@ -26,7 +26,6 @@ #include "interface/EngineInterface.hpp" #include "engine/tuning.hpp" #include "engine/Engine.hpp" -#include "engine/DirectResponder.hpp" #include "engine/QueuedEngineInterface.hpp" #include "client/OSCClientReceiver.hpp" #include "client/OSCEngineSender.hpp" @@ -118,12 +117,10 @@ ConnectWindow::start(SharedPtr engine, SharedPtr client(tsci); - if (interface) { - App::instance().attach(interface, client); - interface->set_responder(SharedPtr(new Ingen::DirectResponder(tsci, 1))); - } - engine->activate(); + + if (interface) + App::instance().attach(interface, client); _connect_stage = 0; @@ -254,9 +251,6 @@ ConnectWindow::connect() App::instance().attach(engine_interface, client); - engine_interface->set_responder(SharedPtr( - new Ingen::DirectResponder(tsci, 1))); - _engine->activate(); Glib::signal_timeout().connect( @@ -357,8 +351,9 @@ ConnectWindow::gtk_callback() _progress_label->set_text("Connecting to engine..."); present(); - App::instance().client()->response_sig.connect(sigc::mem_fun(this, &ConnectWindow::response_received)); - + App::instance().client()->response_ok_sig.connect( + sigc::mem_fun(this, &ConnectWindow::response_ok_received)); + _ping_id = rand(); while (_ping_id == -1) _ping_id = rand(); @@ -387,7 +382,7 @@ ConnectWindow::gtk_callback() // FIXME //auto_ptr client(new ThreadedSigClientInterface(); // FIXME: client URI - App::instance().engine()->register_client("", App::instance().client().get()); + App::instance().engine()->register_client(App::instance().client().get()); App::instance().engine()->load_plugins(); ++_connect_stage; } else if (_connect_stage == 3) { diff --git a/src/libs/gui/ConnectWindow.hpp b/src/libs/gui/ConnectWindow.hpp index f8cd8db8..086da446 100644 --- a/src/libs/gui/ConnectWindow.hpp +++ b/src/libs/gui/ConnectWindow.hpp @@ -54,7 +54,7 @@ public: void set_connected_to(SharedPtr e=SharedPtr()); void start(SharedPtr engine, SharedPtr interface); - void response_received(int32_t id, bool, string) { if ((id) == _ping_id) _attached = true; } + void response_ok_received(int32_t id) { if ((id) == _ping_id) _attached = true; } private: enum Mode { CONNECT_REMOTE, LAUNCH_REMOTE, INTERNAL }; -- cgit v1.2.1