summaryrefslogtreecommitdiffstats
path: root/src/progs/ingenuity/ConnectWindow.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-01-14 23:39:25 +0000
committerDavid Robillard <d@drobilla.net>2007-01-14 23:39:25 +0000
commit8d20b981fa997d3a7f79fcb6f2120095949873a0 (patch)
tree722c8359ac6c11b7da341dac824d912c6e46bfd5 /src/progs/ingenuity/ConnectWindow.cpp
parenta8fafe5adeb6f1782b40d1766d4cb1cf9c3f89d9 (diff)
downloadingen-8d20b981fa997d3a7f79fcb6f2120095949873a0.tar.gz
ingen-8d20b981fa997d3a7f79fcb6f2120095949873a0.tar.bz2
ingen-8d20b981fa997d3a7f79fcb6f2120095949873a0.zip
Fixed launching of external ingen process from ingenuity.
git-svn-id: http://svn.drobilla.net/lad/ingen@259 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/progs/ingenuity/ConnectWindow.cpp')
-rw-r--r--src/progs/ingenuity/ConnectWindow.cpp39
1 files changed, 26 insertions, 13 deletions
diff --git a/src/progs/ingenuity/ConnectWindow.cpp b/src/progs/ingenuity/ConnectWindow.cpp
index f36fb1db..6c5a98ab 100644
--- a/src/progs/ingenuity/ConnectWindow.cpp
+++ b/src/progs/ingenuity/ConnectWindow.cpp
@@ -18,6 +18,9 @@
#include <time.h>
#include <sys/time.h>
#include <stdlib.h>
+#include <sys/time.h>
+#include <sys/resource.h>
+#include "raul/Process.h"
#include "config.h"
#include "ConnectWindow.h"
#include "interface/ClientKey.h"
@@ -141,7 +144,9 @@ ConnectWindow::connect()
_connect_button->set_sensitive(false);
if (_mode == CONNECT_REMOTE) {
- SharedPtr<ModelEngineInterface> engine(new OSCModelEngineInterface(_url_entry->get_text()));
+ SharedPtr<ModelEngineInterface> engine(
+ new OSCModelEngineInterface(_url_entry->get_text()));
+
OSCSigEmitter* ose = new OSCSigEmitter(1024, 16181); // FIXME: args
SharedPtr<SigClientInterface> client(ose);
App::instance().attach(engine, client);
@@ -153,22 +158,30 @@ ConnectWindow::connect()
sigc::mem_fun(ose, &ThreadedSigClientInterface::emit_signals), 2, G_PRIORITY_HIGH_IDLE);
} else if (_mode == LAUNCH_REMOTE) {
- /*
+
int port = _port_spinbutton->get_value_as_int();
char port_str[6];
snprintf(port_str, 6, "%u", port);
- const string port_arg = string("--port=").append(port_str);
- App::instance().engine()->set_engine_url(
- string("osc.udp://localhost:").append(port_str));
-
- if (fork() == 0) { // child
- cerr << "Executing 'ingen " << port_arg << "' ..." << endl;
- execlp("ingen", port_arg.c_str(), (char*)NULL);
- } else {
- Glib::signal_timeout().connect(
+ const string cmd = string("ingen --port=").append(port_str);
+
+ if (Process::launch(cmd)) {
+ SharedPtr<ModelEngineInterface> engine(
+ new OSCModelEngineInterface(string("osc.udp://localhost:").append(port_str)));
+
+ OSCSigEmitter* ose = new OSCSigEmitter(1024, 16181); // FIXME: args
+ SharedPtr<SigClientInterface> client(ose);
+ App::instance().attach(engine, client);
+
+ Glib::signal_timeout().connect(
sigc::mem_fun(this, &ConnectWindow::gtk_callback), 100);
- }*/
- throw;
+
+ Glib::signal_timeout().connect(
+ sigc::mem_fun(ose, &ThreadedSigClientInterface::emit_signals),
+ 2, G_PRIORITY_HIGH_IDLE);
+ } else {
+ cerr << "Failed to launch ingen process." << endl;
+ }
+
#ifdef MONOLITHIC_INGENUITY
} else if (_mode == INTERNAL) {
SharedPtr<Ingen::Engine> engine(new Ingen::Engine());