better behaviour of ping and overall delay displays for large delays

This commit is contained in:
Volker Fischer 2009-02-12 17:15:17 +00:00
parent f84b9673bd
commit b38b8c01a7
4 changed files with 36 additions and 9 deletions

View file

@ -108,7 +108,7 @@ fflush(pFileBI);
const int iRemSpace = iPutPos + iInSize - iMemSize; const int iRemSpace = iPutPos + iInSize - iMemSize;
// data must be written in two steps because of wrap around // data must be written in two steps because of wrap around
while (iPutPos < iMemSize) while ( iPutPos < iMemSize )
{ {
vecdMemory[iPutPos++] = vecdData[iCurPos++]; vecdMemory[iPutPos++] = vecdData[iCurPos++];
} }
@ -143,7 +143,7 @@ fflush(pFileBI);
bool CNetBuf::Get ( CVector<double>& vecdData ) bool CNetBuf::Get ( CVector<double>& vecdData )
{ {
bool bGetOK = true; // init return value bool bGetOK = true; // init return value
bool bFadeOutExtrap = false; bool bFadeOutExtrap = false;
// get size of data to be get from the buffer // get size of data to be get from the buffer

View file

@ -31,7 +31,7 @@ CClient::CClient ( const quint16 iPortNumber ) : bRun ( false ),
Sound ( MIN_SND_CRD_BLOCK_SIZE_SAMPLES * 2 /* stereo */ ), Sound ( MIN_SND_CRD_BLOCK_SIZE_SAMPLES * 2 /* stereo */ ),
Socket ( &Channel, iPortNumber ), Socket ( &Channel, iPortNumber ),
iAudioInFader ( AUD_FADER_IN_MAX / 2 ), iAudioInFader ( AUD_FADER_IN_MAX / 2 ),
iReverbLevel ( AUD_REVERB_MAX / 6 ), iReverbLevel ( 0 ),
bReverbOnLeftChan ( false ), bReverbOnLeftChan ( false ),
iNetwBufSizeFactIn ( DEF_NET_BLOCK_SIZE_FACTOR ), iNetwBufSizeFactIn ( DEF_NET_BLOCK_SIZE_FACTOR ),
strIPAddress ( "" ), strName ( "" ), strIPAddress ( "" ), strName ( "" ),
@ -213,7 +213,7 @@ void CClient::run()
// Set thread priority (The working thread should have a higher // Set thread priority (The working thread should have a higher
// priority than the GUI) // priority than the GUI)
#ifdef _WIN32 #ifdef _WIN32
SetThreadPriority ( GetCurrentThread(), THREAD_PRIORITY_ABOVE_NORMAL ); SetThreadPriority ( GetCurrentThread(), THREAD_PRIORITY_HIGHEST );
#else #else
/* /*
// set the process to realtime privs, taken from // set the process to realtime privs, taken from

View file

@ -340,10 +340,19 @@ void CClientSettingsDlg::OnPingTimeResult ( int iPingTime )
const int iOverallDelay = iTotalBufferDelay + iPingTime; const int iOverallDelay = iTotalBufferDelay + iPingTime;
// apply values to GUI labels // apply values to GUI labels, take special care if ping time exceeds
TextLabelPingTime->setText ( QString().setNum ( iPingTime ) + " ms" ); // a certain value
TextLabelBufferDelay->setText ( QString().setNum ( iTotalBufferDelay ) + " ms" ); TextLabelBufferDelay->setText ( QString().setNum ( iTotalBufferDelay ) + " ms" );
TextLabelOverallDelay->setText ( QString().setNum ( iOverallDelay ) + " ms" ); if ( iPingTime > 500 )
{
TextLabelPingTime->setText ( "<font color=""red""><b>&#62;500 ms</b></font>" );
TextLabelOverallDelay->setText ( "<font color=""red""><b>&#62;500 ms</b></font>" );
}
else
{
TextLabelPingTime->setText ( QString().setNum ( iPingTime ) + " ms" );
TextLabelOverallDelay->setText ( QString().setNum ( iOverallDelay ) + " ms" );
}
// color definition: < 40 ms green, < 60 ms yellow, otherwise red // color definition: < 40 ms green, < 60 ms yellow, otherwise red
if ( iOverallDelay <= 40 ) if ( iOverallDelay <= 40 )

View file

@ -813,6 +813,12 @@
</item> </item>
<item> <item>
<widget class="QLabel" name="TextLabelBufferDelay" > <widget class="QLabel" name="TextLabelBufferDelay" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Maximum" hsizetype="Preferred" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize" > <property name="minimumSize" >
<size> <size>
<width>40</width> <width>40</width>
@ -862,9 +868,15 @@
</item> </item>
<item> <item>
<widget class="QLabel" name="TextLabelPingTime" > <widget class="QLabel" name="TextLabelPingTime" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Maximum" hsizetype="Preferred" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize" > <property name="minimumSize" >
<size> <size>
<width>40</width> <width>50</width>
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
@ -913,9 +925,15 @@
<layout class="QHBoxLayout" > <layout class="QHBoxLayout" >
<item> <item>
<widget class="QLabel" name="TextLabelOverallDelay" > <widget class="QLabel" name="TextLabelOverallDelay" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Maximum" hsizetype="Preferred" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize" > <property name="minimumSize" >
<size> <size>
<width>45</width> <width>50</width>
<height>0</height> <height>0</height>
</size> </size>
</property> </property>