// ------------------------------------------------------------------------ // ecamegapedal.cpp: A graphical realtime effect processing app. // Copyright (C) 2001-2004 Kai Vehmanen (kai.vehmanen@wakkanet.fi) // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // ------------------------------------------------------------------------ #include #include #include /* sigaction() */ #include #include #include #include #include #include #include #include "version.h" #include "interface.h" #include "ecamegapedal.h" using std::string; using std::cerr; using std::cout; using std::endl; static void ecamegapedal_setup_signals(void); int main(int argc, char **argv) { ecamegapedal_setup_signals(); // ECA_LOGGER::instance().disable(); // ECA_LOGGER::instance().set_log_level_bitmask(511); // ECA_LOGGER::instance().set_log_level(ECA_LOGGER::errors, true); // ECA_LOGGER::instance().set_log_level(ECA_LOGGER::info, true); // ECA_LOGGER::instance().set_log_level(ECA_LOGGER::subsystems, true); try { COMMAND_LINE cline = COMMAND_LINE (argc, argv); parse_command_line(cline); QApplication qapp (argc, argv); QEInterface ewinterface; /* set the default input and output */ if (argc > 1) ewinterface.set_input_name(argv[1]); if (argc > 2) ewinterface.set_output_name(argv[2]); ewinterface.initialize(); const string& input = ewinterface.input_name(); const string& output = ewinterface.output_name(); const string jack ("jack"); if (input.find(jack) != string::npos || output.find(jack) != string::npos) { ewinterface.start_processing(true); } /* start the user interface */ qapp.setMainWidget(&ewinterface); ewinterface.show(); QObject::connect( &qapp, SIGNAL( lastWindowClosed() ), &qapp, SLOT( quit() ) ); return(qapp.exec()); } catch(ECA_ERROR& e) { cerr << "---\nlibecasound error while processing event: [" << e.error_section() << "] : \"" << e.error_message() << "\"\n\n"; } catch(...) { cerr << "---\nCaught an unknown exception!\n"; } } void parse_command_line(COMMAND_LINE& cline) { cline.begin(); while(cline.end() == false) { if (cline.current() == "--version") { cout << "Ecamegapedal v" << ecamegapedal_version << " -- (using libecasound v" << ecasound_library_version << ")" << endl; cout << "Copyright (C) 2001-2004 Kai Vehmanen" << endl; cout << "Ecamegapedal comes with ABSOLUTELY NO WARRANTY." << endl; cout << "You may redistribute copies of ecamegapedal under the terms of the GNU" << endl; cout << "General Public License. For more information about these matters, see" << endl; cout << "the file named COPYING." << endl; exit(0); } else if (cline.current() == "--help") { cout << "USAGE: ecamegapedal [options] [ ]\n" << " --version print version info" << endl << " --help show this help" << endl << endl; cout << "For a more detailed documentation, see ecamegapedal(1) man page." << endl; cout << "Report bugs to ecasound-list ." << endl; exit(0); } cline.next(); } } void ecamegapedal_setup_signals(void) { struct sigaction ign_handler; ign_handler.sa_handler = SIG_IGN; sigemptyset(&ign_handler.sa_mask); ign_handler.sa_flags = 0; /* handle the follwing signals explicitly */ /* -none- */ /* ignore the following signals */ sigaction(SIGPIPE, &ign_handler, 0); }