From 8d20b981fa997d3a7f79fcb6f2120095949873a0 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 14 Jan 2007 23:39:25 +0000 Subject: Fixed launching of external ingen process from ingenuity. git-svn-id: http://svn.drobilla.net/lad/ingen@259 a436a847-0d15-0410-975c-d299462d15a1 --- src/progs/ingenuity/ConnectWindow.cpp | 39 +++++++++++++++++++++++------------ src/progs/ingenuity/PatchCanvas.cpp | 8 ++++++- 2 files changed, 33 insertions(+), 14 deletions(-) (limited to 'src') 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 #include #include +#include +#include +#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 engine(new OSCModelEngineInterface(_url_entry->get_text())); + SharedPtr engine( + new OSCModelEngineInterface(_url_entry->get_text())); + OSCSigEmitter* ose = new OSCSigEmitter(1024, 16181); // FIXME: args SharedPtr 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 engine( + new OSCModelEngineInterface(string("osc.udp://localhost:").append(port_str))); + + OSCSigEmitter* ose = new OSCSigEmitter(1024, 16181); // FIXME: args + SharedPtr 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 engine(new Ingen::Engine()); diff --git a/src/progs/ingenuity/PatchCanvas.cpp b/src/progs/ingenuity/PatchCanvas.cpp index d305e9c3..056d25a6 100644 --- a/src/progs/ingenuity/PatchCanvas.cpp +++ b/src/progs/ingenuity/PatchCanvas.cpp @@ -314,7 +314,13 @@ PatchCanvas::destroy_selection() { for (list >::iterator m = m_selected_modules.begin(); m != m_selected_modules.end(); ++m) { boost::shared_ptr module = boost::dynamic_pointer_cast(*m); - App::instance().engine()->destroy(module->node()->path()); + if (module) { + App::instance().engine()->destroy(module->node()->path()); + } else { + boost::shared_ptr port_module = boost::dynamic_pointer_cast(*m); + if (port_module) + App::instance().engine()->destroy(port_module->port()->path()); + } } } -- cgit v1.2.1