diff options
Diffstat (limited to 'src/engine')
-rw-r--r-- | src/engine/OSCEngineReceiver.cpp | 26 | ||||
-rw-r--r-- | src/engine/OSCEngineReceiver.hpp | 1 | ||||
-rw-r--r-- | src/engine/QueuedEngineInterface.cpp | 11 | ||||
-rw-r--r-- | src/engine/QueuedEngineInterface.hpp | 3 | ||||
-rw-r--r-- | src/engine/events.hpp | 1 | ||||
-rw-r--r-- | src/engine/events/RequestObjectEvent.cpp | 22 | ||||
-rw-r--r-- | src/engine/events/RequestObjectEvent.hpp | 12 | ||||
-rw-r--r-- | src/engine/events/RequestPluginEvent.cpp | 78 | ||||
-rw-r--r-- | src/engine/events/RequestPluginEvent.hpp | 51 | ||||
-rw-r--r-- | src/engine/wscript | 1 |
10 files changed, 32 insertions, 174 deletions
diff --git a/src/engine/OSCEngineReceiver.cpp b/src/engine/OSCEngineReceiver.cpp index e9a66665..912a2969 100644 --- a/src/engine/OSCEngineReceiver.cpp +++ b/src/engine/OSCEngineReceiver.cpp @@ -108,7 +108,6 @@ OSCEngineReceiver::OSCEngineReceiver(Engine& engine, size_t queue_size, uint16_t // Queries lo_server_add_method(_server, "/ingen/request_variable", "iss", variable_get_cb, this); - lo_server_add_method(_server, "/ingen/request_plugin", "is", request_plugin_cb, this); lo_server_add_method(_server, "/ingen/request_object", "is", request_object_cb, this); lo_server_add_method(_server, "/ingen/request_plugins", "i", request_plugins_cb, this); lo_server_add_method(_server, "/ingen/request_all_objects", "i", request_all_objects_cb, this); @@ -687,35 +686,16 @@ OSCEngineReceiver::_variable_get_cb(const char* path, const char* types, lo_arg* /** \page engine_osc_namespace - * <h2>/ingen/request_plugin</h2> - * \arg \b response-id (integer) - * \arg \b port-path (string) - Full path of port to send the value of - * - * Request the value of a port. - */ -int -OSCEngineReceiver::_request_plugin_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg) -{ - const char* uri = &argv[1]->s; - - request_plugin(uri); - return 0; -} - - -/** \page engine_osc_namespace * <h2>/ingen/request_object</h2> * \arg \b response-id (integer) - * \arg \b port-path (string) - Full path of port to send the value of \n\n + * \arg \b uri (string) - URI of object (patch, port, node, plugin) to send * - * Request all properties of a graph object. + * Request all properties of an object. */ int OSCEngineReceiver::_request_object_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg) { - const char* object_path = &argv[1]->s; - - request_object(object_path); + request_object(&argv[1]->s); return 0; } diff --git a/src/engine/OSCEngineReceiver.hpp b/src/engine/OSCEngineReceiver.hpp index 10cc2b10..a4d25c29 100644 --- a/src/engine/OSCEngineReceiver.hpp +++ b/src/engine/OSCEngineReceiver.hpp @@ -104,7 +104,6 @@ private: LO_HANDLER(variable_get); LO_HANDLER(variable_set); LO_HANDLER(property_set); - LO_HANDLER(request_plugin); LO_HANDLER(request_object); LO_HANDLER(request_variable); LO_HANDLER(request_plugins); diff --git a/src/engine/QueuedEngineInterface.cpp b/src/engine/QueuedEngineInterface.cpp index 30cc1072..3608ceaf 100644 --- a/src/engine/QueuedEngineInterface.cpp +++ b/src/engine/QueuedEngineInterface.cpp @@ -268,16 +268,9 @@ QueuedEngineInterface::ping() void -QueuedEngineInterface::request_plugin(const URI& uri) +QueuedEngineInterface::request_object(const URI& uri) { - push_queued(new RequestPluginEvent(_engine, _responder, now(), uri)); -} - - -void -QueuedEngineInterface::request_object(const Path& path) -{ - push_queued(new RequestObjectEvent(_engine, _responder, now(), path)); + push_queued(new RequestObjectEvent(_engine, _responder, now(), uri)); } diff --git a/src/engine/QueuedEngineInterface.hpp b/src/engine/QueuedEngineInterface.hpp index 43237ac8..b4fb8912 100644 --- a/src/engine/QueuedEngineInterface.hpp +++ b/src/engine/QueuedEngineInterface.hpp @@ -108,8 +108,7 @@ public: // Requests // virtual void ping(); - virtual void request_plugin(const Raul::URI& uri); - virtual void request_object(const Raul::Path& path); + virtual void request_object(const Raul::URI& uri); virtual void request_variable(const Raul::URI& object_path, const Raul::URI& key); virtual void request_property(const Raul::URI& object_path, const Raul::URI& key); virtual void request_plugins(); diff --git a/src/engine/events.hpp b/src/engine/events.hpp index 8342fd45..78aea9ba 100644 --- a/src/engine/events.hpp +++ b/src/engine/events.hpp @@ -39,7 +39,6 @@ #include "events/RequestAllObjectsEvent.hpp" #include "events/RequestMetadataEvent.hpp" #include "events/RequestObjectEvent.hpp" -#include "events/RequestPluginEvent.hpp" #include "events/RequestPluginsEvent.hpp" #include "events/SetMetadataEvent.hpp" #include "events/SetPortValueEvent.hpp" diff --git a/src/engine/events/RequestObjectEvent.cpp b/src/engine/events/RequestObjectEvent.cpp index dac76f2b..c17e4983 100644 --- a/src/engine/events/RequestObjectEvent.cpp +++ b/src/engine/events/RequestObjectEvent.cpp @@ -32,10 +32,15 @@ using namespace Raul; namespace Ingen { -RequestObjectEvent::RequestObjectEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const Path& path) +RequestObjectEvent::RequestObjectEvent( + Engine& engine, + SharedPtr<Responder> responder, + SampleCount timestamp, + const URI& uri) : QueuedEvent(engine, responder, timestamp) - , _path(path) + , _uri(uri) , _object(NULL) + , _plugin(NULL) { } @@ -43,7 +48,10 @@ RequestObjectEvent::RequestObjectEvent(Engine& engine, SharedPtr<Responder> resp void RequestObjectEvent::pre_process() { - _object = _engine.engine_store()->find_object(_path); + if (Path::is_valid(_uri.str())) + _object = _engine.engine_store()->find_object(Path(_uri.str())); + else + _plugin = _engine.node_factory()->plugin(_uri); QueuedEvent::pre_process(); } @@ -60,10 +68,14 @@ RequestObjectEvent::execute(ProcessContext& context) void RequestObjectEvent::post_process() { - if (!_object) { + if (!_object && !_plugin) { _responder->respond_error("Unable to find object requested."); } else if (_responder->client()) { - ObjectSender::send_object(_responder->client(), _object, true); + _responder->respond_ok(); + if (_object) + _responder->client()->put(_uri, _object->properties()); + else if (_plugin) + _responder->client()->new_plugin(_uri, _plugin->type_uri(), _plugin->symbol()); } else { _responder->respond_error("Unable to find client to send object."); } diff --git a/src/engine/events/RequestObjectEvent.hpp b/src/engine/events/RequestObjectEvent.hpp index 600724b6..67454892 100644 --- a/src/engine/events/RequestObjectEvent.hpp +++ b/src/engine/events/RequestObjectEvent.hpp @@ -24,6 +24,7 @@ namespace Ingen { class GraphObjectImpl; +class PluginImpl; /** A request from a client to send the value of a port. @@ -33,15 +34,20 @@ class GraphObjectImpl; class RequestObjectEvent : public QueuedEvent { public: - RequestObjectEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const Raul::Path& port_path); + RequestObjectEvent( + Engine& engine, + SharedPtr<Responder> responder, + SampleCount timestamp, + const Raul::URI& uri); void pre_process(); void execute(ProcessContext& context); void post_process(); private: - const Raul::Path _path; - GraphObjectImpl* _object; + const Raul::URI _uri; + GraphObjectImpl* _object; + const PluginImpl* _plugin; }; diff --git a/src/engine/events/RequestPluginEvent.cpp b/src/engine/events/RequestPluginEvent.cpp deleted file mode 100644 index e772bf04..00000000 --- a/src/engine/events/RequestPluginEvent.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007-2009 Dave Robillard <http://drobilla.net> - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "interface/ClientInterface.hpp" -#include "RequestPluginEvent.hpp" -#include "Responder.hpp" -#include "Engine.hpp" -#include "PortImpl.hpp" -#include "EngineStore.hpp" -#include "ClientBroadcaster.hpp" -#include "NodeFactory.hpp" -#include "PluginImpl.hpp" -#include "ProcessContext.hpp" - -using namespace Raul; - -namespace Ingen { - - -RequestPluginEvent::RequestPluginEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const URI& uri) - : QueuedEvent(engine, responder, timestamp) - , _uri(uri) - , _plugin(NULL) -{ -} - - -void -RequestPluginEvent::pre_process() -{ - _plugin = _engine.node_factory()->plugin(_uri); - - QueuedEvent::pre_process(); -} - - -void -RequestPluginEvent::execute(ProcessContext& context) -{ - QueuedEvent::execute(context); - assert(_time >= context.start() && _time <= context.end()); -} - - -void -RequestPluginEvent::post_process() -{ - if (!_plugin) { - _responder->respond_error("Unable to find plugin requested."); - - } else if (_responder->client()) { - - _responder->respond_ok(); - assert(_plugin->uri() == _uri); - _responder->client()->new_plugin(_uri, _plugin->type_uri(), _plugin->symbol()); - - } else { - _responder->respond_error("Unable to find client to send plugin."); - } -} - - -} // namespace Ingen - diff --git a/src/engine/events/RequestPluginEvent.hpp b/src/engine/events/RequestPluginEvent.hpp deleted file mode 100644 index b97f3a3e..00000000 --- a/src/engine/events/RequestPluginEvent.hpp +++ /dev/null @@ -1,51 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007-2009 Dave Robillard <http://drobilla.net> - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef REQUESTPLUGINEVENT_H -#define REQUESTPLUGINEVENT_H - -#include "raul/URI.hpp" -#include "QueuedEvent.hpp" -#include "types.hpp" - -namespace Ingen { - -class PluginImpl; - - -/** A request from a client to send information about a plugin. - * - * \ingroup engine - */ -class RequestPluginEvent : public QueuedEvent -{ -public: - RequestPluginEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const Raul::URI& uri); - - void pre_process(); - void execute(ProcessContext& context); - void post_process(); - -private: - const Raul::URI _uri; - const PluginImpl* _plugin; -}; - - -} // namespace Ingen - -#endif // REQUESTPLUGINEVENT_H diff --git a/src/engine/wscript b/src/engine/wscript index 157708e8..bab84cf2 100644 --- a/src/engine/wscript +++ b/src/engine/wscript @@ -73,7 +73,6 @@ def build(bld): events/RequestAllObjectsEvent.cpp events/RequestMetadataEvent.cpp events/RequestObjectEvent.cpp - events/RequestPluginEvent.cpp events/RequestPluginsEvent.cpp events/SetMetadataEvent.cpp events/SetPortValueEvent.cpp |