preliminary implementation
This commit is contained in:
parent
0982cb21ff
commit
2e81acfc3d
6 changed files with 66 additions and 18 deletions
|
@ -110,8 +110,10 @@ public:
|
||||||
void SetSockBufSize ( const int iNumBlocks );
|
void SetSockBufSize ( const int iNumBlocks );
|
||||||
int GetSockBufSize() { return iCurSockBufSize; }
|
int GetSockBufSize() { return iCurSockBufSize; }
|
||||||
|
|
||||||
// TEST
|
void SetNetwBufSizeOut ( const int iNewAudioBlockSizeOut );
|
||||||
void SetNetwBufSizeOut ( const int iNewAudioBlockSizeOut );
|
int GetNetwBufSizeOut() { return iCurAudioBlockSizeOut; }
|
||||||
|
|
||||||
|
int GetAudioBlockSizeIn() { return iCurAudioBlockSizeIn; }
|
||||||
|
|
||||||
void SetNetwBufSizeFactOut ( const int iNewNetwBlSiFactOut );
|
void SetNetwBufSizeFactOut ( const int iNewNetwBlSiFactOut );
|
||||||
int GetNetwBufSizeFactOut() { return iCurNetwOutBlSiFact; }
|
int GetNetwBufSizeFactOut() { return iCurNetwOutBlSiFact; }
|
||||||
|
|
|
@ -194,10 +194,8 @@ void CClient::Init ( const int iPrefMonoBlockSizeSamAtSndCrdSamRate )
|
||||||
iMonoBlockSizeSam = iSndCrdMonoBlockSizeSam * SYSTEM_SAMPLE_RATE / SND_CRD_SAMPLE_RATE;
|
iMonoBlockSizeSam = iSndCrdMonoBlockSizeSam * SYSTEM_SAMPLE_RATE / SND_CRD_SAMPLE_RATE;
|
||||||
iStereoBlockSizeSam = 2 * iMonoBlockSizeSam;
|
iStereoBlockSizeSam = 2 * iMonoBlockSizeSam;
|
||||||
|
|
||||||
|
// the channel works on the same block size as the sound interface
|
||||||
// TEST
|
Channel.SetNetwBufSizeOut ( iMonoBlockSizeSam );
|
||||||
Channel.SetNetwBufSizeOut ( iMonoBlockSizeSam );
|
|
||||||
|
|
||||||
|
|
||||||
vecsAudioSndCrdStereo.Init ( iSndCrdStereoBlockSizeSam );
|
vecsAudioSndCrdStereo.Init ( iSndCrdStereoBlockSizeSam );
|
||||||
vecdAudioSndCrdMono.Init ( iSndCrdMonoBlockSizeSam );
|
vecdAudioSndCrdMono.Init ( iSndCrdMonoBlockSizeSam );
|
||||||
|
|
|
@ -114,6 +114,9 @@ public:
|
||||||
}
|
}
|
||||||
int GetSockBufSize() { return Channel.GetSockBufSize(); }
|
int GetSockBufSize() { return Channel.GetSockBufSize(); }
|
||||||
|
|
||||||
|
int GetNetwBufSizeOut() { return Channel.GetNetwBufSizeOut(); }
|
||||||
|
int GetAudioBlockSizeIn() { return Channel.GetAudioBlockSizeIn(); }
|
||||||
|
|
||||||
void SetAudioCompressionOut ( const EAudComprType eNewAudComprTypeOut )
|
void SetAudioCompressionOut ( const EAudComprType eNewAudComprTypeOut )
|
||||||
{
|
{
|
||||||
Channel.SetAudioCompressionOut ( eNewAudComprTypeOut );
|
Channel.SetAudioCompressionOut ( eNewAudComprTypeOut );
|
||||||
|
|
|
@ -63,6 +63,10 @@ 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 );
|
||||||
|
|
||||||
// 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->GetSndInterface()->GetNumDev(); iSndDevIdx++ )
|
for ( int iSndDevIdx = 0; iSndDevIdx < pClient->GetSndInterface()->GetNumDev(); iSndDevIdx++ )
|
||||||
|
@ -108,8 +112,11 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, QWidget* parent,
|
||||||
QObject::connect ( &TimerPing, SIGNAL ( timeout() ),
|
QObject::connect ( &TimerPing, SIGNAL ( timeout() ),
|
||||||
this, SLOT ( OnTimerPing() ) );
|
this, SLOT ( OnTimerPing() ) );
|
||||||
|
|
||||||
|
// 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 ) ),
|
||||||
|
@ -146,11 +153,16 @@ void CClientSettingsDlg::UpdateJitterBufferFrame()
|
||||||
TextNetBuf->setText ( "Size: " + QString().setNum ( iCurNumNetBuf ) );
|
TextNetBuf->setText ( "Size: " + QString().setNum ( iCurNumNetBuf ) );
|
||||||
|
|
||||||
// if auto setting is enabled, disable slider control
|
// if auto setting is enabled, disable slider control
|
||||||
cbAutoJitBuf->setChecked ( pClient->GetDoAutoSockBufSize() );
|
cbAutoJitBuf->setChecked ( pClient->GetDoAutoSockBufSize() );
|
||||||
SliderNetBuf->setEnabled ( !pClient->GetDoAutoSockBufSize() );
|
SliderNetBuf->setEnabled ( !pClient->GetDoAutoSockBufSize() );
|
||||||
TextNetBuf->setEnabled ( !pClient->GetDoAutoSockBufSize() );
|
TextNetBuf->setEnabled ( !pClient->GetDoAutoSockBufSize() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CClientSettingsDlg::UpdateSoundCardFrame()
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
void CClientSettingsDlg::showEvent ( QShowEvent* showEvent )
|
void CClientSettingsDlg::showEvent ( QShowEvent* showEvent )
|
||||||
{
|
{
|
||||||
// only activate ping timer if window is actually shown
|
// only activate ping timer if window is actually shown
|
||||||
|
@ -171,8 +183,20 @@ void CClientSettingsDlg::OnDriverSetupBut()
|
||||||
void CClientSettingsDlg::OnSliderNetBuf ( int value )
|
void CClientSettingsDlg::OnSliderNetBuf ( int value )
|
||||||
{
|
{
|
||||||
pClient->SetSockBufSize ( value );
|
pClient->SetSockBufSize ( value );
|
||||||
TextNetBuf->setText ( "Size: " + QString().setNum ( value ) );
|
UpdateJitterBufferFrame();
|
||||||
UpdateDisplay();
|
}
|
||||||
|
|
||||||
|
void CClientSettingsDlg::OnSliderSndCrdBufferDelay ( int value )
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
|
||||||
|
|
||||||
|
// TODO put this in the function "UpdateSoundCardFrame"
|
||||||
|
TextLabelPreferredSndCrdBufDelay->setText (
|
||||||
|
QString().setNum ( (double) CSndCrdBufferSizes::GetBufferSizeFromIndex ( value ) *
|
||||||
|
1000 / SND_CRD_SAMPLE_RATE, 'f', 2 ) + " ms (" +
|
||||||
|
QString().setNum ( CSndCrdBufferSizes::GetBufferSizeFromIndex ( value ) ) + ")" );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CClientSettingsDlg::OnSoundCrdSelection ( int iSndDevIdx )
|
void CClientSettingsDlg::OnSoundCrdSelection ( int iSndDevIdx )
|
||||||
|
@ -238,15 +262,11 @@ void CClientSettingsDlg::OnPingTimeResult ( int iPingTime )
|
||||||
- the mean delay of a cyclic buffer is half the buffer size (since
|
- the mean delay of a cyclic buffer is half the buffer size (since
|
||||||
for the average it is assumed that the buffer is half filled)
|
for the average it is assumed that the buffer is half filled)
|
||||||
- consider the jitter buffer on the server side, too
|
- consider the jitter buffer on the server side, too
|
||||||
- assume that the sound card introduces an additional delay of 2 * MIN_SERVER_BLOCK_DURATION_MS
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// TODO revise this
|
const int iTotalJitterBufferDelayMS = MIN_SERVER_BLOCK_DURATION_MS *
|
||||||
|
( 2 /* buffer at client and server */ * pClient->GetSockBufSize() ) / 2;
|
||||||
|
|
||||||
const int iTotalJitterBufferDelayMS = 0;
|
|
||||||
// const int iTotalJitterBufferDelayMS = MIN_SERVER_BLOCK_DURATION_MS *
|
|
||||||
// ( 2 * pClient->GetSockBufSize() + pClient->GetNetwBufSizeFactIn() +
|
|
||||||
// pClient->GetNetwBufSizeFactOut() ) / 2;
|
|
||||||
|
|
||||||
// TODO consider sound card interface block size
|
// TODO consider sound card interface block size
|
||||||
|
|
||||||
|
@ -255,9 +275,9 @@ const int iTotalSoundCardDelayMS = 0;
|
||||||
// MIN_SERVER_BLOCK_DURATION_MS * ( pClient->GetSndInterface()->GetInNumBuf() +
|
// MIN_SERVER_BLOCK_DURATION_MS * ( pClient->GetSndInterface()->GetInNumBuf() +
|
||||||
// pClient->GetSndInterface()->GetOutNumBuf() ) / 2;
|
// pClient->GetSndInterface()->GetOutNumBuf() ) / 2;
|
||||||
|
|
||||||
// TODO
|
const int iDelayToFillNetworkPackets =
|
||||||
const int iDelayToFillNetworkPackets = 0;//MIN_SERVER_BLOCK_DURATION_MS *
|
( pClient->GetNetwBufSizeOut() + pClient->GetAudioBlockSizeIn() ) *
|
||||||
// ( pClient->GetNetwBufSizeFactIn() + pClient->GetNetwBufSizeFactOut() );
|
1000 / SYSTEM_SAMPLE_RATE;
|
||||||
|
|
||||||
const int iTotalBufferDelay = iDelayToFillNetworkPackets +
|
const int iTotalBufferDelay = iDelayToFillNetworkPackets +
|
||||||
iTotalJitterBufferDelayMS + iTotalSoundCardDelayMS;
|
iTotalJitterBufferDelayMS + iTotalSoundCardDelayMS;
|
||||||
|
|
|
@ -73,11 +73,13 @@ protected:
|
||||||
virtual void hideEvent ( QHideEvent* hideEvent );
|
virtual void hideEvent ( QHideEvent* hideEvent );
|
||||||
|
|
||||||
void UpdateJitterBufferFrame();
|
void UpdateJitterBufferFrame();
|
||||||
|
void UpdateSoundCardFrame();
|
||||||
|
|
||||||
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 OnAutoJitBuf ( int value );
|
void OnAutoJitBuf ( int value );
|
||||||
void OnOpenChatOnNewMessageStateChanged ( int value );
|
void OnOpenChatOnNewMessageStateChanged ( int value );
|
||||||
void OnAudioCompressionButtonGroupClicked ( QAbstractButton* button );
|
void OnAudioCompressionButtonGroupClicked ( QAbstractButton* button );
|
||||||
|
|
23
src/util.h
23
src/util.h
|
@ -436,6 +436,29 @@ public:
|
||||||
int iAudioCodingArg;
|
int iAudioCodingArg;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class CSndCrdBufferSizes
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static int GetNumOfBufferSizes() { return 30; }
|
||||||
|
static int GetBufferSizeFromIndex ( const int iIdx )
|
||||||
|
{
|
||||||
|
if ( ( iIdx >= 0 ) && ( iIdx < 30 ) )
|
||||||
|
{
|
||||||
|
const int pSizes[30] = {
|
||||||
|
96, 128, 160, 192, 224, 256, 288, 320, 352,
|
||||||
|
384, 416, 448, 480, 512, 544, 576, 608, 640,
|
||||||
|
672, 704, 736, 768, 800, 832, 864, 896, 928,
|
||||||
|
960, 992, 1024 };
|
||||||
|
|
||||||
|
return pSizes[iIdx];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
// Audio Reverbration ----------------------------------------------------------
|
// Audio Reverbration ----------------------------------------------------------
|
||||||
class CAudioReverb
|
class CAudioReverb
|
||||||
|
|
Loading…
Reference in a new issue