From c1e706e21fd6a8469751272ed9b362d3c2fd1547 Mon Sep 17 00:00:00 2001 From: Volker Fischer Date: Sun, 10 Aug 2008 08:14:30 +0000 Subject: [PATCH] finished implementation of different audio compression types: IMA-ADPCM (already available), MS-ADPCM (new), None (new) --- INSTALL | 2 +- src/audiocompr.h | 11 ++- src/audiomixerboard.cpp | 2 +- src/audiomixerboard.h | 2 +- src/buffer.cpp | 2 +- src/buffer.h | 3 +- src/channel.cpp | 126 ++++++++++++++++++++++------------- src/channel.h | 22 +++--- src/client.h | 11 +-- src/clientsettingsdlg.cpp | 41 ++++++++++++ src/clientsettingsdlg.h | 14 ++-- src/clientsettingsdlgbase.ui | 75 +++++++++++++++------ src/global.h | 1 - src/llconclientdlg.cpp | 2 +- src/llconclientdlg.h | 2 +- src/protocol.cpp | 2 +- src/protocol.h | 1 - src/resample.h | 2 +- src/server.cpp | 2 +- src/server.h | 3 +- src/settings.cpp | 36 ++++++++++ src/settings.h | 1 + src/socket.h | 3 +- src/util.h | 2 +- windows/MocQT.bat | 2 +- windows/sound.h | 2 +- 26 files changed, 264 insertions(+), 108 deletions(-) diff --git a/INSTALL b/INSTALL index 0c284d49..e98257b8 100755 --- a/INSTALL +++ b/INSTALL @@ -1,5 +1,5 @@ /******************************************************************************\ - * Copyright (c) 2004-2006 + * Copyright (c) 2004-2008 * * Author(s): * Volker Fischer diff --git a/src/audiocompr.h b/src/audiocompr.h index 97985703..73af97ac 100755 --- a/src/audiocompr.h +++ b/src/audiocompr.h @@ -1,5 +1,5 @@ /******************************************************************************\ - * Copyright (c) 2004-2006 + * Copyright (c) 2004-2008 * * Author(s): * Volker Fischer, Erik de Castro Lopo @@ -134,7 +134,12 @@ protected: class CAudioCompression { public: - enum EAudComprType { CT_NONE, CT_IMAADPCM, CT_MSADPCM }; + enum EAudComprType + { + CT_NONE = 0, + CT_IMAADPCM = 1, + CT_MSADPCM = 2 + }; CAudioCompression() {} virtual ~CAudioCompression() {} @@ -144,6 +149,8 @@ public: CVector Encode ( const CVector& vecsAudio ); CVector Decode ( const CVector& vecbyAdpcm ); + EAudComprType GetType() { return eAudComprType; } + protected: EAudComprType eAudComprType; CImaAdpcm ImaAdpcm; diff --git a/src/audiomixerboard.cpp b/src/audiomixerboard.cpp index aae7ba88..6d4cba3a 100755 --- a/src/audiomixerboard.cpp +++ b/src/audiomixerboard.cpp @@ -1,5 +1,5 @@ /******************************************************************************\ - * Copyright (c) 2004-2006 + * Copyright (c) 2004-2008 * * Author(s): * Volker Fischer diff --git a/src/audiomixerboard.h b/src/audiomixerboard.h index c5aba03d..48d696bf 100755 --- a/src/audiomixerboard.h +++ b/src/audiomixerboard.h @@ -1,5 +1,5 @@ /******************************************************************************\ - * Copyright (c) 2004-2006 + * Copyright (c) 2004-2008 * * Author(s): * Volker Fischer diff --git a/src/buffer.cpp b/src/buffer.cpp index 90528d44..2388955c 100755 --- a/src/buffer.cpp +++ b/src/buffer.cpp @@ -1,5 +1,5 @@ /******************************************************************************\ - * Copyright (c) 2004-2006 + * Copyright (c) 2004-2008 * * Author(s): * Volker Fischer diff --git a/src/buffer.h b/src/buffer.h index 76f7ff31..aad23d6a 100755 --- a/src/buffer.h +++ b/src/buffer.h @@ -1,5 +1,5 @@ /******************************************************************************\ - * Copyright (c) 2004-2006 + * Copyright (c) 2004-2008 * * Author(s): * Volker Fischer @@ -95,5 +95,4 @@ protected: int iPutPos; }; - #endif /* !defined ( BUFFER_H__3B123453_4344_BB23945IUHF1912__INCLUDED_ ) */ diff --git a/src/channel.cpp b/src/channel.cpp index e8bd5961..2b8b7a1b 100755 --- a/src/channel.cpp +++ b/src/channel.cpp @@ -30,10 +30,11 @@ \******************************************************************************/ CChannelSet::CChannelSet() : bWriteStatusHTMLFile ( false ) { - // enable all channels + // enable all channels and set server flag for ( int i = 0; i < MAX_NUM_CHANNELS; i++ ) { vecChannels[i].SetEnable ( true ); + vecChannels[i].SetIsServer ( true ); } // CODE TAG: MAX_NUM_CHANNELS_TAG @@ -512,24 +513,36 @@ void CChannelSet::WriteHTMLChannelList() * CChannel * \******************************************************************************/ CChannel::CChannel() : sName ( "" ), - vecdGains ( MAX_NUM_CHANNELS, (double) 1.0 ), + vecdGains ( MAX_NUM_CHANNELS, (double) 1.0 ), bIsServer ( false ), // it is important to give the following parameters meaningful initial // values because they are dependend on each other - iCurSockBufSize ( DEF_NET_BUF_SIZE_NUM_BL ), + iCurSockBufSize ( DEF_NET_BUF_SIZE_NUM_BL ), iCurNetwInBlSiFact ( DEF_NET_BLOCK_SIZE_FACTOR ) { // query all possible network in buffer sizes for determining if an // audio packet was received (the following code only works if all // possible network buffer sizes are different!) - vecNetwBufferInProps.Init ( 2 * MAX_NET_BLOCK_SIZE_FACTOR ); + const int iNumSupportedAudComprTypes = 3; + vecNetwBufferInProps.Init ( iNumSupportedAudComprTypes * + MAX_NET_BLOCK_SIZE_FACTOR ); + for ( int i = 0; i < MAX_NET_BLOCK_SIZE_FACTOR; i++ ) { - const int iIMAIdx = 2 * i; - const int iMSIdx = 2 * i + 1; + const int iNoneIdx = iNumSupportedAudComprTypes * i; + const int iIMAIdx = iNumSupportedAudComprTypes * i + 1; + const int iMSIdx = iNumSupportedAudComprTypes * i + 2; // network block size factor must start from 1 -> i + 1 - vecNetwBufferInProps[iIMAIdx].iBlockSizeFactor = i + 1; - vecNetwBufferInProps[iMSIdx].iBlockSizeFactor = i + 1; + const int iCurNetBlockSizeFact = i + 1; + vecNetwBufferInProps[iNoneIdx].iBlockSizeFactor = iCurNetBlockSizeFact; + vecNetwBufferInProps[iIMAIdx].iBlockSizeFactor = iCurNetBlockSizeFact; + vecNetwBufferInProps[iMSIdx].iBlockSizeFactor = iCurNetBlockSizeFact; + + // None (no audio compression) + vecNetwBufferInProps[iNoneIdx].eAudComprType = CAudioCompression::CT_NONE; + vecNetwBufferInProps[iNoneIdx].iNetwInBufSize = AudioCompressionIn.Init ( + vecNetwBufferInProps[iNoneIdx].iBlockSizeFactor * MIN_BLOCK_SIZE_SAMPLES, + vecNetwBufferInProps[iNoneIdx].eAudComprType ); // IMA ADPCM vecNetwBufferInProps[iIMAIdx].eAudComprType = CAudioCompression::CT_IMAADPCM; @@ -548,9 +561,12 @@ CChannel::CChannel() : sName ( "" ), SetSockBufSize ( DEF_NET_BUF_SIZE_NUM_BL ); // set initial input and output block size factors - SetNetwInBlSiFactAndCompr ( DEF_NET_BLOCK_SIZE_FACTOR, CAudioCompression::CT_IMAADPCM ); + SetNetwInBlSiFactAndCompr ( DEF_NET_BLOCK_SIZE_FACTOR, CAudioCompression::CT_MSADPCM ); SetNetwBufSizeFactOut ( DEF_NET_BLOCK_SIZE_FACTOR ); + // set initial audio compression format for output + SetAudioCompressionOut ( CAudioCompression::CT_MSADPCM ); + // init time-out for the buffer with zero -> no connection iConTimeOut = 0; @@ -624,17 +640,31 @@ void CChannel::SetNetwInBlSiFactAndCompr ( const int iNewBlockSizeFactor, } void CChannel::SetNetwBufSizeFactOut ( const int iNewNetwBlSiFactOut ) +{ + Mutex.lock(); + { + // store new value + iCurNetwOutBlSiFact = iNewNetwBlSiFactOut; + + // init audio compression and get audio compression block size + iAudComprSizeOut = AudioCompressionOut.Init ( + iNewNetwBlSiFactOut * MIN_BLOCK_SIZE_SAMPLES, eAudComprTypeOut ); + + // init conversion buffer + ConvBuf.Init ( iNewNetwBlSiFactOut * MIN_BLOCK_SIZE_SAMPLES ); + } + Mutex.unlock(); +} + +void CChannel::SetAudioCompressionOut ( const CAudioCompression::EAudComprType eNewAudComprTypeOut ) { // store new value - iCurNetwOutBlSiFact = iNewNetwBlSiFactOut; + eAudComprTypeOut = eNewAudComprTypeOut; - // init audio compression unit - iAudComprSizeOut = AudioCompressionOut.Init ( - iNewNetwBlSiFactOut * MIN_BLOCK_SIZE_SAMPLES, - CAudioCompression::CT_IMAADPCM ); - - // init conversion buffer - ConvBuf.Init ( iNewNetwBlSiFactOut * MIN_BLOCK_SIZE_SAMPLES ); + // call "set network buffer size factor" function because its initialization + // depends on the audio compression format and implicitely, the audio compression + // is initialized + SetNetwBufSizeFactOut ( iCurNetwOutBlSiFact ); } void CChannel::OnSendProtMessage ( CVector vecMessage ) @@ -673,17 +703,11 @@ void CChannel::SetSockBufSize ( const int iNumBlocks ) void CChannel::OnNetwBlSiFactChange ( int iNewNetwBlSiFact ) { -// TEST -//qDebug ( "new network block size factor: %d", iNewNetwBlSiFact ); - SetNetwBufSizeFactOut ( iNewNetwBlSiFact ); } void CChannel::OnJittBufSizeChange ( int iNewJitBufSize ) { -// TEST -//qDebug ( "new jitter buffer size: %d", iNewJitBufSize ); - SetSockBufSize ( iNewJitBufSize ); } @@ -766,11 +790,25 @@ EPutDataStat CChannel::PutData ( const CVector& vecbyData, const int iNewNetwInBlSiFact = vecNetwBufferInProps[i].iBlockSizeFactor; - if ( iNewNetwInBlSiFact != iCurNetwInBlSiFact ) + const CAudioCompression::EAudComprType eNewAudComprType = + vecNetwBufferInProps[i].eAudComprType; + + if ( ( iNewNetwInBlSiFact != iCurNetwInBlSiFact ) || + ( eNewAudComprType != AudioCompressionIn.GetType() ) ) { // re-initialize to new value SetNetwInBlSiFactAndCompr ( iNewNetwInBlSiFact, - vecNetwBufferInProps[i].eAudComprType ); + eNewAudComprType ); + } + + // in case of a server channel, use the same audio + // compression for output as for the input + if ( bIsServer ) + { + if ( GetAudioCompressionOut() != vecNetwBufferInProps[i].eAudComprType ) + { + SetAudioCompressionOut ( vecNetwBufferInProps[i].eAudComprType ); + } } } } @@ -783,22 +821,14 @@ EPutDataStat CChannel::PutData ( const CVector& vecbyData, // decompress audio CVector vecsDecomprAudio ( AudioCompressionIn.Decode ( vecbyData ) ); - // do resampling to compensate for sample rate offsets in the - // different sound cards of the clients -/* -for (int i = 0; i < BLOCK_SIZE_SAMPLES; i++) - vecdResInData[i] = (double) vecsData[i]; + // convert received data from short to double + CVector vecdDecomprAudio ( iCurNetwInBlSiFact * MIN_BLOCK_SIZE_SAMPLES ); + for ( int i = 0; i < iCurNetwInBlSiFact * MIN_BLOCK_SIZE_SAMPLES; i++ ) + { + vecdDecomprAudio[i] = static_cast ( vecsDecomprAudio[i] ); + } -const int iInSize = ResampleObj.Resample(vecdResInData, vecdResOutData, - (double) SYSTEM_SAMPLE_RATE / (SYSTEM_SAMPLE_RATE - dSamRateOffset)); -*/ - -vecdResOutData.Init ( iCurNetwInBlSiFact * MIN_BLOCK_SIZE_SAMPLES ); -for ( int i = 0; i < iCurNetwInBlSiFact * MIN_BLOCK_SIZE_SAMPLES; i++ ) { - vecdResOutData[i] = (double) vecsDecomprAudio[i]; -} - - if ( SockBuf.Put ( vecdResOutData ) ) + if ( SockBuf.Put ( vecdDecomprAudio ) ) { eRet = PS_AUDIO_OK; } @@ -883,14 +913,18 @@ CVector CChannel::PrepSendPacket ( const CVector& vecsNPac // tell the following network send routine that nothing should be sent CVector vecbySendBuf ( 0 ); - // use conversion buffer to convert sound card block size in network - // block size - if ( ConvBuf.Put ( vecsNPacket ) ) + Mutex.lock(); // get mutex lock { - // a packet is ready, compress audio - vecbySendBuf.Init ( iAudComprSizeOut ); - vecbySendBuf = AudioCompressionOut.Encode ( ConvBuf.Get() ); + // use conversion buffer to convert sound card block size in network + // block size + if ( ConvBuf.Put ( vecsNPacket ) ) + { + // a packet is ready, compress audio + vecbySendBuf.Init ( iAudComprSizeOut ); + vecbySendBuf = AudioCompressionOut.Encode ( ConvBuf.Get() ); + } } + Mutex.unlock(); // get mutex unlock return vecbySendBuf; } diff --git a/src/channel.h b/src/channel.h index 44c5477a..5e80365c 100755 --- a/src/channel.h +++ b/src/channel.h @@ -83,7 +83,7 @@ public: bool IsConnected() const { return iConTimeOut > 0; } void SetEnable ( const bool bNEnStat ); - bool IsEnabled() { return bIsEnabled; } + void SetIsServer ( const bool bNEnStat ) { bIsServer = bNEnStat; } void SetAddress ( const CHostAddress NAddr ) { InetAddr = NAddr; } bool GetAddress ( CHostAddress& RetAddr ); @@ -109,6 +109,9 @@ public: int GetNetwBufSizeFactIn() { return iCurNetwInBlSiFact; } + void SetAudioCompressionOut ( const CAudioCompression::EAudComprType eNewAudComprTypeOut ); + CAudioCompression::EAudComprType GetAudioCompressionOut() { return eAudComprTypeOut; } + // network protocol interface void CreateJitBufMes ( const int iJitBufSize ) { @@ -144,12 +147,6 @@ protected: CAudioCompression AudioCompressionOut; int iAudComprSizeOut; - // resampling - CResample ResampleObj; - double dSamRateOffset; - CVector vecdResInData; - CVector vecdResOutData; - // connection parameters CHostAddress InetAddr; @@ -173,6 +170,12 @@ protected: int iConTimeOutStartVal; bool bIsEnabled; + bool bIsServer; + + int iCurNetwInBlSiFact; + int iCurNetwOutBlSiFact; + + QMutex Mutex; struct sNetwBufferInProps { @@ -182,10 +185,7 @@ protected: }; CVector vecNetwBufferInProps; - int iCurNetwInBlSiFact; - int iCurNetwOutBlSiFact; - - QMutex Mutex; + CAudioCompression::EAudComprType eAudComprTypeOut; public slots: void OnSendProtMessage ( CVector vecMessage ); diff --git a/src/client.h b/src/client.h index 3dfa711c..d2fd026e 100755 --- a/src/client.h +++ b/src/client.h @@ -35,6 +35,7 @@ #include "socket.h" #include "resample.h" #include "channel.h" +#include "audiocompr.h" #include "util.h" #ifdef _WIN32 # include "../windows/sound.h" @@ -110,12 +111,13 @@ public: int GetNetwBufSizeFactIn() { return iNetwBufSizeFactIn; } void SetNetwBufSizeFactOut ( const int iNetNetwBlSiFact ) - { - // set the new socket size - Channel.SetNetwBufSizeFactOut ( iNetNetwBlSiFact ); - } + { Channel.SetNetwBufSizeFactOut ( iNetNetwBlSiFact ); } int GetNetwBufSizeFactOut() { return Channel.GetNetwBufSizeFactOut(); } + void SetAudioCompressionOut ( const CAudioCompression::EAudComprType eNewAudComprTypeOut ) + { Channel.SetAudioCompressionOut ( eNewAudComprTypeOut ); } + CAudioCompression::EAudComprType GetAudioCompressionOut() { return Channel.GetAudioCompressionOut(); } + void SetRemoteChanGain ( const int iId, const double dGain ) { Channel.SetRemoteChanGain ( iId, dGain ); } @@ -193,5 +195,4 @@ signals: void PingTimeReceived ( int iPingTime ); }; - #endif /* !defined ( CLIENT_HOIHGE76GEKJH98_3_43445KJIUHF1912__INCLUDED_ ) */ diff --git a/src/clientsettingsdlg.cpp b/src/clientsettingsdlg.cpp index 13ac8006..146d57bd 100755 --- a/src/clientsettingsdlg.cpp +++ b/src/clientsettingsdlg.cpp @@ -92,6 +92,25 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, QWidget* parent, cbOpenChatOnNewMessage->setCheckState ( Qt::Unchecked ); } + // audio compression type + switch ( pClient->GetAudioCompressionOut() ) + { + case CAudioCompression::CT_NONE: + radioButtonNoAudioCompr->setChecked ( true ); + break; + + case CAudioCompression::CT_IMAADPCM: + radioButtonIMA_ADPCM->setChecked ( true ); + break; + + case CAudioCompression::CT_MSADPCM: + radioButtonMS_ADPCM->setChecked ( true ); + break; + } + AudioCompressionButtonGroup.addButton ( radioButtonNoAudioCompr ); + AudioCompressionButtonGroup.addButton ( radioButtonIMA_ADPCM ); + AudioCompressionButtonGroup.addButton ( radioButtonMS_ADPCM ); + // Connections ------------------------------------------------------------- // timers @@ -123,6 +142,9 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, QWidget* parent, QObject::connect ( pClient, SIGNAL ( PingTimeReceived ( int ) ), this, SLOT ( OnPingTimeResult ( int ) ) ); + QObject::connect ( &AudioCompressionButtonGroup, SIGNAL ( buttonClicked ( QAbstractButton* ) ), + this, SLOT ( OnAudioCompressionButtonGroupClicked ( QAbstractButton* ) ) ); + // Timers ------------------------------------------------------------------ // start timer for status bar @@ -186,6 +208,25 @@ void CClientSettingsDlg::OnOpenChatOnNewMessageStateChanged ( int value ) UpdateDisplay(); } +void CClientSettingsDlg::OnAudioCompressionButtonGroupClicked ( QAbstractButton* button ) +{ + if ( button == radioButtonNoAudioCompr ) + { + pClient->SetAudioCompressionOut ( CAudioCompression::CT_NONE ); + } + + if ( button == radioButtonIMA_ADPCM ) + { + pClient->SetAudioCompressionOut ( CAudioCompression::CT_IMAADPCM ); + } + + if ( button == radioButtonMS_ADPCM ) + { + pClient->SetAudioCompressionOut ( CAudioCompression::CT_MSADPCM ); + } + UpdateDisplay(); +} + void CClientSettingsDlg::OnTimerPing() { // send ping message to server diff --git a/src/clientsettingsdlg.h b/src/clientsettingsdlg.h index 0b11f3c7..3436c0d9 100755 --- a/src/clientsettingsdlg.h +++ b/src/clientsettingsdlg.h @@ -1,5 +1,5 @@ /******************************************************************************\ - * Copyright (c) 2004-2006 + * Copyright (c) 2004-2008 * * Author(s): * Volker Fischer @@ -33,8 +33,10 @@ #include #include #include +#include #include "global.h" #include "client.h" +#include "audiocompr.h" #include "multicolorled.h" #ifdef _WIN32 # include "../windows/moc/clientsettingsdlgbase.h" @@ -61,10 +63,11 @@ public: void SetStatus ( const int iMessType, const int iStatus ); protected: - CClient* pClient; - QTimer TimerStatus; - QTimer TimerPing; - void UpdateDisplay(); + CClient* pClient; + QTimer TimerStatus; + QTimer TimerPing; + QButtonGroup AudioCompressionButtonGroup; + void UpdateDisplay(); virtual void showEvent ( QShowEvent* showEvent ); virtual void hideEvent ( QHideEvent* hideEvent ); @@ -78,5 +81,6 @@ public slots: void OnSliderNetBufSiFactIn ( int value ); void OnSliderNetBufSiFactOut ( int value ); void OnOpenChatOnNewMessageStateChanged ( int value ); + void OnAudioCompressionButtonGroupClicked ( QAbstractButton* button ); void OnPingTimeResult ( int iPingTime ); }; diff --git a/src/clientsettingsdlgbase.ui b/src/clientsettingsdlgbase.ui index 55b38c0b..9b5f6ef5 100755 --- a/src/clientsettingsdlgbase.ui +++ b/src/clientsettingsdlgbase.ui @@ -6,7 +6,7 @@ 0 0 443 - 244 + 260 @@ -724,23 +724,60 @@ - - - Qt::Horizontal + + + + + + + + + + + + + 0 + 0 + + + + Open chat on new message + + + true + + + + + + + + + Audio Compression - - - - - - - - Open chat on new message - - - true - - + + + + + IMA ADPCM + + + + + + + MS ADPCM + + + + + + + None + + + + @@ -750,8 +787,8 @@ - 98 - 21 + 116 + 20 diff --git a/src/global.h b/src/global.h index 272c9cf9..f1b1bb65 100755 --- a/src/global.h +++ b/src/global.h @@ -183,5 +183,4 @@ bool GetNumericArgument ( int argc, char **argv, int &i, std::string strS void PostWinMessage ( const _MESSAGE_IDENT MessID, const int iMessageParam = 0, const int iChanNum = 0 ); - #endif /* !defined ( GLOBAL_H__3B123453_4344_BB2B_23E7A0D31912__INCLUDED_ ) */ diff --git a/src/llconclientdlg.cpp b/src/llconclientdlg.cpp index da2b86a0..7a910994 100755 --- a/src/llconclientdlg.cpp +++ b/src/llconclientdlg.cpp @@ -1,5 +1,5 @@ /******************************************************************************\ - * Copyright (c) 2004-2006 + * Copyright (c) 2004-2008 * * Author(s): * Volker Fischer diff --git a/src/llconclientdlg.h b/src/llconclientdlg.h index 96956afb..70a482c6 100755 --- a/src/llconclientdlg.h +++ b/src/llconclientdlg.h @@ -1,5 +1,5 @@ /******************************************************************************\ - * Copyright (c) 2004-2006 + * Copyright (c) 2004-2008 * * Author(s): * Volker Fischer diff --git a/src/protocol.cpp b/src/protocol.cpp index 67a5625c..1d425c59 100755 --- a/src/protocol.cpp +++ b/src/protocol.cpp @@ -1,5 +1,5 @@ /******************************************************************************\ - * Copyright (c) 2004-2006 + * Copyright (c) 2004-2008 * * Author(s): * Volker Fischer diff --git a/src/protocol.h b/src/protocol.h index 0c7a07f1..51e075df 100755 --- a/src/protocol.h +++ b/src/protocol.h @@ -175,5 +175,4 @@ signals: void ServerFull(); }; - #endif /* !defined ( PROTOCOL_H__3B123453_4344_BB2392354455IUHF1912__INCLUDED_ ) */ diff --git a/src/resample.h b/src/resample.h index 99281677..50b68b14 100755 --- a/src/resample.h +++ b/src/resample.h @@ -1,5 +1,5 @@ /******************************************************************************\ - * Copyright (c) 2004-2006 + * Copyright (c) 2004-2008 * * Author(s): * Volker Fischer diff --git a/src/server.cpp b/src/server.cpp index eaa9617f..7bb98f24 100755 --- a/src/server.cpp +++ b/src/server.cpp @@ -1,5 +1,5 @@ /******************************************************************************\ - * Copyright (c) 2004-2006 + * Copyright (c) 2004-2008 * * Author(s): * Volker Fischer diff --git a/src/server.h b/src/server.h index b80620b1..a7d4cb08 100755 --- a/src/server.h +++ b/src/server.h @@ -1,5 +1,5 @@ /******************************************************************************\ - * Copyright (c) 2004-2006 + * Copyright (c) 2004-2008 * * Author(s): * Volker Fischer @@ -88,5 +88,4 @@ public slots: void OnSendProtMessage ( int iChID, CVector vecMessage ); }; - #endif /* !defined ( SERVER_HOIHGE7LOKIH83JH8_3_43445KJIUHF1912__INCLUDED_ ) */ diff --git a/src/settings.cpp b/src/settings.cpp index 5b9c31f3..725bb51b 100755 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -112,6 +112,26 @@ void CSettings::ReadIniFile ( const QString& sFileName ) { pClient->SetOpenChatOnNewMessage ( bValue ); } + + // audio compression type (check CAudioCompression::EAudComprType definition + // for integer numbers!) + if ( GetNumericIniSet ( IniXMLDocument, "client", "audiocompression", 0, 2, iValue ) ) + { + switch ( iValue ) + { + case 0: + pClient->SetAudioCompressionOut ( CAudioCompression::CT_NONE ); + break; + + case 1: + pClient->SetAudioCompressionOut ( CAudioCompression::CT_IMAADPCM ); + break; + + case 2: + break; + pClient->SetAudioCompressionOut ( CAudioCompression::CT_MSADPCM ); + } + } } void CSettings::WriteIniFile ( const QString& sFileName ) @@ -154,6 +174,22 @@ void CSettings::WriteIniFile ( const QString& sFileName ) // flag whether the chat window shall be opened on a new chat message SetFlagIniSet ( IniXMLDocument, "client", "openchatonnewmessage", pClient->GetOpenChatOnNewMessage() ); + // audio compression type (check CAudioCompression::EAudComprType definition + // for integer numbers!) + switch ( pClient->GetAudioCompressionOut() ) + { + case CAudioCompression::CT_NONE: + SetNumericIniSet ( IniXMLDocument, "client", "audiocompression", 0 ); + break; + + case CAudioCompression::CT_IMAADPCM: + SetNumericIniSet ( IniXMLDocument, "client", "audiocompression", 1 ); + break; + + case CAudioCompression::CT_MSADPCM: + SetNumericIniSet ( IniXMLDocument, "client", "audiocompression", 2 ); + break; + } // prepare file name for storing initialization data in XML file QString sCurFileName = sFileName; diff --git a/src/settings.h b/src/settings.h index ea8aba31..1529d97c 100755 --- a/src/settings.h +++ b/src/settings.h @@ -30,6 +30,7 @@ #include #include "global.h" #include "client.h" +#include "audiocompr.h" /* Definitions ****************************************************************/ diff --git a/src/socket.h b/src/socket.h index 524af52f..d0f0351b 100755 --- a/src/socket.h +++ b/src/socket.h @@ -1,5 +1,5 @@ /******************************************************************************\ - * Copyright (c) 2004-2006 + * Copyright (c) 2004-2008 * * Author(s): * Volker Fischer @@ -74,5 +74,4 @@ public slots: void OnDataReceived(); }; - #endif /* !defined ( SOCKET_HOIHGE76GEKJH98_3_4344_BB23945IUHF1912__INCLUDED_ ) */ diff --git a/src/util.h b/src/util.h index 51b3f5c9..59f22471 100755 --- a/src/util.h +++ b/src/util.h @@ -1,5 +1,5 @@ /******************************************************************************\ - * Copyright (c) 2004-2006 + * Copyright (c) 2004-2008 * * Author(s): * Volker Fischer diff --git a/windows/MocQT.bat b/windows/MocQT.bat index 2426870e..0e091423 100755 --- a/windows/MocQT.bat +++ b/windows/MocQT.bat @@ -1,5 +1,5 @@ rem/******************************************************************************\ -rem * Copyright (c) 2004-2006 +rem * Copyright (c) 2004-2008 rem * rem * Author(s): rem * Volker Fischer diff --git a/windows/sound.h b/windows/sound.h index 5911fe6e..1783c9c1 100755 --- a/windows/sound.h +++ b/windows/sound.h @@ -1,5 +1,5 @@ /******************************************************************************\ - * Copyright (c) 2004-2006 + * Copyright (c) 2004-2008 * * Author(s): * Volker Fischer