From b38b8c01a71588e54e175c05a7b789985572ea5b Mon Sep 17 00:00:00 2001 From: Volker Fischer Date: Thu, 12 Feb 2009 17:15:17 +0000 Subject: [PATCH] better behaviour of ping and overall delay displays for large delays --- src/buffer.cpp | 4 ++-- src/client.cpp | 4 ++-- src/clientsettingsdlg.cpp | 15 ++++++++++++--- src/clientsettingsdlgbase.ui | 22 ++++++++++++++++++++-- 4 files changed, 36 insertions(+), 9 deletions(-) diff --git a/src/buffer.cpp b/src/buffer.cpp index 9b19bf06..1b17d018 100755 --- a/src/buffer.cpp +++ b/src/buffer.cpp @@ -108,7 +108,7 @@ fflush(pFileBI); const int iRemSpace = iPutPos + iInSize - iMemSize; // data must be written in two steps because of wrap around - while (iPutPos < iMemSize) + while ( iPutPos < iMemSize ) { vecdMemory[iPutPos++] = vecdData[iCurPos++]; } @@ -143,7 +143,7 @@ fflush(pFileBI); bool CNetBuf::Get ( CVector& vecdData ) { - bool bGetOK = true; // init return value + bool bGetOK = true; // init return value bool bFadeOutExtrap = false; // get size of data to be get from the buffer diff --git a/src/client.cpp b/src/client.cpp index 155ae78d..d3e45c31 100755 --- a/src/client.cpp +++ b/src/client.cpp @@ -31,7 +31,7 @@ CClient::CClient ( const quint16 iPortNumber ) : bRun ( false ), Sound ( MIN_SND_CRD_BLOCK_SIZE_SAMPLES * 2 /* stereo */ ), Socket ( &Channel, iPortNumber ), iAudioInFader ( AUD_FADER_IN_MAX / 2 ), - iReverbLevel ( AUD_REVERB_MAX / 6 ), + iReverbLevel ( 0 ), bReverbOnLeftChan ( false ), iNetwBufSizeFactIn ( DEF_NET_BLOCK_SIZE_FACTOR ), strIPAddress ( "" ), strName ( "" ), @@ -213,7 +213,7 @@ void CClient::run() // Set thread priority (The working thread should have a higher // priority than the GUI) #ifdef _WIN32 - SetThreadPriority ( GetCurrentThread(), THREAD_PRIORITY_ABOVE_NORMAL ); + SetThreadPriority ( GetCurrentThread(), THREAD_PRIORITY_HIGHEST ); #else /* // set the process to realtime privs, taken from diff --git a/src/clientsettingsdlg.cpp b/src/clientsettingsdlg.cpp index 1b1d979f..16d60360 100755 --- a/src/clientsettingsdlg.cpp +++ b/src/clientsettingsdlg.cpp @@ -340,10 +340,19 @@ void CClientSettingsDlg::OnPingTimeResult ( int iPingTime ) const int iOverallDelay = iTotalBufferDelay + iPingTime; - // apply values to GUI labels - TextLabelPingTime->setText ( QString().setNum ( iPingTime ) + " ms" ); + // apply values to GUI labels, take special care if ping time exceeds + // a certain value TextLabelBufferDelay->setText ( QString().setNum ( iTotalBufferDelay ) + " ms" ); - TextLabelOverallDelay->setText ( QString().setNum ( iOverallDelay ) + " ms" ); + if ( iPingTime > 500 ) + { + TextLabelPingTime->setText ( ">500 ms" ); + TextLabelOverallDelay->setText ( ">500 ms" ); + } + else + { + TextLabelPingTime->setText ( QString().setNum ( iPingTime ) + " ms" ); + TextLabelOverallDelay->setText ( QString().setNum ( iOverallDelay ) + " ms" ); + } // color definition: < 40 ms green, < 60 ms yellow, otherwise red if ( iOverallDelay <= 40 ) diff --git a/src/clientsettingsdlgbase.ui b/src/clientsettingsdlgbase.ui index 745ba6dd..5c86ebff 100755 --- a/src/clientsettingsdlgbase.ui +++ b/src/clientsettingsdlgbase.ui @@ -813,6 +813,12 @@ + + + 0 + 0 + + 40 @@ -862,9 +868,15 @@ + + + 0 + 0 + + - 40 + 50 0 @@ -913,9 +925,15 @@ + + + 0 + 0 + + - 45 + 50 0