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