diff options
-rw-r--r-- | src/AlsaDriver.cpp | 114 | ||||
-rw-r--r-- | src/AlsaDriver.h | 10 | ||||
-rw-r--r-- | src/Driver.h | 8 | ||||
-rw-r--r-- | src/JackDriver.cpp | 198 | ||||
-rw-r--r-- | src/JackDriver.h | 38 | ||||
-rw-r--r-- | src/LashDriver.cpp | 50 | ||||
-rw-r--r-- | src/LashDriver.h | 8 | ||||
-rw-r--r-- | src/Patchage.cpp | 504 | ||||
-rw-r--r-- | src/Patchage.h | 118 | ||||
-rw-r--r-- | src/PatchageFlowCanvas.cpp | 16 | ||||
-rw-r--r-- | src/PatchageFlowCanvas.h | 4 | ||||
-rw-r--r-- | src/PatchageModule.h | 44 | ||||
-rw-r--r-- | src/PatchagePort.h | 18 | ||||
-rw-r--r-- | src/StateManager.cpp | 56 | ||||
-rw-r--r-- | src/StateManager.h | 10 |
15 files changed, 598 insertions, 598 deletions
diff --git a/src/AlsaDriver.cpp b/src/AlsaDriver.cpp index 84c2bbc..3e42df9 100644 --- a/src/AlsaDriver.cpp +++ b/src/AlsaDriver.cpp @@ -30,8 +30,8 @@ using std::string; using namespace LibFlowCanvas; AlsaDriver::AlsaDriver(Patchage* app) -: m_app(app), - m_seq(NULL) +: _app(app), + _seq(NULL) { } @@ -48,18 +48,18 @@ AlsaDriver::~AlsaDriver() void AlsaDriver::attach(bool /*launch_daemon*/) { - int ret = snd_seq_open(&m_seq, "default", + int ret = snd_seq_open(&_seq, "default", SND_SEQ_OPEN_DUPLEX, SND_SEQ_NONBLOCK); if (ret) { - m_app->status_message("[ALSA] Unable to attach"); - m_seq = NULL; + _app->status_message("[ALSA] Unable to attach"); + _seq = NULL; } else { - m_app->status_message("[ALSA] Attached"); + _app->status_message("[ALSA] Attached"); - snd_seq_set_client_name(m_seq, "Patchage"); + snd_seq_set_client_name(_seq, "Patchage"); - ret = pthread_create(&m_refresh_thread, NULL, &AlsaDriver::refresh_main, this); + ret = pthread_create(&_refresh_thread, NULL, &AlsaDriver::refresh_main, this); if (ret) cerr << "Couldn't start refresh thread" << endl; @@ -71,13 +71,13 @@ AlsaDriver::attach(bool /*launch_daemon*/) void AlsaDriver::detach() { - if (m_seq) { - pthread_cancel(m_refresh_thread); - pthread_join(m_refresh_thread, NULL); - snd_seq_close(m_seq); - m_seq = NULL; + if (_seq) { + pthread_cancel(_refresh_thread); + pthread_join(_refresh_thread, NULL); + snd_seq_close(_seq); + _seq = NULL; signal_detached.emit(); - m_app->status_message("[ALSA] Detached"); + _app->status_message("[ALSA] Detached"); } } @@ -90,7 +90,7 @@ AlsaDriver::refresh() if (!is_attached()) return; - assert(m_seq); + assert(_seq); refresh_ports(); refresh_connections(); @@ -105,7 +105,7 @@ AlsaDriver::create_port(boost::shared_ptr<PatchageModule> parent, { boost::shared_ptr<PatchagePort> ret( new PatchagePort(parent, ALSA_MIDI, name, is_input, - m_app->state_manager()->get_port_color(ALSA_MIDI))); + _app->state_manager()->get_port_color(ALSA_MIDI))); ret->alsa_addr(addr); return ret; } @@ -117,7 +117,7 @@ void AlsaDriver::refresh_ports() { assert(is_attached()); - assert(m_seq); + assert(_seq); snd_seq_client_info_t* cinfo; snd_seq_client_info_alloca(&cinfo); @@ -132,13 +132,13 @@ AlsaDriver::refresh_ports() bool is_duplex = false; bool is_application = true; - while (snd_seq_query_next_client (m_seq, cinfo) >= 0) { + while (snd_seq_query_next_client (_seq, cinfo) >= 0) { snd_seq_port_info_set_client(pinfo, snd_seq_client_info_get_client(cinfo)); snd_seq_port_info_set_port(pinfo, -1); client_name = snd_seq_client_info_get_name(cinfo); - while (snd_seq_query_next_port(m_seq, pinfo) >= 0) { + while (snd_seq_query_next_port(_seq, pinfo) >= 0) { int caps = snd_seq_port_info_get_capability(pinfo); int type = snd_seq_port_info_get_type(pinfo); @@ -173,13 +173,13 @@ AlsaDriver::refresh_ports() //cout << client_name << " : " << port_name << " is_application = " << is_application // << " is_duplex = " << is_duplex << endl; - bool split = m_app->state_manager()->get_module_split(client_name, !is_application); + bool split = _app->state_manager()->get_module_split(client_name, !is_application); // Application input/output ports go on the same module if (!split) { - m = m_app->canvas()->find_module(client_name, InputOutput); + m = _app->canvas()->find_module(client_name, InputOutput); if (!m) { - m = boost::shared_ptr<PatchageModule>(new PatchageModule(m_app, client_name, InputOutput)); + m = boost::shared_ptr<PatchageModule>(new PatchageModule(_app, client_name, InputOutput)); m->load_location(); m->store_location(); } @@ -203,14 +203,14 @@ AlsaDriver::refresh_ports() else type = Output; // See if an InputOutput module exists (maybe with Jack ports on it) - m = m_app->canvas()->find_module(client_name, InputOutput); + m = _app->canvas()->find_module(client_name, InputOutput); if (!m) - m = m_app->canvas()->find_module(client_name, type); + m = _app->canvas()->find_module(client_name, type); if (!m) { m = boost::shared_ptr<PatchageModule>( - new PatchageModule(m_app, client_name, type)); + new PatchageModule(_app, client_name, type)); m->load_location(); m->store_location(); } @@ -220,14 +220,14 @@ AlsaDriver::refresh_ports() type = Input; // See if an InputOutput module exists (maybe with Jack ports on it) - m = m_app->canvas()->find_module(client_name, InputOutput); + m = _app->canvas()->find_module(client_name, InputOutput); if (!m) - m = m_app->canvas()->find_module(client_name, type); + m = _app->canvas()->find_module(client_name, type); if (!m) { m = boost::shared_ptr<PatchageModule>( - new PatchageModule(m_app, client_name, type)); + new PatchageModule(_app, client_name, type)); m->load_location(); m->store_location(); } @@ -240,14 +240,14 @@ AlsaDriver::refresh_ports() type = Output; // See if an InputOutput module exists (maybe with Jack ports on it) - m = m_app->canvas()->find_module(client_name, InputOutput); + m = _app->canvas()->find_module(client_name, InputOutput); if (!m) - m = m_app->canvas()->find_module(client_name, type); + m = _app->canvas()->find_module(client_name, type); if (!m) { m = boost::shared_ptr<PatchageModule>( - new PatchageModule(m_app, client_name, type)); + new PatchageModule(_app, client_name, type)); m->load_location(); m->store_location(); } @@ -256,7 +256,7 @@ AlsaDriver::refresh_ports() } } m->resize(); - m_app->canvas()->add_module(m); + _app->canvas()->add_module(m); } } } @@ -268,13 +268,13 @@ void AlsaDriver::refresh_connections() { assert(is_attached()); - assert(m_seq); + assert(_seq); boost::shared_ptr<PatchageModule> m; boost::shared_ptr<PatchagePort> p; - for (ModuleMap::iterator i = m_app->canvas()->modules().begin(); - i != m_app->canvas()->modules().end(); ++i) { + for (ModuleMap::iterator i = _app->canvas()->modules().begin(); + i != _app->canvas()->modules().end(); ++i) { m = boost::dynamic_pointer_cast<PatchageModule>((*i).second); if (m) { for (PortVector::const_iterator j = m->ports().begin(); j != m->ports().end(); ++j) { @@ -293,7 +293,7 @@ void AlsaDriver::add_connections(boost::shared_ptr<PatchagePort> port) { assert(is_attached()); - assert(m_seq); + assert(_seq); const snd_seq_addr_t* addr = port->alsa_addr(); boost::shared_ptr<PatchagePort> connected_port; @@ -308,17 +308,17 @@ AlsaDriver::add_connections(boost::shared_ptr<PatchagePort> port) snd_seq_query_subscribe_set_root(subsinfo, addr); snd_seq_query_subscribe_set_index(subsinfo, 0); - while(!snd_seq_query_port_subscribers(m_seq, subsinfo)) { + while(!snd_seq_query_port_subscribers(_seq, subsinfo)) { const snd_seq_addr_t* connected_addr = snd_seq_query_subscribe_get_addr(subsinfo); - connected_port = m_app->canvas()->find_port(connected_addr); + connected_port = _app->canvas()->find_port(connected_addr); if (connected_port) { - boost::shared_ptr<Connection> existing = m_app->canvas()->get_connection(port, connected_port); + boost::shared_ptr<Connection> existing = _app->canvas()->get_connection(port, connected_port); if (existing) { existing->set_flagged(false); } else { - m_app->canvas()->add_connection(port, connected_port); + _app->canvas()->add_connection(port, connected_port); } } @@ -350,12 +350,12 @@ AlsaDriver::connect(boost::shared_ptr<PatchagePort> src_port, boost::shared_ptr< snd_seq_port_subscribe_set_time_real(subs, 0); // Already connected (shouldn't happen) - if (!snd_seq_get_port_subscription(m_seq, subs)) { + if (!snd_seq_get_port_subscription(_seq, subs)) { cerr << "Error: Attempt to subscribe Alsa ports that are already subscribed." << endl; result = false; } - int ret = snd_seq_subscribe_port(m_seq, subs); + int ret = snd_seq_subscribe_port(_seq, subs); if (ret < 0) { cerr << "Alsa subscription failed: " << snd_strerror(ret) << endl; result = false; @@ -363,10 +363,10 @@ AlsaDriver::connect(boost::shared_ptr<PatchagePort> src_port, boost::shared_ptr< } if (result) - m_app->status_message(string("[ALSA] Connected ") + _app->status_message(string("[ALSA] Connected ") + src_port->full_name() + " -> " + dst_port->full_name()); else - m_app->status_message(string("[ALSA] Unable to connect ") + _app->status_message(string("[ALSA] Unable to connect ") + src_port->full_name() + " -> " + dst_port->full_name()); return (!result); @@ -394,22 +394,22 @@ AlsaDriver::disconnect(boost::shared_ptr<PatchagePort> src_port, boost::shared_p snd_seq_port_subscribe_set_time_real(subs, 0); // Not connected (shouldn't happen) - if (snd_seq_get_port_subscription(m_seq, subs) != 0) { + if (snd_seq_get_port_subscription(_seq, subs) != 0) { cerr << "Error: Attempt to unsubscribe Alsa ports that are not subscribed." << endl; result = false; } - int ret = snd_seq_unsubscribe_port(m_seq, subs); + int ret = snd_seq_unsubscribe_port(_seq, subs); if (ret < 0) { cerr << "Alsa unsubscription failed: " << snd_strerror(ret) << endl; result = false; } if (result) - m_app->status_message(string("[ALSA] Disconnected ") + _app->status_message(string("[ALSA] Disconnected ") + src_port->full_name() + " -> " + dst_port->full_name()); else - m_app->status_message(string("[ALSA] Unable to disconnect ") + _app->status_message(string("[ALSA] Unable to disconnect ") + src_port->full_name() + " -> " + dst_port->full_name()); return (!result); @@ -431,14 +431,14 @@ AlsaDriver::create_refresh_port() snd_seq_port_info_set_type(port_info, SND_SEQ_PORT_TYPE_APPLICATION); - ret = snd_seq_create_port(m_seq, port_info); + ret = snd_seq_create_port(_seq, port_info); if (ret) { cerr << "Error creating alsa port: " << snd_strerror(ret) << endl; return false; } // Subscribe the port to the system announcer - ret = snd_seq_connect_from(m_seq, + ret = snd_seq_connect_from(_seq, snd_seq_port_info_get_port(port_info), SND_SEQ_CLIENT_SYSTEM, SND_SEQ_PORT_SYSTEM_ANNOUNCE); @@ -456,19 +456,19 @@ void* AlsaDriver::refresh_main(void* me) { AlsaDriver* ad = (AlsaDriver*)me; - ad->m_refresh_main(); + ad->_refresh_main(); return NULL; } void -AlsaDriver::m_refresh_main() +AlsaDriver::_refresh_main() { // "Heavily influenced" from alsa-patch-bay // (C) 2002 Robert Ham, released under GPL int ret; - int nfds = snd_seq_poll_descriptors_count(m_seq, POLLIN); + int nfds = snd_seq_poll_descriptors_count(_seq, POLLIN); struct pollfd* pfds = new struct pollfd[nfds]; unsigned short* revents = new unsigned short[nfds]; @@ -477,7 +477,7 @@ AlsaDriver::m_refresh_main() return; } - snd_seq_poll_descriptors(m_seq, pfds, nfds, POLLIN); + snd_seq_poll_descriptors(_seq, pfds, nfds, POLLIN); while (true) { ret = poll(pfds, nfds, -1); @@ -489,7 +489,7 @@ AlsaDriver::m_refresh_main() continue; } - ret = snd_seq_poll_descriptors_revents(m_seq, pfds, nfds, revents); + ret = snd_seq_poll_descriptors_revents(_seq, pfds, nfds, revents); if (ret) { cerr << "Error getting Alsa sequencer poll events: " << snd_strerror(ret) << endl; @@ -499,7 +499,7 @@ AlsaDriver::m_refresh_main() for (int i = 0; i < nfds; ++i) { if (revents[i] > 0) { snd_seq_event_t* ev; - snd_seq_event_input(m_seq, &ev); + snd_seq_event_input(_seq, &ev); if (ev == NULL) continue; @@ -514,7 +514,7 @@ AlsaDriver::m_refresh_main() case SND_SEQ_EVENT_PORT_CHANGE: case SND_SEQ_EVENT_PORT_SUBSCRIBED: case SND_SEQ_EVENT_PORT_UNSUBSCRIBED: - m_is_dirty = true; + _is_dirty = true; break; default: break; diff --git a/src/AlsaDriver.h b/src/AlsaDriver.h index daafbdd..22bcbc5 100644 --- a/src/AlsaDriver.h +++ b/src/AlsaDriver.h @@ -41,7 +41,7 @@ public: void attach(bool launch_daemon = false); void detach(); - bool is_attached() const { return (m_seq != NULL); } + bool is_attached() const { return (_seq != NULL); } void refresh(); @@ -59,16 +59,16 @@ private: bool create_refresh_port(); static void* refresh_main(void* me); - void m_refresh_main(); + void _refresh_main(); boost::shared_ptr<PatchagePort> create_port(boost::shared_ptr<PatchageModule> parent, const string& name, bool is_input, snd_seq_addr_t addr); - Patchage* m_app; + Patchage* _app; - snd_seq_t* m_seq; + snd_seq_t* _seq; - pthread_t m_refresh_thread; + pthread_t _refresh_thread; }; #endif // ALSADRIVER_H diff --git a/src/Driver.h b/src/Driver.h index 1945286..2be29e9 100644 --- a/src/Driver.h +++ b/src/Driver.h @@ -40,18 +40,18 @@ public: boost::shared_ptr<PatchagePort> dst_port) = 0; /** Returns whether or not a refresh is required (pending). */ - inline bool is_dirty() const { return m_is_dirty; } + inline bool is_dirty() const { return _is_dirty; } /** Clear 'dirty' status after a refresh. */ - inline void undirty() { m_is_dirty = false; } + inline void undirty() { _is_dirty = false; } sigc::signal<void> signal_attached; sigc::signal<void> signal_detached; protected: - Driver() : m_is_dirty(false) {} + Driver() : _is_dirty(false) {} - bool m_is_dirty; + bool _is_dirty; }; diff --git a/src/JackDriver.cpp b/src/JackDriver.cpp index 77625bc..5d4c139 100644 --- a/src/JackDriver.cpp +++ b/src/JackDriver.cpp @@ -35,15 +35,15 @@ using namespace LibFlowCanvas; JackDriver::JackDriver(Patchage* app) -: m_app(app) -, m_client(NULL) -, m_events(1024) // FIXME: size? -, m_is_activated(false) -, m_xruns(0) -, m_xrun_delay(0) +: _app(app) +, _client(NULL) +, _events(1024) // FIXME: size? +, _is_activated(false) +, _xruns(0) +, _xrun_delay(0) { - m_last_pos.frame = 0; - m_last_pos.valid = (jack_position_bits_t)0; + _last_pos.frame = 0; + _last_pos.valid = (jack_position_bits_t)0; } @@ -59,34 +59,34 @@ void JackDriver::attach(bool launch_daemon) { // Already connected - if (m_client) + if (_client) return; jack_set_error_function(error_cb); jack_options_t options = (!launch_daemon) ? JackNoStartServer : JackNullOption; - m_client = jack_client_open("Patchage", options, NULL); - if (m_client == NULL) { - m_app->status_message("[JACK] Unable to create client"); - m_is_activated = false; + _client = jack_client_open("Patchage", options, NULL); + if (_client == NULL) { + _app->status_message("[JACK] Unable to create client"); + _is_activated = false; } else { jack_set_error_function(error_cb); - jack_on_shutdown(m_client, jack_shutdown_cb, this); - jack_set_port_registration_callback(m_client, jack_port_registration_cb, this); - jack_set_graph_order_callback(m_client, jack_graph_order_cb, this); - jack_set_buffer_size_callback(m_client, jack_buffer_size_cb, this); - jack_set_xrun_callback(m_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); - m_is_dirty = true; - m_buffer_size = jack_get_buffer_size(m_client); + _is_dirty = true; + _buffer_size = jack_get_buffer_size(_client); - if (!jack_activate(m_client)) { - m_is_activated = true; + if (!jack_activate(_client)) { + _is_activated = true; signal_attached.emit(); - m_app->status_message("[JACK] Attached"); + _app->status_message("[JACK] Attached"); } else { - m_app->status_message("[JACK] ERROR: Failed to attach"); - m_is_activated = false; + _app->status_message("[JACK] ERROR: Failed to attach"); + _is_activated = false; } } } @@ -95,14 +95,14 @@ JackDriver::attach(bool launch_daemon) void JackDriver::detach() { - if (m_client) { - jack_deactivate(m_client); - jack_client_close(m_client); - m_client = NULL; + if (_client) { + jack_deactivate(_client); + jack_client_close(_client); + _client = NULL; destroy_all_ports(); - m_is_activated = false; + _is_activated = false; signal_detached.emit(); - m_app->status_message("[JACK] Detached"); + _app->status_message("[JACK] Detached"); } } @@ -112,7 +112,7 @@ JackDriver::detach() void JackDriver::destroy_all_ports() { - ModuleMap modules = m_app->canvas()->modules(); // copy + ModuleMap modules = _app->canvas()->modules(); // copy for (ModuleMap::iterator m = modules.begin(); m != modules.end(); ++m) { PortVector ports = m->second->ports(); // copy for (PortVector::iterator p = ports.begin(); p != ports.end(); ++p) { @@ -123,7 +123,7 @@ JackDriver::destroy_all_ports() } if (m->second->ports().empty()) - m_app->canvas()->remove_module(m->second->name()); + _app->canvas()->remove_module(m->second->name()); } } @@ -150,7 +150,7 @@ JackDriver::create_port(boost::shared_ptr<PatchageModule> parent, jack_port_t* p boost::shared_ptr<PatchagePort> ret( new PatchagePort(parent, port_type, jack_port_short_name(port), (jack_port_flags(port) & JackPortIsInput), - m_app->state_manager()->get_port_color(port_type))); + _app->state_manager()->get_port_color(port_type))); return ret; } @@ -164,13 +164,13 @@ JackDriver::refresh() { //m_mutex.lock(); - if (m_client == NULL) { + if (_client == NULL) { // Shutdown - if (m_is_dirty) { + if (_is_dirty) { destroy_all_ports(); signal_detached.emit(); } - m_is_dirty = false; + _is_dirty = false; //m_mutex.unlock(); return; } @@ -178,7 +178,7 @@ JackDriver::refresh() const char** ports; jack_port_t* port; - ports = jack_get_ports(m_client, NULL, NULL, 0); // get all existing ports + ports = jack_get_ports(_client, NULL, NULL, 0); // get all existing ports string client1_name; string port1_name; @@ -188,14 +188,14 @@ JackDriver::refresh() // Add all ports if (ports) for (int i=0; ports[i]; ++i) { - port = jack_port_by_name(m_client, ports[i]); + port = jack_port_by_name(_client, ports[i]); client1_name = ports[i]; client1_name = client1_name.substr(0, client1_name.find(":")); ModuleType type = InputOutput; - //if (m_app->state_manager()->get_module_split(client1_name) + //if (_app->state_manager()->get_module_split(client1_name) // || jack_port_flags(port) & JackPortIsTerminal) - if (m_app->state_manager()->get_module_split(client1_name, + if (_app->state_manager()->get_module_split(client1_name, (jack_port_flags(port) & JackPortIsTerminal))) { if (jack_port_flags(port) & JackPortIsInput) { type = Input; @@ -204,13 +204,13 @@ JackDriver::refresh() } } - boost::shared_ptr<PatchageModule> m = m_app->canvas()->find_module(client1_name, type); + boost::shared_ptr<PatchageModule> m = _app->canvas()->find_module(client1_name, type); if (!m) { - m = boost::shared_ptr<PatchageModule>(new PatchageModule(m_app, client1_name, type)); + m = boost::shared_ptr<PatchageModule>(new PatchageModule(_app, client1_name, type)); m->load_location(); m->store_location(); - m_app->canvas()->add_module(m); + _app->canvas()->add_module(m); } // FIXME: leak? jack docs don't say @@ -237,11 +237,11 @@ JackDriver::refresh() // Remove any since-removed ports - /*for (list<string>::iterator i = m_removed_ports.begin(); i != m_removed_ports.end(); ++i) { + /*for (list<string>::iterator i = _removed_ports.begin(); i != _removed_ports.end(); ++i) { const string module_name = (*i).substr(0, i->find(":")); const string port_name = (*i).substr(i->find(":")+1); - for (ModuleMap::iterator m = m_app->canvas()->modules().begin(); m != m_app->canvas()->modules().end(); ++m) { + for (ModuleMap::iterator m = _app->canvas()->modules().begin(); m != _app->canvas()->modules().end(); ++m) { if (m->second->name() == module_name) m->second->remove_port(port_name); } @@ -251,8 +251,8 @@ JackDriver::refresh() // Add all connections if (ports) for (int i=0; ports[i]; ++i) { - port = jack_port_by_name(m_client, ports[i]); - const char** connected_ports = jack_port_get_all_connections(m_client, port); + port = jack_port_by_name(_client, ports[i]); + const char** connected_ports = jack_port_get_all_connections(_client, port); if (connected_ports) { for (int j=0; connected_ports[j]; ++j) { @@ -264,15 +264,15 @@ JackDriver::refresh() port2_name = client2_name.substr(client2_name.find(':')+1); client2_name = client2_name.substr(0, client2_name.find(':')); - boost::shared_ptr<Port> port1 = m_app->canvas()->get_port(client1_name, port1_name); - boost::shared_ptr<Port> port2 = m_app->canvas()->get_port(client2_name, port2_name); + boost::shared_ptr<Port> port1 = _app->canvas()->get_port(client1_name, port1_name); + boost::shared_ptr<Port> port2 = _app->canvas()->get_port(client2_name, port2_name); if (port1 && port2) { - boost::shared_ptr<Connection> existing = m_app->canvas()->get_connection(port1, port2); + boost::shared_ptr<Connection> existing = _app->canvas()->get_connection(port1, port2); if (existing) { existing->set_flagged(false); } else { - m_app->canvas()->add_connection(port1, port2); + _app->canvas()->add_connection(port1, port2); } } } @@ -295,16 +295,16 @@ JackDriver::refresh() bool JackDriver::connect(boost::shared_ptr<PatchagePort> src_port, boost::shared_ptr<PatchagePort> dst_port) { - if (m_client == NULL) + if (_client == NULL) return false; - int result = jack_connect(m_client, src_port->full_name().c_str(), dst_port->full_name().c_str()); + int result = jack_connect(_client, src_port->full_name().c_str(), dst_port->full_name().c_str()); if (result == 0) - m_app->status_message(string("[JACK] Connected ") + _app->status_message(string("[JACK] Connected ") + src_port->full_name() + " -> " + dst_port->full_name()); else - m_app->status_message(string("[JACK] Unable to connect ") + _app->status_message(string("[JACK] Unable to connect ") + src_port->full_name() + " -> " + dst_port->full_name()); return (!result); @@ -318,16 +318,16 @@ JackDriver::connect(boost::shared_ptr<PatchagePort> src_port, boost::shared_ptr< bool JackDriver::disconnect(boost::shared_ptr<PatchagePort> const src_port, boost::shared_ptr<PatchagePort> const dst_port) { - if (m_client == NULL) + if (_client == NULL) return false; - int result = jack_disconnect(m_client, src_port->full_name().c_str(), dst_port->full_name().c_str()); + int result = jack_disconnect(_client, src_port->full_name().c_str(), dst_port->full_name().c_str()); if (result == 0) - m_app->status_message(string("[JACK] Disconnected ") + _app->status_message(string("[JACK] Disconnected ") + src_port->full_name() + " -> " + dst_port->full_name()); else - m_app->status_message(string("[JACK] Unable to disconnect ") + _app->status_message(string("[JACK] Unable to disconnect ") + src_port->full_name() + " -> " + dst_port->full_name()); return (!result); @@ -345,18 +345,18 @@ JackDriver::jack_port_registration_cb(jack_port_id_t port_id, int registered, vo { assert(jack_driver); JackDriver* me = reinterpret_cast<JackDriver*>(jack_driver); - assert(me->m_client); + assert(me->_client); - jack_port_t* const port = jack_port_by_id(me->m_client, port_id); + jack_port_t* const port = jack_port_by_id(me->_client, port_id); const string full_name = jack_port_name(port); - jack_reset_max_delayed_usecs(me->m_client); + jack_reset_max_delayed_usecs(me->_client); if (registered) { - me->m_events.push(PatchageEvent(me->m_app, + me->_events.push(PatchageEvent(me->_app, PatchageEvent::PORT_CREATION, port_id)); } else { - me->m_events.push(PatchageEvent(me->m_app, + me->_events.push(PatchageEvent(me->_app, PatchageEvent::PORT_DESTRUCTION, port_id)); } } @@ -367,11 +367,11 @@ JackDriver::jack_graph_order_cb(void* jack_driver) { assert(jack_driver); JackDriver* me = reinterpret_cast<JackDriver*>(jack_driver); - assert(me->m_client); + assert(me->_client); - jack_reset_max_delayed_usecs(me->m_client); + jack_reset_max_delayed_usecs(me->_client); - me->m_is_dirty = true; + me->_is_dirty = true; return 0; } @@ -382,15 +382,15 @@ JackDriver::jack_buffer_size_cb(jack_nframes_t buffer_size, void* jack_driver) { assert(jack_driver); JackDriver* me = reinterpret_cast<JackDriver*>(jack_driver); - assert(me->m_client); + assert(me->_client); - jack_reset_max_delayed_usecs(me->m_client); + jack_reset_max_delayed_usecs(me->_client); - //(me->m_mutex).lock(); - me->m_buffer_size = buffer_size; + //(me->_mutex).lock(); + me->_buffer_size = buffer_size; me->reset_xruns(); me->reset_delay(); - //(me->m_mutex).unlock(); + //(me->_mutex).unlock(); return 0; } @@ -401,18 +401,18 @@ JackDriver::jack_xrun_cb(void* jack_driver) { assert(jack_driver); JackDriver* me = reinterpret_cast<JackDriver*>(jack_driver); - assert(me->m_client); + assert(me->_client); - //(me->m_mutex).lock(); - me->m_xruns++; - me->m_xrun_delay = jack_get_xrun_delayed_usecs(me->m_client); - jack_reset_max_delayed_usecs(me->m_client); + //(me->_mutex).lock(); + me->_xruns++; + me->_xrun_delay = jack_get_xrun_delayed_usecs(me->_client); + jack_reset_max_delayed_usecs(me->_client); - //cerr << "** XRUN Delay = " << me->m_xrun_delay << endl; + //cerr << "** XRUN Delay = " << me->_xrun_delay << endl; - me->m_is_dirty = true; + me->_is_dirty = true; - //(me->m_mutex).unlock(); + //(me->_mutex).unlock(); return 0; } @@ -423,14 +423,14 @@ JackDriver::jack_shutdown_cb(void* jack_driver) { assert(jack_driver); JackDriver* me = reinterpret_cast<JackDriver*>(jack_driver); - assert(me->m_client); + assert(me->_client); - jack_reset_max_delayed_usecs(me->m_client); + jack_reset_max_delayed_usecs(me->_client); - //(me->m_mutex).lock(); - me->m_client = NULL; - me->m_is_dirty = true; - //(me->m_mutex).unlock(); + //(me->_mutex).lock(); + me->_client = NULL; + me->_is_dirty = true; + //(me->_mutex).unlock(); } @@ -444,18 +444,18 @@ JackDriver::error_cb(const char* msg) jack_nframes_t JackDriver::buffer_size() { - if (m_is_activated) - return m_buffer_size; + if (_is_activated) + return _buffer_size; else - return jack_get_buffer_size(m_client); + return jack_get_buffer_size(_client); } void JackDriver::reset_xruns() { - m_xruns = 0; - m_xrun_delay = 0; + _xruns = 0; + _xrun_delay = 0; } @@ -466,13 +466,13 @@ JackDriver::set_buffer_size(jack_nframes_t size) return true; } - if (!m_client) { - m_buffer_size = size; + if (!_client) { + _buffer_size = size; return true; } - if (jack_set_buffer_size(m_client, size)) { - m_app->status_message("[JACK] ERROR: Unable to set buffer size"); + if (jack_set_buffer_size(_client, size)) { + _app->status_message("[JACK] ERROR: Unable to set buffer size"); return false; } else { return true; @@ -483,14 +483,14 @@ 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(m_client); + pthread_t jack_thread = jack_client_thread_id(_client); if (realtime) if (jack_acquire_real_time_scheduling(jack_thread, priority)) - m_app->status_message("[JACK] ERROR: Unable to set real-time priority"); + _app->status_message("[JACK] ERROR: Unable to set real-time priority"); else if (jack_drop_real_time_scheduling(jack_thread)) - m_app->status_message("[JACK] ERROR: Unable to drop real-time priority"); + _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 2df9789..4ac8467 100644 --- a/src/JackDriver.h +++ b/src/JackDriver.h @@ -47,10 +47,10 @@ public: void attach(bool launch_daemon); void detach(); - bool is_attached() const { return (m_client != NULL); } - bool is_realtime() const { return m_client && jack_is_realtime(m_client); } + bool is_attached() const { return (_client != NULL); } + bool is_realtime() const { return _client && jack_is_realtime(_client); } - Raul::SRSWQueue<PatchageEvent>& events() { return m_events; } + Raul::SRSWQueue<PatchageEvent>& events() { return _events; } void refresh(); @@ -60,31 +60,31 @@ public: bool disconnect(boost::shared_ptr<PatchagePort> src, boost::shared_ptr<PatchagePort> dst); - void start_transport() { jack_transport_start(m_client); } - void stop_transport() { jack_transport_stop(m_client); } + void start_transport() { jack_transport_start(_client); } + void stop_transport() { jack_transport_stop(_client); } void reset_xruns(); - void reset_delay() { jack_reset_max_delayed_usecs(m_client); } + void reset_delay() { jack_reset_max_delayed_usecs(_client); } void rewind_transport() { jack_position_t zero; zero.frame = 0; zero.valid = (jack_position_bits_t)0; - jack_transport_reposition(m_client, &zero); + jack_transport_reposition(_client, &zero); } - jack_client_t* client() { return m_client; } + jack_client_t* client() { return _client; } jack_nframes_t buffer_size(); bool set_buffer_size(jack_nframes_t size); - inline float sample_rate() { return jack_get_sample_rate(m_client); } + inline float sample_rate() { return jack_get_sample_rate(_client); } void set_realtime(bool realtime, int priority=80); - inline size_t xruns() { return m_xruns; } + inline size_t xruns() { return _xruns; } - inline float max_delay() { return jack_get_max_delayed_usecs(m_client); } + inline float max_delay() { return jack_get_max_delayed_usecs(_client); } boost::shared_ptr<PatchagePort> create_port(boost::shared_ptr<PatchageModule> parent, jack_port_t* port); @@ -103,16 +103,16 @@ private: static int jack_xrun_cb(void* me); static void jack_shutdown_cb(void* me); - Patchage* m_app; - jack_client_t* m_client; + Patchage* _app; + jack_client_t* _client; - Raul::SRSWQueue<PatchageEvent> m_events; + Raul::SRSWQueue<PatchageEvent> _events; - bool m_is_activated; - jack_position_t m_last_pos; - jack_nframes_t m_buffer_size; - size_t m_xruns; - float m_xrun_delay; + bool _is_activated; + jack_position_t _last_pos; + jack_nframes_t _buffer_size; + size_t _xruns; + float _xrun_delay; }; diff --git a/src/LashDriver.cpp b/src/LashDriver.cpp index 147cb1c..ba8a732 100644 --- a/src/LashDriver.cpp +++ b/src/LashDriver.cpp @@ -26,18 +26,18 @@ using std::string; LashDriver::LashDriver(Patchage* app, int argc, char** argv) -: m_app(app), - m_client(NULL), - m_args(NULL) +: _app(app), + _client(NULL), + _args(NULL) { - m_args = lash_extract_args(&argc, &argv); + _args = lash_extract_args(&argc, &argv); } LashDriver::~LashDriver() { - if (m_args) - lash_args_destroy(m_args); + if (_args) + lash_args_destroy(_args); } @@ -45,21 +45,21 @@ void LashDriver::attach(bool launch_daemon) { // Already connected - if (m_client) + if (_client) return; int lash_flags = LASH_Server_Interface | LASH_Config_File; if (!launch_daemon) lash_flags |= LASH_No_Start_Server; - m_client = lash_init(m_args, PACKAGE_NAME, lash_flags, LASH_PROTOCOL(2, 0)); - if (!m_client) { - m_app->status_message("[LASH] Unable to attach to server"); + _client = lash_init(_args, PACKAGE_NAME, lash_flags, LASH_PROTOCOL(2, 0)); + if (!_client) { + _app->status_message("[LASH] Unable to attach to server"); } else { //lash_event_t* event = lash_event_new_with_type(LASH_Client_Name); //lash_event_set_string(event, "Patchage"); - //lash_send_event(m_client, event); + //lash_send_event(_client, event); signal_attached.emit(); - m_app->status_message("[LASH] Attached"); + _app->status_message("[LASH] Attached"); } } @@ -67,8 +67,8 @@ LashDriver::attach(bool launch_daemon) void LashDriver::detach() { - m_client = NULL; - m_app->status_message("[LASH] Detached"); + _client = NULL; + _app->status_message("[LASH] Detached"); signal_detached.emit(); } @@ -80,13 +80,13 @@ LashDriver::process_events() lash_config_t* conf = NULL; // Process events - while ((ev = lash_get_event(m_client)) != NULL) { + while ((ev = lash_get_event(_client)) != NULL) { handle_event(ev); lash_event_destroy(ev); } // Process configs - while ((conf = lash_get_config(m_client)) != NULL) { + while ((conf = lash_get_config(_client)) != NULL) { handle_config(conf); lash_config_destroy(conf); } @@ -144,27 +144,27 @@ LashDriver::handle_event(lash_event_t* ev) break; case LASH_Save_File: cout << "[LashDriver] LASH Save File - " << str << endl; - m_app->store_window_location(); - m_app->state_manager()->save(str.append("/locations")); - lash_send_event(m_client, lash_event_new_with_type(LASH_Save_File)); + _app->store_window_location(); + _app->state_manager()->save(str.append("/locations")); + lash_send_event(_client, lash_event_new_with_type(LASH_Save_File)); break; case LASH_Restore_File: cout << "[LashDriver] LASH Restore File - " << str << endl; - m_app->state_manager()->load(str.append("/locations")); - m_app->update_state(); - lash_send_event(m_client, lash_event_new_with_type(LASH_Restore_File)); + _app->state_manager()->load(str.append("/locations")); + _app->update_state(); + lash_send_event(_client, lash_event_new_with_type(LASH_Restore_File)); break; case LASH_Save_Data_Set: cout << "[LashDriver] LASH Save Data Set - " << endl; - lash_send_event(m_client, lash_event_new_with_type(LASH_Save_Data_Set)); + lash_send_event(_client, lash_event_new_with_type(LASH_Save_Data_Set)); break; case LASH_Quit: cout << "[LashDriver] Quit" << endl; - m_client = NULL; - m_app->quit(); + _client = NULL; + _app->quit(); break; } } diff --git a/src/LashDriver.h b/src/LashDriver.h index 9f361d7..be4827e 100644 --- a/src/LashDriver.h +++ b/src/LashDriver.h @@ -31,7 +31,7 @@ public: void attach(bool launch_daemon); void detach(); - bool is_attached() const { return lash_enabled(m_client); } + bool is_attached() const { return lash_enabled(_client); } bool connect(boost::shared_ptr<PatchagePort>, boost::shared_ptr<PatchagePort>) { return false; } @@ -44,9 +44,9 @@ public: void process_events(); private: - Patchage* m_app; - lash_client_t* m_client; - lash_args_t* m_args; + Patchage* _app; + lash_client_t* _client; + lash_args_t* _args; void handle_event(lash_event_t* conf); void handle_config(lash_config_t* conf); diff --git a/src/Patchage.cpp b/src/Patchage.cpp index b7f601c..5b3ea91 100644 --- a/src/Patchage.cpp +++ b/src/Patchage.cpp @@ -73,35 +73,35 @@ gtkmm_set_width_for_given_text (Gtk::Widget &w, const gchar *text, Patchage::Patchage(int argc, char** argv) -: m_pane_closed(false), - m_update_pane_position(true), - m_user_pane_position(0), +: _pane_closed(false), + _update_pane_position(true), + _user_pane_position(0), #ifdef HAVE_LASH - m_lash_driver(NULL), + _lash_driver(NULL), #endif #ifdef HAVE_ALSA - m_alsa_driver(NULL), + _alsa_driver(NULL), #endif - m_jack_driver(NULL), - m_state_manager(NULL), - m_refresh(false) + _jack_driver(NULL), + _state_manager(NULL), + _refresh(false) { - m_settings_filename = getenv("HOME"); - m_settings_filename += "/.patchagerc"; + _settings_filename = getenv("HOME"); + _settings_filename += "/.patchagerc"; - 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)); + _state_manager = new StateManager(); + _canvas = boost::shared_ptr<PatchageFlowCanvas>(new PatchageFlowCanvas(this, 1600*2, 1200*2)); + _jack_driver = new JackDriver(this); + _jack_driver->signal_detached.connect(sigc::mem_fun(this, &Patchage::queue_refresh)); #ifdef HAVE_ALSA - m_alsa_driver = new AlsaDriver(this); + _alsa_driver = new AlsaDriver(this); #endif - m_state_manager->load(m_settings_filename); + _state_manager->load(_settings_filename); #ifdef HAVE_LASH - m_lash_driver = new LashDriver(this, argc, argv); + _lash_driver = new LashDriver(this, argc, argv); #endif Glib::RefPtr<Gnome::Glade::Xml> xml; @@ -129,127 +129,127 @@ Patchage::Patchage(int argc, char** argv) throw; } - xml->get_widget("patchage_win", m_main_window); - xml->get_widget_derived("jack_settings_win", m_jack_settings_dialog); - xml->get_widget("about_win", m_about_window); - xml->get_widget("jack_settings_menuitem", m_menu_jack_settings); - xml->get_widget("launch_jack_menuitem", m_menu_jack_launch); - xml->get_widget("connect_to_jack_menuitem", m_menu_jack_connect); - xml->get_widget("disconnect_from_jack_menuitem", m_menu_jack_disconnect); + xml->get_widget("patchage_win", _main_window); + xml->get_widget_derived("jack_settings_win", _jack_settings_dialog); + xml->get_widget("about_win", _about_window); + xml->get_widget("jack_settings_menuitem", _menu_jack_settings); + xml->get_widget("launch_jack_menuitem", _menu_jack_launch); + xml->get_widget("connect_to_jack_menuitem", _menu_jack_connect); + xml->get_widget("disconnect_from_jack_menuitem", _menu_jack_disconnect); #ifdef HAVE_LASH - xml->get_widget("open_session_menuitem", m_menu_open_session); - xml->get_widget("save_session_menuitem", m_menu_save_session); - xml->get_widget("save_session_as_menuitem", m_menu_save_session_as); - xml->get_widget("launch_lash_menuitem", m_menu_lash_launch); - xml->get_widget("connect_to_lash_menuitem", m_menu_lash_connect); - xml->get_widget("disconnect_from_lash_menuitem", m_menu_lash_disconnect); + xml->get_widget("open_session_menuitem", _menu_open_session); + xml->get_widget("save_session_menuitem", _menu_save_session); + xml->get_widget("save_session_as_menuitem", _menu_save_session_as); + xml->get_widget("launch_lash_menuitem", _menu_lash_launch); + xml->get_widget("connect_to_lash_menuitem", _menu_lash_connect); + xml->get_widget("disconnect_from_lash_menuitem", _menu_lash_disconnect); #endif #ifdef HAVE_ALSA - xml->get_widget("connect_to_alsa_menuitem", m_menu_alsa_connect); - xml->get_widget("disconnect_from_alsa_menuitem", m_menu_alsa_disconnect); + xml->get_widget("connect_to_alsa_menuitem", _menu_alsa_connect); + xml->get_widget("disconnect_from_alsa_menuitem", _menu_alsa_disconnect); #endif - xml->get_widget("store_positions_menuitem", m_menu_store_positions); - xml->get_widget("file_quit_menuitem", m_menu_file_quit); - xml->get_widget("view_refresh_menuitem", m_menu_view_refresh); - xml->get_widget("view_messages_menuitem", m_menu_view_messages); - xml->get_widget("help_about_menuitem", m_menu_help_about); - xml->get_widget("canvas_scrolledwindow", m_canvas_scrolledwindow); - xml->get_widget("zoom_scale", m_zoom_slider); - xml->get_widget("status_text", m_status_text); - xml->get_widget("main_paned", m_main_paned); - xml->get_widget("messages_expander", m_messages_expander); - xml->get_widget("rewind_but", m_rewind_button); - xml->get_widget("play_but", m_play_button); - xml->get_widget("stop_but", m_stop_button); - xml->get_widget("zoom_full_but", m_zoom_full_button); - xml->get_widget("zoom_normal_but", m_zoom_normal_button); - //xml->get_widget("main_statusbar", m_status_bar); - //xml->get_widget("main_load_progress", m_load_progress_bar); - xml->get_widget("main_jack_connect_toggle", m_jack_connect_toggle); - xml->get_widget("main_jack_realtime_check", m_jack_realtime_check); - xml->get_widget("main_buffer_size_combo", m_buffer_size_combo); - xml->get_widget("main_sample_rate_label", m_sample_rate_label); - xml->get_widget("main_xrun_progress", m_xrun_progress_bar); - xml->get_widget("main_xrun_counter", m_xrun_counter); - xml->get_widget("main_clear_load_button", m_clear_load_button); + xml->get_widget("store_positions_menuitem", _menu_store_positions); + xml->get_widget("file_quit_menuitem", _menu_file_quit); + xml->get_widget("view_refresh_menuitem", _menu_view_refresh); + xml->get_widget("view_messages_menuitem", _menu_view_messages); + xml->get_widget("help_about_menuitem", _menu_help_about); + xml->get_widget("canvas_scrolledwindow", _canvas_scrolledwindow); + xml->get_widget("zoom_scale", _zoom_slider); + xml->get_widget("status_text", _status_text); + xml->get_widget("main_paned", _main_paned); + xml->get_widget("messages_expander", _messages_expander); + xml->get_widget("rewind_but", _rewind_button); + xml->get_widget("play_but", _play_button); + xml->get_widget("stop_but", _stop_button); + xml->get_widget("zoom_full_but", _zoom_full_button); + xml->get_widget("zoom_normal_but", _zoom_normal_button); + //xml->get_widget("main_statusbar", _status_bar); + //xml->get_widget("main_load_progress", _load_progress_bar); + xml->get_widget("main_jack_connect_toggle", _jack_connect_toggle); + xml->get_widget("main_jack_realtime_check", _jack_realtime_check); + xml->get_widget("main_buffer_size_combo", _buffer_size_combo); + xml->get_widget("main_sample_rate_label", _sample_rate_label); + xml->get_widget("main_xrun_progress", _xrun_progress_bar); + xml->get_widget("main_xrun_counter", _xrun_counter); + xml->get_widget("main_clear_load_button", _clear_load_button); - gtkmm_set_width_for_given_text(*m_buffer_size_combo, "4096", 40); + gtkmm_set_width_for_given_text(*_buffer_size_combo, "4096", 40); //gtkmm_set_width_for_given_text(*m_sample_rate_combo, "44.1", 40); - m_canvas_scrolledwindow->add(*m_canvas); - //m_canvas_scrolledwindow->signal_event().connect(sigc::mem_fun(m_canvas, &FlowCanvas::scroll_event_handler)); - m_canvas->scroll_to(static_cast<int>(m_canvas->width()/2 - 320), - static_cast<int>(m_canvas->height()/2 - 240)); // FIXME: hardcoded + _canvas_scrolledwindow->add(*_canvas); + //m_canvas_scrolledwindow->signal_event().connect(sigc::mem_fun(_canvas, &FlowCanvas::scroll_event_handler)); + _canvas->scroll_to(static_cast<int>(_canvas->width()/2 - 320), + static_cast<int>(_canvas->height()/2 - 240)); // FIXME: hardcoded - m_zoom_slider->signal_value_changed().connect(sigc::mem_fun(this, &Patchage::zoom_changed)); + _zoom_slider->signal_value_changed().connect(sigc::mem_fun(this, &Patchage::zoom_changed)); - m_jack_connect_toggle->signal_toggled().connect(sigc::mem_fun(this, &Patchage::jack_connect_changed)); + _jack_connect_toggle->signal_toggled().connect(sigc::mem_fun(this, &Patchage::jack_connect_changed)); - m_buffer_size_combo->signal_changed().connect(sigc::mem_fun(this, &Patchage::buffer_size_changed)); + _buffer_size_combo->signal_changed().connect(sigc::mem_fun(this, &Patchage::buffer_size_changed)); //m_sample_rate_combo->signal_changed().connect(sigc::mem_fun(this, &Patchage::sample_rate_changed)); - m_jack_realtime_check->signal_toggled().connect(sigc::mem_fun(this, &Patchage::realtime_changed)); + _jack_realtime_check->signal_toggled().connect(sigc::mem_fun(this, &Patchage::realtime_changed)); - m_rewind_button->signal_clicked().connect(sigc::mem_fun(m_jack_driver, &JackDriver::rewind_transport)); - m_play_button->signal_clicked().connect(sigc::mem_fun(m_jack_driver, &JackDriver::start_transport)); - m_stop_button->signal_clicked().connect(sigc::mem_fun(m_jack_driver, &JackDriver::stop_transport)); + _rewind_button->signal_clicked().connect(sigc::mem_fun(_jack_driver, &JackDriver::rewind_transport)); + _play_button->signal_clicked().connect(sigc::mem_fun(_jack_driver, &JackDriver::start_transport)); + _stop_button->signal_clicked().connect(sigc::mem_fun(_jack_driver, &JackDriver::stop_transport)); - m_clear_load_button->signal_clicked().connect(sigc::mem_fun(this, &Patchage::clear_load)); + _clear_load_button->signal_clicked().connect(sigc::mem_fun(this, &Patchage::clear_load)); - m_zoom_normal_button->signal_clicked().connect(sigc::bind( + _zoom_normal_button->signal_clicked().connect(sigc::bind( sigc::mem_fun(this, &Patchage::zoom), 1.0)); - m_zoom_full_button->signal_clicked().connect(sigc::mem_fun(m_canvas.get(), &PatchageFlowCanvas::zoom_full)); + _zoom_full_button->signal_clicked().connect(sigc::mem_fun(_canvas.get(), &PatchageFlowCanvas::zoom_full)); - m_menu_jack_settings->signal_activate().connect( - sigc::hide_return(sigc::mem_fun(m_jack_settings_dialog, &JackSettingsDialog::run))); + _menu_jack_settings->signal_activate().connect( + sigc::hide_return(sigc::mem_fun(_jack_settings_dialog, &JackSettingsDialog::run))); - m_menu_jack_launch->signal_activate().connect(sigc::bind( - sigc::mem_fun(m_jack_driver, &JackDriver::attach), true)); + _menu_jack_launch->signal_activate().connect(sigc::bind( + sigc::mem_fun(_jack_driver, &JackDriver::attach), true)); - m_menu_jack_connect->signal_activate().connect(sigc::bind( - sigc::mem_fun(m_jack_driver, &JackDriver::attach), false)); + _menu_jack_connect->signal_activate().connect(sigc::bind( + sigc::mem_fun(_jack_driver, &JackDriver::attach), false)); - m_menu_jack_disconnect->signal_activate().connect(sigc::mem_fun(m_jack_driver, &JackDriver::detach)); + _menu_jack_disconnect->signal_activate().connect(sigc::mem_fun(_jack_driver, &JackDriver::detach)); #ifdef HAVE_LASH - m_menu_open_session->signal_activate().connect( sigc::mem_fun(this, &Patchage::menu_open_session)); - m_menu_save_session->signal_activate().connect( sigc::mem_fun(this, &Patchage::menu_save_session)); - m_menu_save_session_as->signal_activate().connect(sigc::mem_fun(this, &Patchage::menu_save_session_as)); - m_menu_lash_launch->signal_activate().connect( sigc::mem_fun(this, &Patchage::menu_lash_launch)); - m_menu_lash_connect->signal_activate().connect( sigc::mem_fun(this, &Patchage::menu_lash_connect)); - m_menu_lash_disconnect->signal_activate().connect(sigc::mem_fun(this, &Patchage::menu_lash_disconnect)); + _menu_open_session->signal_activate().connect( sigc::mem_fun(this, &Patchage::menu_open_session)); + _menu_save_session->signal_activate().connect( sigc::mem_fun(this, &Patchage::menu_save_session)); + _menu_save_session_as->signal_activate().connect(sigc::mem_fun(this, &Patchage::menu_save_session_as)); + _menu_lash_launch->signal_activate().connect( sigc::mem_fun(this, &Patchage::menu_lash_launch)); + _menu_lash_connect->signal_activate().connect( sigc::mem_fun(this, &Patchage::menu_lash_connect)); + _menu_lash_disconnect->signal_activate().connect(sigc::mem_fun(this, &Patchage::menu_lash_disconnect)); #endif #ifdef HAVE_ALSA - m_menu_alsa_connect->signal_activate().connect( sigc::mem_fun(this, &Patchage::menu_alsa_connect)); - m_menu_alsa_disconnect->signal_activate().connect(sigc::mem_fun(this, &Patchage::menu_alsa_disconnect)); + _menu_alsa_connect->signal_activate().connect( sigc::mem_fun(this, &Patchage::menu_alsa_connect)); + _menu_alsa_disconnect->signal_activate().connect(sigc::mem_fun(this, &Patchage::menu_alsa_disconnect)); #endif - m_menu_store_positions->signal_activate().connect(sigc::mem_fun(this, &Patchage::menu_store_positions)); - m_menu_file_quit->signal_activate().connect( sigc::mem_fun(this, &Patchage::menu_file_quit)); - m_menu_view_refresh->signal_activate().connect( sigc::mem_fun(this, &Patchage::menu_view_refresh)); - m_menu_view_messages->signal_toggled().connect( sigc::mem_fun(this, &Patchage::show_messages_toggled)); - m_menu_help_about->signal_activate().connect( sigc::mem_fun(this, &Patchage::menu_help_about)); + _menu_store_positions->signal_activate().connect(sigc::mem_fun(this, &Patchage::menu_store_positions)); + _menu_file_quit->signal_activate().connect( sigc::mem_fun(this, &Patchage::menu_file_quit)); + _menu_view_refresh->signal_activate().connect( sigc::mem_fun(this, &Patchage::menu_view_refresh)); + _menu_view_messages->signal_toggled().connect( sigc::mem_fun(this, &Patchage::show_messages_toggled)); + _menu_help_about->signal_activate().connect( sigc::mem_fun(this, &Patchage::menu_help_about)); connect_widgets(); update_state(); - m_canvas->show(); + _canvas->show(); - m_main_window->present(); + _main_window->present(); - m_update_pane_position = false; - m_main_paned->set_position(max_pane_position()); + _update_pane_position = false; + _main_paned->set_position(max_pane_position()); - m_main_paned->property_position().signal_changed().connect( + _main_paned->property_position().signal_changed().connect( sigc::mem_fun(*this, &Patchage::on_pane_position_changed)); - m_messages_expander->property_expanded().signal_changed().connect( + _messages_expander->property_expanded().signal_changed().connect( sigc::mem_fun(*this, &Patchage::on_messages_expander_changed)); - m_main_paned->set_position(max_pane_position()); - m_user_pane_position = max_pane_position() - m_main_window->get_height()/8; - m_update_pane_position = true; - m_pane_closed = true; + _main_paned->set_position(max_pane_position()); + _user_pane_position = max_pane_position() - _main_window->get_height()/8; + _update_pane_position = true; + _pane_closed = true; // Idle callback, check if we need to refresh Glib::signal_timeout().connect(sigc::mem_fun(this, &Patchage::idle_callback), 100); @@ -261,27 +261,27 @@ Patchage::Patchage(int argc, char** argv) Patchage::~Patchage() { - delete m_jack_driver; + delete _jack_driver; #ifdef HAVE_ALSA - delete m_alsa_driver; + delete _alsa_driver; #endif #ifdef HAVE_LASH - delete m_lash_driver; + delete _lash_driver; #endif - delete m_state_manager; + delete _state_manager; } void Patchage::attach() { - m_jack_driver->attach(true); + _jack_driver->attach(true); #ifdef HAVE_LASH - m_lash_driver->attach(true); + _lash_driver->attach(true); #endif #ifdef HAVE_ALSA - m_alsa_driver->attach(); + _alsa_driver->attach(); #endif menu_view_refresh(); @@ -295,40 +295,40 @@ Patchage::attach() bool Patchage::idle_callback() { - if (m_jack_driver) { - while (!m_jack_driver->events().empty()) { - PatchageEvent& ev = m_jack_driver->events().front(); - m_jack_driver->events().pop(); + if (_jack_driver) { + while (!_jack_driver->events().empty()) { + PatchageEvent& ev = _jack_driver->events().front(); + _jack_driver->events().pop(); ev.execute(); } } - bool refresh = m_refresh; + bool refresh = _refresh; - refresh = refresh || (m_jack_driver && m_jack_driver->is_dirty()); + refresh = refresh || (_jack_driver && _jack_driver->is_dirty()); #ifdef HAVE_ALSA - refresh = refresh || (m_alsa_driver && m_alsa_driver->is_dirty()); + refresh = refresh || (_alsa_driver && _alsa_driver->is_dirty()); #endif if (refresh) { - m_canvas->flag_all_connections(); + _canvas->flag_all_connections(); - m_jack_driver->refresh(); + _jack_driver->refresh(); #ifdef HAVE_ALSA - m_alsa_driver->refresh(); + _alsa_driver->refresh(); #endif } #ifdef HAVE_LASH - if (m_lash_driver->is_attached()) - m_lash_driver->process_events(); + if (_lash_driver->is_attached()) + _lash_driver->process_events(); #endif if (refresh) { - m_canvas->destroy_all_flagged_connections(); - m_refresh = false; + _canvas->destroy_all_flagged_connections(); + _refresh = false; } update_load(); @@ -340,30 +340,30 @@ Patchage::idle_callback() void Patchage::update_toolbar() { - m_jack_connect_toggle->set_active(m_jack_driver->is_attached()); - m_jack_realtime_check->set_active(m_jack_driver->is_realtime()); + _jack_connect_toggle->set_active(_jack_driver->is_attached()); + _jack_realtime_check->set_active(_jack_driver->is_realtime()); - if (m_jack_driver->is_attached()) { - m_buffer_size_combo->set_active((int)log2f(m_jack_driver->buffer_size()) - 5); + if (_jack_driver->is_attached()) { + _buffer_size_combo->set_active((int)log2f(_jack_driver->buffer_size()) - 5); /*switch ((int)m_jack_driver->sample_rate()) { case 44100: - m_sample_rate_combo->set_active(0); + _sample_rate_combo->set_active(0); break; case 48000: - m_sample_rate_combo->set_active(1); + _sample_rate_combo->set_active(1); break; case 96000: - m_sample_rate_combo->set_active(2); + _sample_rate_combo->set_active(2); break; default: - m_sample_rate_combo->set_active(-1); + _sample_rate_combo->set_active(-1); status_message("[JACK] ERROR: Unknown sample rate"); break; }*/ stringstream srate; - srate << m_jack_driver->sample_rate()/1000.0; - m_sample_rate_label->set_text(srate.str()); + srate << _jack_driver->sample_rate()/1000.0; + _sample_rate_label->set_text(srate.str()); } } @@ -371,16 +371,16 @@ Patchage::update_toolbar() bool Patchage::update_load() { - if (!m_jack_driver->is_attached()) + if (!_jack_driver->is_attached()) return true; static float last_delay = 0; - const float max_delay = m_jack_driver->max_delay(); + const float max_delay = _jack_driver->max_delay(); if (max_delay != last_delay) { - const float sample_rate = m_jack_driver->sample_rate(); - const float buffer_size = m_jack_driver->buffer_size(); + const float sample_rate = _jack_driver->sample_rate(); + const float buffer_size = _jack_driver->buffer_size(); const float period = buffer_size / sample_rate * 1000000; // usecs /* if (max_delay > 0) { @@ -388,17 +388,17 @@ Patchage::update_load() << ", MD: " << max_delay << endl; }*/ - m_xrun_progress_bar->set_fraction(max_delay / period); + _xrun_progress_bar->set_fraction(max_delay / period); char tmp_buf[8]; - snprintf(tmp_buf, 8, "%zd", m_jack_driver->xruns()); + snprintf(tmp_buf, 8, "%zd", _jack_driver->xruns()); //m_xrun_progress_bar->set_text(string(tmp_buf) + " XRuns"); - m_xrun_counter->set_text(tmp_buf); + _xrun_counter->set_text(tmp_buf); if (max_delay > period) { - m_xrun_progress_bar->set_fraction(1.0); - m_jack_driver->reset_delay(); + _xrun_progress_bar->set_fraction(1.0); + _jack_driver->reset_delay(); } last_delay = max_delay; @@ -411,8 +411,8 @@ Patchage::update_load() void Patchage::zoom(double z) { - m_state_manager->set_zoom(z); - m_canvas->set_zoom(z); + _state_manager->set_zoom(z); + _canvas->set_zoom(z); } @@ -422,7 +422,7 @@ Patchage::zoom_changed() static bool enable_signal = true; if (enable_signal) { enable_signal = false; - zoom(m_zoom_slider->get_value()); + zoom(_zoom_slider->get_value()); enable_signal = true; } } @@ -431,33 +431,33 @@ Patchage::zoom_changed() void Patchage::update_state() { - for (ModuleMap::iterator i = m_canvas->modules().begin(); i != m_canvas->modules().end(); ++i) + for (ModuleMap::iterator i = _canvas->modules().begin(); i != _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: (" << _state_manager->get_window_size().x + // << "," << _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)); + _main_window->resize( + static_cast<int>(_state_manager->get_window_size().x), + static_cast<int>(_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: (" << _state_manager->get_window_location().x + // << "," << _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)); + _main_window->move( + static_cast<int>(_state_manager->get_window_location().x), + static_cast<int>(_state_manager->get_window_location().y)); } void Patchage::status_message(const string& msg) { - if (m_status_text->get_buffer()->size() > 0) - m_status_text->get_buffer()->insert(m_status_text->get_buffer()->end(), "\n"); + if (_status_text->get_buffer()->size() > 0) + _status_text->get_buffer()->insert(_status_text->get_buffer()->end(), "\n"); - m_status_text->get_buffer()->insert(m_status_text->get_buffer()->end(), msg); - m_status_text->scroll_to_mark(m_status_text->get_buffer()->get_insert(), 0); + _status_text->get_buffer()->insert(_status_text->get_buffer()->end(), msg); + _status_text->scroll_to_mark(_status_text->get_buffer()->get_insert(), 0); } @@ -469,53 +469,53 @@ void Patchage::connect_widgets() { #ifdef HAVE_LASH - m_lash_driver->signal_attached.connect(sigc::bind( - sigc::mem_fun(m_menu_lash_launch, &Gtk::MenuItem::set_sensitive), false)); - m_lash_driver->signal_attached.connect(sigc::bind( - sigc::mem_fun(m_menu_lash_connect, &Gtk::MenuItem::set_sensitive), false)); - m_lash_driver->signal_attached.connect(sigc::bind( - sigc::mem_fun(m_menu_lash_disconnect, &Gtk::MenuItem::set_sensitive), true)); + _lash_driver->signal_attached.connect(sigc::bind( + sigc::mem_fun(_menu_lash_launch, &Gtk::MenuItem::set_sensitive), false)); + _lash_driver->signal_attached.connect(sigc::bind( + sigc::mem_fun(_menu_lash_connect, &Gtk::MenuItem::set_sensitive), false)); + _lash_driver->signal_attached.connect(sigc::bind( + sigc::mem_fun(_menu_lash_disconnect, &Gtk::MenuItem::set_sensitive), true)); - m_lash_driver->signal_detached.connect(sigc::bind( - sigc::mem_fun(m_menu_lash_launch, &Gtk::MenuItem::set_sensitive), true)); - m_lash_driver->signal_detached.connect(sigc::bind( - sigc::mem_fun(m_menu_lash_connect, &Gtk::MenuItem::set_sensitive), true)); - m_lash_driver->signal_detached.connect(sigc::bind( - sigc::mem_fun(m_menu_lash_disconnect, &Gtk::MenuItem::set_sensitive), false)); + _lash_driver->signal_detached.connect(sigc::bind( + sigc::mem_fun(_menu_lash_launch, &Gtk::MenuItem::set_sensitive), true)); + _lash_driver->signal_detached.connect(sigc::bind( + sigc::mem_fun(_menu_lash_connect, &Gtk::MenuItem::set_sensitive), true)); + _lash_driver->signal_detached.connect(sigc::bind( + sigc::mem_fun(_menu_lash_disconnect, &Gtk::MenuItem::set_sensitive), false)); #endif - m_jack_driver->signal_attached.connect( + _jack_driver->signal_attached.connect( sigc::mem_fun(this, &Patchage::update_toolbar)); - m_jack_driver->signal_attached.connect(sigc::bind( - sigc::mem_fun(m_jack_connect_toggle, &Gtk::ToggleButton::set_active), true)); + _jack_driver->signal_attached.connect(sigc::bind( + sigc::mem_fun(_jack_connect_toggle, &Gtk::ToggleButton::set_active), true)); - m_jack_driver->signal_attached.connect(sigc::bind( - sigc::mem_fun(m_menu_jack_launch, &Gtk::MenuItem::set_sensitive), false)); - m_jack_driver->signal_attached.connect(sigc::bind( - sigc::mem_fun(m_menu_jack_connect, &Gtk::MenuItem::set_sensitive), false)); - m_jack_driver->signal_attached.connect(sigc::bind( - sigc::mem_fun(m_menu_jack_disconnect, &Gtk::MenuItem::set_sensitive), true)); + _jack_driver->signal_attached.connect(sigc::bind( + sigc::mem_fun(_menu_jack_launch, &Gtk::MenuItem::set_sensitive), false)); + _jack_driver->signal_attached.connect(sigc::bind( + sigc::mem_fun(_menu_jack_connect, &Gtk::MenuItem::set_sensitive), false)); + _jack_driver->signal_attached.connect(sigc::bind( + sigc::mem_fun(_menu_jack_disconnect, &Gtk::MenuItem::set_sensitive), true)); - m_jack_driver->signal_detached.connect(sigc::bind( - sigc::mem_fun(m_jack_connect_toggle, &Gtk::ToggleButton::set_active), false)); - m_jack_driver->signal_detached.connect(sigc::bind( - sigc::mem_fun(m_menu_jack_launch, &Gtk::MenuItem::set_sensitive), true)); - m_jack_driver->signal_detached.connect(sigc::bind( - sigc::mem_fun(m_menu_jack_connect, &Gtk::MenuItem::set_sensitive), true)); - m_jack_driver->signal_detached.connect(sigc::bind( - sigc::mem_fun(m_menu_jack_disconnect, &Gtk::MenuItem::set_sensitive), false)); + _jack_driver->signal_detached.connect(sigc::bind( + sigc::mem_fun(_jack_connect_toggle, &Gtk::ToggleButton::set_active), false)); + _jack_driver->signal_detached.connect(sigc::bind( + sigc::mem_fun(_menu_jack_launch, &Gtk::MenuItem::set_sensitive), true)); + _jack_driver->signal_detached.connect(sigc::bind( + sigc::mem_fun(_menu_jack_connect, &Gtk::MenuItem::set_sensitive), true)); + _jack_driver->signal_detached.connect(sigc::bind( + sigc::mem_fun(_menu_jack_disconnect, &Gtk::MenuItem::set_sensitive), false)); #ifdef HAVE_ALSA - m_alsa_driver->signal_attached.connect(sigc::bind( - sigc::mem_fun(m_menu_alsa_connect, &Gtk::MenuItem::set_sensitive), false)); - m_alsa_driver->signal_attached.connect(sigc::bind( - sigc::mem_fun(m_menu_alsa_disconnect, &Gtk::MenuItem::set_sensitive), true)); + _alsa_driver->signal_attached.connect(sigc::bind( + sigc::mem_fun(_menu_alsa_connect, &Gtk::MenuItem::set_sensitive), false)); + _alsa_driver->signal_attached.connect(sigc::bind( + sigc::mem_fun(_menu_alsa_disconnect, &Gtk::MenuItem::set_sensitive), true)); - m_alsa_driver->signal_detached.connect(sigc::bind( - sigc::mem_fun(m_menu_alsa_connect, &Gtk::MenuItem::set_sensitive), true)); - m_alsa_driver->signal_detached.connect(sigc::bind( - sigc::mem_fun(m_menu_alsa_disconnect, &Gtk::MenuItem::set_sensitive), false)); + _alsa_driver->signal_detached.connect(sigc::bind( + sigc::mem_fun(_menu_alsa_connect, &Gtk::MenuItem::set_sensitive), true)); + _alsa_driver->signal_detached.connect(sigc::bind( + sigc::mem_fun(_menu_alsa_disconnect, &Gtk::MenuItem::set_sensitive), false)); #endif } @@ -539,21 +539,21 @@ Patchage::menu_save_session_as() void Patchage::menu_lash_launch() { - m_lash_driver->attach(true); + _lash_driver->attach(true); } void Patchage::menu_lash_connect() { - m_lash_driver->attach(false); + _lash_driver->attach(false); } void Patchage::menu_lash_disconnect() { - m_lash_driver->detach(); + _lash_driver->detach(); } #endif @@ -561,14 +561,14 @@ Patchage::menu_lash_disconnect() void Patchage::menu_alsa_connect() { - m_alsa_driver->attach(false); + _alsa_driver->attach(false); } void Patchage::menu_alsa_disconnect() { - m_alsa_driver->detach(); + _alsa_driver->detach(); menu_view_refresh(); } #endif @@ -577,7 +577,7 @@ void Patchage::menu_store_positions() { store_window_location(); - m_state_manager->save(m_settings_filename); + _state_manager->save(_settings_filename); } @@ -585,10 +585,10 @@ void Patchage::menu_file_quit() { #ifdef HAVE_ALSA - m_alsa_driver->detach(); + _alsa_driver->detach(); #endif - m_jack_driver->detach(); - m_main_window->hide(); + _jack_driver->detach(); + _main_window->hide(); } @@ -596,50 +596,50 @@ void Patchage::on_pane_position_changed() { // avoid infinite recursion... - if (!m_update_pane_position) + if (!_update_pane_position) return; - m_update_pane_position = false; + _update_pane_position = false; - int new_position = m_main_paned->get_position(); + int new_position = _main_paned->get_position(); - if (m_pane_closed && new_position < max_pane_position()) { + if (_pane_closed && new_position < max_pane_position()) { // Auto open - m_user_pane_position = new_position; - m_messages_expander->set_expanded(true); - m_pane_closed = false; - m_menu_view_messages->set_active(true); + _user_pane_position = new_position; + _messages_expander->set_expanded(true); + _pane_closed = false; + _menu_view_messages->set_active(true); } else if (new_position >= max_pane_position()) { // Auto close - m_pane_closed = true; + _pane_closed = true; - m_messages_expander->set_expanded(false); + _messages_expander->set_expanded(false); if (new_position > max_pane_position()) - m_main_paned->set_position(max_pane_position()); // ... here - m_menu_view_messages->set_active(false); + _main_paned->set_position(max_pane_position()); // ... here + _menu_view_messages->set_active(false); - m_user_pane_position = max_pane_position() - m_main_window->get_height()/8; + _user_pane_position = max_pane_position() - _main_window->get_height()/8; } - m_update_pane_position = true; + _update_pane_position = true; } void Patchage::on_messages_expander_changed() { - if (!m_pane_closed) { + if (!_pane_closed) { // Store pane position for restoring - m_user_pane_position = m_main_paned->get_position(); - if (m_update_pane_position) { - m_update_pane_position = false; - m_main_paned->set_position(max_pane_position()); - m_update_pane_position = true; + _user_pane_position = _main_paned->get_position(); + if (_update_pane_position) { + _update_pane_position = false; + _main_paned->set_position(max_pane_position()); + _update_pane_position = true; } - m_pane_closed = true; + _pane_closed = true; } else { - m_main_paned->set_position(m_user_pane_position); - m_pane_closed = false; + _main_paned->set_position(_user_pane_position); + _pane_closed = false; } } @@ -647,24 +647,24 @@ Patchage::on_messages_expander_changed() void Patchage::show_messages_toggled() { - if (m_update_pane_position) - m_messages_expander->set_expanded(m_menu_view_messages->get_active()); + if (_update_pane_position) + _messages_expander->set_expanded(_menu_view_messages->get_active()); } void Patchage::menu_view_refresh() { - assert(m_canvas); + assert(_canvas); - m_canvas->destroy(); + _canvas->destroy(); - if (m_jack_driver) - m_jack_driver->refresh(); + if (_jack_driver) + _jack_driver->refresh(); #ifdef HAVE_ALSA - if (m_alsa_driver) - m_alsa_driver->refresh(); + if (_alsa_driver) + _alsa_driver->refresh(); #endif } @@ -672,7 +672,7 @@ Patchage::menu_view_refresh() void Patchage::menu_help_about() { - m_about_window->show(); + _about_window->show(); } @@ -682,32 +682,32 @@ void Patchage::store_window_location() { int loc_x, loc_y, size_x, size_y; - m_main_window->get_position(loc_x, loc_y); - m_main_window->get_size(size_x, size_y); + _main_window->get_position(loc_x, loc_y); + _main_window->get_size(size_x, size_y); Coord window_location; window_location.x = loc_x; window_location.y = loc_y; Coord window_size; window_size.x = size_x; window_size.y = size_y; - m_state_manager->set_window_location(window_location); - m_state_manager->set_window_size(window_size); + _state_manager->set_window_location(window_location); + _state_manager->set_window_size(window_size); } void Patchage::clear_load() { - m_xrun_progress_bar->set_fraction(0.0); - m_jack_driver->reset_xruns(); - m_jack_driver->reset_delay(); + _xrun_progress_bar->set_fraction(0.0); + _jack_driver->reset_xruns(); + _jack_driver->reset_delay(); } void Patchage::buffer_size_changed() { - const int selected = m_buffer_size_combo->get_active_row_number(); + const int selected = _buffer_size_combo->get_active_row_number(); if (selected == -1) { update_toolbar(); @@ -716,7 +716,7 @@ Patchage::buffer_size_changed() //cerr << "BS Changed: " << selected << ": " << buffer_size << endl; - if ( ! m_jack_driver->set_buffer_size(buffer_size)) + if ( ! _jack_driver->set_buffer_size(buffer_size)) update_toolbar(); // reset combo box to actual value } } @@ -726,7 +726,7 @@ Patchage::buffer_size_changed() void Patchage::sample_rate_changed() { - const int selected = m_sample_rate_combo->get_active_row_number(); + const int selected = _sample_rate_combo->get_active_row_number(); if (selected == -1) { update_toolbar(); @@ -747,20 +747,20 @@ Patchage::sample_rate_changed() void Patchage::realtime_changed() { - m_jack_driver->set_realtime(m_jack_realtime_check->get_active()); + _jack_driver->set_realtime(_jack_realtime_check->get_active()); } void Patchage::jack_connect_changed() { - const bool selected = m_jack_connect_toggle->get_active(); + const bool selected = _jack_connect_toggle->get_active(); - if (selected != m_jack_driver->is_attached()) { + if (selected != _jack_driver->is_attached()) { if (selected) { - m_jack_driver->attach(true); + _jack_driver->attach(true); } else { - m_jack_driver->detach(); + _jack_driver->detach(); } } } diff --git a/src/Patchage.h b/src/Patchage.h index 846f74f..7bc172c 100644 --- a/src/Patchage.h +++ b/src/Patchage.h @@ -38,20 +38,20 @@ public: Patchage(int argc, char** argv); ~Patchage(); - boost::shared_ptr<PatchageFlowCanvas> canvas() { return m_canvas; } + boost::shared_ptr<PatchageFlowCanvas> canvas() { return _canvas; } - StateManager* state_manager() { return m_state_manager; } - Gtk::Window* window() { return m_main_window; } - JackDriver* jack_driver() { return m_jack_driver; } + StateManager* state_manager() { return _state_manager; } + Gtk::Window* window() { return _main_window; } + JackDriver* jack_driver() { return _jack_driver; } #ifdef HAVE_ALSA - AlsaDriver* alsa_driver() { return m_alsa_driver; } + AlsaDriver* alsa_driver() { return _alsa_driver; } #endif #ifdef HAVE_LASH - LashDriver* lash_driver() { return m_lash_driver; } + LashDriver* lash_driver() { return _lash_driver; } #endif void attach(); - void quit() { m_main_window->hide(); } + void quit() { _main_window->hide(); } void clear_load(); @@ -59,10 +59,10 @@ public: void store_window_location(); void status_message(const string& msg); - inline void queue_refresh() { m_refresh = true; } + inline void queue_refresh() { _refresh = true; } int max_pane_position() - { return m_main_paned->property_max_position() - m_messages_expander->get_label_widget()->get_height() - 8; } + { return _main_paned->property_max_position() - _messages_expander->get_label_widget()->get_height() - 8; } protected: void connect_widgets(); @@ -86,18 +86,18 @@ protected: void on_pane_position_changed(); void on_messages_expander_changed(); - bool m_pane_closed; - bool m_update_pane_position; - int m_user_pane_position; + bool _pane_closed; + bool _update_pane_position; + int _user_pane_position; #ifdef HAVE_LASH - LashDriver* m_lash_driver; - Gtk::MenuItem* m_menu_open_session; - Gtk::MenuItem* m_menu_save_session; - Gtk::MenuItem* m_menu_save_session_as; - Gtk::MenuItem* m_menu_lash_launch; - Gtk::MenuItem* m_menu_lash_connect; - Gtk::MenuItem* m_menu_lash_disconnect; + LashDriver* _lash_driver; + Gtk::MenuItem* _menu_open_session; + Gtk::MenuItem* _menu_save_session; + Gtk::MenuItem* _menu_save_session_as; + Gtk::MenuItem* _menu_lash_launch; + Gtk::MenuItem* _menu_lash_connect; + Gtk::MenuItem* _menu_lash_disconnect; void menu_open_session(); void menu_save_session(); void menu_save_session_as(); @@ -107,54 +107,54 @@ protected: #endif #ifdef HAVE_ALSA - AlsaDriver* m_alsa_driver; - Gtk::MenuItem* m_menu_alsa_connect; - Gtk::MenuItem* m_menu_alsa_disconnect; + AlsaDriver* _alsa_driver; + Gtk::MenuItem* _menu_alsa_connect; + Gtk::MenuItem* _menu_alsa_disconnect; void menu_alsa_connect(); void menu_alsa_disconnect(); #endif - boost::shared_ptr<PatchageFlowCanvas> m_canvas; + boost::shared_ptr<PatchageFlowCanvas> _canvas; - JackDriver* m_jack_driver; - StateManager* m_state_manager; + JackDriver* _jack_driver; + StateManager* _state_manager; - Gtk::Main* m_gtk_main; + Gtk::Main* _gtk_main; - string m_settings_filename; - bool m_refresh; + string _settings_filename; + bool _refresh; - Gtk::Window* m_main_window; - JackSettingsDialog* m_jack_settings_dialog; - Gtk::AboutDialog* m_about_window; - Gtk::MenuItem* m_menu_jack_settings; - Gtk::MenuItem* m_menu_jack_launch; - Gtk::MenuItem* m_menu_jack_connect; - Gtk::MenuItem* m_menu_jack_disconnect; - Gtk::MenuItem* m_menu_store_positions; - Gtk::MenuItem* m_menu_file_quit; - Gtk::CheckMenuItem* m_menu_view_messages; - Gtk::MenuItem* m_menu_view_refresh; - Gtk::MenuItem* m_menu_help_about; - Gtk::ScrolledWindow* m_canvas_scrolledwindow; - Gtk::HScale* m_zoom_slider; - Gtk::TextView* m_status_text; - Gtk::Paned* m_main_paned; - Gtk::Expander* m_messages_expander; - Gtk::Button* m_rewind_button; - Gtk::Button* m_play_button; - Gtk::Button* m_stop_button; - Gtk::Button* m_zoom_normal_button; - Gtk::Button* m_zoom_full_button; - //Gtk::ProgressBar* m_load_progress_bar; - Gtk::ToggleButton* m_jack_connect_toggle; - Gtk::ToggleButton* m_jack_realtime_check; - Gtk::ComboBox* m_buffer_size_combo; - Gtk::Label* m_sample_rate_label; - Gtk::ProgressBar* m_xrun_progress_bar; - Gtk::Entry* m_xrun_counter; - Gtk::Button* m_clear_load_button; - //Gtk::Statusbar* m_status_bar; + Gtk::Window* _main_window; + JackSettingsDialog* _jack_settings_dialog; + Gtk::AboutDialog* _about_window; + Gtk::MenuItem* _menu_jack_settings; + Gtk::MenuItem* _menu_jack_launch; + Gtk::MenuItem* _menu_jack_connect; + Gtk::MenuItem* _menu_jack_disconnect; + Gtk::MenuItem* _menu_store_positions; + Gtk::MenuItem* _menu_file_quit; + Gtk::CheckMenuItem* _menu_view_messages; + Gtk::MenuItem* _menu_view_refresh; + Gtk::MenuItem* _menu_help_about; + Gtk::ScrolledWindow* _canvas_scrolledwindow; + Gtk::HScale* _zoom_slider; + Gtk::TextView* _status_text; + Gtk::Paned* _main_paned; + Gtk::Expander* _messages_expander; + Gtk::Button* _rewind_button; + Gtk::Button* _play_button; + Gtk::Button* _stop_button; + Gtk::Button* _zoom_normal_button; + Gtk::Button* _zoom_full_button; + //Gtk::ProgressBar* _load_progress_bar; + Gtk::ToggleButton* _jack_connect_toggle; + Gtk::ToggleButton* _jack_realtime_check; + Gtk::ComboBox* _buffer_size_combo; + Gtk::Label* _sample_rate_label; + Gtk::ProgressBar* _xrun_progress_bar; + Gtk::Entry* _xrun_counter; + Gtk::Button* _clear_load_button; + //Gtk::Statusbar* _status_bar; }; #endif // PATCHAGE_H diff --git a/src/PatchageFlowCanvas.cpp b/src/PatchageFlowCanvas.cpp index f059442..881caf8 100644 --- a/src/PatchageFlowCanvas.cpp +++ b/src/PatchageFlowCanvas.cpp @@ -26,7 +26,7 @@ PatchageFlowCanvas::PatchageFlowCanvas(Patchage* app, int width, int height) : FlowCanvas(width, height), - m_app(app) + _app(app) { } @@ -34,7 +34,7 @@ PatchageFlowCanvas::PatchageFlowCanvas(Patchage* app, int width, int height) boost::shared_ptr<PatchageModule> PatchageFlowCanvas::find_module(const string& name, ModuleType type) { - for (ModuleMap::iterator m = m_modules.begin(); m != m_modules.end(); ++m) { + for (ModuleMap::iterator m = _modules.begin(); m != _modules.end(); ++m) { boost::shared_ptr<PatchageModule> pm = boost::dynamic_pointer_cast<PatchageModule>((*m).second); if (pm && pm->name() == name && pm->type() == type) { return pm; @@ -50,7 +50,7 @@ boost::shared_ptr<PatchagePort> PatchageFlowCanvas::find_port(const snd_seq_addr_t* alsa_addr) { boost::shared_ptr<PatchagePort> pp; - for (ModuleMap::iterator m = m_modules.begin(); m != m_modules.end(); ++m) { + for (ModuleMap::iterator m = _modules.begin(); m != _modules.end(); ++m) { for (PortVector::const_iterator p = (*m).second->ports().begin(); p != (*m).second->ports().end(); ++p) { pp = boost::dynamic_pointer_cast<PatchagePort>(*p); if (pp && pp->type() == ALSA_MIDI && pp->alsa_addr() @@ -74,10 +74,10 @@ PatchageFlowCanvas::connect(boost::shared_ptr<Port> port1, boost::shared_ptr<Por if (p1->type() == JACK_AUDIO && p2->type() == JACK_AUDIO || (p1->type() == JACK_MIDI && p2->type() == JACK_MIDI)) - m_app->jack_driver()->connect(p1, p2); + _app->jack_driver()->connect(p1, p2); #ifdef HAVE_ALSA else if (p1->type() == ALSA_MIDI && p2->type() == ALSA_MIDI) - m_app->alsa_driver()->connect(p1, p2); + _app->alsa_driver()->connect(p1, p2); #endif else status_message("WARNING: Cannot make connection, incompatible port types."); @@ -105,10 +105,10 @@ PatchageFlowCanvas::disconnect(boost::shared_ptr<Port> port1, boost::shared_ptr< if (input->type() == JACK_AUDIO && output->type() == JACK_AUDIO || input->type() == JACK_MIDI && output->type() == JACK_MIDI) - m_app->jack_driver()->disconnect(output, input); + _app->jack_driver()->disconnect(output, input); #ifdef HAVE_ALSA else if (input->type() == ALSA_MIDI && output->type() == ALSA_MIDI) - m_app->alsa_driver()->disconnect(output, input); + _app->alsa_driver()->disconnect(output, input); #endif else status_message("ERROR: Attempt to disconnect ports with mismatched types"); @@ -118,6 +118,6 @@ PatchageFlowCanvas::disconnect(boost::shared_ptr<Port> port1, boost::shared_ptr< void PatchageFlowCanvas::status_message(const string& msg) { - m_app->status_message(string("[Canvas] ").append(msg)); + _app->status_message(string("[Canvas] ").append(msg)); } diff --git a/src/PatchageFlowCanvas.h b/src/PatchageFlowCanvas.h index 6af51f7..f2a126f 100644 --- a/src/PatchageFlowCanvas.h +++ b/src/PatchageFlowCanvas.h @@ -36,7 +36,7 @@ using namespace LibFlowCanvas; class PatchageFlowCanvas : public FlowCanvas { public: - PatchageFlowCanvas(Patchage* m_app, int width, int height); + PatchageFlowCanvas(Patchage* _app, int width, int height); boost::shared_ptr<PatchageModule> find_module(const string& name, ModuleType type); #ifdef HAVE_ALSA @@ -48,7 +48,7 @@ public: void status_message(const string& msg); private: - Patchage* m_app; + Patchage* _app; }; diff --git a/src/PatchageModule.h b/src/PatchageModule.h index cb490ad..6210980 100644 --- a/src/PatchageModule.h +++ b/src/PatchageModule.h @@ -37,10 +37,10 @@ class PatchageModule : public Module public: PatchageModule(Patchage* app, const string& title, ModuleType type, double x=0, double y=0) : Module(app->canvas(), title, x, y), - m_app(app), - m_type(type) + _app(app), + _type(type) { - Gtk::Menu::MenuList& items = m_menu.items(); + Gtk::Menu::MenuList& items = _menu.items(); if (type == InputOutput) { items.push_back(Gtk::Menu_Helpers::MenuElem("Split", sigc::mem_fun(this, &PatchageModule::split))); @@ -56,7 +56,7 @@ public: /*virtual void add_patchage_port(const string& port_name, bool is_input, PortType type) { - new PatchagePort(this, type, port_name, is_input, m_app->state_manager()->get_port_color(type)); + new PatchagePort(this, type, port_name, is_input, _app->state_manager()->get_port_color(type)); resize(); } @@ -64,7 +64,7 @@ public: virtual void add_patchage_port(const string& port_name, bool is_input, PortType type, const snd_seq_addr_t addr) { PatchagePort* port = new PatchagePort(this, type, port_name, is_input, - m_app->state_manager()->get_port_color(type)); + _app->state_manager()->get_port_color(type)); port->alsa_addr(addr); @@ -73,47 +73,47 @@ public: virtual void load_location() { - Coord loc = m_app->state_manager()->get_module_location(m_name, m_type); + Coord loc = _app->state_manager()->get_module_location(_name, _type); - //cerr << "******" << m_name << " MOVING TO (" << loc.x << "," << loc.y << ")" << endl; + //cerr << "******" << _name << " MOVING TO (" << loc.x << "," << loc.y << ")" << endl; if (loc.x != -1) move_to(loc.x, loc.y); else - move_to((m_canvas.lock()->width()/2) - 100 + rand() % 400, - (m_canvas.lock()->height()/2) - 100 + rand() % 400); + move_to((_canvas.lock()->width()/2) - 100 + rand() % 400, + (_canvas.lock()->height()/2) - 100 + rand() % 400); } void split() { - assert(m_type == InputOutput); - m_app->state_manager()->set_module_split(m_name, true); - m_app->queue_refresh(); + assert(_type == InputOutput); + _app->state_manager()->set_module_split(_name, true); + _app->queue_refresh(); } void join() { - assert(m_type != InputOutput); - m_app->state_manager()->set_module_split(m_name, false); - m_app->queue_refresh(); + assert(_type != InputOutput); + _app->state_manager()->set_module_split(_name, false); + _app->queue_refresh(); } virtual void store_location() { Coord loc = { property_x().get_value(), property_y().get_value() }; - m_app->state_manager()->set_module_location(m_name, m_type, loc); + _app->state_manager()->set_module_location(_name, _type, loc); } virtual void show_dialog() {} - virtual void on_right_click(GdkEventButton* ev) { m_menu.popup(ev->button, ev->time); } + virtual void on_right_click(GdkEventButton* ev) { _menu.popup(ev->button, ev->time); } virtual void menu_disconnect_all() { - for (PortVector::iterator p = m_ports.begin(); p != m_ports.end(); ++p) + for (PortVector::iterator p = _ports.begin(); p != _ports.end(); ++p) (*p)->disconnect_all(); } - ModuleType type() { return m_type; } + ModuleType type() { return _type; } protected: - Patchage* m_app; - Gtk::Menu m_menu; - ModuleType m_type; + Patchage* _app; + Gtk::Menu _menu; + ModuleType _type; }; diff --git a/src/PatchagePort.h b/src/PatchagePort.h index 13c51a8..be5ee70 100644 --- a/src/PatchagePort.h +++ b/src/PatchagePort.h @@ -43,11 +43,11 @@ class PatchagePort : public LibFlowCanvas::Port public: PatchagePort(boost::shared_ptr<Module> module, PortType type, const string& name, bool is_input, int color) : Port(module, name, is_input, color), - m_type(type) + _type(type) { #ifdef HAVE_ALSA - m_alsa_addr.client = '\0'; - m_alsa_addr.port = '\0'; + _alsa_addr.client = '\0'; + _alsa_addr.port = '\0'; #endif } @@ -55,20 +55,20 @@ public: #ifdef HAVE_ALSA // FIXME: This driver specific crap really needs to go - void alsa_addr(const snd_seq_addr_t addr) { m_alsa_addr = addr; } + void alsa_addr(const snd_seq_addr_t addr) { _alsa_addr = addr; } const snd_seq_addr_t* alsa_addr() const - { return (m_type == ALSA_MIDI) ? &m_alsa_addr : NULL; } + { return (_type == ALSA_MIDI) ? &_alsa_addr : NULL; } #endif /** Returns the full name of this port, as "modulename:portname" */ - string full_name() const { return m_module.lock()->name() + ":" + m_name; } + string full_name() const { return _module.lock()->name() + ":" + _name; } - PortType type() const { return m_type; } + PortType type() const { return _type; } private: #ifdef HAVE_ALSA - snd_seq_addr_t m_alsa_addr; + snd_seq_addr_t _alsa_addr; #endif - PortType m_type; + PortType _type; }; diff --git a/src/StateManager.cpp b/src/StateManager.cpp index 6228a87..d301fa8 100644 --- a/src/StateManager.cpp +++ b/src/StateManager.cpp @@ -26,18 +26,18 @@ using std::cerr; using std::cout; using std::endl; StateManager::StateManager() { - m_window_location.x = 0; - m_window_location.y = 0; - m_window_size.x = 640; - m_window_size.y = 480; - m_zoom = 1.0; + _window_location.x = 0; + _window_location.y = 0; + _window_size.x = 640; + _window_size.y = 480; + _zoom = 1.0; } Coord StateManager::get_module_location(const string& name, ModuleType type) { - for (std::list<ModuleLocation>::iterator i = m_module_locations.begin(); i != m_module_locations.end(); ++i) { + for (std::list<ModuleLocation>::iterator i = _module_locations.begin(); i != _module_locations.end(); ++i) { if ((*i).name == name && (*i).type == type) return (*i).loc; } @@ -51,7 +51,7 @@ StateManager::get_module_location(const string& name, ModuleType type) void StateManager::set_module_location(const string& name, ModuleType type, Coord loc) { - for (std::list<ModuleLocation>::iterator i = m_module_locations.begin(); i != m_module_locations.end(); ++i) { + for (std::list<ModuleLocation>::iterator i = _module_locations.begin(); i != _module_locations.end(); ++i) { if ((*i).name == name && (*i).type == type) { (*i).loc = loc; return; @@ -60,7 +60,7 @@ StateManager::set_module_location(const string& name, ModuleType type, Coord loc // If we get here, module isn't in list yet ModuleLocation ml = { name, type, loc }; - m_module_locations.push_back(ml); + _module_locations.push_back(ml); } @@ -72,8 +72,8 @@ StateManager::set_module_location(const string& name, ModuleType type, Coord loc bool StateManager::get_module_split(const string& name, bool default_val) const { - map<string, bool>::const_iterator i = m_module_splits.find(name); - if (i == m_module_splits.end()) + map<string, bool>::const_iterator i = _module_splits.find(name); + if (i == _module_splits.end()) return default_val; else return (*i).second; @@ -83,14 +83,14 @@ StateManager::get_module_split(const string& name, bool default_val) const void StateManager::set_module_split(const string& name, bool split) { - m_module_splits[name] = split; + _module_splits[name] = split; } void StateManager::load(const string& filename) { - m_module_locations.clear(); + _module_locations.clear(); cerr << "Loading configuration file " << filename << endl; @@ -107,21 +107,21 @@ StateManager::load(const string& filename) is >> s; if (s != "window_location") throw "Corrupt settings file."; is >> s; - m_window_location.x = atoi(s.c_str()); + _window_location.x = atoi(s.c_str()); is >> s; - m_window_location.y = atoi(s.c_str()); + _window_location.y = atoi(s.c_str()); is >> s; if (s != "window_size") throw "Corrupt settings file."; is >> s; - m_window_size.x = atoi(s.c_str()); + _window_size.x = atoi(s.c_str()); is >> s; - m_window_size.y = atoi(s.c_str()); + _window_size.y = atoi(s.c_str()); is >> s; if (s != "zoom_level") throw "Corrupt settings file."; is >> s; - m_zoom = atof(s.c_str()); + _zoom = atof(s.c_str()); ModuleLocation ml; while (1) { @@ -156,7 +156,7 @@ StateManager::load(const string& filename) is >> s; ml.loc.y = atoi(s.c_str()); - m_module_locations.push_back(ml); + _module_locations.push_back(ml); } is.close(); @@ -169,12 +169,12 @@ StateManager::save(const string& filename) std::ofstream os; os.open(filename.c_str(), std::ios::out); - os << "window_location " << m_window_location.x << " " << m_window_location.y << std::endl; - os << "window_size " << m_window_size.x << " " << m_window_size.y << std::endl; - os << "zoom_level " << m_zoom << std::endl; + os << "window_location " << _window_location.x << " " << _window_location.y << std::endl; + os << "window_size " << _window_size.x << " " << _window_size.y << std::endl; + os << "zoom_level " << _zoom << std::endl; ModuleLocation ml; - for (std::list<ModuleLocation>::iterator i = m_module_locations.begin(); i != m_module_locations.end(); ++i) { + for (std::list<ModuleLocation>::iterator i = _module_locations.begin(); i != _module_locations.end(); ++i) { ml = *i; os << "\"" << ml.name << "\""; @@ -193,42 +193,42 @@ StateManager::save(const string& filename) Coord StateManager::get_window_location() { - return m_window_location; + return _window_location; } void StateManager::set_window_location(Coord loc) { - m_window_location = loc; + _window_location = loc; } Coord StateManager::get_window_size() { - return m_window_size; + return _window_size; } void StateManager::set_window_size(Coord size) { - m_window_size = size; + _window_size = size; } float StateManager::get_zoom() { - return m_zoom; + return _zoom; } void StateManager::set_zoom(float zoom) { - m_zoom = zoom; + _zoom = zoom; } diff --git a/src/StateManager.h b/src/StateManager.h index 06843bd..8890ec3 100644 --- a/src/StateManager.h +++ b/src/StateManager.h @@ -64,11 +64,11 @@ public: int get_port_color(PortType type); private: - list<ModuleLocation> m_module_locations; - map<string,bool> m_module_splits; - Coord m_window_location; - Coord m_window_size; - float m_zoom; + list<ModuleLocation> _module_locations; + map<string,bool> _module_splits; + Coord _window_location; + Coord _window_size; + float _zoom; }; |