2009-10-24 14:24:44 +02:00
|
|
|
/******************************************************************************\
|
2010-01-03 14:40:46 +01:00
|
|
|
* Copyright (c) 2004-2010
|
2009-10-24 14:24:44 +02: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
|
2010-02-04 21:25:57 +01:00
|
|
|
* Foundation; either version 2 of the License, or (at your option) any later
|
2009-10-24 14:24:44 +02:00
|
|
|
* version.
|
|
|
|
*
|
2010-02-04 21:25:57 +01:00
|
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
2009-10-24 14:24:44 +02:00
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
2010-02-04 21:25:57 +01:00
|
|
|
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
2009-10-24 14:24:44 +02:00
|
|
|
* details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with
|
2010-02-04 21:25:57 +01:00
|
|
|
* this program; if not, write to the Free Software Foundation, Inc.,
|
2009-10-24 14:24:44 +02:00
|
|
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*
|
|
|
|
\******************************************************************************/
|
|
|
|
|
|
|
|
#include "clientsettingsdlg.h"
|
|
|
|
|
|
|
|
|
|
|
|
/* Implementation *************************************************************/
|
|
|
|
CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, QWidget* parent,
|
|
|
|
Qt::WindowFlags f ) : pClient ( pNCliP ), QDialog ( parent, f )
|
|
|
|
{
|
|
|
|
setupUi ( this );
|
|
|
|
|
2009-11-27 11:47:13 +01:00
|
|
|
// add help text to controls -----------------------------------------------
|
|
|
|
// jitter buffer
|
2009-11-27 19:52:01 +01:00
|
|
|
QString strJitterBufferSize = tr ( "<b>Jitter Buffer Size:</b> The jitter "
|
|
|
|
"buffer compensates for network and sound card timing jitters. The "
|
|
|
|
"size of this jitter buffer has therefore influence on the quality of "
|
|
|
|
"the audio stream (how many dropouts occur) and the overall delay "
|
2009-12-03 22:21:26 +01:00
|
|
|
"(the longer the buffer, the higher the delay).<br>"
|
2009-11-27 19:52:01 +01:00
|
|
|
"Dropouts in the audio stream are indicated by the light on the bottom "
|
|
|
|
"of the jitter buffer size fader. If the light turns to red, a buffer "
|
2009-12-03 22:21:26 +01:00
|
|
|
"overrun/underrun took place and the audio stream is interrupted.<br>"
|
2009-11-27 19:52:01 +01:00
|
|
|
"The jitter buffer setting is therefore a trade-off between audio "
|
2009-12-03 22:21:26 +01:00
|
|
|
"quality and overall delay.<br>"
|
2009-11-27 19:52:01 +01:00
|
|
|
"An auto setting of the jitter buffer size setting is available. If "
|
|
|
|
"the check Auto is enabled, the jitter buffer is set automatically "
|
|
|
|
"based on measurements of the network and sound card timing jitter. If "
|
|
|
|
"the Auto check is enabled, the jitter buffer size fader is disabled "
|
|
|
|
"(cannot be moved by the mouse)." );
|
2009-11-27 13:44:56 +01:00
|
|
|
|
2009-12-03 22:21:26 +01:00
|
|
|
QString strJitterBufferSizeTT = tr ( "In case the Auto setting of the "
|
|
|
|
"jitter buffer is enabled, the network buffer is set to a conservative "
|
|
|
|
"value to minimize the audio dropout probability. To <b>tweak the "
|
|
|
|
"audio delay/latency</b> it is recommended to disable the Auto "
|
|
|
|
"functionality and to <b>lower the jitter buffer size manually</b> by "
|
|
|
|
"using the slider until your personal acceptable limit of the amount "
|
|
|
|
"of dropouts is reached. The LED indicator will visualize the audio "
|
|
|
|
"dropouts by a red light" ) + TOOLTIP_COM_END_TEXT;
|
|
|
|
|
2009-11-27 11:47:13 +01:00
|
|
|
TextNetBuf->setWhatsThis ( strJitterBufferSize );
|
2009-12-03 22:21:26 +01:00
|
|
|
TextNetBuf->setToolTip ( strJitterBufferSizeTT );
|
2009-10-24 14:24:44 +02:00
|
|
|
GroupBoxJitterBuffer->setWhatsThis ( strJitterBufferSize );
|
2009-12-03 22:21:26 +01:00
|
|
|
GroupBoxJitterBuffer->setToolTip ( strJitterBufferSizeTT );
|
2009-11-27 11:47:13 +01:00
|
|
|
SliderNetBuf->setWhatsThis ( strJitterBufferSize );
|
2009-11-27 13:44:56 +01:00
|
|
|
SliderNetBuf->setAccessibleName ( tr ( "Jitter buffer slider control" ) );
|
2009-12-03 22:21:26 +01:00
|
|
|
SliderNetBuf->setToolTip ( strJitterBufferSizeTT );
|
2009-11-27 13:44:56 +01:00
|
|
|
cbAutoJitBuf->setAccessibleName ( tr ( "Auto jitter buffer switch" ) );
|
2009-12-03 22:21:26 +01:00
|
|
|
cbAutoJitBuf->setToolTip ( strJitterBufferSizeTT );
|
2009-11-27 19:52:01 +01:00
|
|
|
CLEDNetw->setAccessibleName ( tr ( "Jitter buffer status LED indicator" ) );
|
2009-12-03 22:21:26 +01:00
|
|
|
CLEDNetw->setToolTip ( strJitterBufferSizeTT );
|
2009-11-27 19:52:01 +01:00
|
|
|
|
|
|
|
// sound card device
|
|
|
|
cbSoundcard->setWhatsThis ( tr ( "<b>Sound Card Device:</b> The ASIO "
|
|
|
|
"driver (sound card) can be selected using llcon under the Windows "
|
|
|
|
"operating system. Under Linux, no sound card selection is possible "
|
|
|
|
"(always wave mapper is shown and cannot be changed). If the selected "
|
|
|
|
"ASIO driver is not valid an error message is shown and the previous "
|
2009-12-03 22:21:26 +01:00
|
|
|
"valid driver is selected.<br>"
|
2009-11-27 19:52:01 +01:00
|
|
|
"If the driver is selected during an active connection, the connection "
|
|
|
|
"is stopped, the driver is changed and the connection is started again "
|
|
|
|
"automatically." ) );
|
2009-12-03 22:21:26 +01:00
|
|
|
|
2009-11-27 19:52:01 +01:00
|
|
|
cbSoundcard->setAccessibleName ( tr ( "Sound card device selector combo box" ) );
|
|
|
|
|
2009-12-03 22:21:26 +01:00
|
|
|
cbSoundcard->setToolTip ( tr ( "In case the <b>ASIO4ALL</b> driver is used, "
|
|
|
|
"please note that this driver usually introduces approx. 10-30 ms of "
|
|
|
|
"additional audio delay. Using a sound card with a native ASIO driver "
|
|
|
|
"is therefore recommended.<br>If you are using the <b>kX ASIO</b> "
|
|
|
|
"driver, make sure to connect the ASIO inputs in the kX DSP settings "
|
|
|
|
"panel." ) + TOOLTIP_COM_END_TEXT );
|
|
|
|
|
2009-11-27 19:52:01 +01:00
|
|
|
// sound card buffer delay
|
|
|
|
QString strSndCrdBufDelay = tr ( "<b>Sound Card Buffer Delay:</b> The "
|
|
|
|
"buffer delay setting is a fundamental setting of the llcon software. "
|
2009-12-03 22:21:26 +01:00
|
|
|
"This setting has influence on many connection properties.<br>"
|
2009-11-27 19:52:01 +01:00
|
|
|
"Three buffer sizes are supported:"
|
|
|
|
"<ul>"
|
|
|
|
"<li>128 samples: This is the preferred setting since it gives lowest "
|
|
|
|
"latency but does not work with all sound cards.</li>"
|
|
|
|
"<li>256 samples: This is the default setting and should work on most "
|
|
|
|
"of the available sound cards.</li>"
|
|
|
|
"<li>512 samples: This setting should only be used if only a very slow "
|
|
|
|
"computer or a slow internet connection is available.</li>"
|
|
|
|
"</ul>"
|
2010-02-04 21:25:57 +01:00
|
|
|
"Some sound card driver do not allow the buffer delay to be changed "
|
2009-11-30 23:38:14 +01:00
|
|
|
"from within the llcon software. In this case the buffer delay setting "
|
|
|
|
"is disabled. To change the actual buffer delay, this "
|
2009-11-27 19:52:01 +01:00
|
|
|
"setting has to be changed in the sound card driver. On Windows, press "
|
|
|
|
"the ASIO Setup button to open the driver settings panel. On Linux, "
|
2009-12-03 22:21:26 +01:00
|
|
|
"use the Jack configuration tool to change the buffer size.<br>"
|
2010-03-14 21:15:06 +01:00
|
|
|
"If no buffer size is selected and all settings are disabled, an "
|
|
|
|
"unsupported buffer size is used by the driver. The llcon software "
|
2010-02-04 21:25:57 +01:00
|
|
|
"will still work with this setting but with restricted performannce.<br>"
|
2009-11-27 19:52:01 +01:00
|
|
|
"The actual buffer delay has influence on the connection status, the "
|
|
|
|
"current upload rate and the overall delay. The lower the buffer size, "
|
|
|
|
"the higher the probability of red light in the status indicator (drop "
|
|
|
|
"outs) and the higher the upload rate and the lower the overall "
|
2009-12-03 22:21:26 +01:00
|
|
|
"delay.<br>"
|
2009-11-27 19:52:01 +01:00
|
|
|
"The jitter buffer setting is therefore a trade-off between audio "
|
|
|
|
"quality and overall delay." );
|
|
|
|
|
2009-12-03 22:21:26 +01:00
|
|
|
QString strSndCrdBufDelayTT = tr ( "If the buffer delay settings are "
|
|
|
|
"disabled, it is prohibited by the audio driver to modify this "
|
|
|
|
"setting from within the llcon software. On Windows, press "
|
|
|
|
"the ASIO Setup button to open the driver settings panel. On Linux, "
|
|
|
|
"use the Jack configuration tool to change the buffer size." ) +
|
|
|
|
TOOLTIP_COM_END_TEXT;
|
|
|
|
|
2009-11-27 19:52:01 +01:00
|
|
|
rButBufferDelayPreferred->setWhatsThis ( strSndCrdBufDelay );
|
|
|
|
rButBufferDelayPreferred->setAccessibleName ( tr ( "128 samples setting radio button" ) );
|
2009-12-03 22:21:26 +01:00
|
|
|
rButBufferDelayPreferred->setToolTip ( strSndCrdBufDelayTT );
|
2009-11-27 19:52:01 +01:00
|
|
|
rButBufferDelayDefault->setWhatsThis ( strSndCrdBufDelay );
|
|
|
|
rButBufferDelayDefault->setAccessibleName ( tr ( "256 samples setting radio button" ) );
|
2009-12-03 22:21:26 +01:00
|
|
|
rButBufferDelayDefault->setToolTip ( strSndCrdBufDelayTT );
|
2009-11-27 19:52:01 +01:00
|
|
|
rButBufferDelaySafe->setWhatsThis ( strSndCrdBufDelay );
|
|
|
|
rButBufferDelaySafe->setAccessibleName ( tr ( "512 samples setting radio button" ) );
|
2009-12-03 22:21:26 +01:00
|
|
|
rButBufferDelaySafe->setToolTip ( strSndCrdBufDelayTT );
|
2009-11-27 19:52:01 +01:00
|
|
|
ButtonDriverSetup->setWhatsThis ( strSndCrdBufDelay );
|
|
|
|
ButtonDriverSetup->setAccessibleName ( tr ( "ASIO setup push button" ) );
|
2009-12-03 22:21:26 +01:00
|
|
|
ButtonDriverSetup->setToolTip ( strSndCrdBufDelayTT );
|
2009-11-27 19:52:01 +01:00
|
|
|
|
|
|
|
// open chat on new message
|
|
|
|
cbOpenChatOnNewMessage->setWhatsThis ( tr ( "<b>Open Chat on New "
|
|
|
|
"Message:</b> If this checkbox is enabled, the chat window will "
|
|
|
|
"open on any incoming chat text if it not already opened." ) );
|
2009-12-03 22:21:26 +01:00
|
|
|
|
2009-11-27 19:52:01 +01:00
|
|
|
cbOpenChatOnNewMessage->setAccessibleName ( tr ( "Open chat on new "
|
|
|
|
"message check box" ) );
|
|
|
|
|
2009-12-03 22:21:26 +01:00
|
|
|
cbOpenChatOnNewMessage->setToolTip ( tr ( "If Open Chat on New Message "
|
|
|
|
"is disabled, a hint in the main window status bar is shown when a "
|
2009-12-03 22:45:54 +01:00
|
|
|
"new message has arrived." ) + TOOLTIP_COM_END_TEXT );
|
2009-12-03 22:21:26 +01:00
|
|
|
|
2009-11-27 19:52:01 +01:00
|
|
|
// use high quality audio
|
|
|
|
cbUseHighQualityAudio->setWhatsThis ( tr ( "<b>Use High Quality Audio</b> "
|
|
|
|
"Enabling ""Use High Quality Audio"" will improve the audio quality "
|
|
|
|
"by increasing the stream data rate. Make sure that the current "
|
|
|
|
"upload rate does not exceed the available bandwidth of your "
|
|
|
|
"internet connection." ) );
|
2009-12-03 22:21:26 +01:00
|
|
|
|
2009-11-27 19:52:01 +01:00
|
|
|
cbUseHighQualityAudio->setAccessibleName ( tr ( "Use high quality audio "
|
|
|
|
"check box" ) );
|
|
|
|
|
2010-02-04 21:25:57 +01:00
|
|
|
// current connection status parameter
|
2009-11-27 19:52:01 +01:00
|
|
|
QString strConnStats = tr ( "<b>Current Connection Status "
|
|
|
|
"Parameter:</b> The ping time is the time required for the audio "
|
|
|
|
"stream to travel from the client to the server and backwards. This "
|
|
|
|
"delay is introduced by the network. This delay should be as low as "
|
|
|
|
"20-30 ms. If this delay is higher (e.g., 50-60 ms), your distance to "
|
|
|
|
"the server is too large or your internet connection is not "
|
2009-12-03 22:21:26 +01:00
|
|
|
"sufficient.<br>"
|
2009-11-27 19:52:01 +01:00
|
|
|
"The overall delay is calculated from the current ping time and the "
|
2009-12-03 22:21:26 +01:00
|
|
|
"delay which is introduced by the current buffer settings.<br>"
|
2009-11-27 19:52:01 +01:00
|
|
|
"The upstream rate depends on the current audio packet size and the "
|
|
|
|
"audio compression setting. Make sure that the upstream rate is not "
|
|
|
|
"higher than the available rate (check the upstream capabilities of "
|
|
|
|
"your internet connection by, e.g., using speedtest.net)." );
|
|
|
|
|
|
|
|
TextPingTime->setWhatsThis ( strConnStats );
|
|
|
|
TextLabelPingTime->setWhatsThis ( strConnStats );
|
|
|
|
TextOverallDelay->setWhatsThis ( strConnStats );
|
|
|
|
TextLabelOverallDelay->setWhatsThis ( strConnStats );
|
|
|
|
TextUpstream->setWhatsThis ( strConnStats );
|
|
|
|
TextUpstreamValue->setWhatsThis ( strConnStats );
|
2009-12-03 22:21:26 +01:00
|
|
|
CLEDOverallDelay->setWhatsThis ( strConnStats );
|
|
|
|
CLEDOverallDelay->setToolTip ( tr ( "If this LED indicator turns red, "
|
|
|
|
"you will not have much fun using the llcon software..." ) +
|
|
|
|
TOOLTIP_COM_END_TEXT );
|
2009-11-27 19:52:01 +01:00
|
|
|
|
2009-10-24 14:24:44 +02: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();
|
2009-12-03 22:21:26 +01:00
|
|
|
|
|
|
|
// for Jack interface, we cannot choose the audio hardware from
|
|
|
|
// within the llcon software, hide the combo box
|
|
|
|
TextSoundcardDevice->hide();
|
|
|
|
cbSoundcard->hide();
|
2009-10-24 14:24:44 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
// init delay and other information controls
|
|
|
|
CLEDOverallDelay->SetUpdateTime ( 2 * PING_UPDATE_TIME );
|
|
|
|
CLEDOverallDelay->Reset();
|
|
|
|
TextLabelPingTime->setText ( "" );
|
|
|
|
TextLabelOverallDelay->setText ( "" );
|
|
|
|
TextUpstreamValue->setText ( "" );
|
|
|
|
|
|
|
|
|
|
|
|
// init slider controls ---
|
|
|
|
// network buffer
|
|
|
|
SliderNetBuf->setRange ( MIN_NET_BUF_SIZE_NUM_BL, MAX_NET_BUF_SIZE_NUM_BL );
|
|
|
|
UpdateJitterBufferFrame();
|
|
|
|
|
|
|
|
// init combo box containing all available sound cards in the system
|
|
|
|
cbSoundcard->clear();
|
|
|
|
for ( int iSndDevIdx = 0; iSndDevIdx < pClient->GetSndCrdNumDev(); iSndDevIdx++ )
|
|
|
|
{
|
2009-12-01 21:08:21 +01:00
|
|
|
cbSoundcard->addItem ( pClient->GetSndCrdDeviceName ( iSndDevIdx ) );
|
2009-10-24 14:24:44 +02:00
|
|
|
}
|
|
|
|
cbSoundcard->setCurrentIndex ( pClient->GetSndCrdDev() );
|
|
|
|
|
|
|
|
// "OpenChatOnNewMessage" check box
|
|
|
|
if ( pClient->GetOpenChatOnNewMessage() )
|
|
|
|
{
|
|
|
|
cbOpenChatOnNewMessage->setCheckState ( Qt::Checked );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cbOpenChatOnNewMessage->setCheckState ( Qt::Unchecked );
|
|
|
|
}
|
|
|
|
|
|
|
|
// fancy GUI design check box
|
|
|
|
if ( pClient->GetGUIDesign() == GD_STANDARD )
|
|
|
|
{
|
|
|
|
cbGUIDesignFancy->setCheckState ( Qt::Unchecked );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cbGUIDesignFancy->setCheckState ( Qt::Checked );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// TODO we disable the fancy GUI switch because the new design
|
|
|
|
// is not yet finished
|
|
|
|
cbGUIDesignFancy->setVisible ( false );
|
|
|
|
|
|
|
|
|
|
|
|
// "High Quality Audio" check box
|
|
|
|
if ( pClient->GetCELTHighQuality() )
|
|
|
|
{
|
|
|
|
cbUseHighQualityAudio->setCheckState ( Qt::Checked );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cbUseHighQualityAudio->setCheckState ( Qt::Unchecked );
|
|
|
|
}
|
|
|
|
|
|
|
|
// set text for sound card buffer delay radio buttons
|
|
|
|
rButBufferDelayPreferred->setText ( GenSndCrdBufferDelayString (
|
|
|
|
FRAME_SIZE_FACTOR_PREFERRED * SYSTEM_FRAME_SIZE_SAMPLES,
|
|
|
|
", preferred" ) );
|
|
|
|
|
|
|
|
rButBufferDelayDefault->setText ( GenSndCrdBufferDelayString (
|
|
|
|
FRAME_SIZE_FACTOR_DEFAULT * SYSTEM_FRAME_SIZE_SAMPLES,
|
|
|
|
", default" ) );
|
|
|
|
|
|
|
|
rButBufferDelaySafe->setText ( GenSndCrdBufferDelayString (
|
|
|
|
FRAME_SIZE_FACTOR_SAFE * SYSTEM_FRAME_SIZE_SAMPLES ) );
|
|
|
|
|
|
|
|
// sound card buffer delay inits
|
|
|
|
SndCrdBufferDelayButtonGroup.addButton ( rButBufferDelayPreferred );
|
|
|
|
SndCrdBufferDelayButtonGroup.addButton ( rButBufferDelayDefault );
|
|
|
|
SndCrdBufferDelayButtonGroup.addButton ( rButBufferDelaySafe );
|
|
|
|
|
|
|
|
UpdateSoundCardFrame();
|
|
|
|
|
|
|
|
|
|
|
|
// Connections -------------------------------------------------------------
|
|
|
|
// timers
|
|
|
|
QObject::connect ( &TimerStatus, SIGNAL ( timeout() ),
|
|
|
|
this, SLOT ( OnTimerStatus() ) );
|
|
|
|
|
|
|
|
QObject::connect ( &TimerPing, SIGNAL ( timeout() ),
|
|
|
|
this, SLOT ( OnTimerPing() ) );
|
|
|
|
|
|
|
|
// slider controls
|
|
|
|
QObject::connect ( SliderNetBuf, SIGNAL ( valueChanged ( int ) ),
|
|
|
|
this, SLOT ( OnSliderNetBuf ( int ) ) );
|
|
|
|
|
|
|
|
// check boxes
|
|
|
|
QObject::connect ( cbOpenChatOnNewMessage, SIGNAL ( stateChanged ( int ) ),
|
|
|
|
this, SLOT ( OnOpenChatOnNewMessageStateChanged ( int ) ) );
|
|
|
|
|
|
|
|
QObject::connect ( cbGUIDesignFancy, SIGNAL ( stateChanged ( int ) ),
|
|
|
|
this, SLOT ( OnGUIDesignFancyStateChanged ( int ) ) );
|
|
|
|
|
|
|
|
QObject::connect ( cbUseHighQualityAudio, SIGNAL ( stateChanged ( int ) ),
|
|
|
|
this, SLOT ( OnUseHighQualityAudioStateChanged ( int ) ) );
|
|
|
|
|
|
|
|
QObject::connect ( cbAutoJitBuf, SIGNAL ( stateChanged ( int ) ),
|
|
|
|
this, SLOT ( OnAutoJitBuf ( int ) ) );
|
|
|
|
|
|
|
|
// combo boxes
|
|
|
|
QObject::connect ( cbSoundcard, SIGNAL ( activated ( int ) ),
|
|
|
|
this, SLOT ( OnSoundCrdSelection ( int ) ) );
|
|
|
|
|
|
|
|
// buttons
|
|
|
|
QObject::connect ( ButtonDriverSetup, SIGNAL ( clicked() ),
|
|
|
|
this, SLOT ( OnDriverSetupBut() ) );
|
|
|
|
|
|
|
|
// misc
|
|
|
|
QObject::connect ( pClient, SIGNAL ( PingTimeReceived ( int ) ),
|
|
|
|
this, SLOT ( OnPingTimeResult ( int ) ) );
|
|
|
|
|
|
|
|
QObject::connect ( &SndCrdBufferDelayButtonGroup,
|
|
|
|
SIGNAL ( buttonClicked ( QAbstractButton* ) ), this,
|
|
|
|
SLOT ( OnSndCrdBufferDelayButtonGroupClicked ( QAbstractButton* ) ) );
|
|
|
|
|
|
|
|
|
|
|
|
// Timers ------------------------------------------------------------------
|
|
|
|
// start timer for status bar
|
|
|
|
TimerStatus.start ( DISPLAY_UPDATE_TIME );
|
|
|
|
}
|
|
|
|
|
|
|
|
void CClientSettingsDlg::UpdateJitterBufferFrame()
|
|
|
|
{
|
|
|
|
// update slider value and text
|
|
|
|
const int iCurNumNetBuf = pClient->GetSockBufNumFrames();
|
|
|
|
SliderNetBuf->setValue ( iCurNumNetBuf );
|
|
|
|
TextNetBuf->setText ( "Size: " + QString().setNum ( iCurNumNetBuf ) );
|
|
|
|
|
|
|
|
// if auto setting is enabled, disable slider control
|
|
|
|
cbAutoJitBuf->setChecked ( pClient->GetDoAutoSockBufSize() );
|
|
|
|
SliderNetBuf->setEnabled ( !pClient->GetDoAutoSockBufSize() );
|
|
|
|
TextNetBuf->setEnabled ( !pClient->GetDoAutoSockBufSize() );
|
|
|
|
}
|
|
|
|
|
|
|
|
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 + ")";
|
|
|
|
}
|
|
|
|
|
|
|
|
void CClientSettingsDlg::UpdateSoundCardFrame()
|
|
|
|
{
|
2009-11-30 20:28:29 +01:00
|
|
|
// get current actual buffer size value
|
2009-10-24 14:24:44 +02:00
|
|
|
const int iCurActualBufSize =
|
|
|
|
pClient->GetSndCrdActualMonoBlSize();
|
|
|
|
|
2009-11-30 21:22:19 +01:00
|
|
|
// Set radio buttons according to current value (To make it possible
|
|
|
|
// to have all radio buttons unchecked, we have to disable the
|
|
|
|
// exclusive check for the radio button group. We require all radio
|
|
|
|
// buttons to be unchecked in the case when the sound card does not
|
|
|
|
// support any of the buffer sizes and therefore all radio buttons
|
|
|
|
// are disabeld and unchecked.).
|
|
|
|
SndCrdBufferDelayButtonGroup.setExclusive ( false );
|
|
|
|
|
2009-11-30 20:28:29 +01:00
|
|
|
rButBufferDelayPreferred->setChecked ( iCurActualBufSize ==
|
|
|
|
SYSTEM_FRAME_SIZE_SAMPLES * FRAME_SIZE_FACTOR_PREFERRED );
|
2009-10-24 14:24:44 +02:00
|
|
|
|
2009-11-30 20:28:29 +01:00
|
|
|
rButBufferDelayDefault->setChecked ( iCurActualBufSize ==
|
|
|
|
SYSTEM_FRAME_SIZE_SAMPLES * FRAME_SIZE_FACTOR_DEFAULT );
|
2009-10-24 14:24:44 +02:00
|
|
|
|
2009-11-30 20:28:29 +01:00
|
|
|
rButBufferDelaySafe->setChecked ( iCurActualBufSize ==
|
|
|
|
SYSTEM_FRAME_SIZE_SAMPLES * FRAME_SIZE_FACTOR_SAFE );
|
2009-10-24 14:24:44 +02:00
|
|
|
|
2009-11-30 21:22:19 +01:00
|
|
|
SndCrdBufferDelayButtonGroup.setExclusive ( true );
|
|
|
|
|
2009-11-30 20:28:29 +01:00
|
|
|
// disable radio buttons which are not supported by audio interface
|
|
|
|
rButBufferDelayPreferred->setEnabled (
|
|
|
|
pClient->GetFraSiFactPrefSupported() );
|
2009-10-24 14:24:44 +02:00
|
|
|
|
2009-11-30 20:28:29 +01:00
|
|
|
rButBufferDelayDefault->setEnabled (
|
|
|
|
pClient->GetFraSiFactDefSupported() );
|
2009-10-24 14:24:44 +02:00
|
|
|
|
2009-11-30 20:28:29 +01:00
|
|
|
rButBufferDelaySafe->setEnabled (
|
|
|
|
pClient->GetFraSiFactSafeSupported() );
|
2009-10-24 14:24:44 +02:00
|
|
|
}
|
|
|
|
|
2010-03-14 21:15:06 +01:00
|
|
|
void CClientSettingsDlg::showEvent ( QShowEvent* )
|
2009-10-24 14:24:44 +02:00
|
|
|
{
|
|
|
|
// only activate ping timer if window is actually shown
|
|
|
|
TimerPing.start ( PING_UPDATE_TIME );
|
|
|
|
|
|
|
|
UpdateDisplay();
|
|
|
|
}
|
|
|
|
|
2010-03-14 21:15:06 +01:00
|
|
|
void CClientSettingsDlg::hideEvent ( QHideEvent* )
|
2009-10-24 14:24:44 +02:00
|
|
|
{
|
|
|
|
// if window is closed, stop timer for ping
|
|
|
|
TimerPing.stop();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CClientSettingsDlg::OnDriverSetupBut()
|
|
|
|
{
|
|
|
|
pClient->OpenSndCrdDriverSetup();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CClientSettingsDlg::OnSliderNetBuf ( int value )
|
|
|
|
{
|
|
|
|
pClient->SetSockBufNumFrames ( value );
|
|
|
|
UpdateJitterBufferFrame();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CClientSettingsDlg::OnSliderSndCrdBufferDelay ( int value )
|
|
|
|
{
|
|
|
|
pClient->SetSndCrdPrefFrameSizeFactor ( value );
|
|
|
|
UpdateDisplay();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CClientSettingsDlg::OnSoundCrdSelection ( int iSndDevIdx )
|
|
|
|
{
|
|
|
|
const QString strError = pClient->SetSndCrdDev ( iSndDevIdx );
|
|
|
|
|
|
|
|
if ( !strError.isEmpty() )
|
|
|
|
{
|
2009-11-30 22:16:40 +01:00
|
|
|
QMessageBox::critical ( this, APP_NAME,
|
2009-12-01 09:52:06 +01:00
|
|
|
QString ( tr ( "The selected audio device could not be used "
|
|
|
|
"because of the following error: " ) ) + strError +
|
|
|
|
QString ( tr ( " The previous driver will be selected." ) ),
|
|
|
|
"Ok", 0 );
|
2009-10-24 14:24:44 +02:00
|
|
|
|
|
|
|
// recover old selection
|
|
|
|
cbSoundcard->setCurrentIndex ( pClient->GetSndCrdDev() );
|
|
|
|
}
|
|
|
|
UpdateDisplay();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CClientSettingsDlg::OnAutoJitBuf ( int value )
|
|
|
|
{
|
|
|
|
pClient->SetDoAutoSockBufSize ( value == Qt::Checked );
|
|
|
|
UpdateJitterBufferFrame();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CClientSettingsDlg::OnOpenChatOnNewMessageStateChanged ( int value )
|
|
|
|
{
|
|
|
|
pClient->SetOpenChatOnNewMessage ( value == Qt::Checked );
|
|
|
|
UpdateDisplay();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CClientSettingsDlg::OnGUIDesignFancyStateChanged ( int value )
|
|
|
|
{
|
|
|
|
if ( value == Qt::Unchecked )
|
|
|
|
{
|
|
|
|
pClient->SetGUIDesign ( GD_STANDARD );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pClient->SetGUIDesign ( GD_ORIGINAL );
|
|
|
|
}
|
|
|
|
emit GUIDesignChanged();
|
|
|
|
UpdateDisplay();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CClientSettingsDlg::OnUseHighQualityAudioStateChanged ( int value )
|
|
|
|
{
|
|
|
|
pClient->SetCELTHighQuality ( value == Qt::Checked );
|
|
|
|
UpdateDisplay();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CClientSettingsDlg::OnSndCrdBufferDelayButtonGroupClicked ( QAbstractButton* button )
|
|
|
|
{
|
|
|
|
if ( button == rButBufferDelayPreferred )
|
|
|
|
{
|
|
|
|
pClient->SetSndCrdPrefFrameSizeFactor ( FRAME_SIZE_FACTOR_PREFERRED );
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( button == rButBufferDelayDefault )
|
|
|
|
{
|
|
|
|
pClient->SetSndCrdPrefFrameSizeFactor ( FRAME_SIZE_FACTOR_DEFAULT );
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( button == rButBufferDelaySafe )
|
|
|
|
{
|
|
|
|
pClient->SetSndCrdPrefFrameSizeFactor ( FRAME_SIZE_FACTOR_SAFE );
|
|
|
|
}
|
|
|
|
|
|
|
|
UpdateDisplay();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CClientSettingsDlg::OnTimerPing()
|
|
|
|
{
|
|
|
|
// send ping message to server
|
|
|
|
pClient->SendPingMess();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CClientSettingsDlg::OnPingTimeResult ( int iPingTime )
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
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
|
|
|
|
*/
|
|
|
|
// 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();
|
|
|
|
|
|
|
|
// 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)
|
2010-02-07 13:15:36 +01:00
|
|
|
// the actual sound card buffer size, also consider delay introduced by
|
|
|
|
// sound card conversion buffer by using
|
|
|
|
// "GetSndCrdConvBufAdditionalDelayMonoBlSize"
|
2009-10-24 14:24:44 +02:00
|
|
|
const double dTotalSoundCardDelayMS =
|
2010-02-07 13:15:36 +01:00
|
|
|
( 3 * pClient->GetSndCrdActualMonoBlSize() +
|
|
|
|
pClient->GetSndCrdConvBufAdditionalDelayMonoBlSize() ) *
|
2009-10-24 14:24:44 +02:00
|
|
|
1000 / SYSTEM_SAMPLE_RATE;
|
|
|
|
|
|
|
|
// network packets are of the same size as the audio packets per definition
|
2010-02-07 13:15:36 +01:00
|
|
|
// if no sound card conversion buffer is used
|
2009-10-24 14:24:44 +02:00
|
|
|
const double dDelayToFillNetworkPackets =
|
2010-02-07 13:15:36 +01:00
|
|
|
pClient->GetSystemMonoBlSize() *
|
2009-10-24 14:24:44 +02:00
|
|
|
1000 / SYSTEM_SAMPLE_RATE;
|
|
|
|
|
|
|
|
// CELT additional delay at small frame sizes is half a frame size
|
|
|
|
const double dAdditionalAudioCodecDelay =
|
|
|
|
SYSTEM_BLOCK_DURATION_MS_FLOAT / 2;
|
|
|
|
|
|
|
|
const double dTotalBufferDelay =
|
|
|
|
dDelayToFillNetworkPackets +
|
|
|
|
dTotalJitterBufferDelayMS +
|
|
|
|
dTotalSoundCardDelayMS +
|
|
|
|
dAdditionalAudioCodecDelay;
|
|
|
|
|
|
|
|
const int iOverallDelay =
|
|
|
|
LlconMath::round ( dTotalBufferDelay + iPingTime );
|
|
|
|
|
|
|
|
// apply values to GUI labels, take special care if ping time exceeds
|
|
|
|
// a certain value
|
|
|
|
if ( iPingTime > 500 )
|
|
|
|
{
|
|
|
|
const QString sErrorText =
|
|
|
|
"<font color=""red""><b>>500 ms</b></font>";
|
|
|
|
|
|
|
|
TextLabelPingTime->setText ( sErrorText );
|
|
|
|
TextLabelOverallDelay->setText ( sErrorText );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
TextLabelPingTime->setText ( QString().setNum ( iPingTime ) + " ms" );
|
|
|
|
TextLabelOverallDelay->setText (
|
|
|
|
QString().setNum ( iOverallDelay ) + " ms" );
|
|
|
|
}
|
|
|
|
|
|
|
|
// color definition: < 40 ms green, < 65 ms yellow, otherwise red
|
|
|
|
if ( iOverallDelay <= 40 )
|
|
|
|
{
|
|
|
|
CLEDOverallDelay->SetLight ( MUL_COL_LED_GREEN );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( iOverallDelay <= 65 )
|
|
|
|
{
|
|
|
|
CLEDOverallDelay->SetLight ( MUL_COL_LED_YELLOW );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
CLEDOverallDelay->SetLight ( MUL_COL_LED_RED );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CClientSettingsDlg::UpdateDisplay()
|
|
|
|
{
|
|
|
|
// update slider controls (settings might have been changed)
|
|
|
|
UpdateJitterBufferFrame();
|
|
|
|
UpdateSoundCardFrame();
|
|
|
|
|
|
|
|
if ( !pClient->IsRunning() )
|
|
|
|
{
|
|
|
|
// clear text labels with client parameters
|
|
|
|
TextLabelPingTime->setText ( "" );
|
|
|
|
TextLabelOverallDelay->setText ( "" );
|
|
|
|
TextUpstreamValue->setText ( "" );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// update upstream rate information label (only if client is running)
|
|
|
|
TextUpstreamValue->setText (
|
|
|
|
QString().setNum ( pClient->GetUploadRateKbps() ) + " kbps" );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CClientSettingsDlg::SetStatus ( const int iMessType, const int iStatus )
|
|
|
|
{
|
|
|
|
switch ( iMessType )
|
|
|
|
{
|
|
|
|
case MS_JIT_BUF_PUT:
|
|
|
|
case MS_JIT_BUF_GET:
|
|
|
|
// network LED shows combined status of put and get
|
|
|
|
CLEDNetw->SetLight ( iStatus );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MS_RESET_ALL:
|
|
|
|
CLEDNetw->Reset();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|