Fixed Patchage dynamic reconnection.

git-svn-id: http://svn.drobilla.net/lad/patchage@166 a436a847-0d15-0410-975c-d299462d15a1
This commit is contained in:
dave 2006-10-14 05:51:23 +00:00
parent fc7faf0da3
commit 4c03e66ffd
5 changed files with 26 additions and 12 deletions

View File

@ -98,6 +98,16 @@ if test "$strict" = "yes"; then
CXXFLAGS="$CXXFLAGS -ansi -Wall -Wextra -Wno-unused-parameter -Wconversion -Winit-self -Woverloaded-virtual -Wsign-promo"
fi
# Boost shared_ptr debugging
pointer_debug="no"
AC_ARG_ENABLE(pointer_debug,
[AS_HELP_STRING(--enable-pointer-debug, [Enable smart pointer debugging (no)])],
[pointer_debug="$enableval"])
if test "$pointer_debug" = "yes"; then
CFLAGS+=" -DBOOST_SP_ENABLE_DEBUG_HOOKS"
CXXFLAGS+=" -DBOOST_SP_ENABLE_DEBUG_HOOKS"
fi
# Bolt on a few specific flags to CXXFLAGS that should always be used
CXXFLAGS="$CXXFLAGS -pipe -Wall -fmessage-length=139 -fdiagnostics-show-location=every-line"
CFLAGS="$CFLAGS -pipe -Wall -fmessage-length=139 -fdiagnostics-show-location=every-line"

View File

@ -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);

View File

@ -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();

View File

@ -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();

View File

@ -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));