From 5a2358e39602607757fedd08a7355bede3cb8739 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 6 Jun 2007 02:51:08 +0000 Subject: Nicer Flowcanvas naming. git-svn-id: http://svn.drobilla.net/lad/patchage@529 a436a847-0d15-0410-975c-d299462d15a1 --- src/AlsaDriver.cpp | 5 +- src/JackDriver.cpp | 100 +++++++++++++++------------ src/JackDriver.h | 7 +- src/Makefile.am | 4 +- src/Patchage.cpp | 6 +- src/Patchage.h | 6 +- src/PatchageCanvas.cpp | 163 +++++++++++++++++++++++++++++++++++++++++++++ src/PatchageCanvas.h | 58 ++++++++++++++++ src/PatchageEvent.cpp | 2 +- src/PatchageFlowCanvas.cpp | 163 --------------------------------------------- src/PatchageFlowCanvas.h | 58 ---------------- src/PatchageModule.h | 10 +-- src/PatchagePort.h | 4 +- 13 files changed, 302 insertions(+), 284 deletions(-) create mode 100644 src/PatchageCanvas.cpp create mode 100644 src/PatchageCanvas.h delete mode 100644 src/PatchageFlowCanvas.cpp delete mode 100644 src/PatchageFlowCanvas.h diff --git a/src/AlsaDriver.cpp b/src/AlsaDriver.cpp index b583917..87ef6d3 100644 --- a/src/AlsaDriver.cpp +++ b/src/AlsaDriver.cpp @@ -18,7 +18,7 @@ #include #include #include -#include "PatchageFlowCanvas.h" +#include "PatchageCanvas.h" #include "AlsaDriver.h" #include "Patchage.h" #include "PatchageModule.h" @@ -27,8 +27,7 @@ using std::cerr; using std::string; - -using namespace LibFlowCanvas; +using namespace FlowCanvas; AlsaDriver::AlsaDriver(Patchage* app) : _app(app), diff --git a/src/JackDriver.cpp b/src/JackDriver.cpp index afb3ffb..5489905 100644 --- a/src/JackDriver.cpp +++ b/src/JackDriver.cpp @@ -24,7 +24,7 @@ #include #include #include -#include "PatchageFlowCanvas.h" +#include "PatchageCanvas.h" #include "PatchageEvent.h" #include "JackDriver.h" #include "Patchage.h" @@ -33,7 +33,7 @@ using std::cerr; using std::endl; using std::string; -using namespace LibFlowCanvas; +using namespace FlowCanvas; JackDriver::JackDriver(Patchage* app) @@ -72,17 +72,19 @@ JackDriver::attach(bool launch_daemon) _app->status_message("[JACK] Unable to create client"); _is_activated = false; } else { + jack_client_t* const client = _client; + jack_set_error_function(error_cb); - jack_on_shutdown(_client, jack_shutdown_cb, this); - jack_set_port_registration_callback(_client, jack_port_registration_cb, this); - jack_set_graph_order_callback(_client, jack_graph_order_cb, this); - jack_set_buffer_size_callback(_client, jack_buffer_size_cb, this); - jack_set_xrun_callback(_client, jack_xrun_cb, this); + jack_on_shutdown(client, jack_shutdown_cb, this); + jack_set_port_registration_callback(client, jack_port_registration_cb, this); + jack_set_graph_order_callback(client, jack_graph_order_cb, this); + jack_set_buffer_size_callback(client, jack_buffer_size_cb, this); + jack_set_xrun_callback(client, jack_xrun_cb, this); _is_dirty = true; - _buffer_size = jack_get_buffer_size(_client); + _buffer_size = jack_get_buffer_size(client); - if (!jack_activate(_client)) { + if (!jack_activate(client)) { _is_activated = true; signal_attached.emit(); _app->status_message("[JACK] Attached"); @@ -97,6 +99,8 @@ JackDriver::attach(bool launch_daemon) void JackDriver::detach() { + _mutex.lock(); + if (_client) { jack_deactivate(_client); jack_client_close(_client); @@ -106,6 +110,8 @@ JackDriver::detach() signal_detached.emit(); _app->status_message("[JACK] Detached"); } + + _mutex.unlock(); } @@ -161,29 +167,38 @@ JackDriver::create_port(boost::shared_ptr parent, jack_port_t* p } +void +JackDriver::shutdown() +{ + destroy_all_ports(); + signal_detached.emit(); + _is_dirty = false; +} + + /** Refresh all Jack audio ports/connections. * To be called from GTK thread only. */ void JackDriver::refresh() { - //m_mutex.lock(); + const char** ports; + jack_port_t* port; + // Jack can take _client away from us at any time throughout here :/ + // Shortest locks possible is the best solution I can figure out + + _mutex.lock(); + if (_client == NULL) { - // Shutdown - if (_is_dirty) { - destroy_all_ports(); - signal_detached.emit(); - } - _is_dirty = false; - //m_mutex.unlock(); + _mutex.unlock(); + shutdown(); return; } - const char** ports; - jack_port_t* port; - ports = jack_get_ports(_client, NULL, NULL, 0); // get all existing ports + + _mutex.unlock(); string client1_name; string port1_name; @@ -193,7 +208,15 @@ JackDriver::refresh() // Add all ports if (ports) for (int i=0; ports[i]; ++i) { + _mutex.lock(); + if (!_client) { + _mutex.unlock(); + shutdown(); + return; + } port = jack_port_by_name(_client, ports[i]); + _mutex.unlock(); + client1_name = ports[i]; client1_name = client1_name.substr(0, client1_name.find(":")); @@ -256,8 +279,17 @@ JackDriver::refresh() // Add all connections if (ports) for (int i=0; ports[i]; ++i) { + _mutex.lock(); + if (!_client) { + _mutex.unlock(); + shutdown(); + return; + } + port = jack_port_by_name(_client, ports[i]); const char** connected_ports = jack_port_get_all_connections(_client, port); + + _mutex.unlock(); if (connected_ports) { for (int j=0; connected_ports[j]; ++j) { @@ -274,6 +306,9 @@ JackDriver::refresh() boost::shared_ptr port2 = _app->canvas()->get_port(client2_name, port2_name); + if (!port1 || !port2) + continue; + boost::shared_ptr src; boost::shared_ptr dst; @@ -303,8 +338,6 @@ JackDriver::refresh() free(ports); undirty(); - - //m_mutex.unlock(); } @@ -447,10 +480,10 @@ JackDriver::jack_shutdown_cb(void* jack_driver) jack_reset_max_delayed_usecs(me->_client); - //(me->_mutex).lock(); - me->_client = NULL; + me->_mutex.lock(); me->_is_dirty = true; - //(me->_mutex).unlock(); + me->_client = NULL; + me->_mutex.unlock(); } @@ -499,20 +532,3 @@ JackDriver::set_buffer_size(jack_nframes_t size) } } -void -JackDriver::set_realtime(bool /*realtime*/, int /*priority*/) -{ - /* need a jack_set_realtime, this doesn't make sense - pthread_t jack_thread = jack_client_thread_id(_client); - - if (realtime) - if (jack_acquire_real_time_scheduling(jack_thread, priority)) - _app->status_message("[JACK] ERROR: Unable to set real-time priority"); - else - if (jack_drop_real_time_scheduling(jack_thread)) - _app->status_message("[JACK] ERROR: Unable to drop real-time priority"); - - cerr << "Set Jack realtime: " << realtime << endl; - */ -} - diff --git a/src/JackDriver.h b/src/JackDriver.h index f621071..816d7d5 100644 --- a/src/JackDriver.h +++ b/src/JackDriver.h @@ -24,6 +24,8 @@ #include #include #include +#include +#include #include "Driver.h" class Patchage; class PatchageEvent; @@ -81,8 +83,6 @@ public: inline float sample_rate() { return jack_get_sample_rate(_client); } - void set_realtime(bool realtime, int priority=80); - inline size_t xruns() { return _xruns; } inline float max_delay() { return jack_get_max_delayed_usecs(_client); } @@ -95,6 +95,7 @@ private: static void error_cb(const char* msg); void destroy_all_ports(); + void shutdown(); void update_time(); @@ -109,6 +110,8 @@ private: Raul::SRSWQueue _events; + Raul::Mutex _mutex; + bool _is_activated; jack_position_t _last_pos; jack_nframes_t _buffer_size; diff --git a/src/Makefile.am b/src/Makefile.am index 485686c..04e30c6 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -24,8 +24,8 @@ patchage_SOURCES = \ PatchageEvent.cpp \ JackDriver.h \ JackDriver.cpp \ - PatchageFlowCanvas.h \ - PatchageFlowCanvas.cpp + PatchageCanvas.h \ + PatchageCanvas.cpp if WITH_LASH patchage_SOURCES += LashDriver.h LashDriver.cpp diff --git a/src/Patchage.cpp b/src/Patchage.cpp index 2b5a85a..603f306 100644 --- a/src/Patchage.cpp +++ b/src/Patchage.cpp @@ -25,7 +25,7 @@ #include #include #include "StateManager.h" -#include "PatchageFlowCanvas.h" +#include "PatchageCanvas.h" #include #include "JackDriver.h" #include "JackSettingsDialog.h" @@ -91,7 +91,7 @@ Patchage::Patchage(int argc, char** argv) _settings_filename += "/.patchagerc"; _state_manager = new StateManager(); - _canvas = boost::shared_ptr(new PatchageFlowCanvas(this, 1600*2, 1200*2)); + _canvas = boost::shared_ptr(new PatchageCanvas(this, 1600*2, 1200*2)); _jack_driver = new JackDriver(this); _jack_driver->signal_detached.connect(sigc::mem_fun(this, &Patchage::queue_refresh)); @@ -195,7 +195,7 @@ Patchage::Patchage(int argc, char** argv) _zoom_normal_button->signal_clicked().connect(sigc::bind( sigc::mem_fun(this, &Patchage::zoom), 1.0)); - _zoom_full_button->signal_clicked().connect(sigc::mem_fun(_canvas.get(), &PatchageFlowCanvas::zoom_full)); + _zoom_full_button->signal_clicked().connect(sigc::mem_fun(_canvas.get(), &PatchageCanvas::zoom_full)); _menu_jack_settings->signal_activate().connect( sigc::hide_return(sigc::mem_fun(_jack_settings_dialog, &JackSettingsDialog::run))); diff --git a/src/Patchage.h b/src/Patchage.h index a647c1c..288c8ee 100644 --- a/src/Patchage.h +++ b/src/Patchage.h @@ -25,7 +25,7 @@ using namespace std; -class PatchageFlowCanvas; +class PatchageCanvas; class JackDriver; class AlsaDriver; class LashDriver; @@ -39,7 +39,7 @@ public: Patchage(int argc, char** argv); ~Patchage(); - boost::shared_ptr canvas() { return _canvas; } + boost::shared_ptr canvas() { return _canvas; } StateManager* state_manager() { return _state_manager; } Gtk::Window* window() { return _main_window; } @@ -120,7 +120,7 @@ protected: void menu_alsa_disconnect(); #endif - boost::shared_ptr _canvas; + boost::shared_ptr _canvas; JackDriver* _jack_driver; StateManager* _state_manager; diff --git a/src/PatchageCanvas.cpp b/src/PatchageCanvas.cpp new file mode 100644 index 0000000..97e31bf --- /dev/null +++ b/src/PatchageCanvas.cpp @@ -0,0 +1,163 @@ +/* This file is part of Patchage. + * Copyright (C) 2007 Dave Robillard + * + * Patchage is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Patchage is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include +#include "config.h" +#include "PatchageCanvas.h" +#include "Patchage.h" +#include "JackDriver.h" +#include "PatchageModule.h" +#include "PatchagePort.h" +#ifdef HAVE_ALSA +#include "AlsaDriver.h" +#endif + +PatchageCanvas::PatchageCanvas(Patchage* app, int width, int height) +: FlowCanvas::Canvas(width, height), + _app(app) +{ +} + + +boost::shared_ptr +PatchageCanvas::get_item(const string& name) +{ + ItemList::iterator m = _items.begin(); + + for ( ; m != _items.end(); ++m) + if ((*m)->name() == name) + break; + + return (m == _items.end()) ? boost::shared_ptr() : *m; +} + + +boost::shared_ptr +PatchageCanvas::find_module(const string& name, ModuleType type) +{ + for (ItemList::iterator m = _items.begin(); m != _items.end(); ++m) { + boost::shared_ptr pm = boost::dynamic_pointer_cast(*m); + if (pm && pm->name() == name && pm->type() == type) { + return pm; + } + } + + return boost::shared_ptr(); +} + + +#ifdef HAVE_ALSA +boost::shared_ptr +PatchageCanvas::find_port(const snd_seq_addr_t* alsa_addr) +{ + boost::shared_ptr pp; + for (ItemList::iterator m = _items.begin(); m != _items.end(); ++m) { + SharedPtr module = PtrCast(*m); + if (!module) + continue; + for (PortVector::const_iterator p = module->ports().begin(); p != module->ports().end(); ++p) { + pp = boost::dynamic_pointer_cast(*p); + if (pp && pp->type() == ALSA_MIDI && pp->alsa_addr() + && pp->alsa_addr()->client == alsa_addr->client + && pp->alsa_addr()->port == alsa_addr->port) + return pp; + } + } + + return boost::shared_ptr(); +} +#endif + +void +PatchageCanvas::connect(boost::shared_ptr port1, boost::shared_ptr port2) +{ + boost::shared_ptr p1 = boost::dynamic_pointer_cast(port1); + boost::shared_ptr p2 = boost::dynamic_pointer_cast(port2); + if (!p1 || !p2) + return; + + if (p1->type() == JACK_AUDIO && p2->type() == JACK_AUDIO + || (p1->type() == JACK_MIDI && p2->type() == JACK_MIDI)) + _app->jack_driver()->connect(p1, p2); +#ifdef HAVE_ALSA + else if (p1->type() == ALSA_MIDI && p2->type() == ALSA_MIDI) + _app->alsa_driver()->connect(p1, p2); +#endif + else + status_message("WARNING: Cannot make connection, incompatible port types."); +} + + +void +PatchageCanvas::disconnect(boost::shared_ptr port1, boost::shared_ptr port2) +{ + boost::shared_ptr input + = boost::dynamic_pointer_cast(port1); + boost::shared_ptr output + = boost::dynamic_pointer_cast(port2); + + if (!input || !output) + return; + + if (input->is_output() && output->is_input()) { + // Damn, guessed wrong + boost::shared_ptr swap = input; + input = output; + output = swap; + } + + if (!input || !output || input->is_output() || output->is_input()) { + status_message("ERROR: Attempt to disconnect mismatched/unknown ports"); + return; + } + + if (input->type() == JACK_AUDIO && output->type() == JACK_AUDIO + || input->type() == JACK_MIDI && output->type() == JACK_MIDI) + _app->jack_driver()->disconnect(output, input); +#ifdef HAVE_ALSA + else if (input->type() == ALSA_MIDI && output->type() == ALSA_MIDI) + _app->alsa_driver()->disconnect(output, input); +#endif + else + status_message("ERROR: Attempt to disconnect ports with mismatched types"); +} + + +void +PatchageCanvas::status_message(const string& msg) +{ + _app->status_message(string("[Canvas] ").append(msg)); +} + + +boost::shared_ptr +PatchageCanvas::get_port(const string& node_name, const string& port_name) +{ + for (ItemList::iterator i = _items.begin(); i != _items.end(); ++i) { + const boost::shared_ptr item = *i; + const boost::shared_ptr module + = boost::dynamic_pointer_cast(item); + if (!module) + continue; + const boost::shared_ptr port = module->get_port(port_name); + if (module->name() == node_name && port) + return port; + } + + return boost::shared_ptr(); +} + diff --git a/src/PatchageCanvas.h b/src/PatchageCanvas.h new file mode 100644 index 0000000..ab9b92e --- /dev/null +++ b/src/PatchageCanvas.h @@ -0,0 +1,58 @@ +/* This file is part of Patchage. + * Copyright (C) 2007 Dave Robillard + * + * Patchage is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Patchage is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#ifndef PATCHAGECANVAS_H +#define PATCHAGECANVAS_H + +#include +#ifdef HAVE_ALSA +#include +#endif +#include +#include "StateManager.h" + +class Patchage; +class PatchageModule; +class PatchagePort; + +using std::string; +using namespace FlowCanvas; + +class PatchageCanvas : public Canvas +{ +public: + PatchageCanvas(Patchage* _app, int width, int height); + + boost::shared_ptr find_module(const string& name, ModuleType type); +#ifdef HAVE_ALSA + boost::shared_ptr find_port(const snd_seq_addr_t* alsa_addr); +#endif + void connect(boost::shared_ptr port1, boost::shared_ptr port2); + void disconnect(boost::shared_ptr port1, boost::shared_ptr port2); + + void status_message(const string& msg); + + boost::shared_ptr get_item(const string& name); + boost::shared_ptr get_port(const string& module_name, + const string& port_name); + +private: + Patchage* _app; +}; + + +#endif // PATCHAGECANVAS_H diff --git a/src/PatchageEvent.cpp b/src/PatchageEvent.cpp index 7141ac1..70d1c43 100644 --- a/src/PatchageEvent.cpp +++ b/src/PatchageEvent.cpp @@ -17,7 +17,7 @@ #include "raul/SharedPtr.h" #include "Patchage.h" -#include "PatchageFlowCanvas.h" +#include "PatchageCanvas.h" #include "PatchageModule.h" #include "PatchageEvent.h" #include "JackDriver.h" diff --git a/src/PatchageFlowCanvas.cpp b/src/PatchageFlowCanvas.cpp deleted file mode 100644 index 986265b..0000000 --- a/src/PatchageFlowCanvas.cpp +++ /dev/null @@ -1,163 +0,0 @@ -/* This file is part of Patchage. - * Copyright (C) 2007 Dave Robillard - * - * Patchage is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Patchage is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#include -#include "config.h" -#include "PatchageFlowCanvas.h" -#include "Patchage.h" -#include "JackDriver.h" -#include "PatchageModule.h" -#include "PatchagePort.h" -#ifdef HAVE_ALSA -#include "AlsaDriver.h" -#endif - -PatchageFlowCanvas::PatchageFlowCanvas(Patchage* app, int width, int height) -: FlowCanvas(width, height), - _app(app) -{ -} - - -boost::shared_ptr -PatchageFlowCanvas::get_item(const string& name) -{ - ItemList::iterator m = _items.begin(); - - for ( ; m != _items.end(); ++m) - if ((*m)->name() == name) - break; - - return (m == _items.end()) ? boost::shared_ptr() : *m; -} - - -boost::shared_ptr -PatchageFlowCanvas::find_module(const string& name, ModuleType type) -{ - for (ItemList::iterator m = _items.begin(); m != _items.end(); ++m) { - boost::shared_ptr pm = boost::dynamic_pointer_cast(*m); - if (pm && pm->name() == name && pm->type() == type) { - return pm; - } - } - - return boost::shared_ptr(); -} - - -#ifdef HAVE_ALSA -boost::shared_ptr -PatchageFlowCanvas::find_port(const snd_seq_addr_t* alsa_addr) -{ - boost::shared_ptr pp; - for (ItemList::iterator m = _items.begin(); m != _items.end(); ++m) { - SharedPtr module = PtrCast(*m); - if (!module) - continue; - for (PortVector::const_iterator p = module->ports().begin(); p != module->ports().end(); ++p) { - pp = boost::dynamic_pointer_cast(*p); - if (pp && pp->type() == ALSA_MIDI && pp->alsa_addr() - && pp->alsa_addr()->client == alsa_addr->client - && pp->alsa_addr()->port == alsa_addr->port) - return pp; - } - } - - return boost::shared_ptr(); -} -#endif - -void -PatchageFlowCanvas::connect(boost::shared_ptr port1, boost::shared_ptr port2) -{ - boost::shared_ptr p1 = boost::dynamic_pointer_cast(port1); - boost::shared_ptr p2 = boost::dynamic_pointer_cast(port2); - if (!p1 || !p2) - return; - - if (p1->type() == JACK_AUDIO && p2->type() == JACK_AUDIO - || (p1->type() == JACK_MIDI && p2->type() == JACK_MIDI)) - _app->jack_driver()->connect(p1, p2); -#ifdef HAVE_ALSA - else if (p1->type() == ALSA_MIDI && p2->type() == ALSA_MIDI) - _app->alsa_driver()->connect(p1, p2); -#endif - else - status_message("WARNING: Cannot make connection, incompatible port types."); -} - - -void -PatchageFlowCanvas::disconnect(boost::shared_ptr port1, boost::shared_ptr port2) -{ - boost::shared_ptr input - = boost::dynamic_pointer_cast(port1); - boost::shared_ptr output - = boost::dynamic_pointer_cast(port2); - - if (!input || !output) - return; - - if (input->is_output() && output->is_input()) { - // Damn, guessed wrong - boost::shared_ptr swap = input; - input = output; - output = swap; - } - - if (!input || !output || input->is_output() || output->is_input()) { - status_message("ERROR: Attempt to disconnect mismatched/unknown ports"); - return; - } - - if (input->type() == JACK_AUDIO && output->type() == JACK_AUDIO - || input->type() == JACK_MIDI && output->type() == JACK_MIDI) - _app->jack_driver()->disconnect(output, input); -#ifdef HAVE_ALSA - else if (input->type() == ALSA_MIDI && output->type() == ALSA_MIDI) - _app->alsa_driver()->disconnect(output, input); -#endif - else - status_message("ERROR: Attempt to disconnect ports with mismatched types"); -} - - -void -PatchageFlowCanvas::status_message(const string& msg) -{ - _app->status_message(string("[Canvas] ").append(msg)); -} - - -boost::shared_ptr -PatchageFlowCanvas::get_port(const string& node_name, const string& port_name) -{ - for (ItemList::iterator i = _items.begin(); i != _items.end(); ++i) { - const boost::shared_ptr item = *i; - const boost::shared_ptr module - = boost::dynamic_pointer_cast(item); - if (!module) - continue; - const boost::shared_ptr port = module->get_port(port_name); - if (module->name() == node_name && port) - return port; - } - - return boost::shared_ptr(); -} - diff --git a/src/PatchageFlowCanvas.h b/src/PatchageFlowCanvas.h deleted file mode 100644 index d395af2..0000000 --- a/src/PatchageFlowCanvas.h +++ /dev/null @@ -1,58 +0,0 @@ -/* This file is part of Patchage. - * Copyright (C) 2007 Dave Robillard - * - * Patchage is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Patchage is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#ifndef PATCHAGEPATCHBAYAREA_H -#define PATCHAGEPATCHBAYAREA_H - -#include -#ifdef HAVE_ALSA -#include -#endif -#include -#include "StateManager.h" - -class Patchage; -class PatchageModule; -class PatchagePort; - -using std::string; -using namespace LibFlowCanvas; - -class PatchageFlowCanvas : public FlowCanvas -{ -public: - PatchageFlowCanvas(Patchage* _app, int width, int height); - - boost::shared_ptr find_module(const string& name, ModuleType type); -#ifdef HAVE_ALSA - boost::shared_ptr find_port(const snd_seq_addr_t* alsa_addr); -#endif - void connect(boost::shared_ptr port1, boost::shared_ptr port2); - void disconnect(boost::shared_ptr port1, boost::shared_ptr port2); - - void status_message(const string& msg); - - boost::shared_ptr get_item(const string& name); - boost::shared_ptr get_port(const string& module_name, - const string& port_name); - -private: - Patchage* _app; -}; - - -#endif // PATCHAGEPATCHBAYAREA_H diff --git a/src/PatchageModule.h b/src/PatchageModule.h index 3dee3c6..131c86a 100644 --- a/src/PatchageModule.h +++ b/src/PatchageModule.h @@ -23,15 +23,15 @@ #ifdef HAVE_ALSA #include #endif -#include +#include #include -#include "PatchageFlowCanvas.h" +#include "PatchageCanvas.h" #include "StateManager.h" #include "PatchagePort.h" using std::string; using std::list; -using namespace LibFlowCanvas; +using namespace FlowCanvas; class PatchageModule : public Module { @@ -76,7 +76,7 @@ public: virtual void load_location() { - boost::shared_ptr canvas = _canvas.lock(); + boost::shared_ptr canvas = _canvas.lock(); if (!canvas) return; @@ -113,7 +113,7 @@ public: virtual void on_click(GdkEventButton* ev) { if (ev->button == 3) _menu.popup(ev->button, ev->time); - LibFlowCanvas::Item::on_click(ev); + FlowCanvas::Item::on_click(ev); } virtual void menu_disconnect_all() { diff --git a/src/PatchagePort.h b/src/PatchagePort.h index e4f4c28..6109fba 100644 --- a/src/PatchagePort.h +++ b/src/PatchagePort.h @@ -29,7 +29,7 @@ #include #endif -using namespace LibFlowCanvas; +using namespace FlowCanvas; using std::string; using std::list; enum PortType { JACK_AUDIO, JACK_MIDI, ALSA_MIDI }; @@ -39,7 +39,7 @@ enum PortType { JACK_AUDIO, JACK_MIDI, ALSA_MIDI }; * * \ingroup OmGtk */ -class PatchagePort : public LibFlowCanvas::Port +class PatchagePort : public FlowCanvas::Port { public: PatchagePort(boost::shared_ptr module, PortType type, const string& name, bool is_input, int color) -- cgit v1.2.1