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 ), bDoAutoSockBufSize ( true ),
iSndCrdPrefFrameSizeFactor ( FRAME_SIZE_FACTOR_DEFAULT ), iSndCrdPrefFrameSizeFactor ( FRAME_SIZE_FACTOR_DEFAULT ),
iSndCrdFrameSizeFactor ( FRAME_SIZE_FACTOR_DEFAULT ), iSndCrdFrameSizeFactor ( FRAME_SIZE_FACTOR_DEFAULT ),
bFraSiFactPrefSupported ( false ),
bFraSiFactDefSupported ( false ),
bFraSiFactSafeSupported ( false ),
iCeltNumCodedBytes ( CELT_NUM_BYTES_NORMAL_QUALITY ), iCeltNumCodedBytes ( CELT_NUM_BYTES_NORMAL_QUALITY ),
bCeltDoHighQuality ( false ) bCeltDoHighQuality ( false )
{ {
@ -375,6 +378,25 @@ void CClient::AudioCallback ( CVector<int16_t>& psData, void* arg )
bool CClient::Init() 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 // translate block size index in actual block size
const int iPrefMonoFrameSize = const int iPrefMonoFrameSize =
iSndCrdPrefFrameSizeFactor * SYSTEM_FRAME_SIZE_SAMPLES; iSndCrdPrefFrameSizeFactor * SYSTEM_FRAME_SIZE_SAMPLES;

View file

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

View file

@ -309,59 +309,29 @@ QString CClientSettingsDlg::GenSndCrdBufferDelayString ( const int iFrameSize,
void CClientSettingsDlg::UpdateSoundCardFrame() void CClientSettingsDlg::UpdateSoundCardFrame()
{ {
// update slider value and text // get current actual buffer size value
const int iCurPrefFrameSizeFactor =
pClient->GetSndCrdPrefFrameSizeFactor();
const int iCurActualBufSize = const int iCurActualBufSize =
pClient->GetSndCrdActualMonoBlSize(); pClient->GetSndCrdActualMonoBlSize();
// update radio buttons // set radio buttons according to current value
switch ( iCurPrefFrameSizeFactor ) rButBufferDelayPreferred->setChecked ( iCurActualBufSize ==
{ SYSTEM_FRAME_SIZE_SAMPLES * FRAME_SIZE_FACTOR_PREFERRED );
case FRAME_SIZE_FACTOR_PREFERRED:
rButBufferDelayPreferred->setChecked ( true );
break;
case FRAME_SIZE_FACTOR_DEFAULT: rButBufferDelayDefault->setChecked ( iCurActualBufSize ==
rButBufferDelayDefault->setChecked ( true ); SYSTEM_FRAME_SIZE_SAMPLES * FRAME_SIZE_FACTOR_DEFAULT );
break;
case FRAME_SIZE_FACTOR_SAFE: rButBufferDelaySafe->setChecked ( iCurActualBufSize ==
rButBufferDelaySafe->setChecked ( true ); SYSTEM_FRAME_SIZE_SAMPLES * FRAME_SIZE_FACTOR_SAFE );
break;
}
// preferred size // disable radio buttons which are not supported by audio interface
const int iPrefBufSize = rButBufferDelayPreferred->setEnabled (
iCurPrefFrameSizeFactor * SYSTEM_FRAME_SIZE_SAMPLES; pClient->GetFraSiFactPrefSupported() );
// actual size (use yellow color if different from preferred size) rButBufferDelayDefault->setEnabled (
const QString strActSizeValues = pClient->GetFraSiFactDefSupported() );
GenSndCrdBufferDelayString ( iCurActualBufSize );
if ( iPrefBufSize != iCurActualBufSize ) rButBufferDelaySafe->setEnabled (
{ pClient->GetFraSiFactSafeSupported() );
// 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 );
}
} }
void CClientSettingsDlg::showEvent ( QShowEvent* showEvent ) void CClientSettingsDlg::showEvent ( QShowEvent* showEvent )

View file

@ -245,36 +245,6 @@
</property> </property>
</widget> </widget>
</item> </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> <item>
<widget class="QPushButton" name="ButtonDriverSetup" > <widget class="QPushButton" name="ButtonDriverSetup" >
<property name="text" > <property name="text" >