moved ping time evaluation timer from settings dialog in main dialog, this is a preparation for the implementation that we make use of the ping result in the main windows for a display; we now always send ping messages, not only if the settings dialog is opened since we did not see performance degradations caused by the ping messages

This commit is contained in:
Volker Fischer 2011-01-09 14:20:58 +00:00
parent fcdc4daeac
commit 897da0c6bd
4 changed files with 61 additions and 55 deletions

View file

@ -330,9 +330,6 @@ cbGUIDesignFancy->setVisible ( false );
QObject::connect ( &TimerStatus, SIGNAL ( timeout() ), QObject::connect ( &TimerStatus, SIGNAL ( timeout() ),
this, SLOT ( OnTimerStatus() ) ); this, SLOT ( OnTimerStatus() ) );
QObject::connect ( &TimerPing, SIGNAL ( timeout() ),
this, SLOT ( OnTimerPing() ) );
// slider controls // slider controls
QObject::connect ( SliderNetBuf, SIGNAL ( valueChanged ( int ) ), QObject::connect ( SliderNetBuf, SIGNAL ( valueChanged ( int ) ),
this, SLOT ( OnSliderNetBuf ( int ) ) ); this, SLOT ( OnSliderNetBuf ( int ) ) );
@ -374,9 +371,6 @@ cbGUIDesignFancy->setVisible ( false );
this, SLOT ( OnDriverSetupBut() ) ); this, SLOT ( OnDriverSetupBut() ) );
// misc // misc
QObject::connect ( pClient, SIGNAL ( PingTimeReceived ( int ) ),
this, SLOT ( OnPingTimeResult ( int ) ) );
QObject::connect ( &SndCrdBufferDelayButtonGroup, QObject::connect ( &SndCrdBufferDelayButtonGroup,
SIGNAL ( buttonClicked ( QAbstractButton* ) ), this, SIGNAL ( buttonClicked ( QAbstractButton* ) ), this,
SLOT ( OnSndCrdBufferDelayButtonGroupClicked ( QAbstractButton* ) ) ); SLOT ( OnSndCrdBufferDelayButtonGroupClicked ( QAbstractButton* ) ) );
@ -494,20 +488,6 @@ void CClientSettingsDlg::UpdateSoundChannelSelectionFrame()
#endif #endif
} }
void CClientSettingsDlg::showEvent ( QShowEvent* )
{
// only activate ping timer if window is actually shown
TimerPing.start ( PING_UPDATE_TIME );
UpdateDisplay();
}
void CClientSettingsDlg::hideEvent ( QHideEvent* )
{
// if window is closed, stop timer for ping
TimerPing.stop();
}
void CClientSettingsDlg::OnDriverSetupBut() void CClientSettingsDlg::OnDriverSetupBut()
{ {
pClient->OpenSndCrdDriverSetup(); pClient->OpenSndCrdDriverSetup();
@ -627,17 +607,10 @@ void CClientSettingsDlg::OnSndCrdBufferDelayButtonGroupClicked ( QAbstractButton
UpdateDisplay(); UpdateDisplay();
} }
void CClientSettingsDlg::OnTimerPing() void CClientSettingsDlg::SetPingTimeResult ( const int iPingTime,
const int iOverallDelayMs,
const int iOverallDelayLEDColor )
{ {
// send ping message to server
pClient->SendPingMess();
}
void CClientSettingsDlg::OnPingTimeResult ( int iPingTime )
{
// calculate overall delay
const int iOverallDelayMs = pClient->EstimatedOverallDelay ( iPingTime );
// apply values to GUI labels, take special care if ping time exceeds // apply values to GUI labels, take special care if ping time exceeds
// a certain value // a certain value
if ( iPingTime > 500 ) if ( iPingTime > 500 )
@ -655,22 +628,8 @@ void CClientSettingsDlg::OnPingTimeResult ( int iPingTime )
QString().setNum ( iOverallDelayMs ) + " ms" ); QString().setNum ( iOverallDelayMs ) + " ms" );
} }
// color definition: < 40 ms green, < 65 ms yellow, otherwise red // set current LED status
if ( iOverallDelayMs <= 40 ) CLEDOverallDelay->SetLight ( iOverallDelayLEDColor );
{
CLEDOverallDelay->SetLight ( MUL_COL_LED_GREEN );
}
else
{
if ( iOverallDelayMs <= 65 )
{
CLEDOverallDelay->SetLight ( MUL_COL_LED_YELLOW );
}
else
{
CLEDOverallDelay->SetLight ( MUL_COL_LED_RED );
}
}
} }
void CClientSettingsDlg::UpdateDisplay() void CClientSettingsDlg::UpdateDisplay()

View file

@ -64,6 +64,9 @@ public:
Qt::WindowFlags f = 0 ); Qt::WindowFlags f = 0 );
void SetStatus ( const int iMessType, const int iStatus ); void SetStatus ( const int iMessType, const int iStatus );
void SetPingTimeResult ( const int iPingTime,
const int iOverallDelayMs,
const int iOverallDelayLEDColor );
protected: protected:
void UpdateJitterBufferFrame(); void UpdateJitterBufferFrame();
@ -72,18 +75,15 @@ protected:
QString GenSndCrdBufferDelayString ( const int iFrameSize, QString GenSndCrdBufferDelayString ( const int iFrameSize,
const QString strAddText = "" ); const QString strAddText = "" );
virtual void showEvent ( QShowEvent* ); virtual void showEvent ( QShowEvent* ) { UpdateDisplay(); }
virtual void hideEvent ( QHideEvent* );
CClient* pClient; CClient* pClient;
QTimer TimerStatus; QTimer TimerStatus;
QTimer TimerPing;
QButtonGroup SndCrdBufferDelayButtonGroup; QButtonGroup SndCrdBufferDelayButtonGroup;
void UpdateDisplay(); void UpdateDisplay();
public slots: public slots:
void OnTimerStatus() { UpdateDisplay(); } void OnTimerStatus() { UpdateDisplay(); }
void OnTimerPing();
void OnSliderNetBuf ( int value ); void OnSliderNetBuf ( int value );
void OnSliderSndCrdBufferDelay ( int value ); void OnSliderSndCrdBufferDelay ( int value );
void OnAutoJitBuf ( int value ); void OnAutoJitBuf ( int value );
@ -92,7 +92,6 @@ protected:
void OnUseHighQualityAudioStateChanged ( int value ); void OnUseHighQualityAudioStateChanged ( int value );
void OnUseStereoStateChanged ( int value ); void OnUseStereoStateChanged ( int value );
void OnSndCrdBufferDelayButtonGroupClicked ( QAbstractButton* button ); void OnSndCrdBufferDelayButtonGroupClicked ( QAbstractButton* button );
void OnPingTimeResult ( int iPingTime );
void OnSoundCrdSelection ( int iSndDevIdx ); void OnSoundCrdSelection ( int iSndDevIdx );
void OnSndCrdLeftInChannelSelection ( int iChanIdx ); void OnSndCrdLeftInChannelSelection ( int iChanIdx );
void OnSndCrdRightInChannelSelection ( int iChanIdx ); void OnSndCrdRightInChannelSelection ( int iChanIdx );

View file

@ -324,6 +324,9 @@ CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP,
QObject::connect ( &TimerStatus, SIGNAL ( timeout() ), QObject::connect ( &TimerStatus, SIGNAL ( timeout() ),
this, SLOT ( OnTimerStatus() ) ); this, SLOT ( OnTimerStatus() ) );
QObject::connect ( &TimerPing, SIGNAL ( timeout() ),
this, SLOT ( OnTimerPing() ) );
// sliders // sliders
QObject::connect ( SliderAudInFader, SIGNAL ( valueChanged ( int ) ), QObject::connect ( SliderAudInFader, SIGNAL ( valueChanged ( int ) ),
this, SLOT ( OnSliderAudInFader ( int ) ) ); this, SLOT ( OnSliderAudInFader ( int ) ) );
@ -365,6 +368,9 @@ CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP,
SIGNAL ( ChatTextReceived ( QString ) ), SIGNAL ( ChatTextReceived ( QString ) ),
this, SLOT ( OnChatTextReceived ( QString ) ) ); this, SLOT ( OnChatTextReceived ( QString ) ) );
QObject::connect ( pClient, SIGNAL ( PingTimeReceived ( int ) ),
this, SLOT ( OnPingTimeResult ( int ) ) );
QObject::connect ( &ClientSettingsDlg, SIGNAL ( GUIDesignChanged() ), QObject::connect ( &ClientSettingsDlg, SIGNAL ( GUIDesignChanged() ),
this, SLOT ( OnGUIDesignChanged() ) ); this, SLOT ( OnGUIDesignChanged() ) );
@ -646,6 +652,41 @@ void CLlconClientDlg::OnTimerSigMet()
MultiColorLEDBarInputLevelR->setValue ( (int) ceil ( dCurSigLevelR ) ); MultiColorLEDBarInputLevelR->setValue ( (int) ceil ( dCurSigLevelR ) );
} }
void CLlconClientDlg::OnTimerPing()
{
// send ping message to server
pClient->SendPingMess();
}
void CLlconClientDlg::OnPingTimeResult ( int iPingTime )
{
// calculate overall delay
const int iOverallDelayMs = pClient->EstimatedOverallDelay ( iPingTime );
// color definition: <= 40 ms green, <= 65 ms yellow, otherwise red
int iOverallDelayLEDColor;
if ( iOverallDelayMs <= 40 )
{
iOverallDelayLEDColor = MUL_COL_LED_GREEN;
}
else
{
if ( iOverallDelayMs <= 65 )
{
iOverallDelayLEDColor = MUL_COL_LED_YELLOW;
}
else
{
iOverallDelayLEDColor = MUL_COL_LED_RED;
}
}
// set ping time result to general settings dialog
ClientSettingsDlg.SetPingTimeResult ( iPingTime,
iOverallDelayMs,
iOverallDelayLEDColor );
}
void CLlconClientDlg::ConnectDisconnect ( const bool bDoStart ) void CLlconClientDlg::ConnectDisconnect ( const bool bDoStart )
{ {
// start/stop client, set button text // start/stop client, set button text
@ -675,8 +716,9 @@ void CLlconClientDlg::ConnectDisconnect ( const bool bDoStart )
{ {
PushButtonConnect->setText ( CON_BUT_DISCONNECTTEXT ); PushButtonConnect->setText ( CON_BUT_DISCONNECTTEXT );
// start timer for level meter bar // start timer for level meter bar and ping time measurement
TimerSigMet.start ( LEVELMETER_UPDATE_TIME ); TimerSigMet.start ( LEVELMETER_UPDATE_TIME );
TimerPing.start ( PING_UPDATE_TIME );
} }
} }
else else
@ -707,6 +749,9 @@ void CLlconClientDlg::ConnectDisconnect ( const bool bDoStart )
MultiColorLEDBarInputLevelL->setValue ( 0 ); MultiColorLEDBarInputLevelL->setValue ( 0 );
MultiColorLEDBarInputLevelR->setValue ( 0 ); MultiColorLEDBarInputLevelR->setValue ( 0 );
// stop ping time measurement timer
TimerPing.stop();
// immediately update status bar // immediately update status bar
OnTimerStatus(); OnTimerStatus();

View file

@ -87,6 +87,7 @@ protected:
bool bUnreadChatMessage; bool bUnreadChatMessage;
QTimer TimerSigMet; QTimer TimerSigMet;
QTimer TimerStatus; QTimer TimerStatus;
QTimer TimerPing;
virtual void customEvent ( QEvent* Event ); virtual void customEvent ( QEvent* Event );
virtual void closeEvent ( QCloseEvent* Event ); virtual void closeEvent ( QCloseEvent* Event );
@ -102,6 +103,8 @@ public slots:
void OnConnectDisconBut(); void OnConnectDisconBut();
void OnTimerSigMet(); void OnTimerSigMet();
void OnTimerStatus() { UpdateDisplay(); } void OnTimerStatus() { UpdateDisplay(); }
void OnTimerPing();
void OnPingTimeResult ( int iPingTime );
void OnOpenGeneralSettings(); void OnOpenGeneralSettings();
void OnOpenChatDialog() { ShowChatWindow(); } void OnOpenChatDialog() { ShowChatWindow(); }
void OnSliderAudInFader ( int value ); void OnSliderAudInFader ( int value );