some GUI work
This commit is contained in:
parent
43eb897fd8
commit
9eb7bb9e1f
8 changed files with 167 additions and 187 deletions
|
@ -29,7 +29,8 @@
|
||||||
|
|
||||||
|
|
||||||
/* Implementation *************************************************************/
|
/* Implementation *************************************************************/
|
||||||
void CNetBuf::Init ( const int iNewBlockSize, const int iNewNumBlocks )
|
void CNetBuf::Init ( const int iNewBlockSize,
|
||||||
|
const int iNewNumBlocks )
|
||||||
{
|
{
|
||||||
// total size -> size of one block times number of blocks
|
// total size -> size of one block times number of blocks
|
||||||
iBlockSize = iNewBlockSize;
|
iBlockSize = iNewBlockSize;
|
||||||
|
@ -226,24 +227,25 @@ int CNetBuf::GetAvailData() const
|
||||||
|
|
||||||
void CNetBuf::Clear ( const EClearType eClearType )
|
void CNetBuf::Clear ( const EClearType eClearType )
|
||||||
{
|
{
|
||||||
|
int iMiddleOfBuffer = 0;
|
||||||
|
|
||||||
int iMiddleOfBuffer;
|
if ( iBlockSize != 0 )
|
||||||
|
{
|
||||||
#if 0
|
#if 0
|
||||||
/* with the following operation we set the new get pos to a block
|
/* with the following operation we set the new get pos to a block
|
||||||
boundary (one block below the middle of the buffer in case of odd
|
boundary (one block below the middle of the buffer in case of odd
|
||||||
number of blocks, e.g.:
|
number of blocks, e.g.:
|
||||||
[buffer size]: [get pos]
|
[buffer size]: [get pos]
|
||||||
1: 0 / 2: 0 / 3: 1 / 4: 1 / ... */
|
1: 0 / 2: 0 / 3: 1 / 4: 1 / ... */
|
||||||
iMiddleOfBuffer = ( ( ( iMemSize - iBlockSize) / 2 ) / iBlockSize ) * iBlockSize;
|
iMiddleOfBuffer = ( ( ( iMemSize - iBlockSize) / 2 ) / iBlockSize ) * iBlockSize;
|
||||||
#else
|
#else
|
||||||
// old code
|
// old code
|
||||||
|
|
||||||
// somehow the old code seems to work better than the sophisticated new one....?
|
// somehow the old code seems to work better than the sophisticated new one....?
|
||||||
/* 1: 0 / 2: 1 / 3: 1 / 4: 2 / ... */
|
/* 1: 0 / 2: 1 / 3: 1 / 4: 2 / ... */
|
||||||
iMiddleOfBuffer = ( ( iMemSize / 2 ) / iBlockSize ) * iBlockSize;
|
iMiddleOfBuffer = ( ( iMemSize / 2 ) / iBlockSize ) * iBlockSize;
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
// different behaviour for get and put corrections
|
// different behaviour for get and put corrections
|
||||||
if ( eClearType == CT_GET )
|
if ( eClearType == CT_GET )
|
||||||
|
|
|
@ -36,7 +36,7 @@ CClient::CClient ( const quint16 iPortNumber ) :
|
||||||
vstrIPAddress ( MAX_NUM_SERVER_ADDR_ITEMS, "" ), strName ( "" ),
|
vstrIPAddress ( MAX_NUM_SERVER_ADDR_ITEMS, "" ), strName ( "" ),
|
||||||
bOpenChatOnNewMessage ( true ),
|
bOpenChatOnNewMessage ( true ),
|
||||||
bDoAutoSockBufSize ( true ),
|
bDoAutoSockBufSize ( true ),
|
||||||
iSndCrdPreferredMonoBlSizeIndex ( CSndCrdBufferSizes::GetDefaultIndex() )
|
iSndCrdPreferredMonoBlSizeIndex ( FRAME_SIZE_FACTOR_DEFAULT )
|
||||||
{
|
{
|
||||||
// connection for protocol
|
// connection for protocol
|
||||||
QObject::connect ( &Channel,
|
QObject::connect ( &Channel,
|
||||||
|
@ -148,25 +148,27 @@ bool CClient::SetServerAddr ( QString strNAddr )
|
||||||
void CClient::SetSndCrdPreferredMonoBlSizeIndex ( const int iNewIdx )
|
void CClient::SetSndCrdPreferredMonoBlSizeIndex ( const int iNewIdx )
|
||||||
{
|
{
|
||||||
// right now we simply set the internal value
|
// right now we simply set the internal value
|
||||||
if ( ( iNewIdx >= 0 ) && ( CSndCrdBufferSizes::GetNumOfBufferSizes() ) )
|
if ( ( iNewIdx == FRAME_SIZE_FACTOR_PREFERRED ) ||
|
||||||
|
( iNewIdx == FRAME_SIZE_FACTOR_DEFAULT ) ||
|
||||||
|
( iNewIdx == FRAME_SIZE_FACTOR_SAFE ) )
|
||||||
{
|
{
|
||||||
iSndCrdPreferredMonoBlSizeIndex = iNewIdx;
|
iSndCrdPreferredMonoBlSizeIndex = iNewIdx;
|
||||||
}
|
|
||||||
|
|
||||||
// init with new parameter, if client was running then first
|
// init with new parameter, if client was running then first
|
||||||
// stop it and restart again after new initialization
|
// stop it and restart again after new initialization
|
||||||
const bool bWasRunning = Sound.IsRunning();
|
const bool bWasRunning = Sound.IsRunning();
|
||||||
if ( bWasRunning )
|
if ( bWasRunning )
|
||||||
{
|
{
|
||||||
Sound.Stop();
|
Sound.Stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
// init with new block size index parameter
|
// init with new block size index parameter
|
||||||
Init ( iSndCrdPreferredMonoBlSizeIndex );
|
Init ( iSndCrdPreferredMonoBlSizeIndex );
|
||||||
|
|
||||||
if ( bWasRunning )
|
if ( bWasRunning )
|
||||||
{
|
{
|
||||||
Sound.Start();
|
Sound.Start();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -259,8 +261,8 @@ void CClient::AudioCallback ( CVector<int16_t>& psData, void* arg )
|
||||||
void CClient::Init ( const int iPrefMonoBlockSizeSamIndexAtSndCrdSamRate )
|
void CClient::Init ( const int iPrefMonoBlockSizeSamIndexAtSndCrdSamRate )
|
||||||
{
|
{
|
||||||
// translate block size index in actual block size
|
// translate block size index in actual block size
|
||||||
const int iPrefMonoBlockSizeSamAtSndCrdSamRate = CSndCrdBufferSizes::
|
const int iPrefMonoBlockSizeSamAtSndCrdSamRate =
|
||||||
GetBufferSizeFromIndex ( iPrefMonoBlockSizeSamIndexAtSndCrdSamRate );
|
iPrefMonoBlockSizeSamIndexAtSndCrdSamRate * SYSTEM_BLOCK_FRAME_SAMPLES;
|
||||||
|
|
||||||
// get actual sound card buffer size using preferred size
|
// get actual sound card buffer size using preferred size
|
||||||
iMonoBlockSizeSam = Sound.Init ( iPrefMonoBlockSizeSamAtSndCrdSamRate );
|
iMonoBlockSizeSam = Sound.Init ( iPrefMonoBlockSizeSamAtSndCrdSamRate );
|
||||||
|
|
|
@ -65,11 +65,6 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, QWidget* parent,
|
||||||
SliderNetBuf->setRange ( MIN_NET_BUF_SIZE_NUM_BL, MAX_NET_BUF_SIZE_NUM_BL );
|
SliderNetBuf->setRange ( MIN_NET_BUF_SIZE_NUM_BL, MAX_NET_BUF_SIZE_NUM_BL );
|
||||||
UpdateJitterBufferFrame();
|
UpdateJitterBufferFrame();
|
||||||
|
|
||||||
// sound card buffer size
|
|
||||||
SliderSndCrdBufferDelay->setRange ( 0,
|
|
||||||
CSndCrdBufferSizes::GetNumOfBufferSizes() - 1 );
|
|
||||||
SliderSndCrdBufferDelay->setPageStep ( 1 ); // improves setting with a mouse click
|
|
||||||
|
|
||||||
// init combo box containing all available sound cards in the system
|
// init combo box containing all available sound cards in the system
|
||||||
cbSoundcard->clear();
|
cbSoundcard->clear();
|
||||||
for ( int iSndDevIdx = 0; iSndDevIdx < pClient->GetSndCrdNumDev(); iSndDevIdx++ )
|
for ( int iSndDevIdx = 0; iSndDevIdx < pClient->GetSndCrdNumDev(); iSndDevIdx++ )
|
||||||
|
@ -88,26 +83,38 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, QWidget* parent,
|
||||||
cbOpenChatOnNewMessage->setCheckState ( Qt::Unchecked );
|
cbOpenChatOnNewMessage->setCheckState ( Qt::Unchecked );
|
||||||
}
|
}
|
||||||
|
|
||||||
// audio compression type
|
// set text for sound card buffer delay radio buttons
|
||||||
|
rButBufferDelayPreferred->setText ( GenSndCrdBufferDelayString (
|
||||||
|
FRAME_SIZE_FACTOR_PREFERRED * SYSTEM_BLOCK_FRAME_SAMPLES,
|
||||||
|
", preferred" ) );
|
||||||
|
|
||||||
|
rButBufferDelayDefault->setText ( GenSndCrdBufferDelayString (
|
||||||
|
FRAME_SIZE_FACTOR_DEFAULT * SYSTEM_BLOCK_FRAME_SAMPLES,
|
||||||
|
", default" ) );
|
||||||
|
|
||||||
|
rButBufferDelaySafe->setText ( GenSndCrdBufferDelayString (
|
||||||
|
FRAME_SIZE_FACTOR_SAFE * SYSTEM_BLOCK_FRAME_SAMPLES ) );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
switch ( pClient->GetAudioCompressionOut() )
|
// sound card buffer delay
|
||||||
|
switch ( pClient->[]() )
|
||||||
{
|
{
|
||||||
case CT_NONE:
|
case CT_NONE:
|
||||||
radioButtonNoAudioCompr->setChecked ( true );
|
rButBufferDelayPreferred->setChecked ( true );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CT_IMAADPCM:
|
case CT_IMAADPCM:
|
||||||
radioButtonIMA_ADPCM->setChecked ( true );
|
rButBufferDelayDefault->setChecked ( true );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CT_MSADPCM:
|
case CT_MSADPCM:
|
||||||
radioButtonMS_ADPCM->setChecked ( true );
|
rButBufferDelaySafe->setChecked ( true );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
AudioCompressionButtonGroup.addButton ( radioButtonNoAudioCompr );
|
SndCrdBufferDelayButtonGroup.addButton ( rButBufferDelayPreferred );
|
||||||
AudioCompressionButtonGroup.addButton ( radioButtonIMA_ADPCM );
|
SndCrdBufferDelayButtonGroup.addButton ( rButBufferDelayDefault );
|
||||||
AudioCompressionButtonGroup.addButton ( radioButtonMS_ADPCM );
|
SndCrdBufferDelayButtonGroup.addButton ( rButBufferDelaySafe );
|
||||||
|
|
||||||
|
|
||||||
// Connections -------------------------------------------------------------
|
// Connections -------------------------------------------------------------
|
||||||
|
@ -120,8 +127,6 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, QWidget* parent,
|
||||||
// slider controls
|
// slider controls
|
||||||
QObject::connect ( SliderNetBuf, SIGNAL ( valueChanged ( int ) ),
|
QObject::connect ( SliderNetBuf, SIGNAL ( valueChanged ( int ) ),
|
||||||
this, SLOT ( OnSliderNetBuf ( int ) ) );
|
this, SLOT ( OnSliderNetBuf ( int ) ) );
|
||||||
QObject::connect ( SliderSndCrdBufferDelay, SIGNAL ( valueChanged ( int ) ),
|
|
||||||
this, SLOT ( OnSliderSndCrdBufferDelay ( int ) ) );
|
|
||||||
|
|
||||||
// check boxes
|
// check boxes
|
||||||
QObject::connect ( cbOpenChatOnNewMessage, SIGNAL ( stateChanged ( int ) ),
|
QObject::connect ( cbOpenChatOnNewMessage, SIGNAL ( stateChanged ( int ) ),
|
||||||
|
@ -141,9 +146,9 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, QWidget* parent,
|
||||||
QObject::connect ( pClient, SIGNAL ( PingTimeReceived ( int ) ),
|
QObject::connect ( pClient, SIGNAL ( PingTimeReceived ( int ) ),
|
||||||
this, SLOT ( OnPingTimeResult ( int ) ) );
|
this, SLOT ( OnPingTimeResult ( int ) ) );
|
||||||
|
|
||||||
QObject::connect ( &AudioCompressionButtonGroup,
|
QObject::connect ( &SndCrdBufferDelayButtonGroup,
|
||||||
SIGNAL ( buttonClicked ( QAbstractButton* ) ), this,
|
SIGNAL ( buttonClicked ( QAbstractButton* ) ), this,
|
||||||
SLOT ( OnAudioCompressionButtonGroupClicked ( QAbstractButton* ) ) );
|
SLOT ( OnSndCrdBufferDelayButtonGroupClicked ( QAbstractButton* ) ) );
|
||||||
|
|
||||||
|
|
||||||
// Timers ------------------------------------------------------------------
|
// Timers ------------------------------------------------------------------
|
||||||
|
@ -164,31 +169,35 @@ void CClientSettingsDlg::UpdateJitterBufferFrame()
|
||||||
TextNetBuf->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()
|
void CClientSettingsDlg::UpdateSoundCardFrame()
|
||||||
{
|
{
|
||||||
// update slider value and text
|
// update slider value and text
|
||||||
const int iCurPrefBufIdx = pClient->GetSndCrdPreferredMonoBlSizeIndex();
|
const int iCurPrefBufIdx = pClient->GetSndCrdPreferredMonoBlSizeIndex();
|
||||||
const int iCurActualBufSize = pClient->GetSndCrdActualMonoBlSize();
|
const int iCurActualBufSize = pClient->GetSndCrdActualMonoBlSize();
|
||||||
|
|
||||||
|
/*
|
||||||
SliderSndCrdBufferDelay->setValue ( iCurPrefBufIdx );
|
SliderSndCrdBufferDelay->setValue ( iCurPrefBufIdx );
|
||||||
|
|
||||||
// preferred size
|
// preferred size
|
||||||
const int iPrefBufSize =
|
const int iPrefBufSize =
|
||||||
CSndCrdBufferSizes::GetBufferSizeFromIndex ( iCurPrefBufIdx );
|
CSndCrdBufferSizes::GetBufferSizeFromIndex ( iCurPrefBufIdx );
|
||||||
|
*/
|
||||||
// use two times the buffer delay for the entire delay since
|
|
||||||
// we have input and output
|
|
||||||
TextLabelPreferredSndCrdBufDelay->setText (
|
|
||||||
QString().setNum ( (double) iPrefBufSize * 2 *
|
|
||||||
1000 / SYSTEM_SAMPLE_RATE, 'f', 2 ) + " ms (" +
|
|
||||||
QString().setNum ( iPrefBufSize ) + ")" );
|
|
||||||
|
|
||||||
// actual size (use yellow color if different from preferred size)
|
// actual size (use yellow color if different from preferred size)
|
||||||
const QString strActSizeValues =
|
const QString strActSizeValues =
|
||||||
QString().setNum ( (double) iCurActualBufSize * 2 *
|
GenSndCrdBufferDelayString ( iCurActualBufSize );
|
||||||
1000 / SYSTEM_SAMPLE_RATE, 'f', 2 ) + " ms (" +
|
|
||||||
QString().setNum ( iCurActualBufSize ) + ")";
|
|
||||||
|
|
||||||
if ( iPrefBufSize != iCurActualBufSize )
|
// if ( iPrefBufSize != iCurActualBufSize )
|
||||||
|
if ( 0 ) // TEST
|
||||||
{
|
{
|
||||||
TextLabelActualSndCrdBufDelay->setText ( "<font color=""red"">" +
|
TextLabelActualSndCrdBufDelay->setText ( "<font color=""red"">" +
|
||||||
strActSizeValues + "</font>" );
|
strActSizeValues + "</font>" );
|
||||||
|
@ -259,20 +268,20 @@ void CClientSettingsDlg::OnOpenChatOnNewMessageStateChanged ( int value )
|
||||||
UpdateDisplay();
|
UpdateDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CClientSettingsDlg::OnAudioCompressionButtonGroupClicked ( QAbstractButton* button )
|
void CClientSettingsDlg::OnSndCrdBufferDelayButtonGroupClicked ( QAbstractButton* button )
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
if ( button == radioButtonNoAudioCompr )
|
if ( button == rButBufferDelayPreferred )
|
||||||
{
|
{
|
||||||
pClient->SetAudioCompressionOut ( CT_NONE );
|
pClient->SetAudioCompressionOut ( CT_NONE );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( button == radioButtonIMA_ADPCM )
|
if ( button == rButBufferDelayDefault )
|
||||||
{
|
{
|
||||||
pClient->SetAudioCompressionOut ( CT_IMAADPCM );
|
pClient->SetAudioCompressionOut ( CT_IMAADPCM );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( button == radioButtonMS_ADPCM )
|
if ( button == rButBufferDelaySafe )
|
||||||
{
|
{
|
||||||
pClient->SetAudioCompressionOut ( CT_MSADPCM );
|
pClient->SetAudioCompressionOut ( CT_MSADPCM );
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,26 +62,28 @@ public:
|
||||||
void SetStatus ( const int iMessType, const int iStatus );
|
void SetStatus ( const int iMessType, const int iStatus );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
CClient* pClient;
|
void UpdateJitterBufferFrame();
|
||||||
QTimer TimerStatus;
|
void UpdateSoundCardFrame();
|
||||||
QTimer TimerPing;
|
QString GenSndCrdBufferDelayString ( const int iFrameSize,
|
||||||
QButtonGroup AudioCompressionButtonGroup;
|
const QString strAddText = "" );
|
||||||
void UpdateDisplay();
|
|
||||||
|
|
||||||
virtual void showEvent ( QShowEvent* showEvent );
|
virtual void showEvent ( QShowEvent* showEvent );
|
||||||
virtual void hideEvent ( QHideEvent* hideEvent );
|
virtual void hideEvent ( QHideEvent* hideEvent );
|
||||||
|
|
||||||
void UpdateJitterBufferFrame();
|
CClient* pClient;
|
||||||
void UpdateSoundCardFrame();
|
QTimer TimerStatus;
|
||||||
|
QTimer TimerPing;
|
||||||
|
QButtonGroup SndCrdBufferDelayButtonGroup;
|
||||||
|
void UpdateDisplay();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void OnTimerStatus() { UpdateDisplay(); }
|
void OnTimerStatus() { UpdateDisplay(); }
|
||||||
void OnTimerPing();
|
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 );
|
||||||
void OnOpenChatOnNewMessageStateChanged ( int value );
|
void OnOpenChatOnNewMessageStateChanged ( int value );
|
||||||
void OnAudioCompressionButtonGroupClicked ( QAbstractButton* button );
|
void OnSndCrdBufferDelayButtonGroupClicked ( QAbstractButton* button );
|
||||||
void OnPingTimeResult ( int iPingTime );
|
void OnPingTimeResult ( int iPingTime );
|
||||||
void OnSoundCrdSelection ( int iSndDevIdx );
|
void OnSoundCrdSelection ( int iSndDevIdx );
|
||||||
void OnDriverSetupBut();
|
void OnDriverSetupBut();
|
||||||
|
|
|
@ -212,8 +212,8 @@
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" >
|
<property name="sizeHint" >
|
||||||
<size>
|
<size>
|
||||||
<width>201</width>
|
<width>71</width>
|
||||||
<height>20</height>
|
<height>16</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
|
@ -225,54 +225,32 @@
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" >
|
<layout class="QVBoxLayout" >
|
||||||
<item>
|
<item>
|
||||||
<widget class="QSlider" name="SliderSndCrdBufferDelay" >
|
<widget class="QRadioButton" name="rButBufferDelayPreferred" >
|
||||||
<property name="orientation" >
|
<property name="text" >
|
||||||
<enum>Qt::Horizontal</enum>
|
<string>(preferred)</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="tickPosition" >
|
</widget>
|
||||||
<enum>QSlider::TicksBelow</enum>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="rButBufferDelayDefault" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>(default)</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="rButBufferDelaySafe" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>(safe)</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" >
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="TextSndCrdBufDelayPreferred" >
|
|
||||||
<property name="text" >
|
|
||||||
<string>Preferred</string>
|
|
||||||
</property>
|
|
||||||
<property name="wordWrap" >
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="TextLabelPreferredSndCrdBufDelay" >
|
|
||||||
<property name="minimumSize" >
|
|
||||||
<size>
|
|
||||||
<width>110</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="frameShape" >
|
|
||||||
<enum>QFrame::Panel</enum>
|
|
||||||
</property>
|
|
||||||
<property name="frameShadow" >
|
|
||||||
<enum>QFrame::Sunken</enum>
|
|
||||||
</property>
|
|
||||||
<property name="text" >
|
|
||||||
<string>val</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" >
|
<layout class="QHBoxLayout" >
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="TextSndCrdBufDelayActual" >
|
<widget class="QLabel" name="TextSndCrdBufDelayActual" >
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>Actual</string>
|
<string>Actual Value</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -323,36 +301,6 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="QGroupBox" name="groupBoxAudioCompressionType" >
|
|
||||||
<property name="title" >
|
|
||||||
<string>Audio Compression</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" >
|
|
||||||
<item>
|
|
||||||
<widget class="QRadioButton" name="radioButtonIMA_ADPCM" >
|
|
||||||
<property name="text" >
|
|
||||||
<string>IMA ADPCM</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QRadioButton" name="radioButtonMS_ADPCM" >
|
|
||||||
<property name="text" >
|
|
||||||
<string>MS ADPCM</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QRadioButton" name="radioButtonNoAudioCompr" >
|
|
||||||
<property name="text" >
|
|
||||||
<string>None</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<spacer>
|
<spacer>
|
||||||
<property name="orientation" >
|
<property name="orientation" >
|
||||||
|
|
|
@ -66,6 +66,13 @@
|
||||||
( static_cast<double> ( SYSTEM_BLOCK_FRAME_SAMPLES ) / \
|
( static_cast<double> ( SYSTEM_BLOCK_FRAME_SAMPLES ) / \
|
||||||
SYSTEM_SAMPLE_RATE * 1000 )
|
SYSTEM_SAMPLE_RATE * 1000 )
|
||||||
|
|
||||||
|
// define the allowed audio frame size factors (since the
|
||||||
|
// "SYSTEM_BLOCK_FRAME_SAMPLES" is quite small, it may be that on some
|
||||||
|
// computers a larger value is required)
|
||||||
|
#define FRAME_SIZE_FACTOR_PREFERRED 1 // 128 (for frame size 128)
|
||||||
|
#define FRAME_SIZE_FACTOR_DEFAULT 2 // 256 (for frame size 128)
|
||||||
|
#define FRAME_SIZE_FACTOR_SAFE 4 // 512 (for frame size 128)
|
||||||
|
|
||||||
// define the maximum mono audio buffer size at a sample rate
|
// define the maximum mono audio buffer size at a sample rate
|
||||||
// of 48 kHz, this is important for defining the maximum number
|
// of 48 kHz, this is important for defining the maximum number
|
||||||
// of bytes to be expected from the network interface
|
// of bytes to be expected from the network interface
|
||||||
|
|
|
@ -110,9 +110,16 @@ void CSettings::ReadIniFile ( const QString& sFileName )
|
||||||
|
|
||||||
// sound card preferred buffer size index
|
// sound card preferred buffer size index
|
||||||
if ( GetNumericIniSet ( IniXMLDocument, "client", "prefsndcrdbufidx",
|
if ( GetNumericIniSet ( IniXMLDocument, "client", "prefsndcrdbufidx",
|
||||||
0, CSndCrdBufferSizes::GetNumOfBufferSizes(), iValue ) )
|
FRAME_SIZE_FACTOR_PREFERRED, FRAME_SIZE_FACTOR_SAFE, iValue ) )
|
||||||
{
|
{
|
||||||
pClient->SetSndCrdPreferredMonoBlSizeIndex ( iValue );
|
// additional check required since only a subset of factors are
|
||||||
|
// defined
|
||||||
|
if ( ( iValue == FRAME_SIZE_FACTOR_PREFERRED ) ||
|
||||||
|
( iValue == FRAME_SIZE_FACTOR_DEFAULT ) ||
|
||||||
|
( iValue == FRAME_SIZE_FACTOR_SAFE ) )
|
||||||
|
{
|
||||||
|
pClient->SetSndCrdPreferredMonoBlSizeIndex ( iValue );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// automatic network jitter buffer size setting
|
// automatic network jitter buffer size setting
|
||||||
|
|
89
src/util.h
89
src/util.h
|
@ -379,15 +379,23 @@ protected:
|
||||||
class CHostAddress
|
class CHostAddress
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CHostAddress() : InetAddr ( (quint32) 0 ), iPort ( 0 ) {}
|
CHostAddress() :
|
||||||
CHostAddress ( const QHostAddress NInetAddr, const quint16 iNPort ) :
|
InetAddr ( (quint32) 0 ),
|
||||||
InetAddr ( NInetAddr ), iPort ( iNPort ) {}
|
iPort ( 0 ) {}
|
||||||
|
|
||||||
|
CHostAddress ( const QHostAddress NInetAddr,
|
||||||
|
const quint16 iNPort ) :
|
||||||
|
InetAddr ( NInetAddr ),
|
||||||
|
iPort ( iNPort ) {}
|
||||||
|
|
||||||
CHostAddress ( const CHostAddress& NHAddr ) :
|
CHostAddress ( const CHostAddress& NHAddr ) :
|
||||||
InetAddr ( NHAddr.InetAddr ), iPort ( NHAddr.iPort ) {}
|
InetAddr ( NHAddr.InetAddr ),
|
||||||
|
iPort ( NHAddr.iPort ) {}
|
||||||
|
|
||||||
// copy and compare operators
|
// copy and compare operators
|
||||||
CHostAddress& operator= ( const CHostAddress& NHAddr )
|
CHostAddress& operator= ( const CHostAddress& NHAddr )
|
||||||
{ InetAddr = NHAddr.InetAddr; iPort = NHAddr.iPort; return *this; }
|
{ InetAddr = NHAddr.InetAddr; iPort = NHAddr.iPort; return *this; }
|
||||||
|
|
||||||
bool operator== ( const CHostAddress& CompAddr ) // compare operator
|
bool operator== ( const CHostAddress& CompAddr ) // compare operator
|
||||||
{ return ( ( CompAddr.InetAddr == InetAddr ) && ( CompAddr.iPort == iPort ) ); }
|
{ return ( ( CompAddr.InetAddr == InetAddr ) && ( CompAddr.iPort == iPort ) ); }
|
||||||
|
|
||||||
|
@ -397,16 +405,24 @@ public:
|
||||||
return InetAddr.toString().section ( ".", 0, 2 ) + ".x";
|
return InetAddr.toString().section ( ".", 0, 2 ) + ".x";
|
||||||
}
|
}
|
||||||
|
|
||||||
QHostAddress InetAddr;
|
QHostAddress InetAddr;
|
||||||
quint16 iPort;
|
quint16 iPort;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CChannelShortInfo
|
class CChannelShortInfo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CChannelShortInfo() : iChanID ( 0 ), iIpAddr ( 0 ), strName ( "" ) {}
|
CChannelShortInfo() :
|
||||||
CChannelShortInfo ( const int iNID, const quint32 nIP, const QString nN ) :
|
iChanID ( 0 ),
|
||||||
iChanID ( iNID ), iIpAddr ( nIP ), strName ( nN ) {}
|
iIpAddr ( 0 ),
|
||||||
|
strName ( "" ) {}
|
||||||
|
|
||||||
|
CChannelShortInfo ( const int iNID,
|
||||||
|
const quint32 nIP,
|
||||||
|
const QString nN ) :
|
||||||
|
iChanID ( iNID ),
|
||||||
|
iIpAddr ( nIP ),
|
||||||
|
strName ( nN ) {}
|
||||||
|
|
||||||
int iChanID;
|
int iChanID;
|
||||||
quint32 iIpAddr;
|
quint32 iIpAddr;
|
||||||
|
@ -430,17 +446,28 @@ enum EGetDataStat
|
||||||
class CNetworkTransportProps
|
class CNetworkTransportProps
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CNetworkTransportProps() : iNetworkPacketSize ( 0 ), iBlockSizeFact ( 0 ),
|
CNetworkTransportProps() :
|
||||||
iNumAudioChannels ( 0 ), iSampleRate ( 0 ),
|
iNetworkPacketSize ( 0 ),
|
||||||
eAudioCodingType ( CT_NONE ), iAudioCodingArg ( 0 ) {}
|
iBlockSizeFact ( 0 ),
|
||||||
|
iNumAudioChannels ( 0 ),
|
||||||
|
iSampleRate ( 0 ),
|
||||||
|
eAudioCodingType ( CT_NONE ),
|
||||||
|
iAudioCodingArg ( 0 ) {}
|
||||||
|
|
||||||
CNetworkTransportProps ( const uint32_t iNNPS, const uint16_t iNBSF,
|
CNetworkTransportProps ( const uint32_t iNNPS,
|
||||||
const uint32_t iNNACH, const uint32_t iNSR,
|
const uint16_t iNBSF,
|
||||||
const EAudComprType eNACT, const uint32_t iNVers, const int32_t iNACA ) :
|
const uint32_t iNNACH,
|
||||||
iNetworkPacketSize ( iNNPS ), iBlockSizeFact ( iNBSF ),
|
const uint32_t iNSR,
|
||||||
iNumAudioChannels ( iNNACH ), iSampleRate ( iNSR ),
|
const EAudComprType eNACT,
|
||||||
eAudioCodingType ( eNACT ), iVersion ( iNVers ),
|
const uint32_t iNVers,
|
||||||
iAudioCodingArg ( iNACA ) {}
|
const int32_t iNACA ) :
|
||||||
|
iNetworkPacketSize ( iNNPS ),
|
||||||
|
iBlockSizeFact ( iNBSF ),
|
||||||
|
iNumAudioChannels ( iNNACH ),
|
||||||
|
iSampleRate ( iNSR ),
|
||||||
|
eAudioCodingType ( eNACT ),
|
||||||
|
iVersion ( iNVers ),
|
||||||
|
iAudioCodingArg ( iNACA ) {}
|
||||||
|
|
||||||
uint32_t iNetworkPacketSize;
|
uint32_t iNetworkPacketSize;
|
||||||
uint16_t iBlockSizeFact;
|
uint16_t iBlockSizeFact;
|
||||||
|
@ -451,30 +478,6 @@ public:
|
||||||
int32_t iAudioCodingArg;
|
int32_t iAudioCodingArg;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CSndCrdBufferSizes
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
// we use a conservative value as default, this value does not
|
|
||||||
// give perfekt latency results but should work ok on most
|
|
||||||
// sound cards and drivers
|
|
||||||
static int GetDefaultIndex() { return 1; }
|
|
||||||
|
|
||||||
static int GetNumOfBufferSizes() { return 4; }
|
|
||||||
static int GetBufferSizeFromIndex ( const int iIdx )
|
|
||||||
{
|
|
||||||
if ( ( iIdx >= 0 ) && ( iIdx < 4 ) )
|
|
||||||
{
|
|
||||||
const int pSizes[4] = { 128, 256, 512, 1024 };
|
|
||||||
|
|
||||||
return pSizes[iIdx];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// Audio Reverbration ----------------------------------------------------------
|
// Audio Reverbration ----------------------------------------------------------
|
||||||
class CAudioReverb
|
class CAudioReverb
|
||||||
|
|
Loading…
Reference in a new issue