removed actual sound card buffer size GUI control, only enable radio buttons for supported sound card frame sizes

This commit is contained in:
Volker Fischer 2009-11-30 19:28:29 +00:00
parent 7fd7157e6a
commit 46a9825d07
4 changed files with 45 additions and 75 deletions

View file

@ -39,6 +39,9 @@ CClient::CClient ( const quint16 iPortNumber ) :
bDoAutoSockBufSize ( true ),
iSndCrdPrefFrameSizeFactor ( FRAME_SIZE_FACTOR_DEFAULT ),
iSndCrdFrameSizeFactor ( FRAME_SIZE_FACTOR_DEFAULT ),
bFraSiFactPrefSupported ( false ),
bFraSiFactDefSupported ( false ),
bFraSiFactSafeSupported ( false ),
iCeltNumCodedBytes ( CELT_NUM_BYTES_NORMAL_QUALITY ),
bCeltDoHighQuality ( false )
{
@ -375,6 +378,25 @@ void CClient::AudioCallback ( CVector<int16_t>& psData, void* arg )
bool CClient::Init()
{
// check if possible frame size factors are supported
const int iFraSizePreffered =
FRAME_SIZE_FACTOR_PREFERRED * SYSTEM_FRAME_SIZE_SAMPLES;
bFraSiFactPrefSupported =
( Sound.Init ( iFraSizePreffered ) == iFraSizePreffered );
const int iFraSizeDefault =
FRAME_SIZE_FACTOR_DEFAULT * SYSTEM_FRAME_SIZE_SAMPLES;
bFraSiFactDefSupported =
( Sound.Init ( iFraSizeDefault ) == iFraSizeDefault );
const int iFraSizeSafe =
FRAME_SIZE_FACTOR_SAFE * SYSTEM_FRAME_SIZE_SAMPLES;
bFraSiFactSafeSupported =
( Sound.Init ( iFraSizeSafe ) == iFraSizeSafe );
// translate block size index in actual block size
const int iPrefMonoFrameSize =
iSndCrdPrefFrameSizeFactor * SYSTEM_FRAME_SIZE_SAMPLES;

View file

@ -136,6 +136,10 @@ public:
{ return iSndCrdPrefFrameSizeFactor; }
int GetSndCrdActualMonoBlSize() { return iMonoBlockSizeSam; }
bool GetFraSiFactPrefSupported() { return bFraSiFactPrefSupported; }
bool GetFraSiFactDefSupported() { return bFraSiFactDefSupported; }
bool GetFraSiFactSafeSupported() { return bFraSiFactSafeSupported; }
void SetRemoteChanGain ( const int iId, const double dGain )
{ Channel.SetRemoteChanGain ( iId, dGain ); }
@ -188,6 +192,10 @@ protected:
int iSndCrdPrefFrameSizeFactor;
int iSndCrdFrameSizeFactor;
bool bFraSiFactPrefSupported;
bool bFraSiFactDefSupported;
bool bFraSiFactSafeSupported;
int iMonoBlockSizeSam;
int iStereoBlockSizeSam;

View file

@ -309,59 +309,29 @@ QString CClientSettingsDlg::GenSndCrdBufferDelayString ( const int iFrameSize,
void CClientSettingsDlg::UpdateSoundCardFrame()
{
// update slider value and text
const int iCurPrefFrameSizeFactor =
pClient->GetSndCrdPrefFrameSizeFactor();
// get current actual buffer size value
const int iCurActualBufSize =
pClient->GetSndCrdActualMonoBlSize();
// update radio buttons
switch ( iCurPrefFrameSizeFactor )
{
case FRAME_SIZE_FACTOR_PREFERRED:
rButBufferDelayPreferred->setChecked ( true );
break;
// set radio buttons according to current value
rButBufferDelayPreferred->setChecked ( iCurActualBufSize ==
SYSTEM_FRAME_SIZE_SAMPLES * FRAME_SIZE_FACTOR_PREFERRED );
case FRAME_SIZE_FACTOR_DEFAULT:
rButBufferDelayDefault->setChecked ( true );
break;
rButBufferDelayDefault->setChecked ( iCurActualBufSize ==
SYSTEM_FRAME_SIZE_SAMPLES * FRAME_SIZE_FACTOR_DEFAULT );
case FRAME_SIZE_FACTOR_SAFE:
rButBufferDelaySafe->setChecked ( true );
break;
}
rButBufferDelaySafe->setChecked ( iCurActualBufSize ==
SYSTEM_FRAME_SIZE_SAMPLES * FRAME_SIZE_FACTOR_SAFE );
// preferred size
const int iPrefBufSize =
iCurPrefFrameSizeFactor * SYSTEM_FRAME_SIZE_SAMPLES;
// disable radio buttons which are not supported by audio interface
rButBufferDelayPreferred->setEnabled (
pClient->GetFraSiFactPrefSupported() );
// actual size (use yellow color if different from preferred size)
const QString strActSizeValues =
GenSndCrdBufferDelayString ( iCurActualBufSize );
rButBufferDelayDefault->setEnabled (
pClient->GetFraSiFactDefSupported() );
if ( iPrefBufSize != iCurActualBufSize )
{
// yellow color if actual buffer size is not the selected one
// but a valid one, red color if actual buffer size is not the
// selected one and is not a vaild one
if ( ( iCurActualBufSize != ( SYSTEM_FRAME_SIZE_SAMPLES * FRAME_SIZE_FACTOR_PREFERRED ) ) &&
( iCurActualBufSize != ( SYSTEM_FRAME_SIZE_SAMPLES * FRAME_SIZE_FACTOR_DEFAULT ) ) &&
( iCurActualBufSize != ( SYSTEM_FRAME_SIZE_SAMPLES * FRAME_SIZE_FACTOR_SAFE ) ) )
{
TextLabelActualSndCrdBufDelay->setText ( "<b><font color=""red"">" +
strActSizeValues + "</font></b>" );
}
else
{
TextLabelActualSndCrdBufDelay->setText ( "<b><font color=""yellow"">" +
strActSizeValues + "</font></b>" );
}
}
else
{
TextLabelActualSndCrdBufDelay->setText ( strActSizeValues );
}
rButBufferDelaySafe->setEnabled (
pClient->GetFraSiFactSafeSupported() );
}
void CClientSettingsDlg::showEvent ( QShowEvent* showEvent )

View file

@ -245,36 +245,6 @@
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" >
<item>
<widget class="QLabel" name="TextSndCrdBufDelayActual" >
<property name="text" >
<string>Actual Value</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="TextLabelActualSndCrdBufDelay" >
<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>
<widget class="QPushButton" name="ButtonDriverSetup" >
<property name="text" >