From 694b31089c8060fc6b908b146b12c0e340d004c7 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 17 Aug 2008 01:34:53 +0000 Subject: Cloooser... Bundling of OSC communication both ways (previous was just engine->client). Factor out common OSC*Sender functionality (bundling stuff). Fully type-safe and polyphony-aware port value setting/getting, from RDF through OSC through engine and back again. git-svn-id: http://svn.drobilla.net/lad/ingen@1409 a436a847-0d15-0410-975c-d299462d15a1 --- src/libs/engine/OSCClientSender.hpp | 57 +++++++++++++++---------------------- 1 file changed, 23 insertions(+), 34 deletions(-) (limited to 'src/libs/engine/OSCClientSender.hpp') diff --git a/src/libs/engine/OSCClientSender.hpp b/src/libs/engine/OSCClientSender.hpp index cc700e38..662ba75b 100644 --- a/src/libs/engine/OSCClientSender.hpp +++ b/src/libs/engine/OSCClientSender.hpp @@ -21,15 +21,11 @@ #include #include #include -#include #include #include #include "types.hpp" #include "interface/ClientInterface.hpp" - -using std::list; -using std::string; -using std::cerr; +#include "shared/OSCSender.hpp" namespace Ingen { @@ -40,35 +36,33 @@ namespace Shared { class EngineInterface; } * * \ingroup engine */ -class OSCClientSender : public Shared::ClientInterface +class OSCClientSender : public Shared::ClientInterface, public Shared::OSCSender { public: OSCClientSender(const std::string& url) - : Shared::ClientInterface(url) - , _address(lo_address_new_from_url(url.c_str())) - , _transfer(NULL) - , _enabled(true) - {} + : _url(url) + { + _address = lo_address_new_from_url(url.c_str()); + } virtual ~OSCClientSender() { lo_address_free(_address); } - - lo_address address() const { return _address; } + + void enable() { _enabled = true; } + void disable() { _enabled = false; } + + void bundle_begin() { OSCSender::bundle_begin(); } + void bundle_end() { OSCSender::bundle_end(); } + void transfer_begin() { OSCSender::transfer_begin(); } + void transfer_end() { OSCSender::transfer_end(); } + + std::string uri() const { return lo_address_get_url(_address); } void subscribe(Shared::EngineInterface* engine) { } /* *** ClientInterface Implementation Below *** */ //void client_registration(const std::string& url, int client_id); - - void enable() { _enabled = true; } - void disable() { _enabled = false; } - - void bundle_begin(); - void bundle_end(); - - void transfer_begin(); - void transfer_end(); void response_ok(int32_t id); void response_error(int32_t id, const std::string& msg); @@ -120,8 +114,12 @@ public: const std::string& predicate, const Raul::Atom& value); - virtual void control_change(const std::string& port_path, - float value); + virtual void set_port_value(const std::string& port_path, + const Raul::Atom& value); + + virtual void set_voice_value(const std::string& port_path, + uint32_t voice, + const Raul::Atom& value); virtual void port_activity(const std::string& port_path); @@ -135,16 +133,7 @@ public: uint32_t program); private: - int send(const char *path, const char *types, ...); - void send_message(const char* path, lo_message m); - - enum SendState { Immediate, SendingBundle, SendingTransfer }; - - string _url; - lo_address _address; - SendState _send_state; - lo_bundle _transfer; - bool _enabled; + std::string _url; }; -- cgit v1.2.1