main.cpp
Go to the documentation of this file.
00001 /****************************************************************************
00002 **
00003 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
00004 ** All rights reserved.
00005 ** Contact: Nokia Corporation (qt-info@nokia.com)
00006 **
00007 ** This file is part of the examples of the Qt Toolkit.
00008 **
00009 ** $QT_BEGIN_LICENSE:LGPL$
00010 ** Commercial Usage
00011 ** Licensees holding valid Qt Commercial licenses may use this file in
00012 ** accordance with the Qt Commercial License Agreement provided with the
00013 ** Software or, alternatively, in accordance with the terms contained in
00014 ** a written agreement between you and Nokia.
00015 **
00016 ** GNU Lesser General Public License Usage
00017 ** Alternatively, this file may be used under the terms of the GNU Lesser
00018 ** General Public License version 2.1 as published by the Free Software
00019 ** Foundation and appearing in the file LICENSE.LGPL included in the
00020 ** packaging of this file.  Please review the following information to
00021 ** ensure the GNU Lesser General Public License version 2.1 requirements
00022 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
00023 **
00024 ** In addition, as a special exception, Nokia gives you certain additional
00025 ** rights.  These rights are described in the Nokia Qt LGPL Exception
00026 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
00027 **
00028 ** GNU General Public License Usage
00029 ** Alternatively, this file may be used under the terms of the GNU
00030 ** General Public License version 3.0 as published by the Free Software
00031 ** Foundation and appearing in the file LICENSE.GPL included in the
00032 ** packaging of this file.  Please review the following information to
00033 ** ensure the GNU General Public License version 3.0 requirements will be
00034 ** met: http://www.gnu.org/copyleft/gpl.html.
00035 **
00036 ** If you have questions regarding the use of this file, please contact
00037 ** Nokia at qt-info@nokia.com.
00038 ** $QT_END_LICENSE$
00039 **
00040 ****************************************************************************/
00041 
00042 #include <QtGui>
00043 #include "audioinput.h"
00044 #include "soundserver.h"
00045 
00046 int main(int argc, char **argv)
00047 {
00048     QApplication app(argc, argv);
00049     app.setApplicationName("Audio Monitor");
00050 
00051     int port = 0;
00052     QString epdHost;
00053     QStringList args = app.arguments();
00054     for (int i = 1; i < args.count(); i++){
00055         if (args[i] == "-filename"){
00056             i++;
00057             if (i < args.count()){
00058                 AudioInfo::setFileName(args[i]);
00059             }
00060         }
00061         else if (args[i] == "-port"){
00062             i++;
00063             if (i < args.count()){
00064                 port = args[i].toInt();
00065             }
00066         }
00067         else if (args[i] == "-epd"){
00068             i++;
00069             if (i < args.count()){
00070                 QStringList epdArgs = args[i].split(":");
00071                 if (epdArgs.count() == 2){
00072                     epdHost = epdArgs[0];
00073                     _epdPort = epdArgs[1].toInt();
00074                 }
00075                 else{
00076                     _epdPort = args[i].toInt();
00077                 }
00078             }
00079         }
00080     }
00081 
00082     SoundServer server;
00083     if (port > 0){
00084         if (!server.listen(QHostAddress::Any, port)) {
00085             QMessageBox::critical(NULL, "Sound Server",
00086                 QString("Unable to start the server: %1.").arg(server.errorString()));
00087             return -1;
00088         }
00089     }
00090     _atrasrClient.socket = NULL;
00091     if (!epdHost.isEmpty() && _epdPort > 0){
00092         if ( AtrasrConnect( &_atrasrClient, epdHost.toAscii(), _epdPort ) != -1 ){
00093             AtrasrSendTOF( &_atrasrClient );
00094             AtrasrSendSTARTPU( &_atrasrClient );
00095         }      
00096     }
00097 
00098     SoundServerApp input(&server);
00099     input.resize(480,480);
00100     input.show();
00101 
00102     int ret = app.exec();
00103     if (port > 0){
00104         server.close();
00105     }
00106     if (_epdPort > 0){
00107         AtrasrSendEOF( &_atrasrClient );
00108         AtrasrClose( &_atrasrClient );
00109     }
00110     return ret;
00111 }


rospeex_audiomonitor
Author(s): Komei Sugiura
autogenerated on Wed Aug 26 2015 16:10:37