2006-12-18 15:39:33 +01:00
|
|
|
/******************************************************************************\
|
2009-02-22 12:07:18 +01:00
|
|
|
* Copyright (c) 2004-2009
|
2006-12-18 15:39:33 +01:00
|
|
|
*
|
|
|
|
* Author(s):
|
|
|
|
* Volker Fischer
|
|
|
|
*
|
|
|
|
******************************************************************************
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
* Foundation; either version 2 of the License, or (at your option) any later
|
|
|
|
* version.
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
|
|
* details.
|
|
|
|
*
|
|
|
|
* 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.,
|
|
|
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*
|
|
|
|
\******************************************************************************/
|
|
|
|
|
|
|
|
#include "clientsettingsdlg.h"
|
|
|
|
|
|
|
|
|
2006-11-03 19:54:12 +01:00
|
|
|
/* Implementation *************************************************************/
|
|
|
|
CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, QWidget* parent,
|
2008-01-14 23:14:17 +01:00
|
|
|
Qt::WindowFlags f ) : pClient ( pNCliP ), QDialog ( parent, f )
|
2006-11-03 19:54:12 +01:00
|
|
|
{
|
2008-01-17 19:56:43 +01:00
|
|
|
setupUi ( this );
|
|
|
|
|
2008-08-10 11:56:06 +02:00
|
|
|
// add help text to controls
|
|
|
|
QString strJitterBufferSize = tr ( "<b>Jitter Buffer Size:</b> The size of "
|
|
|
|
"the network buffer (jitter buffer). The jitter buffer compensates for "
|
|
|
|
"the network jitter. The larger this buffer is, the more robust the "
|
|
|
|
"connection is against network jitter but the higher is the latency. "
|
|
|
|
"This setting is therefore a trade-off between audio drop outs and "
|
|
|
|
"overall audio delay.<br>By changing this setting, both, the client "
|
|
|
|
"and the server jitter buffer is set to the same value." );
|
|
|
|
SliderNetBuf->setWhatsThis ( strJitterBufferSize );
|
|
|
|
TextNetBuf->setWhatsThis ( strJitterBufferSize );
|
|
|
|
GroupBoxJitterBuffer->setWhatsThis ( strJitterBufferSize );
|
|
|
|
|
2009-03-03 14:37:28 +01:00
|
|
|
// init driver button
|
|
|
|
#ifdef _WIN32
|
|
|
|
ButtonDriverSetup->setText ( "ASIO Setup" );
|
|
|
|
#else
|
|
|
|
// no use for this button for Linux right now, maybe later used
|
|
|
|
// for Jack
|
|
|
|
ButtonDriverSetup->hide();
|
|
|
|
#endif
|
|
|
|
|
2009-03-04 08:57:44 +01:00
|
|
|
// init delay and other information controls
|
2008-10-31 23:24:05 +01:00
|
|
|
CLEDOverallDelay->SetUpdateTime ( 2 * PING_UPDATE_TIME );
|
|
|
|
CLEDOverallDelay->Reset();
|
2009-03-05 14:55:00 +01:00
|
|
|
TextLabelPingTime->setText ( "" );
|
2008-10-31 23:24:05 +01:00
|
|
|
TextLabelOverallDelay->setText ( "" );
|
2009-03-05 14:55:00 +01:00
|
|
|
TextUpstreamValue->setText ( "" );
|
|
|
|
|
2008-08-03 00:01:19 +02:00
|
|
|
|
2008-01-22 20:58:53 +01:00
|
|
|
// init slider controls ---
|
|
|
|
// network buffer
|
2009-03-01 12:17:35 +01:00
|
|
|
SliderNetBuf->setRange ( MIN_NET_BUF_SIZE_NUM_BL, MAX_NET_BUF_SIZE_NUM_BL );
|
2009-02-12 15:48:35 +01:00
|
|
|
UpdateJitterBufferFrame();
|
2006-11-25 15:46:57 +01:00
|
|
|
|
2008-10-31 00:23:26 +01:00
|
|
|
// init combo box containing all available sound cards in the system
|
|
|
|
cbSoundcard->clear();
|
2009-03-07 21:45:00 +01:00
|
|
|
for ( int iSndDevIdx = 0; iSndDevIdx < pClient->GetSndCrdNumDev(); iSndDevIdx++ )
|
2008-10-31 00:23:26 +01:00
|
|
|
{
|
2009-03-07 21:45:00 +01:00
|
|
|
cbSoundcard->addItem ( pClient->GetSndCrdDeviceName ( iSndDevIdx ).c_str() );
|
2008-10-31 00:23:26 +01:00
|
|
|
}
|
2009-03-07 21:45:00 +01:00
|
|
|
cbSoundcard->setCurrentIndex ( pClient->GetSndCrdDev() );
|
2008-10-31 00:23:26 +01:00
|
|
|
|
2008-07-24 18:20:25 +02:00
|
|
|
// "OpenChatOnNewMessage" check box
|
|
|
|
if ( pClient->GetOpenChatOnNewMessage() )
|
|
|
|
{
|
|
|
|
cbOpenChatOnNewMessage->setCheckState ( Qt::Checked );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cbOpenChatOnNewMessage->setCheckState ( Qt::Unchecked );
|
|
|
|
}
|
|
|
|
|
2009-08-02 19:44:45 +02:00
|
|
|
// set text for sound card buffer delay radio buttons
|
|
|
|
rButBufferDelayPreferred->setText ( GenSndCrdBufferDelayString (
|
2009-08-13 18:12:49 +02:00
|
|
|
FRAME_SIZE_FACTOR_PREFERRED * SYSTEM_FRAME_SIZE_SAMPLES,
|
2009-08-02 19:44:45 +02:00
|
|
|
", preferred" ) );
|
|
|
|
|
|
|
|
rButBufferDelayDefault->setText ( GenSndCrdBufferDelayString (
|
2009-08-13 18:12:49 +02:00
|
|
|
FRAME_SIZE_FACTOR_DEFAULT * SYSTEM_FRAME_SIZE_SAMPLES,
|
2009-08-02 19:44:45 +02:00
|
|
|
", default" ) );
|
|
|
|
|
|
|
|
rButBufferDelaySafe->setText ( GenSndCrdBufferDelayString (
|
2009-08-13 18:12:49 +02:00
|
|
|
FRAME_SIZE_FACTOR_SAFE * SYSTEM_FRAME_SIZE_SAMPLES ) );
|
2009-08-02 19:44:45 +02:00
|
|
|
|
2009-08-02 21:46:29 +02:00
|
|
|
// sound card buffer delay inits
|
2009-08-02 19:44:45 +02:00
|
|
|
SndCrdBufferDelayButtonGroup.addButton ( rButBufferDelayPreferred );
|
|
|
|
SndCrdBufferDelayButtonGroup.addButton ( rButBufferDelayDefault );
|
|
|
|
SndCrdBufferDelayButtonGroup.addButton ( rButBufferDelaySafe );
|
2008-08-10 10:14:30 +02:00
|
|
|
|
2009-08-02 21:46:29 +02:00
|
|
|
UpdateSoundCardFrame();
|
|
|
|
|
2006-11-25 15:46:57 +01:00
|
|
|
|
2008-01-22 20:58:53 +01:00
|
|
|
// Connections -------------------------------------------------------------
|
|
|
|
// timers
|
2007-09-08 12:45:14 +02:00
|
|
|
QObject::connect ( &TimerStatus, SIGNAL ( timeout() ),
|
|
|
|
this, SLOT ( OnTimerStatus() ) );
|
2008-08-03 00:01:19 +02:00
|
|
|
QObject::connect ( &TimerPing, SIGNAL ( timeout() ),
|
|
|
|
this, SLOT ( OnTimerPing() ) );
|
|
|
|
|
2009-03-03 19:04:51 +01:00
|
|
|
// slider controls
|
2007-09-08 12:45:14 +02:00
|
|
|
QObject::connect ( SliderNetBuf, SIGNAL ( valueChanged ( int ) ),
|
|
|
|
this, SLOT ( OnSliderNetBuf ( int ) ) );
|
2006-11-25 15:46:57 +01:00
|
|
|
|
2008-07-24 18:20:25 +02:00
|
|
|
// check boxes
|
|
|
|
QObject::connect ( cbOpenChatOnNewMessage, SIGNAL ( stateChanged ( int ) ),
|
|
|
|
this, SLOT ( OnOpenChatOnNewMessageStateChanged ( int ) ) );
|
2009-02-12 15:48:35 +01:00
|
|
|
QObject::connect ( cbAutoJitBuf, SIGNAL ( stateChanged ( int ) ),
|
|
|
|
this, SLOT ( OnAutoJitBuf ( int ) ) );
|
2008-07-24 18:20:25 +02:00
|
|
|
|
2008-10-31 00:23:26 +01:00
|
|
|
// combo boxes
|
|
|
|
QObject::connect ( cbSoundcard, SIGNAL ( activated ( int ) ),
|
|
|
|
this, SLOT ( OnSoundCrdSelection ( int ) ) );
|
|
|
|
|
2009-03-03 14:37:28 +01:00
|
|
|
// buttons
|
|
|
|
QObject::connect ( ButtonDriverSetup, SIGNAL ( clicked() ),
|
|
|
|
this, SLOT ( OnDriverSetupBut() ) );
|
|
|
|
|
2008-08-02 15:42:24 +02:00
|
|
|
// misc
|
|
|
|
QObject::connect ( pClient, SIGNAL ( PingTimeReceived ( int ) ),
|
|
|
|
this, SLOT ( OnPingTimeResult ( int ) ) );
|
|
|
|
|
2009-08-02 19:44:45 +02:00
|
|
|
QObject::connect ( &SndCrdBufferDelayButtonGroup,
|
2009-03-09 23:52:28 +01:00
|
|
|
SIGNAL ( buttonClicked ( QAbstractButton* ) ), this,
|
2009-08-02 19:44:45 +02:00
|
|
|
SLOT ( OnSndCrdBufferDelayButtonGroupClicked ( QAbstractButton* ) ) );
|
2008-08-10 10:14:30 +02:00
|
|
|
|
2006-11-25 15:46:57 +01:00
|
|
|
|
2008-01-22 20:58:53 +01:00
|
|
|
// Timers ------------------------------------------------------------------
|
|
|
|
// start timer for status bar
|
2007-09-08 12:45:14 +02:00
|
|
|
TimerStatus.start ( DISPLAY_UPDATE_TIME );
|
2006-12-18 15:39:33 +01:00
|
|
|
}
|
|
|
|
|
2009-02-12 15:48:35 +01:00
|
|
|
void CClientSettingsDlg::UpdateJitterBufferFrame()
|
2009-02-11 19:37:26 +01:00
|
|
|
{
|
2009-02-22 12:07:18 +01:00
|
|
|
// update slider value and text
|
2009-08-02 09:54:15 +02:00
|
|
|
const int iCurNumNetBuf = pClient->GetSockBufNumFrames();
|
2009-02-11 19:37:26 +01:00
|
|
|
SliderNetBuf->setValue ( iCurNumNetBuf );
|
|
|
|
TextNetBuf->setText ( "Size: " + QString().setNum ( iCurNumNetBuf ) );
|
2009-02-12 15:48:35 +01:00
|
|
|
|
2009-02-22 12:07:18 +01:00
|
|
|
// if auto setting is enabled, disable slider control
|
2009-03-03 19:04:51 +01:00
|
|
|
cbAutoJitBuf->setChecked ( pClient->GetDoAutoSockBufSize() );
|
2009-02-22 12:07:18 +01:00
|
|
|
SliderNetBuf->setEnabled ( !pClient->GetDoAutoSockBufSize() );
|
|
|
|
TextNetBuf->setEnabled ( !pClient->GetDoAutoSockBufSize() );
|
2009-02-11 19:37:26 +01:00
|
|
|
}
|
|
|
|
|
2009-08-02 19:44:45 +02:00
|
|
|
QString CClientSettingsDlg::GenSndCrdBufferDelayString ( const int iFrameSize,
|
|
|
|
const QString strAddText )
|
|
|
|
{
|
|
|
|
// use two times the buffer delay for the entire delay since
|
|
|
|
// we have input and output
|
|
|
|
return QString().setNum ( (double) iFrameSize * 2 *
|
|
|
|
1000 / SYSTEM_SAMPLE_RATE, 'f', 2 ) + " ms (" +
|
|
|
|
QString().setNum ( iFrameSize ) + strAddText + ")";
|
|
|
|
}
|
|
|
|
|
2009-03-03 19:04:51 +01:00
|
|
|
void CClientSettingsDlg::UpdateSoundCardFrame()
|
|
|
|
{
|
2009-03-04 08:57:44 +01:00
|
|
|
// update slider value and text
|
2009-08-02 21:46:29 +02:00
|
|
|
const int iCurPrefFrameSizeFactor =
|
2009-08-13 20:59:14 +02:00
|
|
|
pClient->GetSndCrdPrefFrameSizeFactor();
|
2009-08-02 19:44:45 +02:00
|
|
|
|
2009-08-02 21:46:29 +02:00
|
|
|
const int iCurActualBufSize =
|
|
|
|
pClient->GetSndCrdActualMonoBlSize();
|
|
|
|
|
|
|
|
// update radio buttons
|
|
|
|
switch ( iCurPrefFrameSizeFactor )
|
|
|
|
{
|
|
|
|
case FRAME_SIZE_FACTOR_PREFERRED:
|
|
|
|
rButBufferDelayPreferred->setChecked ( true );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case FRAME_SIZE_FACTOR_DEFAULT:
|
|
|
|
rButBufferDelayDefault->setChecked ( true );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case FRAME_SIZE_FACTOR_SAFE:
|
|
|
|
rButBufferDelaySafe->setChecked ( true );
|
|
|
|
break;
|
|
|
|
}
|
2009-03-04 08:57:44 +01:00
|
|
|
|
2009-03-05 21:45:36 +01:00
|
|
|
// preferred size
|
2009-03-08 18:14:37 +01:00
|
|
|
const int iPrefBufSize =
|
2009-08-13 18:12:49 +02:00
|
|
|
iCurPrefFrameSizeFactor * SYSTEM_FRAME_SIZE_SAMPLES;
|
2009-08-02 21:46:29 +02:00
|
|
|
|
2009-03-08 18:14:37 +01:00
|
|
|
// actual size (use yellow color if different from preferred size)
|
|
|
|
const QString strActSizeValues =
|
2009-08-02 19:44:45 +02:00
|
|
|
GenSndCrdBufferDelayString ( iCurActualBufSize );
|
2009-03-08 18:14:37 +01:00
|
|
|
|
2009-08-02 21:46:29 +02:00
|
|
|
if ( iPrefBufSize != iCurActualBufSize )
|
2009-03-08 18:14:37 +01:00
|
|
|
{
|
|
|
|
TextLabelActualSndCrdBufDelay->setText ( "<font color=""red"">" +
|
|
|
|
strActSizeValues + "</font>" );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
TextLabelActualSndCrdBufDelay->setText ( strActSizeValues );
|
|
|
|
}
|
2009-03-03 19:04:51 +01:00
|
|
|
}
|
|
|
|
|
2008-08-03 00:01:19 +02:00
|
|
|
void CClientSettingsDlg::showEvent ( QShowEvent* showEvent )
|
|
|
|
{
|
|
|
|
// only activate ping timer if window is actually shown
|
|
|
|
TimerPing.start ( PING_UPDATE_TIME );
|
2009-03-05 11:08:42 +01:00
|
|
|
|
|
|
|
UpdateDisplay();
|
2008-08-03 00:01:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void CClientSettingsDlg::hideEvent ( QHideEvent* hideEvent )
|
|
|
|
{
|
|
|
|
// if window is closed, stop timer for ping
|
|
|
|
TimerPing.stop();
|
|
|
|
}
|
|
|
|
|
2009-03-03 14:37:28 +01:00
|
|
|
void CClientSettingsDlg::OnDriverSetupBut()
|
2006-12-18 15:39:33 +01:00
|
|
|
{
|
2009-03-07 21:45:00 +01:00
|
|
|
pClient->OpenSndCrdDriverSetup();
|
2006-11-03 19:54:12 +01:00
|
|
|
}
|
|
|
|
|
2009-03-03 14:37:28 +01:00
|
|
|
void CClientSettingsDlg::OnSliderNetBuf ( int value )
|
2006-11-03 19:54:12 +01:00
|
|
|
{
|
2009-08-02 09:54:15 +02:00
|
|
|
pClient->SetSockBufNumFrames ( value );
|
2009-03-03 19:04:51 +01:00
|
|
|
UpdateJitterBufferFrame();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CClientSettingsDlg::OnSliderSndCrdBufferDelay ( int value )
|
|
|
|
{
|
2009-08-13 20:59:14 +02:00
|
|
|
pClient->SetSndCrdPrefFrameSizeFactor ( value );
|
2009-03-09 23:52:28 +01:00
|
|
|
UpdateDisplay();
|
2006-11-03 19:54:12 +01:00
|
|
|
}
|
|
|
|
|
2008-10-31 00:23:26 +01:00
|
|
|
void CClientSettingsDlg::OnSoundCrdSelection ( int iSndDevIdx )
|
|
|
|
{
|
2009-03-08 18:14:37 +01:00
|
|
|
const QString strError = pClient->SetSndCrdDev ( iSndDevIdx );
|
|
|
|
|
|
|
|
if ( !strError.isEmpty() )
|
2008-10-31 00:23:26 +01:00
|
|
|
{
|
|
|
|
QMessageBox::critical ( 0, APP_NAME,
|
|
|
|
QString ( "The selected audio device could not be used because "
|
2009-03-08 18:14:37 +01:00
|
|
|
"of the following error: " ) + strError +
|
2008-10-31 21:27:55 +01:00
|
|
|
QString ( " The previous driver will be selected." ), "Ok", 0 );
|
2008-10-31 00:23:26 +01:00
|
|
|
|
|
|
|
// recover old selection
|
2009-03-07 21:45:00 +01:00
|
|
|
cbSoundcard->setCurrentIndex ( pClient->GetSndCrdDev() );
|
2008-10-31 00:23:26 +01:00
|
|
|
}
|
2008-11-01 12:48:17 +01:00
|
|
|
UpdateDisplay();
|
2008-10-31 00:23:26 +01:00
|
|
|
}
|
|
|
|
|
2009-02-12 15:48:35 +01:00
|
|
|
void CClientSettingsDlg::OnAutoJitBuf ( int value )
|
|
|
|
{
|
2009-02-22 12:07:18 +01:00
|
|
|
pClient->SetDoAutoSockBufSize ( value == Qt::Checked );
|
|
|
|
UpdateJitterBufferFrame();
|
2009-02-12 15:48:35 +01:00
|
|
|
}
|
|
|
|
|
2008-07-24 18:20:25 +02:00
|
|
|
void CClientSettingsDlg::OnOpenChatOnNewMessageStateChanged ( int value )
|
|
|
|
{
|
|
|
|
pClient->SetOpenChatOnNewMessage ( value == Qt::Checked );
|
|
|
|
UpdateDisplay();
|
2008-08-02 15:42:24 +02:00
|
|
|
}
|
|
|
|
|
2009-08-02 19:44:45 +02:00
|
|
|
void CClientSettingsDlg::OnSndCrdBufferDelayButtonGroupClicked ( QAbstractButton* button )
|
2008-08-10 10:14:30 +02:00
|
|
|
{
|
2009-08-02 19:44:45 +02:00
|
|
|
if ( button == rButBufferDelayPreferred )
|
2008-08-10 10:14:30 +02:00
|
|
|
{
|
2009-08-13 20:59:14 +02:00
|
|
|
pClient->SetSndCrdPrefFrameSizeFactor ( FRAME_SIZE_FACTOR_PREFERRED );
|
2008-08-10 10:14:30 +02:00
|
|
|
}
|
|
|
|
|
2009-08-02 19:44:45 +02:00
|
|
|
if ( button == rButBufferDelayDefault )
|
2008-08-10 10:14:30 +02:00
|
|
|
{
|
2009-08-13 20:59:14 +02:00
|
|
|
pClient->SetSndCrdPrefFrameSizeFactor ( FRAME_SIZE_FACTOR_DEFAULT );
|
2008-08-10 10:14:30 +02:00
|
|
|
}
|
|
|
|
|
2009-08-02 19:44:45 +02:00
|
|
|
if ( button == rButBufferDelaySafe )
|
2008-08-10 10:14:30 +02:00
|
|
|
{
|
2009-08-13 20:59:14 +02:00
|
|
|
pClient->SetSndCrdPrefFrameSizeFactor ( FRAME_SIZE_FACTOR_SAFE );
|
2008-08-10 10:14:30 +02:00
|
|
|
}
|
2009-08-02 21:18:19 +02:00
|
|
|
|
2008-08-10 10:14:30 +02:00
|
|
|
UpdateDisplay();
|
|
|
|
}
|
|
|
|
|
2008-08-03 00:01:19 +02:00
|
|
|
void CClientSettingsDlg::OnTimerPing()
|
2008-08-02 15:42:24 +02:00
|
|
|
{
|
2008-08-03 00:01:19 +02:00
|
|
|
// send ping message to server
|
|
|
|
pClient->SendPingMess();
|
|
|
|
}
|
2008-08-02 15:42:24 +02:00
|
|
|
|
2008-08-03 00:01:19 +02:00
|
|
|
void CClientSettingsDlg::OnPingTimeResult ( int iPingTime )
|
|
|
|
{
|
2008-10-31 23:24:05 +01:00
|
|
|
/*
|
|
|
|
For estimating the overall delay, use the following assumptions:
|
|
|
|
- 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)
|
|
|
|
- consider the jitter buffer on the server side, too
|
|
|
|
*/
|
2009-08-02 22:14:25 +02:00
|
|
|
// 2 times buffers at client and server divided by 2 (half the buffer
|
|
|
|
// for the delay) is simply the total socket buffer size
|
|
|
|
const double dTotalJitterBufferDelayMS =
|
|
|
|
SYSTEM_BLOCK_DURATION_MS_FLOAT * pClient->GetSockBufNumFrames();
|
2009-03-03 14:37:28 +01:00
|
|
|
|
2009-03-08 09:31:55 +01:00
|
|
|
// 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)
|
|
|
|
// the actual sound card buffer size
|
2009-08-02 22:14:25 +02:00
|
|
|
const double dTotalSoundCardDelayMS =
|
2009-03-08 09:31:55 +01:00
|
|
|
3 * pClient->GetSndCrdActualMonoBlSize() *
|
2009-07-24 16:31:25 +02:00
|
|
|
1000 / SYSTEM_SAMPLE_RATE;
|
2008-10-31 23:24:05 +01:00
|
|
|
|
2009-08-02 22:14:25 +02:00
|
|
|
const double dDelayToFillNetworkPackets =
|
|
|
|
SYSTEM_BLOCK_DURATION_MS_FLOAT *
|
2009-08-13 20:59:14 +02:00
|
|
|
pClient->GetSndCrdPrefFrameSizeFactor();
|
2009-07-24 22:17:01 +02:00
|
|
|
|
2009-08-02 22:14:25 +02:00
|
|
|
// CELT additional delay at small frame sizes is half a frame size
|
|
|
|
const double dAdditionalAudioCodecDelay =
|
|
|
|
SYSTEM_BLOCK_DURATION_MS_FLOAT / 2;
|
2008-10-31 23:24:05 +01:00
|
|
|
|
2009-08-02 22:14:25 +02:00
|
|
|
const double dTotalBufferDelay =
|
|
|
|
dDelayToFillNetworkPackets +
|
|
|
|
dTotalJitterBufferDelayMS +
|
|
|
|
dTotalSoundCardDelayMS +
|
|
|
|
dAdditionalAudioCodecDelay;
|
2008-10-31 23:24:05 +01:00
|
|
|
|
2009-08-02 22:14:25 +02:00
|
|
|
const int iOverallDelay =
|
|
|
|
LlconMath::round ( dTotalBufferDelay + iPingTime );
|
2008-10-31 23:24:05 +01:00
|
|
|
|
2009-02-12 18:15:17 +01:00
|
|
|
// apply values to GUI labels, take special care if ping time exceeds
|
|
|
|
// a certain value
|
|
|
|
if ( iPingTime > 500 )
|
|
|
|
{
|
2009-08-02 22:14:25 +02:00
|
|
|
const QString sErrorText =
|
|
|
|
"<font color=""red""><b>>500 ms</b></font>";
|
|
|
|
|
2009-02-12 19:15:49 +01:00
|
|
|
TextLabelPingTime->setText ( sErrorText );
|
|
|
|
TextLabelOverallDelay->setText ( sErrorText );
|
2009-02-12 18:15:17 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
TextLabelPingTime->setText ( QString().setNum ( iPingTime ) + " ms" );
|
2009-03-09 23:52:28 +01:00
|
|
|
TextLabelOverallDelay->setText (
|
|
|
|
QString().setNum ( iOverallDelay ) + " ms" );
|
2009-02-12 18:15:17 +01:00
|
|
|
}
|
2008-10-31 23:24:05 +01:00
|
|
|
|
2009-03-09 23:52:28 +01:00
|
|
|
// color definition: < 40 ms green, < 65 ms yellow, otherwise red
|
2008-10-31 23:24:05 +01:00
|
|
|
if ( iOverallDelay <= 40 )
|
2008-08-03 00:01:19 +02:00
|
|
|
{
|
2008-10-31 23:24:05 +01:00
|
|
|
CLEDOverallDelay->SetLight ( MUL_COL_LED_GREEN );
|
2008-08-03 00:01:19 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-03-09 23:52:28 +01:00
|
|
|
if ( iOverallDelay <= 65 )
|
2008-08-03 00:01:19 +02:00
|
|
|
{
|
2008-10-31 23:24:05 +01:00
|
|
|
CLEDOverallDelay->SetLight ( MUL_COL_LED_YELLOW );
|
2008-08-03 00:01:19 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-10-31 23:24:05 +01:00
|
|
|
CLEDOverallDelay->SetLight ( MUL_COL_LED_RED );
|
2008-08-03 00:01:19 +02:00
|
|
|
}
|
|
|
|
}
|
2008-07-24 18:20:25 +02:00
|
|
|
}
|
|
|
|
|
2006-11-03 19:54:12 +01:00
|
|
|
void CClientSettingsDlg::UpdateDisplay()
|
|
|
|
{
|
2009-03-01 12:17:35 +01:00
|
|
|
// update slider controls (settings might have been changed)
|
2009-02-12 15:48:35 +01:00
|
|
|
UpdateJitterBufferFrame();
|
2009-03-04 08:57:44 +01:00
|
|
|
UpdateSoundCardFrame();
|
2009-03-03 23:46:36 +01:00
|
|
|
|
2008-11-01 09:47:31 +01:00
|
|
|
if ( !pClient->IsRunning() )
|
2008-08-03 23:38:24 +02:00
|
|
|
{
|
|
|
|
// clear text labels with client parameters
|
2009-03-05 14:55:00 +01:00
|
|
|
TextLabelPingTime->setText ( "" );
|
2008-10-31 23:24:05 +01:00
|
|
|
TextLabelOverallDelay->setText ( "" );
|
2009-03-05 14:55:00 +01:00
|
|
|
TextUpstreamValue->setText ( "" );
|
2009-03-04 08:57:44 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// update upstream rate information label (only if client is running)
|
2009-03-09 23:52:28 +01:00
|
|
|
TextUpstreamValue->setText (
|
|
|
|
QString().setNum ( pClient->GetUploadRateKbps() ) + " kbps" );
|
2008-08-03 23:38:24 +02:00
|
|
|
}
|
2006-11-03 19:54:12 +01:00
|
|
|
}
|
|
|
|
|
2006-12-18 15:39:33 +01:00
|
|
|
void CClientSettingsDlg::SetStatus ( const int iMessType, const int iStatus )
|
|
|
|
{
|
2007-09-08 12:45:14 +02:00
|
|
|
switch ( iMessType )
|
2006-12-18 15:39:33 +01:00
|
|
|
{
|
|
|
|
case MS_JIT_BUF_PUT:
|
|
|
|
case MS_JIT_BUF_GET:
|
2009-03-01 23:38:42 +01:00
|
|
|
// network LED shows combined status of put and get
|
|
|
|
CLEDNetw->SetLight ( iStatus );
|
2006-11-25 15:46:57 +01:00
|
|
|
break;
|
2006-11-05 11:09:32 +01:00
|
|
|
|
2006-12-18 15:39:33 +01:00
|
|
|
case MS_RESET_ALL:
|
2009-03-01 23:38:42 +01:00
|
|
|
CLEDNetw->Reset();
|
2006-12-18 15:39:33 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|