2006-12-18 15:39:33 +01:00
|
|
|
/******************************************************************************\
|
|
|
|
* Copyright (c) 2004-2006
|
|
|
|
*
|
|
|
|
* 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-01-22 20:58:53 +01:00
|
|
|
// init timing jitter text label
|
2006-11-25 15:46:57 +01:00
|
|
|
TextLabelStdDevTimer->setText ( "" );
|
|
|
|
|
2008-01-22 20:58:53 +01:00
|
|
|
// init slider controls ---
|
|
|
|
// sound buffer in
|
2008-07-14 00:57:31 +02:00
|
|
|
#ifdef _WIN32
|
|
|
|
SliderSndBufIn->setRange ( 1, AUD_SLIDER_LENGTH ); // for ASIO we only need one buffer
|
|
|
|
#else
|
2007-09-08 12:45:14 +02:00
|
|
|
SliderSndBufIn->setRange ( 2, AUD_SLIDER_LENGTH );
|
2008-07-14 00:57:31 +02:00
|
|
|
#endif
|
2006-11-25 15:46:57 +01:00
|
|
|
const int iCurNumInBuf = pClient->GetSndInterface()->GetInNumBuf();
|
2007-09-08 12:45:14 +02:00
|
|
|
SliderSndBufIn->setValue ( iCurNumInBuf );
|
|
|
|
TextSndBufIn->setText ( "In: " + QString().setNum ( iCurNumInBuf ) );
|
2006-11-25 15:46:57 +01:00
|
|
|
|
2008-01-22 20:58:53 +01:00
|
|
|
// sound buffer out
|
2008-07-14 00:57:31 +02:00
|
|
|
#ifdef _WIN32
|
|
|
|
SliderSndBufOut->setRange ( 1, AUD_SLIDER_LENGTH ); // for ASIO we only need one buffer
|
|
|
|
#else
|
2007-09-08 12:45:14 +02:00
|
|
|
SliderSndBufOut->setRange ( 2, AUD_SLIDER_LENGTH );
|
2008-07-14 00:57:31 +02:00
|
|
|
#endif
|
2006-11-25 15:46:57 +01:00
|
|
|
const int iCurNumOutBuf = pClient->GetSndInterface()->GetOutNumBuf();
|
2007-09-08 12:45:14 +02:00
|
|
|
SliderSndBufOut->setValue ( iCurNumOutBuf );
|
|
|
|
TextSndBufOut->setText ( "Out: " + QString().setNum ( iCurNumOutBuf ) );
|
2006-11-25 15:46:57 +01:00
|
|
|
|
2008-01-22 20:58:53 +01:00
|
|
|
// network buffer
|
2007-09-08 12:45:14 +02:00
|
|
|
SliderNetBuf->setRange ( 0, MAX_NET_BUF_SIZE_NUM_BL );
|
2006-11-25 15:46:57 +01:00
|
|
|
const int iCurNumNetBuf = pClient->GetSockBufSize();
|
2007-09-08 12:45:14 +02:00
|
|
|
SliderNetBuf->setValue ( iCurNumNetBuf );
|
|
|
|
TextNetBuf->setText ( "Size: " + QString().setNum ( iCurNumNetBuf ) );
|
2006-11-25 15:46:57 +01:00
|
|
|
|
2008-01-22 20:58:53 +01:00
|
|
|
// network buffer size factor in
|
2007-09-08 12:45:14 +02:00
|
|
|
SliderNetBufSiFactIn->setRange ( 1, MAX_NET_BLOCK_SIZE_FACTOR );
|
2006-11-25 15:46:57 +01:00
|
|
|
const int iCurNetBufSiFactIn = pClient->GetNetwBufSizeFactIn();
|
2007-09-08 12:45:14 +02:00
|
|
|
SliderNetBufSiFactIn->setValue ( iCurNetBufSiFactIn );
|
|
|
|
TextNetBufSiFactIn->setText ( "In:\n" + QString().setNum (
|
|
|
|
double ( iCurNetBufSiFactIn * MIN_BLOCK_DURATION_MS ), 'f', 2 ) +
|
|
|
|
" ms" );
|
2006-11-25 15:46:57 +01:00
|
|
|
|
2008-01-22 20:58:53 +01:00
|
|
|
// network buffer size factor out
|
2007-09-08 12:45:14 +02:00
|
|
|
SliderNetBufSiFactOut->setRange ( 1, MAX_NET_BLOCK_SIZE_FACTOR );
|
2006-11-25 15:46:57 +01:00
|
|
|
const int iCurNetBufSiFactOut = pClient->GetNetwBufSizeFactOut();
|
2007-09-08 12:45:14 +02:00
|
|
|
SliderNetBufSiFactOut->setValue ( iCurNetBufSiFactOut );
|
|
|
|
TextNetBufSiFactOut->setText ( "Out:\n" + QString().setNum (
|
|
|
|
double ( iCurNetBufSiFactOut * MIN_BLOCK_DURATION_MS), 'f', 2 ) +
|
|
|
|
" ms" );
|
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() ) );
|
2006-11-25 15:46:57 +01:00
|
|
|
|
2008-01-22 20:58:53 +01:00
|
|
|
// sliders
|
2007-09-08 12:45:14 +02:00
|
|
|
QObject::connect ( SliderSndBufIn, SIGNAL ( valueChanged ( int ) ),
|
|
|
|
this, SLOT ( OnSliderSndBufInChange ( int ) ) );
|
|
|
|
QObject::connect ( SliderSndBufOut, SIGNAL ( valueChanged ( int ) ),
|
|
|
|
this, SLOT ( OnSliderSndBufOutChange ( int ) ) );
|
2006-11-25 15:46:57 +01:00
|
|
|
|
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
|
|
|
|
2007-09-08 12:45:14 +02:00
|
|
|
QObject::connect ( SliderNetBufSiFactIn, SIGNAL ( valueChanged ( int ) ),
|
|
|
|
this, SLOT ( OnSliderNetBufSiFactIn ( int ) ) );
|
|
|
|
QObject::connect ( SliderNetBufSiFactOut, SIGNAL ( valueChanged ( int ) ),
|
|
|
|
this, SLOT ( OnSliderNetBufSiFactOut ( int ) ) );
|
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
|
|
|
}
|
|
|
|
|
2007-09-08 12:45:14 +02:00
|
|
|
void CClientSettingsDlg::OnSliderSndBufInChange ( int value )
|
2006-12-18 15:39:33 +01:00
|
|
|
{
|
2007-09-08 12:45:14 +02:00
|
|
|
pClient->GetSndInterface()->SetInNumBuf ( value );
|
|
|
|
TextSndBufIn->setText ( "In: " + QString().setNum ( value ) );
|
2006-11-25 15:46:57 +01:00
|
|
|
UpdateDisplay();
|
2006-12-18 15:39:33 +01:00
|
|
|
}
|
|
|
|
|
2007-09-08 12:45:14 +02:00
|
|
|
void CClientSettingsDlg::OnSliderSndBufOutChange ( int value )
|
2006-12-18 15:39:33 +01:00
|
|
|
{
|
2007-09-08 12:45:14 +02:00
|
|
|
pClient->GetSndInterface()->SetOutNumBuf ( value );
|
|
|
|
TextSndBufOut->setText ( "Out: " + QString().setNum ( value ) );
|
2006-11-25 15:46:57 +01:00
|
|
|
UpdateDisplay();
|
2006-12-18 15:39:33 +01:00
|
|
|
}
|
|
|
|
|
2007-09-08 12:45:14 +02:00
|
|
|
void CClientSettingsDlg::OnSliderNetBuf ( int value )
|
2006-12-18 15:39:33 +01:00
|
|
|
{
|
|
|
|
pClient->SetSockBufSize ( value );
|
2007-09-08 12:45:14 +02:00
|
|
|
TextNetBuf->setText ( "Size: " + QString().setNum ( value ) );
|
2006-11-25 15:46:57 +01:00
|
|
|
UpdateDisplay();
|
2006-11-03 19:54:12 +01:00
|
|
|
}
|
|
|
|
|
2007-09-08 12:45:14 +02:00
|
|
|
void CClientSettingsDlg::OnSliderNetBufSiFactIn ( int value )
|
2006-11-03 19:54:12 +01:00
|
|
|
{
|
2006-11-25 15:46:57 +01:00
|
|
|
pClient->SetNetwBufSizeFactIn ( value );
|
2007-09-08 12:45:14 +02:00
|
|
|
TextNetBufSiFactIn->setText ( "In:\n" + QString().setNum (
|
|
|
|
double ( value * MIN_BLOCK_DURATION_MS ), 'f', 2 ) +
|
|
|
|
" ms" );
|
2006-11-25 15:46:57 +01:00
|
|
|
UpdateDisplay();
|
2006-11-03 19:54:12 +01:00
|
|
|
}
|
|
|
|
|
2007-09-08 12:45:14 +02:00
|
|
|
void CClientSettingsDlg::OnSliderNetBufSiFactOut ( int value )
|
2006-11-03 19:54:12 +01:00
|
|
|
{
|
2006-11-25 15:46:57 +01:00
|
|
|
pClient->SetNetwBufSizeFactOut ( value );
|
2007-09-08 12:45:14 +02:00
|
|
|
TextNetBufSiFactOut->setText ( "Out:\n" + QString().setNum (
|
|
|
|
double ( value * MIN_BLOCK_DURATION_MS ), 'f', 2 ) +
|
|
|
|
" ms" );
|
2006-11-25 15:46:57 +01:00
|
|
|
UpdateDisplay();
|
2006-11-03 19:54:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void CClientSettingsDlg::UpdateDisplay()
|
|
|
|
{
|
2008-01-22 20:58:53 +01:00
|
|
|
// response time
|
2007-09-08 12:45:14 +02:00
|
|
|
TextLabelStdDevTimer->setText ( QString().
|
|
|
|
setNum ( pClient->GetTimingStdDev(), 'f', 2 ) + " ms" );
|
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_SOUND_IN:
|
2007-09-08 12:45:14 +02:00
|
|
|
CLEDSoundIn->SetLight ( iStatus );
|
2006-12-18 15:39:33 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case MS_SOUND_OUT:
|
2007-09-08 12:45:14 +02:00
|
|
|
CLEDSoundOut->SetLight ( iStatus );
|
2006-12-18 15:39:33 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case MS_JIT_BUF_PUT:
|
2007-09-08 12:45:14 +02:00
|
|
|
CLEDNetwPut->SetLight ( iStatus );
|
2006-12-18 15:39:33 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case MS_JIT_BUF_GET:
|
2007-09-08 12:45:14 +02:00
|
|
|
CLEDNetwGet->SetLight ( iStatus );
|
2006-11-25 15:46:57 +01:00
|
|
|
break;
|
2006-11-05 11:09:32 +01:00
|
|
|
|
2006-11-25 15:46:57 +01:00
|
|
|
case MS_PROTOCOL:
|
2007-09-08 12:45:14 +02:00
|
|
|
CLEDProtocolStatus->SetLight ( iStatus );
|
2006-12-18 15:39:33 +01:00
|
|
|
|
|
|
|
case MS_RESET_ALL:
|
|
|
|
CLEDSoundIn->Reset();
|
|
|
|
CLEDSoundOut->Reset();
|
|
|
|
CLEDNetwPut->Reset();
|
2006-11-25 15:46:57 +01:00
|
|
|
CLEDNetwGet->Reset();
|
2006-12-18 15:39:33 +01:00
|
|
|
CLEDProtocolStatus->Reset();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|