diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/client/OSCClientReceiver.cpp | 15 | ||||
-rw-r--r-- | src/client/OSCEngineSender.cpp | 13 | ||||
-rw-r--r-- | src/engine/OSCClientSender.cpp | 9 | ||||
-rw-r--r-- | src/engine/OSCEngineReceiver.cpp | 12 |
4 files changed, 41 insertions, 8 deletions
diff --git a/src/client/OSCClientReceiver.cpp b/src/client/OSCClientReceiver.cpp index e30ff7c4..c552e82e 100644 --- a/src/client/OSCClientReceiver.cpp +++ b/src/client/OSCClientReceiver.cpp @@ -29,13 +29,14 @@ using namespace Raul; namespace Ingen { namespace Client { +using namespace Shared; OSCClientReceiver::OSCClientReceiver(int listen_port, SharedPtr<Shared::ClientInterface> target) : _target(target) , _listen_port(listen_port) , _st(NULL) { - start(false); // true = dump, false = shutup + start(true); // true = dump, false = shutup } @@ -184,6 +185,18 @@ OSCClientReceiver::_clear_patch_cb(const char* path, const char* types, lo_arg** int +OSCClientReceiver::_put_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg) +{ + const char* obj_path = &argv[0]->s; + Resource::Properties prop; + for (int i = 1; i < argc-1; i += 2) + prop.insert(make_pair(&argv[i]->s, AtomLiblo::lo_arg_to_atom(types[i+1], argv[i+1]))); + _target->put(obj_path, prop); + return 0; +} + + +int OSCClientReceiver::_move_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg) { _target->move((const char*)&argv[0]->s, (const char*)&argv[1]->s); diff --git a/src/client/OSCEngineSender.cpp b/src/client/OSCEngineSender.cpp index 3bc872f7..775dd047 100644 --- a/src/client/OSCEngineSender.cpp +++ b/src/client/OSCEngineSender.cpp @@ -80,14 +80,13 @@ OSCEngineSender::attach(int32_t ping_id, bool block) /** Register with the engine via OSC. * - * Note that this does not actually use 'key', since the engine creates + * Note that this does not actually use 'client', since the engine creates * it's own key for OSC clients (namely the incoming URL), for NAT * traversal. It is a parameter to remain compatible with EngineInterface. */ void OSCEngineSender::register_client(Shared::ClientInterface* client) { - // FIXME: use parameters.. er, somehow. send("/ingen/register_client", "i", next_id(), LO_ARGS_END, LO_ARGS_END); } @@ -136,7 +135,15 @@ void OSCEngineSender::put(const Raul::URI& path, const Shared::Resource::Properties& properties) { - cerr << "OSC ENGINE PUT " << path << endl; + typedef Shared::Resource::Properties::const_iterator iterator; + lo_message m = lo_message_new(); + lo_message_add_int32(m, next_id()); + lo_message_add_string(m, path.c_str()); + for (iterator i = properties.begin(); i != properties.end(); ++i) { + lo_message_add_string(m, i->first.c_str()); + Raul::AtomLiblo::lo_message_add_atom(m, i->second); + } + send_message("/ingen/put", m); } diff --git a/src/engine/OSCClientSender.cpp b/src/engine/OSCClientSender.cpp index 5a941dc2..3d33c6ce 100644 --- a/src/engine/OSCClientSender.cpp +++ b/src/engine/OSCClientSender.cpp @@ -108,7 +108,14 @@ void OSCClientSender::put(const Raul::URI& path, const Shared::Resource::Properties& properties) { - cerr << "OSC CLIENT PUT " << path << endl; + typedef Shared::Resource::Properties::const_iterator iterator; + lo_message m = lo_message_new(); + lo_message_add_string(m, path.c_str()); + for (iterator i = properties.begin(); i != properties.end(); ++i) { + lo_message_add_string(m, i->first.c_str()); + Raul::AtomLiblo::lo_message_add_atom(m, i->second); + } + send_message("/ingen/put", m); } diff --git a/src/engine/OSCEngineReceiver.cpp b/src/engine/OSCEngineReceiver.cpp index 6cdc4ea2..c4ec402b 100644 --- a/src/engine/OSCEngineReceiver.cpp +++ b/src/engine/OSCEngineReceiver.cpp @@ -22,8 +22,8 @@ #include <string> #include <lo/lo.h> #include "ingen-config.h" -#include "raul/SharedPtr.hpp" #include "raul/AtomLiblo.hpp" +#include "raul/SharedPtr.hpp" #include "interface/ClientInterface.hpp" #include "ClientBroadcaster.hpp" #include "Engine.hpp" @@ -33,9 +33,12 @@ #include "ThreadManager.hpp" using namespace std; +using namespace Raul; namespace Ingen { +using namespace Shared; + /*! \page engine_osc_namespace Engine OSC Namespace Documentation * @@ -390,8 +393,11 @@ OSCEngineReceiver::_engine_deactivate_cb(const char* path, const char* types, lo int OSCEngineReceiver::_put_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg) { - //const char* path = &argv[1]->s; - + const char* obj_path = &argv[1]->s; + Resource::Properties prop; + for (int i = 2; i < argc-1; i += 2) + prop.insert(make_pair(&argv[i]->s, AtomLiblo::lo_arg_to_atom(types[i+1], argv[i+1]))); + put(obj_path, prop); return 0; } |