some cleanup and a possible fix in Jack interface
This commit is contained in:
parent
69c7bbab2d
commit
42243e51d7
3 changed files with 23 additions and 36 deletions
|
@ -37,7 +37,7 @@ if ( jack_get_sample_rate ( pJackClient ) != SND_CRD_SAMPLE_RATE )
|
|||
"required one" );
|
||||
}
|
||||
|
||||
// create four ports
|
||||
// create four ports (two for input, two for output -> stereo)
|
||||
input_port_left = jack_port_register ( pJackClient, "input left",
|
||||
JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput, 0 );
|
||||
input_port_right = jack_port_register ( pJackClient, "input right",
|
||||
|
@ -137,9 +137,7 @@ int CSound::Init ( const int iNewPrefMonoBufferSize )
|
|||
// create memory for intermediate audio buffer
|
||||
vecsTmpAudioSndCrdStereo.Init ( iJACKBufferSizeStero );
|
||||
|
||||
// TEST
|
||||
return iJACKBufferSizeMono;
|
||||
|
||||
return iJACKBufferSizeMono;
|
||||
}
|
||||
|
||||
|
||||
|
@ -159,11 +157,8 @@ int CSound::process ( jack_nframes_t nframes, void* arg )
|
|||
// copy input data
|
||||
for ( i = 0; i < pSound->iJACKBufferSizeMono; i++ )
|
||||
{
|
||||
|
||||
// TODO better conversion from float to short
|
||||
|
||||
pSound->vecsTmpAudioSndCrdStereo[2 * i] = (short) in_left[i];
|
||||
pSound->vecsTmpAudioSndCrdStereo[2 * i + 1] = (short) in_right[i];
|
||||
pSound->vecsTmpAudioSndCrdStereo[2 * i] = (short) ( in_left[i] * _MAXSHORT );
|
||||
pSound->vecsTmpAudioSndCrdStereo[2 * i + 1] = (short) ( in_right[i] * _MAXSHORT );
|
||||
}
|
||||
|
||||
// call processing callback function
|
||||
|
@ -179,8 +174,11 @@ int CSound::process ( jack_nframes_t nframes, void* arg )
|
|||
// copy output data
|
||||
for ( i = 0; i < pSound->iJACKBufferSizeMono; i++ )
|
||||
{
|
||||
out_left[i] = pSound->vecsTmpAudioSndCrdStereo[2 * i];
|
||||
out_right[i] = pSound->vecsTmpAudioSndCrdStereo[2 * i + 1];
|
||||
out_left[i] = (jack_default_audio_sample_t)
|
||||
pSound->vecsTmpAudioSndCrdStereo[2 * i] / _MAXSHORT;
|
||||
|
||||
out_right[i] = (jack_default_audio_sample_t)
|
||||
pSound->vecsTmpAudioSndCrdStereo[2 * i + 1] / _MAXSHORT;
|
||||
}
|
||||
|
||||
return 0; // zero on success, non-zero on error
|
||||
|
|
|
@ -372,7 +372,7 @@ void CChannelSet::GetBlockAllConC ( CVector<int>& vecChanID,
|
|||
CVector<CVector<double> >& vecvecdGains )
|
||||
{
|
||||
int i, j;
|
||||
bool bCreateChanList = false;
|
||||
bool bChannelIsNowDisconnected = false;
|
||||
|
||||
// init temporal data vector and clear input buffers
|
||||
CVector<double> vecdData ( MIN_SERVER_BLOCK_SIZE_SAMPLES );
|
||||
|
@ -396,7 +396,7 @@ void CChannelSet::GetBlockAllConC ( CVector<int>& vecChanID,
|
|||
// client list is sent to all other clients
|
||||
if ( eGetStat == GS_CHAN_NOW_DISCONNECTED )
|
||||
{
|
||||
bCreateChanList = true;
|
||||
bChannelIsNowDisconnected = true;
|
||||
}
|
||||
|
||||
if ( vecChannels[i].IsConnected() )
|
||||
|
@ -435,12 +435,12 @@ void CChannelSet::GetBlockAllConC ( CVector<int>& vecChanID,
|
|||
// the channel ID! Therefore we have to use "vecChanID" to
|
||||
// query the IDs of the currently connected channels
|
||||
vecvecdGains[i][j] =
|
||||
vecChannels[ vecChanID[i] ].GetGain( vecChanID[j] );
|
||||
vecChannels[vecChanID[i]].GetGain( vecChanID[j] );
|
||||
}
|
||||
}
|
||||
|
||||
// create channel list message if requested
|
||||
if ( bCreateChanList )
|
||||
if ( bChannelIsNowDisconnected )
|
||||
{
|
||||
// update channel list for all currently connected clients
|
||||
CreateAndSendChanListForAllConChannels();
|
||||
|
|
|
@ -139,8 +139,9 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, QWidget* parent,
|
|||
QObject::connect ( pClient, SIGNAL ( PingTimeReceived ( int ) ),
|
||||
this, SLOT ( OnPingTimeResult ( int ) ) );
|
||||
|
||||
QObject::connect ( &AudioCompressionButtonGroup, SIGNAL ( buttonClicked ( QAbstractButton* ) ),
|
||||
this, SLOT ( OnAudioCompressionButtonGroupClicked ( QAbstractButton* ) ) );
|
||||
QObject::connect ( &AudioCompressionButtonGroup,
|
||||
SIGNAL ( buttonClicked ( QAbstractButton* ) ), this,
|
||||
SLOT ( OnAudioCompressionButtonGroupClicked ( QAbstractButton* ) ) );
|
||||
|
||||
|
||||
// Timers ------------------------------------------------------------------
|
||||
|
@ -222,7 +223,7 @@ void CClientSettingsDlg::OnSliderNetBuf ( int value )
|
|||
void CClientSettingsDlg::OnSliderSndCrdBufferDelay ( int value )
|
||||
{
|
||||
pClient->SetSndCrdPreferredMonoBlSizeIndex ( value );
|
||||
UpdateSoundCardFrame();
|
||||
UpdateDisplay();
|
||||
}
|
||||
|
||||
void CClientSettingsDlg::OnSoundCrdSelection ( int iSndDevIdx )
|
||||
|
@ -318,17 +319,18 @@ void CClientSettingsDlg::OnPingTimeResult ( int iPingTime )
|
|||
else
|
||||
{
|
||||
TextLabelPingTime->setText ( QString().setNum ( iPingTime ) + " ms" );
|
||||
TextLabelOverallDelay->setText ( QString().setNum ( iOverallDelay ) + " ms" );
|
||||
TextLabelOverallDelay->setText (
|
||||
QString().setNum ( iOverallDelay ) + " ms" );
|
||||
}
|
||||
|
||||
// color definition: < 40 ms green, < 60 ms yellow, otherwise red
|
||||
// color definition: < 40 ms green, < 65 ms yellow, otherwise red
|
||||
if ( iOverallDelay <= 40 )
|
||||
{
|
||||
CLEDOverallDelay->SetLight ( MUL_COL_LED_GREEN );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( iOverallDelay <= 60 )
|
||||
if ( iOverallDelay <= 65 )
|
||||
{
|
||||
CLEDOverallDelay->SetLight ( MUL_COL_LED_YELLOW );
|
||||
}
|
||||
|
@ -355,7 +357,8 @@ void CClientSettingsDlg::UpdateDisplay()
|
|||
else
|
||||
{
|
||||
// update upstream rate information label (only if client is running)
|
||||
TextUpstreamValue->setText ( QString().setNum ( pClient->GetUploadRateKbps() ) + " kbps" );
|
||||
TextUpstreamValue->setText (
|
||||
QString().setNum ( pClient->GetUploadRateKbps() ) + " kbps" );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -363,16 +366,6 @@ void CClientSettingsDlg::SetStatus ( const int iMessType, const int iStatus )
|
|||
{
|
||||
switch ( iMessType )
|
||||
{
|
||||
/*
|
||||
case MS_SOUND_IN:
|
||||
CLEDSoundIn->SetLight ( iStatus );
|
||||
break;
|
||||
|
||||
case MS_SOUND_OUT:
|
||||
CLEDSoundOut->SetLight ( iStatus );
|
||||
break;
|
||||
*/
|
||||
|
||||
case MS_JIT_BUF_PUT:
|
||||
case MS_JIT_BUF_GET:
|
||||
// network LED shows combined status of put and get
|
||||
|
@ -380,10 +373,6 @@ void CClientSettingsDlg::SetStatus ( const int iMessType, const int iStatus )
|
|||
break;
|
||||
|
||||
case MS_RESET_ALL:
|
||||
/*
|
||||
CLEDSoundIn->Reset();
|
||||
CLEDSoundOut->Reset();
|
||||
*/
|
||||
CLEDNetw->Reset();
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue