some more GUI work

This commit is contained in:
Volker Fischer 2009-08-02 19:18:19 +00:00
parent 9eb7bb9e1f
commit 22713c9c7a
4 changed files with 33 additions and 39 deletions

View file

@ -36,7 +36,7 @@ CClient::CClient ( const quint16 iPortNumber ) :
vstrIPAddress ( MAX_NUM_SERVER_ADDR_ITEMS, "" ), strName ( "" ),
bOpenChatOnNewMessage ( true ),
bDoAutoSockBufSize ( true ),
iSndCrdPreferredMonoBlSizeIndex ( FRAME_SIZE_FACTOR_DEFAULT )
iSndCrdPrefMonoFrameSizeFactor ( FRAME_SIZE_FACTOR_DEFAULT )
{
// connection for protocol
QObject::connect ( &Channel,
@ -145,14 +145,14 @@ bool CClient::SetServerAddr ( QString strNAddr )
return true;
}
void CClient::SetSndCrdPreferredMonoBlSizeIndex ( const int iNewIdx )
void CClient::SetSndCrdPrefMonoFrameSizeFactor ( const int iNewFactor )
{
// right now we simply set the internal value
if ( ( iNewIdx == FRAME_SIZE_FACTOR_PREFERRED ) ||
( iNewIdx == FRAME_SIZE_FACTOR_DEFAULT ) ||
( iNewIdx == FRAME_SIZE_FACTOR_SAFE ) )
if ( ( iNewFactor == FRAME_SIZE_FACTOR_PREFERRED ) ||
( iNewFactor == FRAME_SIZE_FACTOR_DEFAULT ) ||
( iNewFactor == FRAME_SIZE_FACTOR_SAFE ) )
{
iSndCrdPreferredMonoBlSizeIndex = iNewIdx;
iSndCrdPrefMonoFrameSizeFactor = iNewFactor;
// init with new parameter, if client was running then first
// stop it and restart again after new initialization
@ -163,7 +163,7 @@ void CClient::SetSndCrdPreferredMonoBlSizeIndex ( const int iNewIdx )
}
// init with new block size index parameter
Init ( iSndCrdPreferredMonoBlSizeIndex );
Init();
if ( bWasRunning )
{
@ -186,7 +186,7 @@ QString CClient::SetSndCrdDev ( const int iNewDev )
// init again because the sound card actual buffer size might
// be changed on new device
Init ( iSndCrdPreferredMonoBlSizeIndex );
Init();
if ( bWasRunning )
{
@ -209,7 +209,7 @@ void CClient::OnSndCrdReinitRequest()
// reinit the driver (we use the currently selected driver) and
// init client object, too
Sound.SetDev ( Sound.GetDev() );
Init ( iSndCrdPreferredMonoBlSizeIndex );
Init();
if ( bWasRunning )
{
@ -220,7 +220,7 @@ void CClient::OnSndCrdReinitRequest()
void CClient::Start()
{
// init object
Init ( iSndCrdPreferredMonoBlSizeIndex );
Init();
// enable channel
Channel.SetEnable ( true );
@ -258,14 +258,14 @@ void CClient::AudioCallback ( CVector<int16_t>& psData, void* arg )
pMyClientObj->ProcessAudioData ( psData );
}
void CClient::Init ( const int iPrefMonoBlockSizeSamIndexAtSndCrdSamRate )
void CClient::Init()
{
// translate block size index in actual block size
const int iPrefMonoBlockSizeSamAtSndCrdSamRate =
iPrefMonoBlockSizeSamIndexAtSndCrdSamRate * SYSTEM_BLOCK_FRAME_SAMPLES;
const int iPrefMonoFrameSize =
iSndCrdPrefMonoFrameSizeFactor * SYSTEM_BLOCK_FRAME_SAMPLES;
// get actual sound card buffer size using preferred size
iMonoBlockSizeSam = Sound.Init ( iPrefMonoBlockSizeSamAtSndCrdSamRate );
iMonoBlockSizeSam = Sound.Init ( iPrefMonoFrameSize );
iStereoBlockSizeSam = 2 * iMonoBlockSizeSam;
vecsAudioSndCrdStereo.Init ( iStereoBlockSizeSam );
@ -299,11 +299,8 @@ void CClient::Init ( const int iPrefMonoBlockSizeSamIndexAtSndCrdSamRate )
vecbyNetwData.Init ( iCeltNumCodedBytes );
// set the channel network properties
// TEST right now we only support 128 samples, later 256 and 512, too
Channel.SetNetwFrameSizeAndFact ( iCeltNumCodedBytes,
1 ); // TEST "1"
Channel.SetNetwFrameSizeAndFact ( iCeltNumCodedBytes,
iSndCrdPrefMonoFrameSizeFactor );
}
void CClient::ProcessAudioData ( CVector<int16_t>& vecsStereoSndCrd )

View file

@ -119,9 +119,9 @@ public:
int GetSndCrdDev() { return Sound.GetDev(); }
void OpenSndCrdDriverSetup() { Sound.OpenDriverSetup(); }
void SetSndCrdPreferredMonoBlSizeIndex ( const int iNewIdx );
int GetSndCrdPreferredMonoBlSizeIndex()
{ return iSndCrdPreferredMonoBlSizeIndex; }
void SetSndCrdPrefMonoFrameSizeFactor ( const int iNewFactor );
int GetSndCrdPrefMonoFrameSizeFactor()
{ return iSndCrdPrefMonoFrameSizeFactor; }
int GetSndCrdActualMonoBlSize() { return iMonoBlockSizeSam; }
void SetRemoteChanGain ( const int iId, const double dGain )
@ -146,7 +146,7 @@ protected:
// callback function must be static, otherwise it does not work
static void AudioCallback ( CVector<short>& psData, void* arg );
void Init ( const int iPrefMonoBlockSizeSamIndexAtSndCrdSamRate );
void Init();
void ProcessAudioData ( CVector<short>& vecsStereoSndCrd );
void UpdateSocketBufferSize();
@ -172,7 +172,7 @@ protected:
int iReverbLevel;
CAudioReverb AudioReverb;
int iSndCrdPreferredMonoBlSizeIndex;
int iSndCrdPrefMonoFrameSizeFactor;
int iMonoBlockSizeSam;
int iStereoBlockSizeSam;

View file

@ -95,23 +95,21 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, QWidget* parent,
rButBufferDelaySafe->setText ( GenSndCrdBufferDelayString (
FRAME_SIZE_FACTOR_SAFE * SYSTEM_BLOCK_FRAME_SAMPLES ) );
/*
// sound card buffer delay
switch ( pClient->[]() )
switch ( pClient->GetSndCrdPrefMonoFrameSizeFactor() )
{
case CT_NONE:
case FRAME_SIZE_FACTOR_PREFERRED:
rButBufferDelayPreferred->setChecked ( true );
break;
case CT_IMAADPCM:
case FRAME_SIZE_FACTOR_DEFAULT:
rButBufferDelayDefault->setChecked ( true );
break;
case CT_MSADPCM:
case FRAME_SIZE_FACTOR_SAFE:
rButBufferDelaySafe->setChecked ( true );
break;
}
*/
SndCrdBufferDelayButtonGroup.addButton ( rButBufferDelayPreferred );
SndCrdBufferDelayButtonGroup.addButton ( rButBufferDelayDefault );
SndCrdBufferDelayButtonGroup.addButton ( rButBufferDelaySafe );
@ -182,7 +180,7 @@ QString CClientSettingsDlg::GenSndCrdBufferDelayString ( const int iFrameSize,
void CClientSettingsDlg::UpdateSoundCardFrame()
{
// update slider value and text
const int iCurPrefBufIdx = pClient->GetSndCrdPreferredMonoBlSizeIndex();
const int iCurPrefBufIdx = pClient->GetSndCrdPrefMonoFrameSizeFactor();
const int iCurActualBufSize = pClient->GetSndCrdActualMonoBlSize();
/*
@ -235,7 +233,7 @@ void CClientSettingsDlg::OnSliderNetBuf ( int value )
void CClientSettingsDlg::OnSliderSndCrdBufferDelay ( int value )
{
pClient->SetSndCrdPreferredMonoBlSizeIndex ( value );
pClient->SetSndCrdPrefMonoFrameSizeFactor ( value );
UpdateDisplay();
}
@ -270,22 +268,21 @@ void CClientSettingsDlg::OnOpenChatOnNewMessageStateChanged ( int value )
void CClientSettingsDlg::OnSndCrdBufferDelayButtonGroupClicked ( QAbstractButton* button )
{
/*
if ( button == rButBufferDelayPreferred )
{
pClient->SetAudioCompressionOut ( CT_NONE );
pClient->SetSndCrdPrefMonoFrameSizeFactor ( FRAME_SIZE_FACTOR_PREFERRED );
}
if ( button == rButBufferDelayDefault )
{
pClient->SetAudioCompressionOut ( CT_IMAADPCM );
pClient->SetSndCrdPrefMonoFrameSizeFactor ( FRAME_SIZE_FACTOR_DEFAULT );
}
if ( button == rButBufferDelaySafe )
{
pClient->SetAudioCompressionOut ( CT_MSADPCM );
pClient->SetSndCrdPrefMonoFrameSizeFactor ( FRAME_SIZE_FACTOR_SAFE );
}
*/
UpdateDisplay();
}

View file

@ -118,7 +118,7 @@ void CSettings::ReadIniFile ( const QString& sFileName )
( iValue == FRAME_SIZE_FACTOR_DEFAULT ) ||
( iValue == FRAME_SIZE_FACTOR_SAFE ) )
{
pClient->SetSndCrdPreferredMonoBlSizeIndex ( iValue );
pClient->SetSndCrdPrefMonoFrameSizeFactor ( iValue );
}
}
@ -179,7 +179,7 @@ void CSettings::WriteIniFile ( const QString& sFileName )
// sound card preferred buffer size index
SetNumericIniSet ( IniXMLDocument, "client", "prefsndcrdbufidx",
pClient->GetSndCrdPreferredMonoBlSizeIndex() );
pClient->GetSndCrdPrefMonoFrameSizeFactor() );
// automatic network jitter buffer size setting
SetFlagIniSet ( IniXMLDocument, "client", "autojitbuf",