summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/AlsaDriver.cpp2
-rw-r--r--src/JackDriver.cpp10
-rw-r--r--src/LashDriver.cpp1
-rw-r--r--src/Patchage.cpp15
4 files changed, 16 insertions, 12 deletions
diff --git a/src/AlsaDriver.cpp b/src/AlsaDriver.cpp
index f868af9..eb93dac 100644
--- a/src/AlsaDriver.cpp
+++ b/src/AlsaDriver.cpp
@@ -73,7 +73,7 @@ AlsaDriver::attach(bool /*launch_daemon*/)
void
AlsaDriver::detach()
{
- if (m_seq != NULL) {
+ if (m_seq) {
pthread_cancel(m_refresh_thread);
pthread_join(m_refresh_thread, NULL);
snd_seq_close(m_seq);
diff --git a/src/JackDriver.cpp b/src/JackDriver.cpp
index 8bfea6f..eef6b2f 100644
--- a/src/JackDriver.cpp
+++ b/src/JackDriver.cpp
@@ -75,12 +75,12 @@ JackDriver::attach(bool launch_daemon)
void
JackDriver::detach()
{
- if (m_client != NULL) {
+ if (m_client) {
jack_deactivate(m_client);
jack_client_close(m_client);
m_client = NULL;
- signal_detached.emit();
destroy_all_ports();
+ signal_detached.emit();
m_app->status_message("[JACK] Detached");
}
}
@@ -97,12 +97,12 @@ JackDriver::destroy_all_ports()
for (PortVector::iterator p = ports.begin(); p != ports.end(); ++p) {
boost::shared_ptr<PatchagePort> port = boost::dynamic_pointer_cast<PatchagePort>(*p);
if (port && port->type() == JACK_AUDIO || port->type() == JACK_MIDI) {
- port.reset();
+ m->second->remove_port(port);
}
}
if (m->second->ports().empty())
- m->second.reset();
+ m_app->canvas()->remove_module(m->second->name());
}
}
@@ -144,8 +144,8 @@ JackDriver::refresh()
if (m_client == NULL) {
// Shutdown
if (m_is_dirty) {
- signal_detached.emit();
destroy_all_ports();
+ signal_detached.emit();
}
m_is_dirty = false;
m_mutex.unlock();
diff --git a/src/LashDriver.cpp b/src/LashDriver.cpp
index 7989aa9..7347842 100644
--- a/src/LashDriver.cpp
+++ b/src/LashDriver.cpp
@@ -67,7 +67,6 @@ LashDriver::attach(bool launch_daemon)
void
LashDriver::detach()
{
- // FIXME: send some notification that we're gone??
m_client = NULL;
m_app->status_message("[LASH] Detached");
signal_detached.emit();
diff --git a/src/Patchage.cpp b/src/Patchage.cpp
index ace5e24..bf7ad88 100644
--- a/src/Patchage.cpp
+++ b/src/Patchage.cpp
@@ -28,6 +28,8 @@
#include "LashDriver.h"
#endif
+// FIXME: include to avoid undefined reference to boost SP debug hooks stuff
+#include <raul/SharedPtr.h>
Patchage::Patchage(int argc, char** argv)
:
@@ -47,6 +49,8 @@ Patchage::Patchage(int argc, char** argv)
m_state_manager = new StateManager();
m_canvas = boost::shared_ptr<PatchageFlowCanvas>(new PatchageFlowCanvas(this, 1600*2, 1200*2));
m_jack_driver = new JackDriver(this);
+ m_jack_driver->signal_detached.connect(sigc::mem_fun(this, &Patchage::queue_refresh));
+
#ifdef HAVE_ALSA
m_alsa_driver = new AlsaDriver(this);
#endif
@@ -108,6 +112,7 @@ Patchage::Patchage(int argc, char** argv)
xml->get_widget("zoom_normal_but", m_zoom_normal_button);
update_state();
+ m_main_paned->set_position(m_main_paned->get_height() - 20);
m_canvas_scrolledwindow->add(*m_canvas);
//m_canvas_scrolledwindow->signal_event().connect(sigc::mem_fun(m_canvas, &FlowCanvas::scroll_event_handler));
@@ -142,7 +147,6 @@ Patchage::Patchage(int argc, char** argv)
m_menu_help_about->signal_activate().connect( sigc::mem_fun(this, &Patchage::menu_help_about));
attach_menu_items();
- m_main_paned->set_position(m_main_paned->get_height() - 20);
m_canvas->show();
}
@@ -231,15 +235,16 @@ Patchage::update_state()
for (ModuleMap::iterator i = m_canvas->modules().begin(); i != m_canvas->modules().end(); ++i)
(*i).second->load_location();
- cerr << "[Patchage] Resizing window: (" << m_state_manager->get_window_size().x
- << "," << m_state_manager->get_window_size().y << ")" << endl;
+ //cerr << "[Patchage] Resizing window: (" << m_state_manager->get_window_size().x
+ // << "," << m_state_manager->get_window_size().y << ")" << endl;
m_main_window->resize(
static_cast<int>(m_state_manager->get_window_size().x),
static_cast<int>(m_state_manager->get_window_size().y));
- cerr << "[Patchage] Moving window: (" << m_state_manager->get_window_location().x
- << "," << m_state_manager->get_window_location().y << ")" << endl;
+ //cerr << "[Patchage] Moving window: (" << m_state_manager->get_window_location().x
+ // << "," << m_state_manager->get_window_location().y << ")" << endl;
+
m_main_window->move(
static_cast<int>(m_state_manager->get_window_location().x),
static_cast<int>(m_state_manager->get_window_location().y));