diff options
author | David Robillard <d@drobilla.net> | 2018-01-21 00:41:34 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2018-01-21 01:05:26 +0100 |
commit | ee32624cd2b473e299e822ed10b58ca408698e4b (patch) | |
tree | f922c16385018df140c34a4280315357ed9f06b8 /src/ingen | |
parent | d356d1854a01a09bda32185647a8bd01b09df3d3 (diff) | |
download | ingen-ee32624cd2b473e299e822ed10b58ca408698e4b.tar.gz ingen-ee32624cd2b473e299e822ed10b58ca408698e4b.tar.bz2 ingen-ee32624cd2b473e299e822ed10b58ca408698e4b.zip |
Remove glib dependency from engine and core library
Diffstat (limited to 'src/ingen')
-rw-r--r-- | src/ingen/ingen.cpp | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/src/ingen/ingen.cpp b/src/ingen/ingen.cpp index dfad1bb1..d812d862 100644 --- a/src/ingen/ingen.cpp +++ b/src/ingen/ingen.cpp @@ -22,8 +22,6 @@ #include <memory> #include <string> -#include <glibmm/thread.h> - #include "raul/Path.hpp" #include "ingen_config.h" @@ -34,7 +32,6 @@ #include "ingen/Log.hpp" #include "ingen/Parser.hpp" #include "ingen/World.hpp" -#include "ingen/client/ThreadedSigClientInterface.hpp" #include "ingen/paths.hpp" #include "ingen/runtime_paths.hpp" #include "ingen/types.hpp" @@ -45,6 +42,12 @@ using namespace std; using namespace Ingen; +class DummyInterface : public Interface +{ + URI uri() const override { return URI("ingen:dummy"); } + void message(const Message& msg) override {} +}; + unique_ptr<Ingen::World> world; static void @@ -111,7 +114,6 @@ main(int argc, char** argv) } // Run engine - SPtr<Interface> engine_interface; if (conf.option("engine").get<int32_t>()) { if (world->conf().option("threads").get<int32_t>() < 1) { cerr << "ingen: error: threads must be > 0" << endl; @@ -122,33 +124,33 @@ main(int argc, char** argv) ingen_try(bool(world->engine()), "Unable to create engine"); world->engine()->listen(); - - engine_interface = world->interface(); } - // If we don't have a local engine interface (for GUI), use network - if (!engine_interface) { - ingen_try(world->load_module("client"), "Failed to load client module"); #ifdef HAVE_SOCKET - Client::SocketClient::register_factories(world.get()); + Client::SocketClient::register_factories(world.get()); #endif + + // Load GUI if requested + if (conf.option("gui").get<int32_t>()) { + ingen_try(world->load_module("client"), "Failed to load client module"); + ingen_try(world->load_module("gui"), "Failed to load GUI module"); + } + + // If we don't have a local engine interface (from the GUI), use network + SPtr<Interface> engine_interface(world->interface()); + SPtr<Interface> dummy_client(new DummyInterface()); + if (!engine_interface) { const char* const uri = conf.option("connect").ptr<char>(); ingen_try(URI::is_valid(uri), (fmt("Invalid URI <%1%>") % uri).str().c_str()); - SPtr<Interface> client(new Client::ThreadedSigClientInterface()); - engine_interface = world->new_interface(URI(uri), client); + engine_interface = world->new_interface(URI(uri), dummy_client); if (!engine_interface && !conf.option("gui").get<int32_t>()) { cerr << (fmt("ingen: error: Failed to connect to `%1%'\n") % uri); return EXIT_FAILURE; } - } - world->set_interface(engine_interface); - - // Load GUI if requested - if (conf.option("gui").get<int32_t>()) { - ingen_try(world->load_module("gui"), "Failed to load GUI module"); + world->set_interface(engine_interface); } // Activate the engine, if we have one |