This commit is contained in:
Volker Fischer 2009-08-15 14:15:05 +00:00
parent 94c27493c2
commit e9a52a83ff

View file

@ -1,405 +1,406 @@
/******************************************************************************\ /******************************************************************************\
* Copyright (c) 2004-2009 * Copyright (c) 2004-2009
* *
* Author(s): * Author(s):
* Volker Fischer * Volker Fischer
* *
****************************************************************************** ******************************************************************************
* *
* 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
* *
\******************************************************************************/ \******************************************************************************/
#include "clientsettingsdlg.h" #include "clientsettingsdlg.h"
/* Implementation *************************************************************/ /* Implementation *************************************************************/
CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, QWidget* parent, CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, QWidget* parent,
Qt::WindowFlags f ) : pClient ( pNCliP ), QDialog ( parent, f ) Qt::WindowFlags f ) : pClient ( pNCliP ), QDialog ( parent, f )
{ {
setupUi ( this ); setupUi ( this );
// add help text to controls // add help text to controls
QString strJitterBufferSize = tr ( "<b>Jitter Buffer Size:</b> The size of " QString strJitterBufferSize = tr ( "<b>Jitter Buffer Size:</b> The size of "
"the network buffer (jitter buffer). The jitter buffer compensates for " "the network buffer (jitter buffer). The jitter buffer compensates for "
"the network jitter. The larger this buffer is, the more robust the " "the network jitter. The larger this buffer is, the more robust the "
"connection is against network jitter but the higher is the latency. " "connection is against network jitter but the higher is the latency. "
"This setting is therefore a trade-off between audio drop outs and " "This setting is therefore a trade-off between audio drop outs and "
"overall audio delay.<br>By changing this setting, both, the client " "overall audio delay.<br>By changing this setting, both, the client "
"and the server jitter buffer is set to the same value." ); "and the server jitter buffer is set to the same value." );
SliderNetBuf->setWhatsThis ( strJitterBufferSize ); SliderNetBuf->setWhatsThis ( strJitterBufferSize );
TextNetBuf->setWhatsThis ( strJitterBufferSize ); TextNetBuf->setWhatsThis ( strJitterBufferSize );
GroupBoxJitterBuffer->setWhatsThis ( strJitterBufferSize ); GroupBoxJitterBuffer->setWhatsThis ( strJitterBufferSize );
// init driver button // init driver button
#ifdef _WIN32 #ifdef _WIN32
ButtonDriverSetup->setText ( "ASIO Setup" ); ButtonDriverSetup->setText ( "ASIO Setup" );
#else #else
// no use for this button for Linux right now, maybe later used // no use for this button for Linux right now, maybe later used
// for Jack // for Jack
ButtonDriverSetup->hide(); ButtonDriverSetup->hide();
#endif #endif
// init delay and other information controls // init delay and other information controls
CLEDOverallDelay->SetUpdateTime ( 2 * PING_UPDATE_TIME ); CLEDOverallDelay->SetUpdateTime ( 2 * PING_UPDATE_TIME );
CLEDOverallDelay->Reset(); CLEDOverallDelay->Reset();
TextLabelPingTime->setText ( "" ); TextLabelPingTime->setText ( "" );
TextLabelOverallDelay->setText ( "" ); TextLabelOverallDelay->setText ( "" );
TextUpstreamValue->setText ( "" ); TextUpstreamValue->setText ( "" );
// init slider controls --- // init slider controls ---
// network buffer // network buffer
SliderNetBuf->setRange ( MIN_NET_BUF_SIZE_NUM_BL, MAX_NET_BUF_SIZE_NUM_BL ); SliderNetBuf->setRange ( MIN_NET_BUF_SIZE_NUM_BL, MAX_NET_BUF_SIZE_NUM_BL );
UpdateJitterBufferFrame(); UpdateJitterBufferFrame();
// init combo box containing all available sound cards in the system // init combo box containing all available sound cards in the system
cbSoundcard->clear(); cbSoundcard->clear();
for ( int iSndDevIdx = 0; iSndDevIdx < pClient->GetSndCrdNumDev(); iSndDevIdx++ ) for ( int iSndDevIdx = 0; iSndDevIdx < pClient->GetSndCrdNumDev(); iSndDevIdx++ )
{ {
cbSoundcard->addItem ( pClient->GetSndCrdDeviceName ( iSndDevIdx ).c_str() ); cbSoundcard->addItem ( pClient->GetSndCrdDeviceName ( iSndDevIdx ).c_str() );
} }
cbSoundcard->setCurrentIndex ( pClient->GetSndCrdDev() ); cbSoundcard->setCurrentIndex ( pClient->GetSndCrdDev() );
// "OpenChatOnNewMessage" check box // "OpenChatOnNewMessage" check box
if ( pClient->GetOpenChatOnNewMessage() ) if ( pClient->GetOpenChatOnNewMessage() )
{ {
cbOpenChatOnNewMessage->setCheckState ( Qt::Checked ); cbOpenChatOnNewMessage->setCheckState ( Qt::Checked );
} }
else else
{ {
cbOpenChatOnNewMessage->setCheckState ( Qt::Unchecked ); cbOpenChatOnNewMessage->setCheckState ( Qt::Unchecked );
} }
// set text for sound card buffer delay radio buttons // set text for sound card buffer delay radio buttons
rButBufferDelayPreferred->setText ( GenSndCrdBufferDelayString ( rButBufferDelayPreferred->setText ( GenSndCrdBufferDelayString (
FRAME_SIZE_FACTOR_PREFERRED * SYSTEM_FRAME_SIZE_SAMPLES, FRAME_SIZE_FACTOR_PREFERRED * SYSTEM_FRAME_SIZE_SAMPLES,
", preferred" ) ); ", preferred" ) );
rButBufferDelayDefault->setText ( GenSndCrdBufferDelayString ( rButBufferDelayDefault->setText ( GenSndCrdBufferDelayString (
FRAME_SIZE_FACTOR_DEFAULT * SYSTEM_FRAME_SIZE_SAMPLES, FRAME_SIZE_FACTOR_DEFAULT * SYSTEM_FRAME_SIZE_SAMPLES,
", default" ) ); ", default" ) );
rButBufferDelaySafe->setText ( GenSndCrdBufferDelayString ( rButBufferDelaySafe->setText ( GenSndCrdBufferDelayString (
FRAME_SIZE_FACTOR_SAFE * SYSTEM_FRAME_SIZE_SAMPLES ) ); FRAME_SIZE_FACTOR_SAFE * SYSTEM_FRAME_SIZE_SAMPLES ) );
// sound card buffer delay inits // sound card buffer delay inits
SndCrdBufferDelayButtonGroup.addButton ( rButBufferDelayPreferred ); SndCrdBufferDelayButtonGroup.addButton ( rButBufferDelayPreferred );
SndCrdBufferDelayButtonGroup.addButton ( rButBufferDelayDefault ); SndCrdBufferDelayButtonGroup.addButton ( rButBufferDelayDefault );
SndCrdBufferDelayButtonGroup.addButton ( rButBufferDelaySafe ); SndCrdBufferDelayButtonGroup.addButton ( rButBufferDelaySafe );
UpdateSoundCardFrame(); UpdateSoundCardFrame();
// Connections ------------------------------------------------------------- // Connections -------------------------------------------------------------
// timers // timers
QObject::connect ( &TimerStatus, SIGNAL ( timeout() ), QObject::connect ( &TimerStatus, SIGNAL ( timeout() ),
this, SLOT ( OnTimerStatus() ) ); this, SLOT ( OnTimerStatus() ) );
QObject::connect ( &TimerPing, SIGNAL ( timeout() ), QObject::connect ( &TimerPing, SIGNAL ( timeout() ),
this, SLOT ( OnTimerPing() ) ); this, SLOT ( OnTimerPing() ) );
// slider controls // slider controls
QObject::connect ( SliderNetBuf, SIGNAL ( valueChanged ( int ) ), QObject::connect ( SliderNetBuf, SIGNAL ( valueChanged ( int ) ),
this, SLOT ( OnSliderNetBuf ( int ) ) ); this, SLOT ( OnSliderNetBuf ( int ) ) );
// check boxes // check boxes
QObject::connect ( cbOpenChatOnNewMessage, SIGNAL ( stateChanged ( int ) ), QObject::connect ( cbOpenChatOnNewMessage, SIGNAL ( stateChanged ( int ) ),
this, SLOT ( OnOpenChatOnNewMessageStateChanged ( int ) ) ); this, SLOT ( OnOpenChatOnNewMessageStateChanged ( int ) ) );
QObject::connect ( cbAutoJitBuf, SIGNAL ( stateChanged ( int ) ), QObject::connect ( cbAutoJitBuf, SIGNAL ( stateChanged ( int ) ),
this, SLOT ( OnAutoJitBuf ( int ) ) ); this, SLOT ( OnAutoJitBuf ( int ) ) );
// combo boxes // combo boxes
QObject::connect ( cbSoundcard, SIGNAL ( activated ( int ) ), QObject::connect ( cbSoundcard, SIGNAL ( activated ( int ) ),
this, SLOT ( OnSoundCrdSelection ( int ) ) ); this, SLOT ( OnSoundCrdSelection ( int ) ) );
// buttons // buttons
QObject::connect ( ButtonDriverSetup, SIGNAL ( clicked() ), QObject::connect ( ButtonDriverSetup, SIGNAL ( clicked() ),
this, SLOT ( OnDriverSetupBut() ) ); this, SLOT ( OnDriverSetupBut() ) );
// misc // misc
QObject::connect ( pClient, SIGNAL ( PingTimeReceived ( int ) ), QObject::connect ( pClient, SIGNAL ( PingTimeReceived ( int ) ),
this, SLOT ( OnPingTimeResult ( int ) ) ); this, SLOT ( OnPingTimeResult ( int ) ) );
QObject::connect ( &SndCrdBufferDelayButtonGroup, QObject::connect ( &SndCrdBufferDelayButtonGroup,
SIGNAL ( buttonClicked ( QAbstractButton* ) ), this, SIGNAL ( buttonClicked ( QAbstractButton* ) ), this,
SLOT ( OnSndCrdBufferDelayButtonGroupClicked ( QAbstractButton* ) ) ); SLOT ( OnSndCrdBufferDelayButtonGroupClicked ( QAbstractButton* ) ) );
// Timers ------------------------------------------------------------------ // Timers ------------------------------------------------------------------
// start timer for status bar // start timer for status bar
TimerStatus.start ( DISPLAY_UPDATE_TIME ); TimerStatus.start ( DISPLAY_UPDATE_TIME );
} }
void CClientSettingsDlg::UpdateJitterBufferFrame() void CClientSettingsDlg::UpdateJitterBufferFrame()
{ {
// update slider value and text // update slider value and text
const int iCurNumNetBuf = pClient->GetSockBufNumFrames(); const int iCurNumNetBuf = pClient->GetSockBufNumFrames();
SliderNetBuf->setValue ( iCurNumNetBuf ); SliderNetBuf->setValue ( iCurNumNetBuf );
TextNetBuf->setText ( "Size: " + QString().setNum ( iCurNumNetBuf ) ); TextNetBuf->setText ( "Size: " + QString().setNum ( iCurNumNetBuf ) );
// if auto setting is enabled, disable slider control // if auto setting is enabled, disable slider control
cbAutoJitBuf->setChecked ( pClient->GetDoAutoSockBufSize() ); cbAutoJitBuf->setChecked ( pClient->GetDoAutoSockBufSize() );
SliderNetBuf->setEnabled ( !pClient->GetDoAutoSockBufSize() ); SliderNetBuf->setEnabled ( !pClient->GetDoAutoSockBufSize() );
TextNetBuf->setEnabled ( !pClient->GetDoAutoSockBufSize() ); TextNetBuf->setEnabled ( !pClient->GetDoAutoSockBufSize() );
} }
QString CClientSettingsDlg::GenSndCrdBufferDelayString ( const int iFrameSize, QString CClientSettingsDlg::GenSndCrdBufferDelayString ( const int iFrameSize,
const QString strAddText ) const QString strAddText )
{ {
// use two times the buffer delay for the entire delay since // use two times the buffer delay for the entire delay since
// we have input and output // we have input and output
return QString().setNum ( (double) iFrameSize * 2 * return QString().setNum ( (double) iFrameSize * 2 *
1000 / SYSTEM_SAMPLE_RATE, 'f', 2 ) + " ms (" + 1000 / SYSTEM_SAMPLE_RATE, 'f', 2 ) + " ms (" +
QString().setNum ( iFrameSize ) + strAddText + ")"; QString().setNum ( iFrameSize ) + strAddText + ")";
} }
void CClientSettingsDlg::UpdateSoundCardFrame() void CClientSettingsDlg::UpdateSoundCardFrame()
{ {
// update slider value and text // update slider value and text
const int iCurPrefFrameSizeFactor = const int iCurPrefFrameSizeFactor =
pClient->GetSndCrdPrefFrameSizeFactor(); pClient->GetSndCrdPrefFrameSizeFactor();
const int iCurActualBufSize = const int iCurActualBufSize =
pClient->GetSndCrdActualMonoBlSize(); pClient->GetSndCrdActualMonoBlSize();
// update radio buttons // update radio buttons
switch ( iCurPrefFrameSizeFactor ) switch ( iCurPrefFrameSizeFactor )
{ {
case FRAME_SIZE_FACTOR_PREFERRED: case FRAME_SIZE_FACTOR_PREFERRED:
rButBufferDelayPreferred->setChecked ( true ); rButBufferDelayPreferred->setChecked ( true );
break; break;
case FRAME_SIZE_FACTOR_DEFAULT: case FRAME_SIZE_FACTOR_DEFAULT:
rButBufferDelayDefault->setChecked ( true ); rButBufferDelayDefault->setChecked ( true );
break; break;
case FRAME_SIZE_FACTOR_SAFE: case FRAME_SIZE_FACTOR_SAFE:
rButBufferDelaySafe->setChecked ( true ); rButBufferDelaySafe->setChecked ( true );
break; break;
} }
// preferred size // preferred size
const int iPrefBufSize = const int iPrefBufSize =
iCurPrefFrameSizeFactor * SYSTEM_FRAME_SIZE_SAMPLES; iCurPrefFrameSizeFactor * SYSTEM_FRAME_SIZE_SAMPLES;
// actual size (use yellow color if different from preferred size) // actual size (use yellow color if different from preferred size)
const QString strActSizeValues = const QString strActSizeValues =
GenSndCrdBufferDelayString ( iCurActualBufSize ); GenSndCrdBufferDelayString ( iCurActualBufSize );
if ( iPrefBufSize != iCurActualBufSize ) if ( iPrefBufSize != iCurActualBufSize )
{ {
TextLabelActualSndCrdBufDelay->setText ( "<font color=""red"">" + TextLabelActualSndCrdBufDelay->setText ( "<font color=""red"">" +
strActSizeValues + "</font>" ); strActSizeValues + "</font>" );
} }
else else
{ {
TextLabelActualSndCrdBufDelay->setText ( strActSizeValues ); TextLabelActualSndCrdBufDelay->setText ( strActSizeValues );
} }
} }
void CClientSettingsDlg::showEvent ( QShowEvent* showEvent ) void CClientSettingsDlg::showEvent ( QShowEvent* showEvent )
{ {
// only activate ping timer if window is actually shown // only activate ping timer if window is actually shown
TimerPing.start ( PING_UPDATE_TIME ); TimerPing.start ( PING_UPDATE_TIME );
UpdateDisplay(); UpdateDisplay();
} }
void CClientSettingsDlg::hideEvent ( QHideEvent* hideEvent ) void CClientSettingsDlg::hideEvent ( QHideEvent* hideEvent )
{ {
// if window is closed, stop timer for ping // if window is closed, stop timer for ping
TimerPing.stop(); TimerPing.stop();
} }
void CClientSettingsDlg::OnDriverSetupBut() void CClientSettingsDlg::OnDriverSetupBut()
{ {
pClient->OpenSndCrdDriverSetup(); pClient->OpenSndCrdDriverSetup();
} }
void CClientSettingsDlg::OnSliderNetBuf ( int value ) void CClientSettingsDlg::OnSliderNetBuf ( int value )
{ {
pClient->SetSockBufNumFrames ( value ); pClient->SetSockBufNumFrames ( value );
UpdateJitterBufferFrame(); UpdateJitterBufferFrame();
} }
void CClientSettingsDlg::OnSliderSndCrdBufferDelay ( int value ) void CClientSettingsDlg::OnSliderSndCrdBufferDelay ( int value )
{ {
pClient->SetSndCrdPrefFrameSizeFactor ( value ); pClient->SetSndCrdPrefFrameSizeFactor ( value );
UpdateDisplay(); UpdateDisplay();
} }
void CClientSettingsDlg::OnSoundCrdSelection ( int iSndDevIdx ) void CClientSettingsDlg::OnSoundCrdSelection ( int iSndDevIdx )
{ {
const QString strError = pClient->SetSndCrdDev ( iSndDevIdx ); const QString strError = pClient->SetSndCrdDev ( iSndDevIdx );
if ( !strError.isEmpty() ) if ( !strError.isEmpty() )
{ {
QMessageBox::critical ( 0, APP_NAME, QMessageBox::critical ( 0, APP_NAME,
QString ( "The selected audio device could not be used because " QString ( "The selected audio device could not be used because "
"of the following error: " ) + strError + "of the following error: " ) + strError +
QString ( " The previous driver will be selected." ), "Ok", 0 ); QString ( " The previous driver will be selected." ), "Ok", 0 );
// recover old selection // recover old selection
cbSoundcard->setCurrentIndex ( pClient->GetSndCrdDev() ); cbSoundcard->setCurrentIndex ( pClient->GetSndCrdDev() );
} }
UpdateDisplay(); UpdateDisplay();
} }
void CClientSettingsDlg::OnAutoJitBuf ( int value ) void CClientSettingsDlg::OnAutoJitBuf ( int value )
{ {
pClient->SetDoAutoSockBufSize ( value == Qt::Checked ); pClient->SetDoAutoSockBufSize ( value == Qt::Checked );
UpdateJitterBufferFrame(); UpdateJitterBufferFrame();
} }
void CClientSettingsDlg::OnOpenChatOnNewMessageStateChanged ( int value ) void CClientSettingsDlg::OnOpenChatOnNewMessageStateChanged ( int value )
{ {
pClient->SetOpenChatOnNewMessage ( value == Qt::Checked ); pClient->SetOpenChatOnNewMessage ( value == Qt::Checked );
UpdateDisplay(); UpdateDisplay();
} }
void CClientSettingsDlg::OnSndCrdBufferDelayButtonGroupClicked ( QAbstractButton* button ) void CClientSettingsDlg::OnSndCrdBufferDelayButtonGroupClicked ( QAbstractButton* button )
{ {
if ( button == rButBufferDelayPreferred ) if ( button == rButBufferDelayPreferred )
{ {
pClient->SetSndCrdPrefFrameSizeFactor ( FRAME_SIZE_FACTOR_PREFERRED ); pClient->SetSndCrdPrefFrameSizeFactor ( FRAME_SIZE_FACTOR_PREFERRED );
} }
if ( button == rButBufferDelayDefault ) if ( button == rButBufferDelayDefault )
{ {
pClient->SetSndCrdPrefFrameSizeFactor ( FRAME_SIZE_FACTOR_DEFAULT ); pClient->SetSndCrdPrefFrameSizeFactor ( FRAME_SIZE_FACTOR_DEFAULT );
} }
if ( button == rButBufferDelaySafe ) if ( button == rButBufferDelaySafe )
{ {
pClient->SetSndCrdPrefFrameSizeFactor ( FRAME_SIZE_FACTOR_SAFE ); pClient->SetSndCrdPrefFrameSizeFactor ( FRAME_SIZE_FACTOR_SAFE );
} }
UpdateDisplay(); UpdateDisplay();
} }
void CClientSettingsDlg::OnTimerPing() void CClientSettingsDlg::OnTimerPing()
{ {
// send ping message to server // send ping message to server
pClient->SendPingMess(); pClient->SendPingMess();
} }
void CClientSettingsDlg::OnPingTimeResult ( int iPingTime ) void CClientSettingsDlg::OnPingTimeResult ( int iPingTime )
{ {
/* /*
For estimating the overall delay, use the following assumptions: For estimating the overall delay, use the following assumptions:
- the mean delay of a cyclic buffer is half the buffer size (since - the mean delay of a cyclic buffer is half the buffer size (since
for the average it is assumed that the buffer is half filled) for the average it is assumed that the buffer is half filled)
- consider the jitter buffer on the server side, too - consider the jitter buffer on the server side, too
*/ */
// 2 times buffers at client and server divided by 2 (half the buffer // 2 times buffers at client and server divided by 2 (half the buffer
// for the delay) is simply the total socket buffer size // for the delay) is simply the total socket buffer size
const double dTotalJitterBufferDelayMS = const double dTotalJitterBufferDelayMS =
SYSTEM_BLOCK_DURATION_MS_FLOAT * pClient->GetSockBufNumFrames(); SYSTEM_BLOCK_DURATION_MS_FLOAT * pClient->GetSockBufNumFrames();
// we assume that we have two period sizes for the input and one for the // we assume that we have two period sizes for the input and one for the
// output, therefore we have "3 *" instead of "2 *" (for input and output) // output, therefore we have "3 *" instead of "2 *" (for input and output)
// the actual sound card buffer size // the actual sound card buffer size
const double dTotalSoundCardDelayMS = const double dTotalSoundCardDelayMS =
3 * pClient->GetSndCrdActualMonoBlSize() * 3 * pClient->GetSndCrdActualMonoBlSize() *
1000 / SYSTEM_SAMPLE_RATE; 1000 / SYSTEM_SAMPLE_RATE;
const double dDelayToFillNetworkPackets = // network packets are of the same size as the audio packets per definition
SYSTEM_BLOCK_DURATION_MS_FLOAT * const double dDelayToFillNetworkPackets =
pClient->GetSndCrdPrefFrameSizeFactor(); pClient->GetSndCrdActualMonoBlSize() *
1000 / SYSTEM_SAMPLE_RATE;
// CELT additional delay at small frame sizes is half a frame size
const double dAdditionalAudioCodecDelay = // CELT additional delay at small frame sizes is half a frame size
SYSTEM_BLOCK_DURATION_MS_FLOAT / 2; const double dAdditionalAudioCodecDelay =
SYSTEM_BLOCK_DURATION_MS_FLOAT / 2;
const double dTotalBufferDelay =
dDelayToFillNetworkPackets + const double dTotalBufferDelay =
dTotalJitterBufferDelayMS + dDelayToFillNetworkPackets +
dTotalSoundCardDelayMS + dTotalJitterBufferDelayMS +
dAdditionalAudioCodecDelay; dTotalSoundCardDelayMS +
dAdditionalAudioCodecDelay;
const int iOverallDelay =
LlconMath::round ( dTotalBufferDelay + iPingTime ); const int iOverallDelay =
LlconMath::round ( dTotalBufferDelay + iPingTime );
// apply values to GUI labels, take special care if ping time exceeds
// a certain value // apply values to GUI labels, take special care if ping time exceeds
if ( iPingTime > 500 ) // a certain value
{ if ( iPingTime > 500 )
const QString sErrorText = {
"<font color=""red""><b>&#62;500 ms</b></font>"; const QString sErrorText =
"<font color=""red""><b>&#62;500 ms</b></font>";
TextLabelPingTime->setText ( sErrorText );
TextLabelOverallDelay->setText ( sErrorText ); TextLabelPingTime->setText ( sErrorText );
} TextLabelOverallDelay->setText ( sErrorText );
else }
{ else
TextLabelPingTime->setText ( QString().setNum ( iPingTime ) + " ms" ); {
TextLabelOverallDelay->setText ( TextLabelPingTime->setText ( QString().setNum ( iPingTime ) + " ms" );
QString().setNum ( iOverallDelay ) + " ms" ); TextLabelOverallDelay->setText (
} QString().setNum ( iOverallDelay ) + " ms" );
}
// color definition: < 40 ms green, < 65 ms yellow, otherwise red
if ( iOverallDelay <= 40 ) // color definition: < 40 ms green, < 65 ms yellow, otherwise red
{ if ( iOverallDelay <= 40 )
CLEDOverallDelay->SetLight ( MUL_COL_LED_GREEN ); {
} CLEDOverallDelay->SetLight ( MUL_COL_LED_GREEN );
else }
{ else
if ( iOverallDelay <= 65 ) {
{ if ( iOverallDelay <= 65 )
CLEDOverallDelay->SetLight ( MUL_COL_LED_YELLOW ); {
} CLEDOverallDelay->SetLight ( MUL_COL_LED_YELLOW );
else }
{ else
CLEDOverallDelay->SetLight ( MUL_COL_LED_RED ); {
} CLEDOverallDelay->SetLight ( MUL_COL_LED_RED );
} }
} }
}
void CClientSettingsDlg::UpdateDisplay()
{ void CClientSettingsDlg::UpdateDisplay()
// update slider controls (settings might have been changed) {
UpdateJitterBufferFrame(); // update slider controls (settings might have been changed)
UpdateSoundCardFrame(); UpdateJitterBufferFrame();
UpdateSoundCardFrame();
if ( !pClient->IsRunning() )
{ if ( !pClient->IsRunning() )
// clear text labels with client parameters {
TextLabelPingTime->setText ( "" ); // clear text labels with client parameters
TextLabelOverallDelay->setText ( "" ); TextLabelPingTime->setText ( "" );
TextUpstreamValue->setText ( "" ); TextLabelOverallDelay->setText ( "" );
} TextUpstreamValue->setText ( "" );
else }
{ else
// update upstream rate information label (only if client is running) {
TextUpstreamValue->setText ( // update upstream rate information label (only if client is running)
QString().setNum ( pClient->GetUploadRateKbps() ) + " kbps" ); TextUpstreamValue->setText (
} QString().setNum ( pClient->GetUploadRateKbps() ) + " kbps" );
} }
}
void CClientSettingsDlg::SetStatus ( const int iMessType, const int iStatus )
{ void CClientSettingsDlg::SetStatus ( const int iMessType, const int iStatus )
switch ( iMessType ) {
{ switch ( iMessType )
case MS_JIT_BUF_PUT: {
case MS_JIT_BUF_GET: case MS_JIT_BUF_PUT:
// network LED shows combined status of put and get case MS_JIT_BUF_GET:
CLEDNetw->SetLight ( iStatus ); // network LED shows combined status of put and get
break; CLEDNetw->SetLight ( iStatus );
break;
case MS_RESET_ALL:
CLEDNetw->Reset(); case MS_RESET_ALL:
break; CLEDNetw->Reset();
} break;
} }
}