summaryrefslogtreecommitdiffstats
path: root/src/libs
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-08-19 02:33:04 +0000
committerDavid Robillard <d@drobilla.net>2008-08-19 02:33:04 +0000
commit14764da12f3808da0c40b643ac8224716f060729 (patch)
treedfb40da4d1a0c23c05923e78319aa95f172f9e57 /src/libs
parent353944ee388081b5fa280847fb202a4f27c81735 (diff)
downloadingen-14764da12f3808da0c40b643ac8224716f060729.tar.gz
ingen-14764da12f3808da0c40b643ac8224716f060729.tar.bz2
ingen-14764da12f3808da0c40b643ac8224716f060729.zip
Remove weird virtual inheritance interface overlay thing from client in favour of wrappers.
git-svn-id: http://svn.drobilla.net/lad/ingen@1445 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs')
-rw-r--r--src/libs/client/OSCClientReceiver.cpp45
-rw-r--r--src/libs/client/OSCClientReceiver.hpp7
-rw-r--r--src/libs/client/SigClientInterface.hpp2
-rw-r--r--src/libs/gui/App.cpp5
-rw-r--r--src/libs/gui/App.hpp8
-rw-r--r--src/libs/gui/ConnectWindow.cpp27
6 files changed, 47 insertions, 47 deletions
diff --git a/src/libs/client/OSCClientReceiver.cpp b/src/libs/client/OSCClientReceiver.cpp
index b2de59e5..8ebd9d8e 100644
--- a/src/libs/client/OSCClientReceiver.cpp
+++ b/src/libs/client/OSCClientReceiver.cpp
@@ -29,9 +29,10 @@ using namespace Raul;
namespace Ingen {
namespace Client {
-
-OSCClientReceiver::OSCClientReceiver(int listen_port)
- : _listen_port(listen_port)
+
+OSCClientReceiver::OSCClientReceiver(int listen_port, SharedPtr<Shared::ClientInterface> target)
+ : _target(target)
+ , _listen_port(listen_port)
, _st(NULL)
{
start(false); // true = dump, false = shutup
@@ -165,7 +166,7 @@ OSCClientReceiver::setup_callbacks()
int
OSCClientReceiver::_error_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
- error((char*)argv[0]);
+ _target->error((char*)argv[0]);
return 0;
}
@@ -173,7 +174,7 @@ OSCClientReceiver::_error_cb(const char* path, const char* types, lo_arg** argv,
int
OSCClientReceiver::_new_patch_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
- new_patch(&argv[0]->s, argv[1]->i); // path, poly
+ _target->new_patch(&argv[0]->s, argv[1]->i); // path, poly
return 0;
}
@@ -181,7 +182,7 @@ OSCClientReceiver::_new_patch_cb(const char* path, const char* types, lo_arg** a
int
OSCClientReceiver::_destroyed_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
- destroy((const char*)&argv[0]->s);
+ _target->destroy((const char*)&argv[0]->s);
return 0;
}
@@ -189,7 +190,7 @@ OSCClientReceiver::_destroyed_cb(const char* path, const char* types, lo_arg** a
int
OSCClientReceiver::_patch_cleared_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
- patch_cleared((const char*)&argv[0]->s);
+ _target->patch_cleared((const char*)&argv[0]->s);
return 0;
}
@@ -197,7 +198,7 @@ OSCClientReceiver::_patch_cleared_cb(const char* path, const char* types, lo_arg
int
OSCClientReceiver::_object_renamed_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
- object_renamed((const char*)&argv[0]->s, (const char*)&argv[1]->s);
+ _target->object_renamed((const char*)&argv[0]->s, (const char*)&argv[1]->s);
return 0;
}
@@ -208,7 +209,7 @@ OSCClientReceiver::_connection_cb(const char* path, const char* types, lo_arg**
const char* const src_port_path = &argv[0]->s;
const char* const dst_port_path = &argv[1]->s;
- connect(src_port_path, dst_port_path);
+ _target->connect(src_port_path, dst_port_path);
return 0;
}
@@ -220,7 +221,7 @@ OSCClientReceiver::_disconnection_cb(const char* path, const char* types, lo_arg
const char* src_port_path = &argv[0]->s;
const char* dst_port_path = &argv[1]->s;
- disconnect(src_port_path, dst_port_path);
+ _target->disconnect(src_port_path, dst_port_path);
return 0;
}
@@ -234,7 +235,7 @@ OSCClientReceiver::_new_node_cb(const char* path, const char* types, lo_arg** ar
const char* uri = &argv[0]->s;
const char* node_path = &argv[1]->s;
- new_node(uri, node_path);
+ _target->new_node(uri, node_path);
return 0;
}
@@ -250,7 +251,7 @@ OSCClientReceiver::_new_port_cb(const char* path, const char* types, lo_arg** ar
const char* type = &argv[2]->s;
const bool is_output = (argv[3]->i == 1);
- new_port(port_path, index, type, is_output);
+ _target->new_port(port_path, index, type, is_output);
return 0;
}
@@ -269,7 +270,7 @@ OSCClientReceiver::_set_variable_cb(const char* path, const char* types, lo_arg*
Atom value = AtomLiblo::lo_arg_to_atom(types[2], argv[2]);
- set_variable(obj_path, key, value);
+ _target->set_variable(obj_path, key, value);
return 0;
}
@@ -288,7 +289,7 @@ OSCClientReceiver::_set_property_cb(const char* path, const char* types, lo_arg*
Atom value = AtomLiblo::lo_arg_to_atom(types[2], argv[2]);
- set_property(obj_path, key, value);
+ _target->set_property(obj_path, key, value);
return 0;
}
@@ -300,7 +301,7 @@ OSCClientReceiver::_set_port_value_cb(const char* path, const char* types, lo_ar
const char* const port_path = &argv[0]->s;
const float value = argv[1]->f;
- set_port_value(port_path, value);
+ _target->set_port_value(port_path, value);
return 0;
}
@@ -313,7 +314,7 @@ OSCClientReceiver::_set_voice_value_cb(const char* path, const char* types, lo_a
const int voice = argv[1]->i;
const float value = argv[2]->f;
- set_voice_value(port_path, voice, value);
+ _target->set_voice_value(port_path, voice, value);
return 0;
}
@@ -324,7 +325,7 @@ OSCClientReceiver::_port_activity_cb(const char* path, const char* types, lo_arg
{
const char* const port_path = &argv[0]->s;
- port_activity(port_path);
+ _target->port_activity(port_path);
return 0;
}
@@ -334,7 +335,7 @@ int
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);
+ _target->response_ok(argv[0]->i);
return 0;
}
@@ -344,7 +345,7 @@ int
OSCClientReceiver::_response_error_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
assert(!strcmp(types, "is"));
- response_error(argv[0]->i, &argv[1]->s);
+ _target->response_error(argv[0]->i, &argv[1]->s);
return 0;
}
@@ -356,7 +357,7 @@ int
OSCClientReceiver::_plugin_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
assert(argc == 4 && !strcmp(types, "ssss"));
- new_plugin(&argv[0]->s, &argv[1]->s, &argv[2]->s, &argv[3]->s); // uri, type, symbol, name
+ _target->new_plugin(&argv[0]->s, &argv[1]->s, &argv[2]->s, &argv[3]->s); // uri, type, symbol, name
return 0;
}
@@ -370,7 +371,7 @@ OSCClientReceiver::_program_add_cb(const char* path, const char* types, lo_arg**
int32_t program = argv[2]->i;
const char* name = &argv[3]->s;
- program_add(node_path, bank, program, name);
+ _target->program_add(node_path, bank, program, name);
return 0;
}
@@ -383,7 +384,7 @@ OSCClientReceiver::_program_remove_cb(const char* path, const char* types, lo_ar
int32_t bank = argv[1]->i;
int32_t program = argv[2]->i;
- program_remove(node_path, bank, program);
+ _target->program_remove(node_path, bank, program);
return 0;
}
diff --git a/src/libs/client/OSCClientReceiver.hpp b/src/libs/client/OSCClientReceiver.hpp
index 5913322c..f1d71dbb 100644
--- a/src/libs/client/OSCClientReceiver.hpp
+++ b/src/libs/client/OSCClientReceiver.hpp
@@ -22,6 +22,7 @@
#include <boost/utility.hpp>
#include <lo/lo.h>
#include "interface/ClientInterface.hpp"
+#include "raul/Deletable.hpp"
namespace Ingen {
@@ -55,10 +56,10 @@ inline static int name##_cb(LO_HANDLER_ARGS, void* osc_listener)\
*
* \ingroup IngenClient
*/
-class OSCClientReceiver : boost::noncopyable, virtual public Ingen::Shared::ClientInterface
+class OSCClientReceiver : public boost::noncopyable, public Raul::Deletable
{
public:
- OSCClientReceiver(int listen_port);
+ OSCClientReceiver(int listen_port, SharedPtr<Shared::ClientInterface> target);
~OSCClientReceiver();
void start(bool dump_osc);
@@ -75,6 +76,8 @@ private:
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);
+ SharedPtr<Shared::ClientInterface> _target;
+
int _listen_port;
lo_server_thread _st;
diff --git a/src/libs/client/SigClientInterface.hpp b/src/libs/client/SigClientInterface.hpp
index ee626042..32a0a43b 100644
--- a/src/libs/client/SigClientInterface.hpp
+++ b/src/libs/client/SigClientInterface.hpp
@@ -37,7 +37,7 @@ namespace Client {
* The signals here match the calls to ClientInterface exactly. See the
* documentation for ClientInterface for meanings of signal parameters.
*/
-class SigClientInterface : virtual public Ingen::Shared::ClientInterface, public sigc::trackable
+class SigClientInterface : public Ingen::Shared::ClientInterface, public sigc::trackable
{
public:
SigClientInterface() : _enabled(true) {}
diff --git a/src/libs/gui/App.cpp b/src/libs/gui/App.cpp
index 408b7503..64a89f8a 100644
--- a/src/libs/gui/App.cpp
+++ b/src/libs/gui/App.cpp
@@ -142,7 +142,8 @@ App::run(int argc, char** argv, Ingen::Shared::World* world)
void
-App::attach(SharedPtr<SigClientInterface> client)
+App::attach(SharedPtr<SigClientInterface> client,
+ SharedPtr<Raul::Deletable> handle)
{
assert( ! _client);
assert( ! _store);
@@ -151,6 +152,7 @@ App::attach(SharedPtr<SigClientInterface> client)
_world->engine->register_client(client.get());
_client = client;
+ _handle = handle;
_store = SharedPtr<ClientStore>(new ClientStore(_world->engine, client));
_loader = SharedPtr<ThreadedLoader>(new ThreadedLoader(_world->engine));
@@ -171,6 +173,7 @@ App::detach()
_loader.reset();
_store.reset();
_client.reset();
+ _handle.reset();
_world->engine.reset();
}
}
diff --git a/src/libs/gui/App.hpp b/src/libs/gui/App.hpp
index d4caef21..8d16a1c4 100644
--- a/src/libs/gui/App.hpp
+++ b/src/libs/gui/App.hpp
@@ -37,6 +37,7 @@ namespace Ingen {
class Engine;
namespace Shared {
class EngineInterface;
+ class ClientInterface;
class World;
}
namespace Client {
@@ -85,7 +86,9 @@ public:
void error_message(const string& msg);
- void attach(SharedPtr<SigClientInterface> client);
+ void attach(SharedPtr<SigClientInterface> client,
+ SharedPtr<Raul::Deletable> handle=SharedPtr<Raul::Deletable>());
+
void detach();
bool gtk_main_iteration();
@@ -106,7 +109,7 @@ public:
Glib::RefPtr<Gdk::Pixbuf> icon_from_path(const string& path, int size);
- const SharedPtr<EngineInterface> engine() const { return _world->engine; }
+ const SharedPtr<EngineInterface>& engine() const { return _world->engine; }
const SharedPtr<SigClientInterface>& client() const { return _client; }
const SharedPtr<ClientStore>& store() const { return _store; }
const SharedPtr<ThreadedLoader>& loader() const { return _loader; }
@@ -143,6 +146,7 @@ protected:
static App* _instance;
SharedPtr<SigClientInterface> _client;
+ SharedPtr<Raul::Deletable> _handle;
SharedPtr<ClientStore> _store;
SharedPtr<Serialiser> _serialiser;
SharedPtr<ThreadedLoader> _loader;
diff --git a/src/libs/gui/ConnectWindow.cpp b/src/libs/gui/ConnectWindow.cpp
index f1b0912a..03f8408a 100644
--- a/src/libs/gui/ConnectWindow.cpp
+++ b/src/libs/gui/ConnectWindow.cpp
@@ -44,19 +44,6 @@ namespace Ingen {
namespace GUI {
-// Paste together some interfaces to get the combination we want
-
-
-struct OSCSigEmitter : public OSCClientReceiver, public ThreadedSigClientInterface {
- OSCSigEmitter(size_t queue_size, int listen_port)
- : Ingen::Shared::ClientInterface()
- , OSCClientReceiver(listen_port)
- , ThreadedSigClientInterface(queue_size)
- {
- }
-};
-
-
// ConnectWindow
@@ -170,9 +157,10 @@ ConnectWindow::connect(bool existing)
world->engine = SharedPtr<EngineInterface>(new OSCEngineSender(url));
}
- OSCSigEmitter* ose = new OSCSigEmitter(1024, 16181); // FIXME: args
- SharedPtr<ThreadedSigClientInterface> client(ose);
- App::instance().attach(client);
+ // FIXME: static args
+ SharedPtr<ThreadedSigClientInterface> tsci(new ThreadedSigClientInterface(1024));
+ SharedPtr<OSCClientReceiver> client(new OSCClientReceiver(16181, tsci));
+ App::instance().attach(tsci, client);
Glib::signal_timeout().connect(
sigc::mem_fun(App::instance(), &App::gtk_main_iteration), 40, G_PRIORITY_DEFAULT);
@@ -191,9 +179,10 @@ ConnectWindow::connect(bool existing)
world->engine = SharedPtr<EngineInterface>(
new OSCEngineSender(string("osc.udp://localhost:").append(port_str)));
- OSCSigEmitter* ose = new OSCSigEmitter(1024, 16181); // FIXME: args
- SharedPtr<ThreadedSigClientInterface> client(ose);
- App::instance().attach(client);
+ // FIXME: static args
+ SharedPtr<ThreadedSigClientInterface> tsci(new ThreadedSigClientInterface(1024));
+ SharedPtr<OSCClientReceiver> client(new OSCClientReceiver(16181, tsci));
+ App::instance().attach(tsci, client);
Glib::signal_timeout().connect(
sigc::mem_fun(App::instance(), &App::gtk_main_iteration), 40, G_PRIORITY_DEFAULT);