fixes for reverberation in stereo mode (disable channel selection and apply reverb on both channels)

This commit is contained in:
Volker Fischer 2010-03-24 20:10:25 +00:00
parent a5f95bf4c7
commit 7362dae229
6 changed files with 109 additions and 41 deletions

View file

@ -524,7 +524,8 @@ void CClient::Init()
CycleTimeVariance.Reset();
// init reverberation
AudioReverb.Init ( SYSTEM_SAMPLE_RATE );
AudioReverbL.Init ( SYSTEM_SAMPLE_RATE );
AudioReverbR.Init ( SYSTEM_SAMPLE_RATE );
// inits for CELT coding
if ( bCeltDoHighQuality )
@ -634,22 +635,39 @@ void CClient::ProcessAudioDataIntern ( CVector<int16_t>& vecsStereoSndCrd )
const double dRevLev =
static_cast<double> ( iReverbLevel ) / AUD_REVERB_MAX / 2;
if ( bReverbOnLeftChan )
if ( bUseStereo )
{
// for stereo always apply reverberation effect on both channels
for ( i = 0; i < iStereoBlockSizeSam; i += 2 )
{
// left channel
vecdAudioStereo[i] +=
dRevLev * AudioReverb.ProcessSample ( vecdAudioStereo[i] );
dRevLev * AudioReverbL.ProcessSample ( vecdAudioStereo[i] );
// right channel
vecdAudioStereo[i + 1] +=
dRevLev * AudioReverbR.ProcessSample ( vecdAudioStereo[i + 1] );
}
}
else
{
for ( i = 1; i < iStereoBlockSizeSam; i += 2 )
if ( bReverbOnLeftChan )
{
// right channel
vecdAudioStereo[i] +=
dRevLev * AudioReverb.ProcessSample ( vecdAudioStereo[i] );
for ( i = 0; i < iStereoBlockSizeSam; i += 2 )
{
// left channel
vecdAudioStereo[i] +=
dRevLev * AudioReverbL.ProcessSample ( vecdAudioStereo[i] );
}
}
else
{
for ( i = 1; i < iStereoBlockSizeSam; i += 2 )
{
// right channel
vecdAudioStereo[i] +=
dRevLev * AudioReverbR.ProcessSample ( vecdAudioStereo[i] );
}
}
}
}

View file

@ -117,7 +117,8 @@ public:
void SetReverbOnLeftChan ( const bool bIL )
{
bReverbOnLeftChan = bIL;
AudioReverb.Clear();
AudioReverbL.Clear();
AudioReverbR.Clear();
}
void SetDoAutoSockBufSize ( const bool bValue ) { bDoAutoSockBufSize = bValue; }
@ -251,7 +252,8 @@ protected:
int iAudioInFader;
bool bReverbOnLeftChan;
int iReverbLevel;
CAudioReverb AudioReverb;
CAudioReverb AudioReverbL;
CAudioReverb AudioReverbR;
int iSndCrdPrefFrameSizeFactor;
int iSndCrdFrameSizeFactor;

View file

@ -600,6 +600,7 @@ void CClientSettingsDlg::OnUseHighQualityAudioStateChanged ( int value )
void CClientSettingsDlg::OnUseStereoStateChanged ( int value )
{
pClient->SetUseStereo ( value == Qt::Checked );
emit StereoCheckBoxChanged();
UpdateDisplay(); // upload rate will be changed
}

View file

@ -102,4 +102,5 @@ protected:
signals:
void GUIDesignChanged();
void StereoCheckBoxChanged();
};

View file

@ -254,14 +254,9 @@ CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP,
// set radio buttons ---
// reverb channel
if ( pClient->IsReverbOnLeftChan() )
{
RadioButtonRevSelL->setChecked ( true );
}
else
{
RadioButtonRevSelR->setChecked ( true );
}
RevSelectionButtonGroup.addButton ( RadioButtonRevSelL );
RevSelectionButtonGroup.addButton ( RadioButtonRevSelR );
UpdateRevSelection();
// connect on startup ---
@ -340,11 +335,9 @@ CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP,
this, SLOT ( OnSliderAudReverb ( int ) ) );
// radio buttons
QObject::connect ( RadioButtonRevSelL, SIGNAL ( clicked() ),
this, SLOT ( OnRevSelL() ) );
QObject::connect ( RadioButtonRevSelR, SIGNAL ( clicked() ),
this, SLOT ( OnRevSelR() ) );
QObject::connect ( &RevSelectionButtonGroup,
SIGNAL ( buttonClicked ( QAbstractButton* ) ), this,
SLOT ( OnRevSelectionButtonGroupClicked ( QAbstractButton* ) ) );
// line edits
QObject::connect ( LineEditFaderTag, SIGNAL ( textChanged ( const QString& ) ),
@ -376,6 +369,9 @@ CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP,
QObject::connect ( &ClientSettingsDlg, SIGNAL ( GUIDesignChanged() ),
this, SLOT ( OnGUIDesignChanged() ) );
QObject::connect ( &ClientSettingsDlg, SIGNAL ( StereoCheckBoxChanged() ),
this, SLOT ( OnStereoCheckBoxChanged() ) );
QObject::connect ( MainMixerBoard, SIGNAL ( ChangeChanGain ( int, double ) ),
this, SLOT ( OnChangeChanGain ( int, double ) ) );
@ -446,6 +442,39 @@ void CLlconClientDlg::UpdateAudioFaderSlider()
}
}
void CLlconClientDlg::UpdateRevSelection()
{
if ( pClient->GetUseStereo() )
{
// for stereo set both channels checked and disable all settings
RevSelectionButtonGroup.setExclusive ( false );
// to be able to set both checks, exclusive has to be disabled
RadioButtonRevSelL->setChecked ( true );
RadioButtonRevSelR->setChecked ( true );
// enable exclusive again, since this is required for mono mode
RevSelectionButtonGroup.setExclusive ( true );
// the user shall not modify the radio buttons in stereo mode
RadioButtonRevSelL->setEnabled ( false );
RadioButtonRevSelR->setEnabled ( false );
}
else
{
// mono case, enable all radio buttons and set to current value
RadioButtonRevSelL->setEnabled ( true );
RadioButtonRevSelR->setEnabled ( true );
// first reset and then set correct selection
RadioButtonRevSelL->setChecked ( false );
RadioButtonRevSelR->setChecked ( false );
RadioButtonRevSelL->setChecked ( pClient->IsReverbOnLeftChan() );
RadioButtonRevSelR->setChecked ( !pClient->IsReverbOnLeftChan() );
}
}
void CLlconClientDlg::OnSliderAudInFader ( int value )
{
pClient->SetAudioInFader ( value );
@ -535,6 +564,19 @@ void CLlconClientDlg::OnNumClientsChanged ( int iNewNumClients )
SetMyWindowTitle ( iNewNumClients );
}
void CLlconClientDlg::OnRevSelectionButtonGroupClicked ( QAbstractButton* button )
{
if ( button == RadioButtonRevSelL )
{
pClient->SetReverbOnLeftChan ( true );
}
if ( button == RadioButtonRevSelR )
{
pClient->SetReverbOnLeftChan ( false );
}
}
void CLlconClientDlg::SetMyWindowTitle ( const int iNumClients )
{
// show number of connected clients in window title (and therefore also in

View file

@ -31,6 +31,7 @@
#include <qtimer.h>
#include <qslider.h>
#include <qradiobutton.h>
#include <qbuttongroup.h>
#include <qmenubar.h>
#include <qlayout.h>
#include "global.h"
@ -75,27 +76,30 @@ public:
QWidget* parent = 0, Qt::WindowFlags f = 0 );
protected:
void SetGUIDesign ( const EGUIDesign eNewDesign );
void SetMyWindowTitle ( const int iNumClients );
void ShowChatWindow();
void UpdateAudioFaderSlider();
void ConnectDisconnect ( const bool bDoStart );
void SetGUIDesign ( const EGUIDesign eNewDesign );
void SetMyWindowTitle ( const int iNumClients );
void ShowChatWindow();
void UpdateAudioFaderSlider();
void UpdateRevSelection();
void ConnectDisconnect ( const bool bDoStart );
CClient* pClient;
bool bConnected;
bool bUnreadChatMessage;
QTimer TimerSigMet;
QTimer TimerStatus;
CClient* pClient;
bool bConnected;
bool bUnreadChatMessage;
QTimer TimerSigMet;
QTimer TimerStatus;
virtual void customEvent ( QEvent* Event );
virtual void closeEvent ( QCloseEvent* Event );
void UpdateDisplay();
virtual void customEvent ( QEvent* Event );
virtual void closeEvent ( QCloseEvent* Event );
void UpdateDisplay();
QMenu* pViewMenu;
QMenuBar* pMenu;
QMenu* pViewMenu;
QMenuBar* pMenu;
CClientSettingsDlg ClientSettingsDlg;
CChatDlg ChatDlg;
QButtonGroup RevSelectionButtonGroup;
CClientSettingsDlg ClientSettingsDlg;
CChatDlg ChatDlg;
public slots:
void OnConnectDisconBut();
@ -105,8 +109,7 @@ public slots:
void OnOpenChatDialog() { ShowChatWindow(); }
void OnSliderAudInFader ( int value );
void OnSliderAudReverb ( int value ) { pClient->SetReverbLevel ( value ); }
void OnRevSelL() { pClient->SetReverbOnLeftChan ( true ); }
void OnRevSelR() { pClient->SetReverbOnLeftChan ( false ); }
void OnRevSelectionButtonGroupClicked ( QAbstractButton* button );
void OnConClientListMesReceived ( CVector<CChannelShortInfo> vecChanInfo );
void OnChangeChanGain ( int iId, double dGain )
{ pClient->SetRemoteChanGain ( iId, dGain ); }
@ -119,5 +122,6 @@ public slots:
void OnDisconnected();
void OnStopped();
void OnGUIDesignChanged() { SetGUIDesign ( pClient->GetGUIDesign() ); }
void OnStereoCheckBoxChanged() { UpdateRevSelection(); }
void OnNumClientsChanged ( int iNewNumClients );
};