diff options
-rw-r--r-- | src/AlsaDriver.cpp | 25 | ||||
-rw-r--r-- | src/JackDriver.cpp | 27 | ||||
-rw-r--r-- | src/Patchage.cpp | 26 | ||||
-rw-r--r-- | src/PatchageCanvas.cpp | 9 |
4 files changed, 40 insertions, 47 deletions
diff --git a/src/AlsaDriver.cpp b/src/AlsaDriver.cpp index 2b14c26..0dfcd72 100644 --- a/src/AlsaDriver.cpp +++ b/src/AlsaDriver.cpp @@ -28,7 +28,6 @@ #include <string> #include <utility> -using std::string; using boost::format; AlsaDriver::AlsaDriver(Patchage* app) @@ -241,11 +240,11 @@ AlsaDriver::create_port_view_internal( snd_seq_port_info_set_port(pinfo, addr.port); snd_seq_get_any_port_info(_seq, addr.client, addr.port, pinfo); - const string client_name = snd_seq_client_info_get_name(cinfo); - const string port_name = snd_seq_port_info_get_name(pinfo); - bool is_input = false; - bool is_duplex = false; - bool is_application = true; + const std::string client_name = snd_seq_client_info_get_name(cinfo); + const std::string port_name = snd_seq_port_info_get_name(pinfo); + bool is_input = false; + bool is_duplex = false; + bool is_application = true; int caps = snd_seq_port_info_get_capability(pinfo); int type = snd_seq_port_info_get_type(pinfo); @@ -299,8 +298,10 @@ AlsaDriver::create_port_view_internal( } PatchagePort* -AlsaDriver::create_port(PatchageModule& parent, - const string& name, bool is_input, snd_seq_addr_t addr) +AlsaDriver::create_port(PatchageModule& parent, + const std::string& name, + bool is_input, + snd_seq_addr_t addr) { PatchagePort* ret = new PatchagePort( parent, ALSA_MIDI, name, "", is_input, @@ -405,10 +406,10 @@ AlsaDriver::connect(PatchagePort* src_port, } if (result) - _app->info_msg(string("Alsa: Connected ") + _app->info_msg(std::string("Alsa: Connected ") + src_port->full_name() + " => " + dst_port->full_name()); else - _app->error_msg(string("Alsa: Unable to connect ") + _app->error_msg(std::string("Alsa: Unable to connect ") + src_port->full_name() + " => " + dst_port->full_name()); return (!result); @@ -449,13 +450,13 @@ AlsaDriver::disconnect(PatchagePort* src_port, int ret = snd_seq_unsubscribe_port(_seq, subs); if (ret < 0) { - _app->error_msg(string("Alsa: Unable to disconnect ") + _app->error_msg(std::string("Alsa: Unable to disconnect ") + src_port->full_name() + " => " + dst_port->full_name() + "(" + snd_strerror(ret) + ")"); return false; } - _app->info_msg(string("Alsa: Disconnected ") + _app->info_msg(std::string("Alsa: Disconnected ") + src_port->full_name() + " => " + dst_port->full_name()); return true; diff --git a/src/JackDriver.cpp b/src/JackDriver.cpp index 67e9915..df344f1 100644 --- a/src/JackDriver.cpp +++ b/src/JackDriver.cpp @@ -37,7 +37,6 @@ #include <set> #include <string> -using std::string; using boost::format; JackDriver::JackDriver(Patchage* app) @@ -142,7 +141,7 @@ JackDriver::create_port_view(Patchage* patchage, const int jack_flags = jack_port_flags(jack_port); - string module_name, port_name; + std::string module_name, port_name; port_names(id, module_name, port_name); ModuleType type = InputOutput; @@ -284,11 +283,11 @@ JackDriver::refresh() return; } - string client1_name; - string port1_name; - string client2_name; - string port2_name; - size_t colon; + std::string client1_name; + std::string port1_name; + std::string client2_name; + std::string port2_name; + size_t colon; // Add all ports for (int i = 0; ports[i]; ++i) { @@ -379,8 +378,8 @@ JackDriver::refresh() bool JackDriver::port_names(const PortID& id, - string& module_name, - string& port_name) + std::string& module_name, + std::string& port_name) { jack_port_t* jack_port = NULL; @@ -393,7 +392,7 @@ JackDriver::port_names(const PortID& id, return false; } - const string full_name = jack_port_name(jack_port); + const std::string full_name = jack_port_name(jack_port); module_name = full_name.substr(0, full_name.find(":")); port_name = full_name.substr(full_name.find(":")+1); @@ -415,10 +414,10 @@ JackDriver::connect(PatchagePort* src_port, int result = jack_connect(_client, src_port->full_name().c_str(), dst_port->full_name().c_str()); if (result == 0) - _app->info_msg(string("Jack: Connected ") + _app->info_msg(std::string("Jack: Connected ") + src_port->full_name() + " => " + dst_port->full_name()); else - _app->error_msg(string("Jack: Unable to connect ") + _app->error_msg(std::string("Jack: Unable to connect ") + src_port->full_name() + " => " + dst_port->full_name()); return (!result); @@ -438,10 +437,10 @@ JackDriver::disconnect(PatchagePort* const src_port, int result = jack_disconnect(_client, src_port->full_name().c_str(), dst_port->full_name().c_str()); if (result == 0) - _app->info_msg(string("Jack: Disconnected ") + _app->info_msg(std::string("Jack: Disconnected ") + src_port->full_name() + " => " + dst_port->full_name()); else - _app->error_msg(string("Jack: Unable to disconnect ") + _app->error_msg(std::string("Jack: Unable to disconnect ") + src_port->full_name() + " => " + dst_port->full_name()); return (!result); diff --git a/src/Patchage.cpp b/src/Patchage.cpp index eec9ac4..fe57e3e 100644 --- a/src/Patchage.cpp +++ b/src/Patchage.cpp @@ -106,10 +106,6 @@ struct ProjectList_column_record : public Gtk::TreeModel::ColumnRecord { Gtk::TreeModelColumn<Glib::ustring> label; }; -using std::cout; -using std::endl; -using std::string; - #define INIT_WIDGET(x) x(_xml, ((const char*)#x) + 1) Patchage::Patchage(int argc, char** argv) @@ -173,12 +169,12 @@ Patchage::Patchage(int argc, char** argv) while (argc > 0) { if (!strcmp(*argv, "-h") || !strcmp(*argv, "--help")) { - cout << "Usage: patchage [OPTION]..." << endl; - cout << "Visually connect JACK and ALSA Audio/MIDI ports." << endl << endl; - cout << "Options:" << endl; - cout << "\t-h --help Show this help" << endl; - cout << "\t-A --no-alsa Do not automatically attach to ALSA" << endl; - cout << "\t-J --no-jack Do not automatically attack to JACK" << endl; + std::cout << "Usage: patchage [OPTION]...\n"; + std::cout << "Visually connect JACK and ALSA Audio/MIDI ports.\n\n"; + std::cout << "Options:\n"; + std::cout << "\t-h --help Show this help\n"; + std::cout << "\t-A --no-alsa Do not automatically attach to ALSA\n"; + std::cout << "\t-J --no-jack Do not automatically attack to JACK\n"; exit(0); #ifdef HAVE_ALSA } else if (!strcmp(*argv, "-A") || !strcmp(*argv, "--no-alsa")) { @@ -690,7 +686,7 @@ print_edge(GanvEdge* edge, void* data) } (*script) << "jack_connect '" << src->full_name() - << "' '" << dst->full_name() << "' &" << endl; + << "' '" << dst->full_name() << "' &\n"; } void @@ -722,7 +718,7 @@ Patchage::save_session(bool close) const std::string script_path = path + "jack-session"; std::ofstream script(script_path.c_str()); - script << "#!/bin/sh" << endl << endl; + script << "#!/bin/sh\n\n"; const std::string var("${SESSION_DIR}"); for (int c = 0; cmd[c].uuid; ++c) { @@ -732,12 +728,10 @@ Patchage::save_session(bool close) command.replace(index, var.length(), cmd[c].client_name); } - script << command << " &" << endl; + script << command << " &\n"; } - script << endl; - script << "sleep 3" << endl; - script << endl; + script << "\nsleep 3\n\n"; _canvas->for_each_edge(print_edge, &script); diff --git a/src/PatchageCanvas.cpp b/src/PatchageCanvas.cpp index 4b8d309..a51ea32 100644 --- a/src/PatchageCanvas.cpp +++ b/src/PatchageCanvas.cpp @@ -35,7 +35,6 @@ #include <boost/format.hpp> -using std::string; using boost::format; PatchageCanvas::PatchageCanvas(Patchage* app, int width, int height) @@ -51,7 +50,7 @@ PatchageCanvas::PatchageCanvas(Patchage* app, int width, int height) } PatchageModule* -PatchageCanvas::find_module(const string& name, ModuleType type) +PatchageCanvas::find_module(const std::string& name, ModuleType type) { const ModuleIndex::const_iterator i = _module_index.find(name); if (i == _module_index.end()) @@ -71,7 +70,7 @@ PatchageCanvas::find_module(const string& name, ModuleType type) } void -PatchageCanvas::remove_module(const string& name) +PatchageCanvas::remove_module(const std::string& name) { ModuleIndex::iterator i = _module_index.find(name); while (i != _module_index.end()) { @@ -100,8 +99,8 @@ PatchageCanvas::find_port(const PortID& id) if (!jack_port) return NULL; - string module_name; - string port_name; + std::string module_name; + std::string port_name; _app->jack_driver()->port_names(id, module_name, port_name); PatchageModule* module = find_module( |