diff options
author | David Robillard <d@drobilla.net> | 2011-10-22 00:21:43 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2011-10-22 00:21:43 +0000 |
commit | 14ab4dcff7f8461dfed27b6352249b683c1f4bae (patch) | |
tree | f263ecca5c5c2a220bd00c69bba11a03ad266dc5 /src | |
parent | 91bd13d3767452ba0575d69447f23eed1c508603 (diff) | |
download | ingen-14ab4dcff7f8461dfed27b6352249b683c1f4bae.tar.gz ingen-14ab4dcff7f8461dfed27b6352249b683c1f4bae.tar.bz2 ingen-14ab4dcff7f8461dfed27b6352249b683c1f4bae.zip |
Move *all* OSC and HTTP stuff to their respective modules.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@3578 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r-- | src/client/ingen_client.cpp | 50 | ||||
-rw-r--r-- | src/client/wscript | 15 | ||||
-rw-r--r-- | src/http/HTTPClientReceiver.cpp (renamed from src/client/HTTPClientReceiver.cpp) | 0 | ||||
-rw-r--r-- | src/http/HTTPClientReceiver.hpp (renamed from src/client/HTTPClientReceiver.hpp) | 0 | ||||
-rw-r--r-- | src/http/HTTPClientSender.hpp | 3 | ||||
-rw-r--r-- | src/http/HTTPEngineSender.cpp (renamed from src/client/HTTPEngineSender.cpp) | 0 | ||||
-rw-r--r-- | src/http/HTTPEngineSender.hpp (renamed from src/client/HTTPEngineSender.hpp) | 0 | ||||
-rw-r--r-- | src/http/HTTPSender.cpp (renamed from src/shared/HTTPSender.cpp) | 0 | ||||
-rw-r--r-- | src/http/HTTPSender.hpp (renamed from src/shared/HTTPSender.hpp) | 0 | ||||
-rw-r--r-- | src/http/ingen_http_server.cpp (renamed from src/http/ingen_http.cpp) | 0 | ||||
-rw-r--r-- | src/ingen/main.cpp | 17 | ||||
-rw-r--r-- | src/osc/OSCClientReceiver.cpp (renamed from src/client/OSCClientReceiver.cpp) | 0 | ||||
-rw-r--r-- | src/osc/OSCClientReceiver.hpp (renamed from src/client/OSCClientReceiver.hpp) | 46 | ||||
-rw-r--r-- | src/osc/OSCClientSender.hpp | 3 | ||||
-rw-r--r-- | src/osc/OSCEngineReceiver.hpp | 56 | ||||
-rw-r--r-- | src/osc/OSCEngineSender.cpp (renamed from src/client/OSCEngineSender.cpp) | 0 | ||||
-rw-r--r-- | src/osc/OSCEngineSender.hpp (renamed from src/client/OSCEngineSender.hpp) | 3 | ||||
-rw-r--r-- | src/osc/OSCSender.cpp (renamed from src/shared/OSCSender.cpp) | 0 | ||||
-rw-r--r-- | src/osc/OSCSender.hpp (renamed from src/shared/OSCSender.hpp) | 0 | ||||
-rw-r--r-- | src/osc/ingen_osc_server.cpp (renamed from src/osc/ingen_osc.cpp) | 4 | ||||
-rw-r--r-- | src/shared/World.cpp | 5 | ||||
-rw-r--r-- | src/shared/wscript | 9 |
22 files changed, 73 insertions, 138 deletions
diff --git a/src/client/ingen_client.cpp b/src/client/ingen_client.cpp index 03056f65..2e3e2c74 100644 --- a/src/client/ingen_client.cpp +++ b/src/client/ingen_client.cpp @@ -15,60 +15,16 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "ingen-config.h" -#include "raul/SharedPtr.hpp" #include "ingen/shared/Module.hpp" #include "ingen/shared/World.hpp" -#ifdef HAVE_LIBLO -#include "OSCClientReceiver.hpp" -#include "OSCEngineSender.hpp" -#endif -#ifdef HAVE_SOUP -#include "HTTPClientReceiver.hpp" -#include "HTTPEngineSender.hpp" -#endif - -using namespace Ingen; +#include "raul/SharedPtr.hpp" -#ifdef HAVE_LIBLO -SharedPtr<Ingen::ServerInterface> -new_osc_interface(Ingen::Shared::World* world, - const std::string& url, - SharedPtr<ClientInterface> respond_to) -{ - SharedPtr<Client::OSCClientReceiver> receiver( - new Client::OSCClientReceiver(16181, respond_to)); - Client::OSCEngineSender* oes = new Client::OSCEngineSender( - url, world->conf()->option("packet-size").get_int32(), receiver); - oes->attach(rand(), true); - return SharedPtr<ServerInterface>(oes); -} -#endif +#include "ingen-config.h" -#ifdef HAVE_SOUP -SharedPtr<Ingen::ServerInterface> -new_http_interface(Ingen::Shared::World* world, - const std::string& url, - SharedPtr<ClientInterface> respond_to) -{ - SharedPtr<Client::HTTPClientReceiver> receiver( - new Client::HTTPClientReceiver(world, url, respond_to)); - Client::HTTPEngineSender* hes = new Client::HTTPEngineSender( - world, url, receiver); - hes->attach(rand(), true); - return SharedPtr<ServerInterface>(hes); -} -#endif +using namespace Ingen; struct IngenClientModule : public Ingen::Shared::Module { void load(Ingen::Shared::World* world) { -#ifdef HAVE_LIBLO - world->add_interface_factory("osc.udp", &new_osc_interface); - world->add_interface_factory("osc.tcp", &new_osc_interface); -#endif -#ifdef HAVE_SOUP - world->add_interface_factory("http", &new_http_interface); -#endif } }; diff --git a/src/client/wscript b/src/client/wscript index 9047859a..29ac636d 100644 --- a/src/client/wscript +++ b/src/client/wscript @@ -9,7 +9,7 @@ def build(bld): target = 'ingen_client', install_path = '${LIBDIR}', use = 'libingen_shared') - autowaf.use_lib(bld, obj, 'GLIBMM LV2CORE LILV SUIL RAUL SORD SOUP SIGCPP LIBLO SOUP') + autowaf.use_lib(bld, obj, 'GLIBMM LV2CORE LILV SUIL RAUL SORD SIGCPP') obj.source = ''' ClientStore.cpp @@ -22,16 +22,3 @@ def build(bld): ThreadedSigClientInterface.cpp ingen_client.cpp ''' - - if bld.is_defined('HAVE_SOUP'): - obj.source += ''' - HTTPClientReceiver.cpp - HTTPEngineSender.cpp - ''' - - if bld.is_defined('HAVE_LIBLO'): - obj.source += ''' - OSCClientReceiver.cpp - OSCEngineSender.cpp - ''' - diff --git a/src/client/HTTPClientReceiver.cpp b/src/http/HTTPClientReceiver.cpp index 0ec5aaa4..0ec5aaa4 100644 --- a/src/client/HTTPClientReceiver.cpp +++ b/src/http/HTTPClientReceiver.cpp diff --git a/src/client/HTTPClientReceiver.hpp b/src/http/HTTPClientReceiver.hpp index d7165c81..d7165c81 100644 --- a/src/client/HTTPClientReceiver.hpp +++ b/src/http/HTTPClientReceiver.hpp diff --git a/src/http/HTTPClientSender.hpp b/src/http/HTTPClientSender.hpp index 116f0601..761a60a6 100644 --- a/src/http/HTTPClientSender.hpp +++ b/src/http/HTTPClientSender.hpp @@ -24,7 +24,8 @@ #include "raul/Thread.hpp" #include "ingen/ClientInterface.hpp" -#include "../shared/HTTPSender.hpp" + +#include "HTTPSender.hpp" namespace Ingen { diff --git a/src/client/HTTPEngineSender.cpp b/src/http/HTTPEngineSender.cpp index 43a3d44c..43a3d44c 100644 --- a/src/client/HTTPEngineSender.cpp +++ b/src/http/HTTPEngineSender.cpp diff --git a/src/client/HTTPEngineSender.hpp b/src/http/HTTPEngineSender.hpp index 14439e39..14439e39 100644 --- a/src/client/HTTPEngineSender.hpp +++ b/src/http/HTTPEngineSender.hpp diff --git a/src/shared/HTTPSender.cpp b/src/http/HTTPSender.cpp index 1a4d35da..1a4d35da 100644 --- a/src/shared/HTTPSender.cpp +++ b/src/http/HTTPSender.cpp diff --git a/src/shared/HTTPSender.hpp b/src/http/HTTPSender.hpp index a1a3ea2a..a1a3ea2a 100644 --- a/src/shared/HTTPSender.hpp +++ b/src/http/HTTPSender.hpp diff --git a/src/http/ingen_http.cpp b/src/http/ingen_http_server.cpp index 0a08f59b..0a08f59b 100644 --- a/src/http/ingen_http.cpp +++ b/src/http/ingen_http_server.cpp diff --git a/src/ingen/main.cpp b/src/ingen/main.cpp index cb76f778..62c2b757 100644 --- a/src/ingen/main.cpp +++ b/src/ingen/main.cpp @@ -134,12 +134,12 @@ main(int argc, char** argv) // Not loading a GUI, load network engine interfaces if (!conf.option("gui").get_bool()) { #ifdef HAVE_LIBLO - ingen_try(world->load_module("osc"), - "Unable to load OSC module"); + ingen_try(world->load_module("osc_server"), + "Unable to load OSC server module"); #endif #ifdef HAVE_SOUP - ingen_try(world->load_module("http"), - "Unable to load HTTP module"); + ingen_try(world->load_module("http_server"), + "Unable to load HTTP server module"); #endif } } @@ -148,6 +148,15 @@ main(int argc, char** argv) if (!engine_interface) { ingen_try(world->load_module("client"), "Unable to load client module"); + #ifdef HAVE_LIBLO + ingen_try(world->load_module("osc_client"), + "Unable to load OSC client module"); + #endif + #ifdef HAVE_SOUP + ingen_try(world->load_module("http_client"), + "Unable to load HTTP client module"); + #endif + const char* const uri = conf.option("connect").get_string(); ingen_try((engine_interface = world->interface(uri, SharedPtr<ClientInterface>())), (string("Unable to create interface to `") + uri + "'").c_str()); diff --git a/src/client/OSCClientReceiver.cpp b/src/osc/OSCClientReceiver.cpp index 4fef1d1c..4fef1d1c 100644 --- a/src/client/OSCClientReceiver.cpp +++ b/src/osc/OSCClientReceiver.cpp diff --git a/src/client/OSCClientReceiver.hpp b/src/osc/OSCClientReceiver.hpp index 3b7f5db0..46afc81a 100644 --- a/src/client/OSCClientReceiver.hpp +++ b/src/osc/OSCClientReceiver.hpp @@ -27,19 +27,11 @@ #include "raul/Deletable.hpp" #include "raul/SharedPtr.hpp" +#include "macros.h" + namespace Ingen { namespace Client { -/** Arguments to a liblo handler */ -#define LO_HANDLER_ARGS const char* path, const char* types, lo_arg** argv, int argc, lo_message msg - -/** Define a static handler to be passed to lo_add_method, which is a trivial - * wrapper around a non-static method that does the real work. */ -#define LO_HANDLER(name) \ -int _##name##_cb (LO_HANDLER_ARGS);\ -inline static int name##_cb(LO_HANDLER_ARGS, void* osc_listener)\ -{ return ((OSCClientReceiver*)osc_listener)->_##name##_cb(path, types, argv, argc, msg); } - /** Client-side receiver for OSC messages from the engine. * * \ingroup IngenClient @@ -73,23 +65,23 @@ private: Resource::Properties _delta_add; int _listen_port; - LO_HANDLER(error); - LO_HANDLER(response_ok); - LO_HANDLER(response_error); - LO_HANDLER(plugin); - LO_HANDLER(plugin_list_end); - LO_HANDLER(new_patch); - LO_HANDLER(del); - LO_HANDLER(move); - LO_HANDLER(connection); - LO_HANDLER(disconnection); - LO_HANDLER(put); - LO_HANDLER(delta_begin); - LO_HANDLER(delta_remove); - LO_HANDLER(delta_add); - LO_HANDLER(delta_end); - LO_HANDLER(set_property); - LO_HANDLER(activity); + LO_HANDLER(OSCClientReceiver, error); + LO_HANDLER(OSCClientReceiver, response_ok); + LO_HANDLER(OSCClientReceiver, response_error); + LO_HANDLER(OSCClientReceiver, plugin); + LO_HANDLER(OSCClientReceiver, plugin_list_end); + LO_HANDLER(OSCClientReceiver, new_patch); + LO_HANDLER(OSCClientReceiver, del); + LO_HANDLER(OSCClientReceiver, move); + LO_HANDLER(OSCClientReceiver, connection); + LO_HANDLER(OSCClientReceiver, disconnection); + LO_HANDLER(OSCClientReceiver, put); + LO_HANDLER(OSCClientReceiver, delta_begin); + LO_HANDLER(OSCClientReceiver, delta_remove); + LO_HANDLER(OSCClientReceiver, delta_add); + LO_HANDLER(OSCClientReceiver, delta_end); + LO_HANDLER(OSCClientReceiver, set_property); + LO_HANDLER(OSCClientReceiver, activity); }; } // namespace Client diff --git a/src/osc/OSCClientSender.hpp b/src/osc/OSCClientSender.hpp index ffc3b202..c391e54a 100644 --- a/src/osc/OSCClientSender.hpp +++ b/src/osc/OSCClientSender.hpp @@ -25,7 +25,8 @@ #include "ingen/ClientInterface.hpp" #include "ingen/GraphObject.hpp" -#include "../shared/OSCSender.hpp" + +#include "OSCSender.hpp" namespace Ingen { diff --git a/src/osc/OSCEngineReceiver.hpp b/src/osc/OSCEngineReceiver.hpp index fe16ac1a..72388bc2 100644 --- a/src/osc/OSCEngineReceiver.hpp +++ b/src/osc/OSCEngineReceiver.hpp @@ -28,6 +28,7 @@ #include "ingen/Resource.hpp" #include "ingen-config.h" +#include "macros.h" namespace Ingen { @@ -37,17 +38,6 @@ namespace Server { class Engine; -/* Some boilerplate killing macros... */ -#define LO_HANDLER_ARGS const char* path, const char* types, lo_arg** argv, int argc, lo_message msg - -/* Defines a static handler to be passed to lo_add_method, which is a trivial - * wrapper around a non-static method that does the real work. Makes a whoole - * lot of ugly boiler plate go away */ -#define LO_HANDLER(name) \ -int _##name##_cb (LO_HANDLER_ARGS);\ -inline static int name##_cb(LO_HANDLER_ARGS, void* myself)\ -{ return ((OSCEngineReceiver*)myself)->_##name##_cb(path, types, argv, argc, msg); } - /* FIXME: Make this receive and preprocess in the same thread? */ /** Receive OSC messages and call interface functions. @@ -96,28 +86,28 @@ private: static int generic_cb(LO_HANDLER_ARGS, void* myself); static int unknown_cb(LO_HANDLER_ARGS, void* myself); - LO_HANDLER(quit); - LO_HANDLER(ping); - LO_HANDLER(ping_slow); - LO_HANDLER(register_client); - LO_HANDLER(unregister_client); - LO_HANDLER(get); - LO_HANDLER(put); - LO_HANDLER(delta_begin); - LO_HANDLER(delta_remove); - LO_HANDLER(delta_add); - LO_HANDLER(delta_end); - LO_HANDLER(move); - LO_HANDLER(del); - LO_HANDLER(connect); - LO_HANDLER(disconnect); - LO_HANDLER(disconnect_all); - LO_HANDLER(note_on); - LO_HANDLER(note_off); - LO_HANDLER(all_notes_off); - LO_HANDLER(learn); - LO_HANDLER(set_property); - LO_HANDLER(property_set); + LO_HANDLER(OSCEngineReceiver, quit); + LO_HANDLER(OSCEngineReceiver, ping); + LO_HANDLER(OSCEngineReceiver, ping_slow); + LO_HANDLER(OSCEngineReceiver, register_client); + LO_HANDLER(OSCEngineReceiver, unregister_client); + LO_HANDLER(OSCEngineReceiver, get); + LO_HANDLER(OSCEngineReceiver, put); + LO_HANDLER(OSCEngineReceiver, delta_begin); + LO_HANDLER(OSCEngineReceiver, delta_remove); + LO_HANDLER(OSCEngineReceiver, delta_add); + LO_HANDLER(OSCEngineReceiver, delta_end); + LO_HANDLER(OSCEngineReceiver, move); + LO_HANDLER(OSCEngineReceiver, del); + LO_HANDLER(OSCEngineReceiver, connect); + LO_HANDLER(OSCEngineReceiver, disconnect); + LO_HANDLER(OSCEngineReceiver, disconnect_all); + LO_HANDLER(OSCEngineReceiver, note_on); + LO_HANDLER(OSCEngineReceiver, note_off); + LO_HANDLER(OSCEngineReceiver, all_notes_off); + LO_HANDLER(OSCEngineReceiver, learn); + LO_HANDLER(OSCEngineReceiver, set_property); + LO_HANDLER(OSCEngineReceiver, property_set); Engine& _engine; SharedPtr<ServerInterface> _interface; diff --git a/src/client/OSCEngineSender.cpp b/src/osc/OSCEngineSender.cpp index e2436af7..e2436af7 100644 --- a/src/client/OSCEngineSender.cpp +++ b/src/osc/OSCEngineSender.cpp diff --git a/src/client/OSCEngineSender.hpp b/src/osc/OSCEngineSender.hpp index 75569ec0..5aeeed7b 100644 --- a/src/client/OSCEngineSender.hpp +++ b/src/osc/OSCEngineSender.hpp @@ -27,7 +27,8 @@ #include "raul/Deletable.hpp" #include "ingen/ServerInterface.hpp" -#include "../shared/OSCSender.hpp" + +#include "OSCSender.hpp" namespace Ingen { diff --git a/src/shared/OSCSender.cpp b/src/osc/OSCSender.cpp index 6c07551b..6c07551b 100644 --- a/src/shared/OSCSender.cpp +++ b/src/osc/OSCSender.cpp diff --git a/src/shared/OSCSender.hpp b/src/osc/OSCSender.hpp index b2febb70..b2febb70 100644 --- a/src/shared/OSCSender.hpp +++ b/src/osc/OSCSender.hpp diff --git a/src/osc/ingen_osc.cpp b/src/osc/ingen_osc_server.cpp index 4a8946c0..fd4455f0 100644 --- a/src/osc/ingen_osc.cpp +++ b/src/osc/ingen_osc_server.cpp @@ -26,7 +26,7 @@ using namespace std; using namespace Ingen; -struct IngenOSCModule : public Ingen::Shared::Module { +struct IngenOSCServerModule : public Ingen::Shared::Module { void load(Ingen::Shared::World* world) { Server::Engine* engine = (Server::Engine*)world->local_engine().get(); SharedPtr<Server::ServerInterfaceImpl> interface( @@ -47,7 +47,7 @@ extern "C" { Ingen::Shared::Module* ingen_module_load() { - return new IngenOSCModule(); + return new IngenOSCServerModule(); } } // extern "C" diff --git a/src/shared/World.cpp b/src/shared/World.cpp index 9aa17d4f..aae321fe 100644 --- a/src/shared/World.cpp +++ b/src/shared/World.cpp @@ -219,6 +219,11 @@ SharedPtr<LV2URIMap> World::lv2_uri_map() { return _impl->lv2_uri_map; } bool World::load_module(const char* name) { + Pimpl::Modules::iterator i = _impl->modules.find(name); + if (i != _impl->modules.end()) { + LOG(info) << "Module `" << name << "' already loaded" << endl; + return true; + } SharedPtr<Glib::Module> lib = ingen_load_module(name); Ingen::Shared::Module* (*module_load)() = NULL; if (lib && lib->get_symbol("ingen_module_load", (void*&)module_load)) { diff --git a/src/shared/wscript b/src/shared/wscript index 601f3286..410325a4 100644 --- a/src/shared/wscript +++ b/src/shared/wscript @@ -10,7 +10,7 @@ def build(bld): vnum = '0.0.0', install_path = '${LIBDIR}', linkflags = '-ldl') - autowaf.use_lib(bld, obj, 'GLIBMM LV2CORE LILV RAUL SORD LIBLO') + autowaf.use_lib(bld, obj, 'GLIBMM LV2CORE LILV RAUL SORD') obj.source = ''' Builder.cpp @@ -26,10 +26,3 @@ def build(bld): World.cpp runtime_paths.cpp ''' - - if bld.is_defined('HAVE_LIBLO'): - obj.source += ' OSCSender.cpp ' - - if bld.is_defined('HAVE_SOUP'): - autowaf.use_lib(bld, obj, 'SOUP') - obj.source += ' HTTPSender.cpp ' |