fix file type

This commit is contained in:
Volker Fischer 2011-05-09 18:10:35 +00:00
parent 8d6a1b45c4
commit 4ca03d9244

View file

@ -1,12 +1,12 @@
/******************************************************************************\ /******************************************************************************\
* Copyright (c) 2004-2011 * Copyright (c) 2004-2011
* *
* Author(s): * Author(s):
* Volker Fischer * Volker Fischer
* *
Prefix definitions for the GUI: Prefix definitions for the GUI:
label: lbl label: lbl
combo box: cbx combo box: cbx
line edit: edt line edit: edt
@ -19,290 +19,290 @@ slider: sld
LED: led LED: led
group box: grb group box: grb
pixmap label: pxl pixmap label: pxl
LED bar: lbr LED bar: lbr
****************************************************************************** ******************************************************************************
* *
* This program is free software; you can redistribute it and/or modify it under * 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 * 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 * Foundation; either version 2 of the License, or (at your option) any later
* version. * version.
* *
* This program is distributed in the hope that it will be useful, but WITHOUT * 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 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details. * details.
* *
* You should have received a copy of the GNU General Public License along with * 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., * this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* *
\******************************************************************************/ \******************************************************************************/
#if !defined ( GLOBAL_H__3B123453_4344_BB2B_23E7A0D31912__INCLUDED_ ) #if !defined ( GLOBAL_H__3B123453_4344_BB2B_23E7A0D31912__INCLUDED_ )
#define GLOBAL_H__3B123453_4344_BB2B_23E7A0D31912__INCLUDED_ #define GLOBAL_H__3B123453_4344_BB2B_23E7A0D31912__INCLUDED_
#include <qstring.h> #include <qstring.h>
#include <qevent.h> #include <qevent.h>
#include <qdebug.h> #include <qdebug.h>
#include <stdio.h> #include <stdio.h>
#include <math.h> #include <math.h>
#include <string> #include <string>
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include "config.h" # include "config.h"
#endif #endif
/* Definitions ****************************************************************/ /* Definitions ****************************************************************/
// define this macro to get debug output // define this macro to get debug output
//#define _DEBUG_ //#define _DEBUG_
#undef _DEBUG_ #undef _DEBUG_
// version and application name (always use this version) // version and application name (always use this version)
#undef VERSION #undef VERSION
#define VERSION "4.0.0cvs" #define VERSION "4.0.0cvs"
#define APP_NAME "llcon" #define APP_NAME "llcon"
// Windows registry key name of auto run entry for the server // Windows registry key name of auto run entry for the server
#define AUTORUN_SERVER_REG_NAME "llcon server" #define AUTORUN_SERVER_REG_NAME "llcon server"
// default names of the ini-file for client and server // default names of the ini-file for client and server
#define DEFAULT_INI_FILE_NAME "llcon.ini" #define DEFAULT_INI_FILE_NAME "llcon.ini"
#define DEFAULT_INI_FILE_NAME_SERVER "llconserver.ini" #define DEFAULT_INI_FILE_NAME_SERVER "llconserver.ini"
// file name for logging file // file name for logging file
#define DEFAULT_LOG_FILE_NAME "llconsrvlog.txt" #define DEFAULT_LOG_FILE_NAME "llconsrvlog.txt"
// default server address // default server address
#define DEFAULT_SERVER_ADDRESS "llcon.dyndns.org" #define DEFAULT_SERVER_ADDRESS "llcon.dyndns.org"
// download URL // download URL
#define LLCON_DOWNLOAD_URL "http://sourceforge.net/projects/llcon/files" #define LLCON_DOWNLOAD_URL "http://sourceforge.net/projects/llcon/files"
// defined port number for client and server // defined port number for client and server
#define LLCON_DEFAULT_PORT_NUMBER 22122 #define LLCON_DEFAULT_PORT_NUMBER 22122
// system sample rate (the sound card and audio coder works on this sample rate) // system sample rate (the sound card and audio coder works on this sample rate)
#define SYSTEM_SAMPLE_RATE_HZ 48000 // Hz #define SYSTEM_SAMPLE_RATE_HZ 48000 // Hz
// System block size, this is the block size on which the audio coder works. // System block size, this is the block size on which the audio coder works.
// All other block sizes must be a multiple of this size // All other block sizes must be a multiple of this size
#define SYSTEM_FRAME_SIZE_SAMPLES 128 #define SYSTEM_FRAME_SIZE_SAMPLES 128
#define SYSTEM_BLOCK_DURATION_MS_FLOAT \ #define SYSTEM_BLOCK_DURATION_MS_FLOAT \
( static_cast<double> ( SYSTEM_FRAME_SIZE_SAMPLES ) / \ ( static_cast<double> ( SYSTEM_FRAME_SIZE_SAMPLES ) / \
SYSTEM_SAMPLE_RATE_HZ * 1000 ) SYSTEM_SAMPLE_RATE_HZ * 1000 )
// define the allowed audio frame size factors (since the // define the allowed audio frame size factors (since the
// "SYSTEM_FRAME_SIZE_SAMPLES" is quite small, it may be that on some // "SYSTEM_FRAME_SIZE_SAMPLES" is quite small, it may be that on some
// computers a larger value is required) // computers a larger value is required)
#define FRAME_SIZE_FACTOR_PREFERRED 1 // 128 (for frame size 128) #define FRAME_SIZE_FACTOR_PREFERRED 1 // 128 (for frame size 128)
#define FRAME_SIZE_FACTOR_DEFAULT 2 // 256 (for frame size 128) #define FRAME_SIZE_FACTOR_DEFAULT 2 // 256 (for frame size 128)
#define FRAME_SIZE_FACTOR_SAFE 4 // 512 (for frame size 128) #define FRAME_SIZE_FACTOR_SAFE 4 // 512 (for frame size 128)
// low complexity CELT encoder (if defined) // low complexity CELT encoder (if defined)
#define USE_LOW_COMPLEXITY_CELT_ENC #define USE_LOW_COMPLEXITY_CELT_ENC
// define the maximum mono audio buffer size at a sample rate // define the maximum mono audio buffer size at a sample rate
// of 48 kHz, this is important for defining the maximum number // of 48 kHz, this is important for defining the maximum number
// of bytes to be expected from the network interface // of bytes to be expected from the network interface
#define MAX_MONO_AUD_BUFF_SIZE_AT_48KHZ 4096 #define MAX_MONO_AUD_BUFF_SIZE_AT_48KHZ 4096
// Maximum block size for network input buffer. Consider a maximum sample rate // Maximum block size for network input buffer. Consider a maximum sample rate
// of 48 kHz and two audio channels and two bytes per sample. // of 48 kHz and two audio channels and two bytes per sample.
#define MAX_SIZE_BYTES_NETW_BUF ( MAX_MONO_AUD_BUFF_SIZE_AT_48KHZ * 4 ) #define MAX_SIZE_BYTES_NETW_BUF ( MAX_MONO_AUD_BUFF_SIZE_AT_48KHZ * 4 )
// minimum/maximum network buffer size (which can be chosen by slider) // minimum/maximum network buffer size (which can be chosen by slider)
#define MIN_NET_BUF_SIZE_NUM_BL 1 // number of blocks #define MIN_NET_BUF_SIZE_NUM_BL 1 // number of blocks
#define MAX_NET_BUF_SIZE_NUM_BL 20 // number of blocks #define MAX_NET_BUF_SIZE_NUM_BL 20 // number of blocks
// default network buffer size // default network buffer size
#define DEF_NET_BUF_SIZE_NUM_BL 10 // number of blocks #define DEF_NET_BUF_SIZE_NUM_BL 10 // number of blocks
// maximum number of recognized sound cards installed in the system, // maximum number of recognized sound cards installed in the system,
// definition for "no device" // definition for "no device"
#define MAX_NUMBER_SOUND_CARDS 10 #define MAX_NUMBER_SOUND_CARDS 10
#define INVALID_SNC_CARD_DEVICE -1 #define INVALID_SNC_CARD_DEVICE -1
// define the maximum number of audio channel for input/output we can store // define the maximum number of audio channel for input/output we can store
// channel infos for (and therefore this is the maximum number of entries in // channel infos for (and therefore this is the maximum number of entries in
// the channel selection combo box regardless of the actual available number // the channel selection combo box regardless of the actual available number
// of channels by the audio device) // of channels by the audio device)
#define MAX_NUM_IN_OUT_CHANNELS 32 #define MAX_NUM_IN_OUT_CHANNELS 32
// maximum number of elemts in the server address combo box // maximum number of elemts in the server address combo box
#define MAX_NUM_SERVER_ADDR_ITEMS 6 #define MAX_NUM_SERVER_ADDR_ITEMS 6
// defines for LED input level meter // defines for LED input level meter
#define NUM_STEPS_INP_LEV_METER 8 #define NUM_STEPS_INP_LEV_METER 8
#define RED_BOUND_INP_LEV_METER 7 #define RED_BOUND_INP_LEV_METER 7
#define YELLOW_BOUND_INP_LEV_METER 5 #define YELLOW_BOUND_INP_LEV_METER 5
// maximum number of internet connections (channels) // maximum number of internet connections (channels)
// if you want to change this paramter, there has to be done code modifications // if you want to change this paramter, there has to be done code modifications
// on other places, too! The code tag "MAX_NUM_CHANNELS_TAG" shows these places // on other places, too! The code tag "MAX_NUM_CHANNELS_TAG" shows these places
// (just search for the tag in the entire code) // (just search for the tag in the entire code)
#define MAX_NUM_CHANNELS 12 // max number channels for server #define MAX_NUM_CHANNELS 12 // max number channels for server
// actual number of used channels in the server // actual number of used channels in the server
// this parameter can safely be changed from 1 to MAX_NUM_CHANNELS // this parameter can safely be changed from 1 to MAX_NUM_CHANNELS
// without any other changes in the code // without any other changes in the code
#define USED_NUM_CHANNELS 6 // used number channels for server #define USED_NUM_CHANNELS 6 // used number channels for server
// maximum number of servers registered in the server list // maximum number of servers registered in the server list
#define MAX_NUM_SERVERS_IN_SERVER_LIST 100 #define MAX_NUM_SERVERS_IN_SERVER_LIST 100
// defines the time interval at which the ping time is updated in the GUI // defines the time interval at which the ping time is updated in the GUI
#define PING_UPDATE_TIME_MS 500 // ms #define PING_UPDATE_TIME_MS 500 // ms
// defines the time interval at which the ping time is updated for the server // defines the time interval at which the ping time is updated for the server
// list // list
#define PING_UPDATE_TIME_SERVER_LIST_MS 2000 // ms #define PING_UPDATE_TIME_SERVER_LIST_MS 2000 // ms
// time-out until a registered server is deleted from the server list if no // time-out until a registered server is deleted from the server list if no
// new registering was made in minutes // new registering was made in minutes
#define SERVLIST_TIME_OUT_MINUTES 60 // minutes #define SERVLIST_TIME_OUT_MINUTES 60 // minutes
// poll time for server list (to check if entries are time-out) // poll time for server list (to check if entries are time-out)
#define SERVLIST_POLL_TIME_MINUTES 1 // minute #define SERVLIST_POLL_TIME_MINUTES 1 // minute
// time until a slave server registers in the server list // time until a slave server registers in the server list
#define SERVLIST_REGIST_INTERV_MINUTES 30 // minutes #define SERVLIST_REGIST_INTERV_MINUTES 30 // minutes
// length of the moving average buffer for response time measurement // length of the moving average buffer for response time measurement
#define TIME_MOV_AV_RESPONSE_SECONDS 30 // seconds #define TIME_MOV_AV_RESPONSE_SECONDS 30 // seconds
// Maximum length of fader tag and text message strings (Since for chat messages // Maximum length of fader tag and text message strings (Since for chat messages
// some HTML code is added, we also have to define a second length which includes // some HTML code is added, we also have to define a second length which includes
// this additionl HTML code. Right now the length of the HTML code is approx. 66 // this additionl HTML code. Right now the length of the HTML code is approx. 66
// character. Here, we add some headroom to this number) // character. Here, we add some headroom to this number)
#define MAX_LEN_FADER_TAG 16 #define MAX_LEN_FADER_TAG 16
#define MAX_LEN_CHAT_TEXT 1600 #define MAX_LEN_CHAT_TEXT 1600
#define MAX_LEN_CHAT_TEXT_PLUS_HTML 1800 #define MAX_LEN_CHAT_TEXT_PLUS_HTML 1800
#define MAX_LEN_SERVER_NAME 20 #define MAX_LEN_SERVER_NAME 20
#define MAX_LEN_SERVER_TOPIC 32 #define MAX_LEN_SERVER_TOPIC 32
#define MAX_LEN_SERVER_CITY 20 #define MAX_LEN_SERVER_CITY 20
// common tool tip bottom line text // common tool tip bottom line text
#define TOOLTIP_COM_END_TEXT tr ( \ #define TOOLTIP_COM_END_TEXT tr ( \
"<br><div align=right><font size=-1><i>" \ "<br><div align=right><font size=-1><i>" \
"For more information use the ""What's " \ "For more information use the ""What's " \
"This"" help (? menu, right mouse button or Shift+F1)" \ "This"" help (? menu, right mouse button or Shift+F1)" \
"</i></font></div>" ) "</i></font></div>" )
#define _MAXSHORT 32767 #define _MAXSHORT 32767
#define _MAXBYTE 255 // binary: 11111111 #define _MAXBYTE 255 // binary: 11111111
#define _MINSHORT ( -32768 ) #define _MINSHORT ( -32768 )
#if HAVE_STDINT_H #if HAVE_STDINT_H
# include <stdint.h> # include <stdint.h>
#elif HAVE_INTTYPES_H #elif HAVE_INTTYPES_H
# include <inttypes.h> # include <inttypes.h>
#elif defined ( _WIN32 ) #elif defined ( _WIN32 )
typedef __int64 int64_t; typedef __int64 int64_t;
typedef __int32 int32_t; typedef __int32 int32_t;
typedef __int16 int16_t; typedef __int16 int16_t;
typedef unsigned __int64 uint64_t; typedef unsigned __int64 uint64_t;
typedef unsigned __int32 uint32_t; typedef unsigned __int32 uint32_t;
typedef unsigned __int16 uint16_t; typedef unsigned __int16 uint16_t;
typedef unsigned __int8 uint8_t; typedef unsigned __int8 uint8_t;
#else #else
typedef long long int64_t; typedef long long int64_t;
typedef int int32_t; typedef int int32_t;
typedef short int16_t; typedef short int16_t;
typedef unsigned long long uint64_t; typedef unsigned long long uint64_t;
typedef unsigned int uint32_t; typedef unsigned int uint32_t;
typedef unsigned short uint16_t; typedef unsigned short uint16_t;
typedef unsigned char uint8_t; typedef unsigned char uint8_t;
#endif #endif
/* Definitions for window message system ------------------------------------ */ /* Definitions for window message system ------------------------------------ */
typedef unsigned int _MESSAGE_IDENT; typedef unsigned int _MESSAGE_IDENT;
#define MS_RESET_ALL 0 // MS: Message #define MS_RESET_ALL 0 // MS: Message
#define MS_SOUND_IN 1 #define MS_SOUND_IN 1
#define MS_SOUND_OUT 2 #define MS_SOUND_OUT 2
#define MS_JIT_BUF_PUT 3 #define MS_JIT_BUF_PUT 3
#define MS_JIT_BUF_GET 4 #define MS_JIT_BUF_GET 4
#define MS_PACKET_RECEIVED 5 #define MS_PACKET_RECEIVED 5
#define MS_ERROR_IN_THREAD 6 #define MS_ERROR_IN_THREAD 6
#define MS_SET_JIT_BUF_SIZE 7 #define MS_SET_JIT_BUF_SIZE 7
#define MUL_COL_LED_RED 0 #define MUL_COL_LED_RED 0
#define MUL_COL_LED_YELLOW 1 #define MUL_COL_LED_YELLOW 1
#define MUL_COL_LED_GREEN 2 #define MUL_COL_LED_GREEN 2
/* Classes ********************************************************************/ /* Classes ********************************************************************/
class CGenErr class CGenErr
{ {
public: public:
CGenErr ( QString strNewErrorMsg, QString strNewErrorType = "" ) : CGenErr ( QString strNewErrorMsg, QString strNewErrorType = "" ) :
strErrorMsg ( strNewErrorMsg ), strErrorType ( strNewErrorType ) {} strErrorMsg ( strNewErrorMsg ), strErrorType ( strNewErrorType ) {}
QString GetErrorText() QString GetErrorText()
{ {
// return formatted error text // return formatted error text
if ( strErrorType.isEmpty() ) if ( strErrorType.isEmpty() )
{ {
return strErrorMsg; return strErrorMsg;
} }
else else
{ {
return strErrorType + ": " + strErrorMsg; return strErrorType + ": " + strErrorMsg;
} }
} }
protected: protected:
QString strErrorMsg; QString strErrorMsg;
QString strErrorType; QString strErrorType;
}; };
class CLlconEvent : public QEvent class CLlconEvent : public QEvent
{ {
public: public:
CLlconEvent ( int iNewMeTy, int iNewSt, int iNewChN = 0 ) : CLlconEvent ( int iNewMeTy, int iNewSt, int iNewChN = 0 ) :
QEvent ( QEvent::Type ( QEvent::User + 11 ) ), iMessType ( iNewMeTy ), iStatus ( iNewSt ), QEvent ( QEvent::Type ( QEvent::User + 11 ) ), iMessType ( iNewMeTy ), iStatus ( iNewSt ),
iChanNum ( iNewChN ) {} iChanNum ( iNewChN ) {}
int iMessType; int iMessType;
int iStatus; int iStatus;
int iChanNum; int iChanNum;
}; };
/* Prototypes for global functions ********************************************/ /* Prototypes for global functions ********************************************/
// command line parsing, TODO do not declare functions globally but in a class // command line parsing, TODO do not declare functions globally but in a class
QString UsageArguments ( char** argv ); QString UsageArguments ( char** argv );
bool GetFlagArgument ( char** argv, bool GetFlagArgument ( char** argv,
int& i, int& i,
QString strShortOpt, QString strShortOpt,
QString strLongOpt ); QString strLongOpt );
bool GetStringArgument ( QTextStream& tsConsole, bool GetStringArgument ( QTextStream& tsConsole,
int argc, int argc,
char** argv, char** argv,
int& i, int& i,
QString strShortOpt, QString strShortOpt,
QString strLongOpt, QString strLongOpt,
QString& strArg ); QString& strArg );
bool GetNumericArgument ( QTextStream& tsConsole, bool GetNumericArgument ( QTextStream& tsConsole,
int argc, int argc,
char** argv, char** argv,
int& i, int& i,
QString strShortOpt, QString strShortOpt,
QString strLongOpt, QString strLongOpt,
double rRangeStart, double rRangeStart,
double rRangeStop, double rRangeStop,
double& rValue); double& rValue);
// posting a window message // posting a window message
void PostWinMessage ( const _MESSAGE_IDENT MessID, void PostWinMessage ( const _MESSAGE_IDENT MessID,
const int iMessageParam = 0, const int iMessageParam = 0,
const int iChanNum = 0 ); const int iChanNum = 0 );
#endif /* !defined ( GLOBAL_H__3B123453_4344_BB2B_23E7A0D31912__INCLUDED_ ) */ #endif /* !defined ( GLOBAL_H__3B123453_4344_BB2B_23E7A0D31912__INCLUDED_ ) */