summaryrefslogtreecommitdiffstats
path: root/src/progs
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
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')
-rw-r--r--src/progs/ingenuity/ConnectWindow.cpp39
-rw-r--r--src/progs/ingenuity/PatchCanvas.cpp8
2 files changed, 33 insertions, 14 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());
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<boost::shared_ptr<Module> >::iterator m = m_selected_modules.begin(); m != m_selected_modules.end(); ++m) {
boost::shared_ptr<NodeModule> module = boost::dynamic_pointer_cast<NodeModule>(*m);
- App::instance().engine()->destroy(module->node()->path());
+ if (module) {
+ App::instance().engine()->destroy(module->node()->path());
+ } else {
+ boost::shared_ptr<PatchPortModule> port_module = boost::dynamic_pointer_cast<PatchPortModule>(*m);
+ if (port_module)
+ App::instance().engine()->destroy(port_module->port()->path());
+ }
}
}