diff options
author | David Robillard <d@drobilla.net> | 2007-08-01 03:20:35 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2007-08-01 03:20:35 +0000 |
commit | 9cd4eddfb41c4573d4acd4f625572c4cdff50497 (patch) | |
tree | b9ebf2ecd19ddc5033c891edf17fae01a61ef438 /src | |
parent | 22395ab7d817dec53e2c2fff07de6d88db70492e (diff) | |
download | ingen-9cd4eddfb41c4573d4acd4f625572c4cdff50497.tar.gz ingen-9cd4eddfb41c4573d4acd4f625572c4cdff50497.tar.bz2 ingen-9cd4eddfb41c4573d4acd4f625572c4cdff50497.zip |
More SWIGification. Engine->Client calls/messages implemented... and segfault somewhere in Python :/ .
git-svn-id: http://svn.drobilla.net/lad/ingen@664 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
33 files changed, 228 insertions, 90 deletions
diff --git a/src/bindings/Client.hpp b/src/bindings/Client.hpp new file mode 100644 index 00000000..aeca11d7 --- /dev/null +++ b/src/bindings/Client.hpp @@ -0,0 +1,90 @@ + +/** Need a stub ClientInterface without pure virtual methods + * to allow inheritance in the script + */ +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); + } + + virtual void response(int32_t id, bool success, std::string msg) {} + + 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() {} + + /** 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() {} + + /** 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). + */ + virtual void transfer_begin() {} + virtual void transfer_end() {} + + virtual void error(std::string msg) {} + + 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_patch(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_port(std::string path, + std::string data_type, + bool is_output) {} + + virtual void patch_enabled(std::string path) {} + + virtual void patch_disabled(std::string path) {} + + virtual void patch_cleared(std::string path) {} + + virtual void object_renamed(std::string old_path, + std::string new_path) {} + + virtual void object_destroyed(std::string path) {} + + virtual void connection(std::string src_port_path, + std::string dst_port_path) {} + + virtual void disconnection(std::string src_port_path, + std::string dst_port_path) {} + + virtual void metadata_update(std::string subject_path, + std::string predicate, + Raul::Atom value) {} + + virtual void control_change(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_remove(std::string node_path, + uint32_t bank, + uint32_t program) {} +}; diff --git a/src/bindings/ingen.i b/src/bindings/ingen.i index dbf5ab10..719ece20 100644 --- a/src/bindings/ingen.i +++ b/src/bindings/ingen.i @@ -1,11 +1,12 @@ %include "stl.i" -%module ingen +%module(directors="1") ingen %{ #include "../common/interface/ClientInterface.hpp" #include "../common/interface/EngineInterface.hpp" #include "../libs/module/World.hpp" /*#include "../libs/module/module.h"*/ #include "ingen_bindings.hpp" +#include "Client.hpp" namespace Ingen { namespace Shared { class World; @@ -22,7 +23,11 @@ namespace Ingen { namespace Shared { //%include "../libs/module/module.h" %include "ingen_bindings.hpp" -using namespace Ingen::Shared; +// generate directors for all classes that have virtual methods +%feature("director"); +%feature("director") Ingen::Shared::ClientInterface; +//%feature("director") Ingen::Shared::EngineInterface; + namespace Ingen { namespace Shared { class World; } } @@ -39,7 +44,14 @@ namespace Ingen { namespace Shared { } /*SLV2World slv2() { return $self->me->slv2_world; }*/ }; + } } + +%include "Client.hpp" + +%feature("director") Client; + + /*SharedPtr<Ingen::Shared::EngineInterface> engine() { return $self->me->engine; }*/ diff --git a/src/bindings/test_ingen.py b/src/bindings/test_ingen.py index 794e51ba..4109dd21 100755 --- a/src/bindings/test_ingen.py +++ b/src/bindings/test_ingen.py @@ -3,9 +3,38 @@ import ingen import time world = ingen.World() + +class PythonClient(ingen.Client): + #def __init__(self): + # ingen.Client(self) + # print "Client" + + def bundle_begin(): + print "Bundle {" + + + def new_port(self, path, data_type, is_output): + print "Port:", path, data_type, is_output + +c = PythonClient() +c.thisown = 0 +print "C OWN", c.thisown +#print c.__base__ + e = world.engine +print "E OWN", e.thisown +e.thisown = 0 +#print e e.activate() + +#e.register_client("foo", c) +c.subscribe(e) + +c.enable() +#c.new_patch("/foo/bar", 1) + + e.create_port("/I", "ingen:midi", False) e.create_port("/made", "ingen:audio", False) e.create_port("/these", "ingen:audio", False) diff --git a/src/common/interface/ClientInterface.hpp b/src/common/interface/ClientInterface.hpp index 06114101..a13b870c 100644 --- a/src/common/interface/ClientInterface.hpp +++ b/src/common/interface/ClientInterface.hpp @@ -25,6 +25,8 @@ namespace Ingen { namespace Shared { +class EngineInterface; + /** The (only) interface the engine uses to communicate with clients. * @@ -35,6 +37,9 @@ class ClientInterface 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; diff --git a/src/common/interface/EngineInterface.hpp b/src/common/interface/EngineInterface.hpp index 0ac56c7c..09860e31 100644 --- a/src/common/interface/EngineInterface.hpp +++ b/src/common/interface/EngineInterface.hpp @@ -47,7 +47,7 @@ public: virtual void disable_responses() = 0; // Client registration - virtual void register_client(const string& uri, SharedPtr<ClientInterface> client) = 0; + virtual void register_client(const string& uri, ClientInterface* client) = 0; virtual void unregister_client(const string& uri) = 0; @@ -64,7 +64,7 @@ public: virtual void create_port(const string& path, const string& data_type, - bool direction) = 0; + bool is_output) = 0; virtual void create_node(const string& path, const string& plugin_uri, diff --git a/src/common/interface/Responder.hpp b/src/common/interface/Responder.hpp index 0ae0972a..463a3471 100644 --- a/src/common/interface/Responder.hpp +++ b/src/common/interface/Responder.hpp @@ -55,7 +55,7 @@ public: virtual std::string client_uri() { return ""; } - virtual SharedPtr<ClientInterface> client() { return SharedPtr<ClientInterface>(); } + virtual ClientInterface* client() { return NULL; } virtual void set_id(int32_t id) {} diff --git a/src/libs/client/OSCEngineSender.cpp b/src/libs/client/OSCEngineSender.cpp index 988f2c5e..553b073c 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, SharedPtr<ClientInterface> client) +OSCEngineSender::register_client(const string& uri, 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 ea804d59..b1a3ae1e 100644 --- a/src/libs/client/OSCEngineSender.hpp +++ b/src/libs/client/OSCEngineSender.hpp @@ -61,7 +61,7 @@ public: /* *** EngineInterface implementation below here *** */ // Client registration - void register_client(const string& uri, SharedPtr<ClientInterface> client); + void register_client(const string& uri, ClientInterface* client); void unregister_client(const string& uri); diff --git a/src/libs/client/ThreadedSigClientInterface.hpp b/src/libs/client/ThreadedSigClientInterface.hpp index b6908a1c..af321cab 100644 --- a/src/libs/client/ThreadedSigClientInterface.hpp +++ b/src/libs/client/ThreadedSigClientInterface.hpp @@ -68,6 +68,8 @@ public: void enable() { _enabled = true; } void disable() { _enabled = false ; } + + virtual void subscribe(Shared::EngineInterface* engine) { throw; } // FIXME // FIXME: make this insert bundle-boundary-events, where the GTK thread // process all events between start and finish in one cycle, guaranteed diff --git a/src/libs/engine/ClientBroadcaster.cpp b/src/libs/engine/ClientBroadcaster.cpp index 8547543a..5023b2e0 100644 --- a/src/libs/engine/ClientBroadcaster.cpp +++ b/src/libs/engine/ClientBroadcaster.cpp @@ -41,9 +41,9 @@ namespace Ingen { /** Register a client to receive messages over the notification band. */ void -ClientBroadcaster::register_client(const string& uri, SharedPtr<ClientInterface> client) +ClientBroadcaster::register_client(const string& uri, ClientInterface* client) { - ClientMap::iterator i = _clients.find(uri); + Clients::iterator i = _clients.find(uri); if (i == _clients.end()) { _clients[uri] = client; @@ -79,15 +79,15 @@ ClientBroadcaster::unregister_client(const string& uri) * (A responder is passed to remove the dependency on liblo addresses in request * events, in anticipation of libom and multiple ways of responding to clients). */ -SharedPtr<ClientInterface> +ClientInterface* ClientBroadcaster::client(const string& uri) { - ClientMap::iterator i = _clients.find(uri); + Clients::iterator i = _clients.find(uri); if (i != _clients.end()) { return (*i).second; } else { cerr << "[ClientBroadcaster] Failed to find client: " << uri << endl; - return SharedPtr<ClientInterface>(); + return NULL; } } @@ -95,12 +95,12 @@ ClientBroadcaster::client(const string& uri) void ClientBroadcaster::send_error(const string& msg) { - for (ClientMap::const_iterator i = _clients.begin(); i != _clients.end(); ++i) + for (Clients::const_iterator i = _clients.begin(); i != _clients.end(); ++i) (*i).second->error(msg); } void -ClientBroadcaster::send_plugins_to(SharedPtr<ClientInterface> client, const list<Plugin*>& plugin_list) +ClientBroadcaster::send_plugins_to(ClientInterface* client, const list<Plugin*>& plugin_list) { #if 0 // FIXME: This probably isn't actually thread safe @@ -161,7 +161,7 @@ ClientBroadcaster::send_plugins_to(SharedPtr<ClientInterface> client, const list void ClientBroadcaster::send_plugins(const list<Plugin*>& plugin_list) { - for (ClientMap::const_iterator c = _clients.begin(); c != _clients.end(); ++c) + for (Clients::const_iterator c = _clients.begin(); c != _clients.end(); ++c) send_plugins_to((*c).second, plugin_list); } @@ -169,16 +169,16 @@ ClientBroadcaster::send_plugins(const list<Plugin*>& plugin_list) void ClientBroadcaster::send_node(const Node* node, bool recursive) { - for (ClientMap::const_iterator i = _clients.begin(); i != _clients.end(); ++i) - ObjectSender::send_node((*i).second.get(), node, recursive); + for (Clients::const_iterator i = _clients.begin(); i != _clients.end(); ++i) + ObjectSender::send_node((*i).second, node, recursive); } void ClientBroadcaster::send_port(const Port* port) { - for (ClientMap::const_iterator i = _clients.begin(); i != _clients.end(); ++i) - ObjectSender::send_port((*i).second.get(), port); + for (Clients::const_iterator i = _clients.begin(); i != _clients.end(); ++i) + ObjectSender::send_port((*i).second, port); } @@ -186,21 +186,21 @@ void ClientBroadcaster::send_destroyed(const string& path) { assert(path != "/"); - for (ClientMap::const_iterator i = _clients.begin(); i != _clients.end(); ++i) + for (Clients::const_iterator i = _clients.begin(); i != _clients.end(); ++i) (*i).second->object_destroyed(path); } void ClientBroadcaster::send_patch_cleared(const string& patch_path) { - for (ClientMap::const_iterator i = _clients.begin(); i != _clients.end(); ++i) + for (Clients::const_iterator i = _clients.begin(); i != _clients.end(); ++i) (*i).second->patch_cleared(patch_path); } void ClientBroadcaster::send_connection(const Connection* const c) { - for (ClientMap::const_iterator i = _clients.begin(); i != _clients.end(); ++i) + for (Clients::const_iterator i = _clients.begin(); i != _clients.end(); ++i) (*i).second->connection(c->src_port()->path(), c->dst_port()->path()); } @@ -208,7 +208,7 @@ ClientBroadcaster::send_connection(const Connection* const c) void ClientBroadcaster::send_disconnection(const string& src_port_path, const string& dst_port_path) { - for (ClientMap::const_iterator i = _clients.begin(); i != _clients.end(); ++i) + for (Clients::const_iterator i = _clients.begin(); i != _clients.end(); ++i) (*i).second->disconnection(src_port_path, dst_port_path); } @@ -216,7 +216,7 @@ ClientBroadcaster::send_disconnection(const string& src_port_path, const string& void ClientBroadcaster::send_patch_enable(const string& patch_path) { - for (ClientMap::const_iterator i = _clients.begin(); i != _clients.end(); ++i) + for (Clients::const_iterator i = _clients.begin(); i != _clients.end(); ++i) (*i).second->patch_enabled(patch_path); } @@ -224,7 +224,7 @@ ClientBroadcaster::send_patch_enable(const string& patch_path) void ClientBroadcaster::send_patch_disable(const string& patch_path) { - for (ClientMap::const_iterator i = _clients.begin(); i != _clients.end(); ++i) + for (Clients::const_iterator i = _clients.begin(); i != _clients.end(); ++i) (*i).second->patch_disabled(patch_path); } @@ -236,7 +236,7 @@ ClientBroadcaster::send_patch_disable(const string& patch_path) void ClientBroadcaster::send_metadata_update(const string& node_path, const string& key, const Atom& value) { - for (ClientMap::const_iterator i = _clients.begin(); i != _clients.end(); ++i) + for (Clients::const_iterator i = _clients.begin(); i != _clients.end(); ++i) (*i).second->metadata_update(node_path, key, value); } @@ -250,7 +250,7 @@ ClientBroadcaster::send_metadata_update(const string& node_path, const string& k void ClientBroadcaster::send_control_change(const string& port_path, float value) { - for (ClientMap::const_iterator i = _clients.begin(); i != _clients.end(); ++i) + for (Clients::const_iterator i = _clients.begin(); i != _clients.end(); ++i) (*i).second->control_change(port_path, value); } @@ -258,7 +258,7 @@ ClientBroadcaster::send_control_change(const string& port_path, float value) void ClientBroadcaster::send_program_add(const string& node_path, int bank, int program, const string& name) { - for (ClientMap::const_iterator i = _clients.begin(); i != _clients.end(); ++i) + for (Clients::const_iterator i = _clients.begin(); i != _clients.end(); ++i) (*i).second->program_add(node_path, bank, program, name); } @@ -266,7 +266,7 @@ ClientBroadcaster::send_program_add(const string& node_path, int bank, int progr void ClientBroadcaster::send_program_remove(const string& node_path, int bank, int program) { - for (ClientMap::const_iterator i = _clients.begin(); i != _clients.end(); ++i) + for (Clients::const_iterator i = _clients.begin(); i != _clients.end(); ++i) (*i).second->program_remove(node_path, bank, program); } @@ -278,8 +278,8 @@ ClientBroadcaster::send_program_remove(const string& node_path, int bank, int pr void ClientBroadcaster::send_patch(const Patch* const p, bool recursive) { - for (ClientMap::const_iterator i = _clients.begin(); i != _clients.end(); ++i) - ObjectSender::send_patch((*i).second.get(), p, recursive); + for (Clients::const_iterator i = _clients.begin(); i != _clients.end(); ++i) + ObjectSender::send_patch((*i).second, p, recursive); } @@ -288,7 +288,7 @@ ClientBroadcaster::send_patch(const Patch* const p, bool recursive) void ClientBroadcaster::send_rename(const string& old_path, const string& new_path) { - for (ClientMap::const_iterator i = _clients.begin(); i != _clients.end(); ++i) + for (Clients::const_iterator i = _clients.begin(); i != _clients.end(); ++i) (*i).second->object_renamed(old_path, new_path); } @@ -300,7 +300,7 @@ ClientBroadcaster::send_all_objects() { cerr << "FIXME: send_all" << endl; - //for (ClientMap::const_iterator i = _clients.begin(); i != _clients.end(); ++i) + //for (Clients::const_iterator i = _clients.begin(); i != _clients.end(); ++i) // (*i).second->send_all_objects(); } diff --git a/src/libs/engine/ClientBroadcaster.hpp b/src/libs/engine/ClientBroadcaster.hpp index 3103c4d9..034476f5 100644 --- a/src/libs/engine/ClientBroadcaster.hpp +++ b/src/libs/engine/ClientBroadcaster.hpp @@ -23,7 +23,6 @@ #include <map> #include <lo/lo.h> #include <pthread.h> -#include <raul/SharedPtr.hpp> #include "interface/ClientInterface.hpp" #include "types.hpp" @@ -55,10 +54,10 @@ using Shared::ClientInterface; class ClientBroadcaster { public: - void register_client(const string& uri, SharedPtr<ClientInterface> client); + void register_client(const string& uri, ClientInterface* client); bool unregister_client(const string& uri); - SharedPtr<ClientInterface> client(const string& uri); + ClientInterface* client(const string& uri); // Notification band: @@ -88,11 +87,11 @@ public: void send_program_add(const string& node_path, int bank, int program, const string& name); void send_program_remove(const string& node_path, int bank, int program); - void send_plugins_to(SharedPtr<ClientInterface>, const list<Plugin*>& plugin_list); + void send_plugins_to(ClientInterface*, const list<Plugin*>& plugin_list); private: - typedef std::map<string, SharedPtr<ClientInterface> > ClientMap; - ClientMap _clients; + typedef std::map<string, ClientInterface*> Clients; + Clients _clients; }; diff --git a/src/libs/engine/DirectResponder.hpp b/src/libs/engine/DirectResponder.hpp index 739cd017..7bd35dcd 100644 --- a/src/libs/engine/DirectResponder.hpp +++ b/src/libs/engine/DirectResponder.hpp @@ -30,7 +30,7 @@ namespace Ingen { class DirectResponder : public Shared::Responder { public: - DirectResponder(SharedPtr<Shared::ClientInterface> client, int32_t id) + DirectResponder(Shared::ClientInterface* client, int32_t id) : _client(client), _id(id) {} @@ -39,11 +39,11 @@ public: void respond_ok() { _client->response(_id, true, ""); } void respond_error(const string& msg) { _client->response(_id, false, msg); } - SharedPtr<Shared::ClientInterface> client() { return _client; } + Shared::ClientInterface* client() { return _client; } private: - SharedPtr<Shared::ClientInterface> _client; - int32_t _id; + Shared::ClientInterface* _client; + int32_t _id; }; diff --git a/src/libs/engine/OSCClientSender.hpp b/src/libs/engine/OSCClientSender.hpp index 769bb0b9..6cf8abbe 100644 --- a/src/libs/engine/OSCClientSender.hpp +++ b/src/libs/engine/OSCClientSender.hpp @@ -53,6 +53,8 @@ public: const string& url() const { return _url; } const lo_address address() const { return _address; } + void subscribe(Shared::EngineInterface* engine) { } + //void plugins(); // FIXME remove diff --git a/src/libs/engine/OSCEngineReceiver.cpp b/src/libs/engine/OSCEngineReceiver.cpp index 011f950c..a2b98017 100644 --- a/src/libs/engine/OSCEngineReceiver.cpp +++ b/src/libs/engine/OSCEngineReceiver.cpp @@ -252,7 +252,7 @@ OSCEngineReceiver::set_response_address_cb(const char* path, const char* types, // Don't respond } else { me->disable_responses(); - SharedPtr<ClientInterface> client = me->_engine.broadcaster()->client(url); + ClientInterface* client = me->_engine.broadcaster()->client(url); if (client) client->disable(); else @@ -329,7 +329,7 @@ OSCEngineReceiver::_register_client_cb(const char* path, const char* types, lo_a lo_address addr = lo_message_get_source(msg); char* const url = lo_address_get_url(addr); - SharedPtr<ClientInterface> client(new OSCClientSender((const char*)url)); + ClientInterface* client = new OSCClientSender((const char*)url); register_client(url, client); free(url); diff --git a/src/libs/engine/OSCResponder.cpp b/src/libs/engine/OSCResponder.cpp index a966a2d3..e43ba49a 100644 --- a/src/libs/engine/OSCResponder.cpp +++ b/src/libs/engine/OSCResponder.cpp @@ -54,7 +54,7 @@ OSCResponder::~OSCResponder() void OSCResponder::respond_ok() { - SharedPtr<ClientInterface> client = this->client(); + ClientInterface* client = this->client(); if (client) client->enable(); @@ -71,7 +71,7 @@ OSCResponder::respond_ok() void OSCResponder::respond_error(const string& msg) { - SharedPtr<ClientInterface> client = this->client(); + ClientInterface* client = this->client(); if (client) client->enable(); @@ -85,13 +85,13 @@ OSCResponder::respond_error(const string& msg) } -SharedPtr<ClientInterface> +ClientInterface* OSCResponder::client() { if (_broadcaster) return _broadcaster->client(client_uri()); else - return SharedPtr<ClientInterface>(); + return NULL; } } // namespace OM diff --git a/src/libs/engine/OSCResponder.hpp b/src/libs/engine/OSCResponder.hpp index b536c169..e4049160 100644 --- a/src/libs/engine/OSCResponder.hpp +++ b/src/libs/engine/OSCResponder.hpp @@ -54,7 +54,7 @@ public: std::string client_uri() { return _url; } - SharedPtr<Shared::ClientInterface> client(); + Shared::ClientInterface* client(); private: ClientBroadcaster* _broadcaster; diff --git a/src/libs/engine/QueuedEngineInterface.cpp b/src/libs/engine/QueuedEngineInterface.cpp index 6055d8bd..a27a55f5 100644 --- a/src/libs/engine/QueuedEngineInterface.cpp +++ b/src/libs/engine/QueuedEngineInterface.cpp @@ -74,7 +74,7 @@ QueuedEngineInterface::disable_responses() void -QueuedEngineInterface::register_client(const string& uri, SharedPtr<ClientInterface> client) +QueuedEngineInterface::register_client(const string& uri, ClientInterface* client) { push_queued(new RegisterClientEvent(_engine, _responder, now(), uri, client)); } diff --git a/src/libs/engine/QueuedEngineInterface.hpp b/src/libs/engine/QueuedEngineInterface.hpp index 7b0f32d4..9d48074e 100644 --- a/src/libs/engine/QueuedEngineInterface.hpp +++ b/src/libs/engine/QueuedEngineInterface.hpp @@ -68,7 +68,7 @@ public: virtual void disable_responses(); // Client registration - virtual void register_client(const string& uri, SharedPtr<ClientInterface> client); + virtual void register_client(const string& uri, ClientInterface* client); virtual void unregister_client(const string& uri); diff --git a/src/libs/engine/events/RegisterClientEvent.cpp b/src/libs/engine/events/RegisterClientEvent.cpp index ac2dbbc3..ac38d88c 100644 --- a/src/libs/engine/events/RegisterClientEvent.cpp +++ b/src/libs/engine/events/RegisterClientEvent.cpp @@ -27,7 +27,7 @@ RegisterClientEvent::RegisterClientEvent(Engine& engine, SharedPtr<Shared::Responder> responder, SampleCount timestamp, const string& uri, - SharedPtr<ClientInterface> client) + ClientInterface* client) : QueuedEvent(engine, responder, timestamp) , _uri(uri) , _client(client) diff --git a/src/libs/engine/events/RegisterClientEvent.hpp b/src/libs/engine/events/RegisterClientEvent.hpp index 90528956..a653a8bd 100644 --- a/src/libs/engine/events/RegisterClientEvent.hpp +++ b/src/libs/engine/events/RegisterClientEvent.hpp @@ -39,14 +39,14 @@ public: SharedPtr<Shared::Responder> responder, SampleCount timestamp, const string& uri, - SharedPtr<ClientInterface> client); + ClientInterface* client); void pre_process(); void post_process(); private: - string _uri; - SharedPtr<ClientInterface> _client; + string _uri; + ClientInterface* _client; }; diff --git a/src/libs/engine/events/RequestAllObjectsEvent.cpp b/src/libs/engine/events/RequestAllObjectsEvent.cpp index 4b068536..d82b6779 100644 --- a/src/libs/engine/events/RequestAllObjectsEvent.cpp +++ b/src/libs/engine/events/RequestAllObjectsEvent.cpp @@ -49,7 +49,7 @@ RequestAllObjectsEvent::post_process() // 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.get(), root, true); + ObjectSender::send_patch(_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 91dfefc3..016e35c7 100644 --- a/src/libs/engine/events/RequestAllObjectsEvent.hpp +++ b/src/libs/engine/events/RequestAllObjectsEvent.hpp @@ -42,7 +42,7 @@ public: void post_process(); private: - SharedPtr<ClientInterface> _client; + ClientInterface* _client; }; diff --git a/src/libs/engine/events/RequestMetadataEvent.cpp b/src/libs/engine/events/RequestMetadataEvent.cpp index 9540d738..fa0ecafb 100644 --- a/src/libs/engine/events/RequestMetadataEvent.cpp +++ b/src/libs/engine/events/RequestMetadataEvent.cpp @@ -33,7 +33,7 @@ RequestMetadataEvent::RequestMetadataEvent(Engine& engine, SharedPtr<Shared::Res _path(node_path), _key(key), _object(NULL), - _client(SharedPtr<ClientInterface>()) + _client(NULL) { } diff --git a/src/libs/engine/events/RequestMetadataEvent.hpp b/src/libs/engine/events/RequestMetadataEvent.hpp index ed33e4af..db41fd32 100644 --- a/src/libs/engine/events/RequestMetadataEvent.hpp +++ b/src/libs/engine/events/RequestMetadataEvent.hpp @@ -44,11 +44,11 @@ public: void post_process(); private: - string _path; - string _key; - Raul::Atom _value; - GraphObject* _object; - SharedPtr<ClientInterface> _client; + string _path; + 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 745b10c1..f8343df0 100644 --- a/src/libs/engine/events/RequestObjectEvent.cpp +++ b/src/libs/engine/events/RequestObjectEvent.cpp @@ -68,21 +68,21 @@ RequestObjectEvent::post_process() Patch* const patch = dynamic_cast<Patch*>(_object); if (patch) { _responder->respond_ok(); - ObjectSender::send_patch(_client.get(), patch, true); + ObjectSender::send_patch(_client, patch, true); return; } Node* const node = dynamic_cast<Node*>(_object); if (node) { _responder->respond_ok(); - ObjectSender::send_node(_client.get(), node, true); + ObjectSender::send_node(_client, node, true); return; } Port* const port = dynamic_cast<Port*>(_object); if (port) { _responder->respond_ok(); - ObjectSender::send_port(_client.get(), port); + ObjectSender::send_port(_client, port); return; } diff --git a/src/libs/engine/events/RequestObjectEvent.hpp b/src/libs/engine/events/RequestObjectEvent.hpp index 6731182a..58f7d73e 100644 --- a/src/libs/engine/events/RequestObjectEvent.hpp +++ b/src/libs/engine/events/RequestObjectEvent.hpp @@ -45,9 +45,9 @@ public: void post_process(); private: - string _path; - GraphObject* _object; - SharedPtr<ClientInterface> _client; + string _path; + GraphObject* _object; + ClientInterface* _client; }; diff --git a/src/libs/engine/events/RequestPluginEvent.hpp b/src/libs/engine/events/RequestPluginEvent.hpp index 26e5a8fa..8c927ed5 100644 --- a/src/libs/engine/events/RequestPluginEvent.hpp +++ b/src/libs/engine/events/RequestPluginEvent.hpp @@ -45,9 +45,9 @@ public: void post_process(); private: - string _uri; - const Plugin* _plugin; - SharedPtr<ClientInterface> _client; + string _uri; + const Plugin* _plugin; + ClientInterface* _client; }; diff --git a/src/libs/engine/events/RequestPluginsEvent.hpp b/src/libs/engine/events/RequestPluginsEvent.hpp index fae8bf94..489478e4 100644 --- a/src/libs/engine/events/RequestPluginsEvent.hpp +++ b/src/libs/engine/events/RequestPluginsEvent.hpp @@ -45,8 +45,8 @@ public: void post_process(); private: - SharedPtr<ClientInterface> _client; - std::list<Plugin*> _plugins; + ClientInterface* _client; + std::list<Plugin*> _plugins; }; diff --git a/src/libs/engine/events/RequestPortValueEvent.hpp b/src/libs/engine/events/RequestPortValueEvent.hpp index 1a20b90f..da843947 100644 --- a/src/libs/engine/events/RequestPortValueEvent.hpp +++ b/src/libs/engine/events/RequestPortValueEvent.hpp @@ -45,10 +45,10 @@ public: void post_process(); private: - string _port_path; - Port* _port; - Sample _value; - SharedPtr<ClientInterface> _client; + string _port_path; + Port* _port; + Sample _value; + ClientInterface* _client; }; diff --git a/src/libs/gui/ConnectWindow.cpp b/src/libs/gui/ConnectWindow.cpp index a1c89c88..f5a3fdea 100644 --- a/src/libs/gui/ConnectWindow.cpp +++ b/src/libs/gui/ConnectWindow.cpp @@ -120,7 +120,7 @@ ConnectWindow::start(SharedPtr<Ingen::Engine> engine, SharedPtr<Shared::EngineIn if (interface) { App::instance().attach(interface, client); - interface->set_responder(SharedPtr<Ingen::Shared::Responder>(new Ingen::DirectResponder(client, 1))); + interface->set_responder(SharedPtr<Ingen::Shared::Responder>(new Ingen::DirectResponder(tsci, 1))); } engine->activate(); @@ -254,7 +254,8 @@ ConnectWindow::connect() App::instance().attach(engine_interface, client); - engine_interface->set_responder(SharedPtr<Ingen::Shared::Responder>(new Ingen::DirectResponder(client, 1))); + engine_interface->set_responder(SharedPtr<Ingen::Shared::Responder>( + new Ingen::DirectResponder(tsci, 1))); _engine->activate(); @@ -386,7 +387,7 @@ ConnectWindow::gtk_callback() // FIXME //auto_ptr<ClientInterface> client(new ThreadedSigClientInterface(); // FIXME: client URI - App::instance().engine()->register_client("", App::instance().client()); + 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/module/Module.cpp b/src/libs/module/Module.cpp index e5a137e7..1c6c7788 100644 --- a/src/libs/module/Module.cpp +++ b/src/libs/module/Module.cpp @@ -56,7 +56,7 @@ load_module(const string& name) string filename = Glib::Module::build_path(dir, name); if (Glib::file_test(filename, Glib::FILE_TEST_EXISTS)) { - module = new Glib::Module(filename); + module = new Glib::Module(filename, Glib::MODULE_BIND_LAZY); if (*module) { return SharedPtr<Glib::Module>(module); @@ -70,7 +70,8 @@ load_module(const string& name) // Try default directory if not found module = new Glib::Module( - Glib::Module::build_path(INGEN_MODULE_DIR, name)); + Glib::Module::build_path(INGEN_MODULE_DIR, name), + Glib::MODULE_BIND_LAZY); if (*module) { return SharedPtr<Glib::Module>(module); diff --git a/src/libs/module/module.cpp b/src/libs/module/module.cpp index ab73c09e..d169e546 100644 --- a/src/libs/module/module.cpp +++ b/src/libs/module/module.cpp @@ -42,7 +42,6 @@ get_world() } if (!world) { - cerr << "NEW WORLD\n" << endl; world = new World(); world->rdf_world = new Raul::RDF::World(); #ifdef HAVE_SLV2 diff --git a/src/progs/ingen/main.cpp b/src/progs/ingen/main.cpp index 145ec463..22ace336 100644 --- a/src/progs/ingen/main.cpp +++ b/src/progs/ingen/main.cpp @@ -217,11 +217,9 @@ main(int argc, char** argv) } else { cerr << "FAILED: " << Glib::Module::get_last_error() << endl; } - } - - - /* Didn't run the GUI, listen to OSC and do our own main thing. */ - if (engine && !ran_gui) { + + /* Listen to OSC and do our own main thing. */ + } else if (engine && !ran_gui) { signal(SIGINT, catch_int); signal(SIGTERM, catch_int); |