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(); CycleTimeVariance.Reset();
// init reverberation // init reverberation
AudioReverb.Init ( SYSTEM_SAMPLE_RATE ); AudioReverbL.Init ( SYSTEM_SAMPLE_RATE );
AudioReverbR.Init ( SYSTEM_SAMPLE_RATE );
// inits for CELT coding // inits for CELT coding
if ( bCeltDoHighQuality ) if ( bCeltDoHighQuality )
@ -634,22 +635,39 @@ void CClient::ProcessAudioDataIntern ( CVector<int16_t>& vecsStereoSndCrd )
const double dRevLev = const double dRevLev =
static_cast<double> ( iReverbLevel ) / AUD_REVERB_MAX / 2; 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 ) for ( i = 0; i < iStereoBlockSizeSam; i += 2 )
{ {
// left channel // left channel
vecdAudioStereo[i] += vecdAudioStereo[i] +=
dRevLev * AudioReverb.ProcessSample ( vecdAudioStereo[i] ); dRevLev * AudioReverbL.ProcessSample ( vecdAudioStereo[i] );
// right channel
vecdAudioStereo[i + 1] +=
dRevLev * AudioReverbR.ProcessSample ( vecdAudioStereo[i + 1] );
} }
} }
else else
{ {
for ( i = 1; i < iStereoBlockSizeSam; i += 2 ) if ( bReverbOnLeftChan )
{ {
// right channel for ( i = 0; i < iStereoBlockSizeSam; i += 2 )
vecdAudioStereo[i] += {
dRevLev * AudioReverb.ProcessSample ( vecdAudioStereo[i] ); // 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 ) void SetReverbOnLeftChan ( const bool bIL )
{ {
bReverbOnLeftChan = bIL; bReverbOnLeftChan = bIL;
AudioReverb.Clear(); AudioReverbL.Clear();
AudioReverbR.Clear();
} }
void SetDoAutoSockBufSize ( const bool bValue ) { bDoAutoSockBufSize = bValue; } void SetDoAutoSockBufSize ( const bool bValue ) { bDoAutoSockBufSize = bValue; }
@ -251,7 +252,8 @@ protected:
int iAudioInFader; int iAudioInFader;
bool bReverbOnLeftChan; bool bReverbOnLeftChan;
int iReverbLevel; int iReverbLevel;
CAudioReverb AudioReverb; CAudioReverb AudioReverbL;
CAudioReverb AudioReverbR;
int iSndCrdPrefFrameSizeFactor; int iSndCrdPrefFrameSizeFactor;
int iSndCrdFrameSizeFactor; int iSndCrdFrameSizeFactor;

View file

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

View file

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

View file

@ -254,14 +254,9 @@ CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP,
// set radio buttons --- // set radio buttons ---
// reverb channel // reverb channel
if ( pClient->IsReverbOnLeftChan() ) RevSelectionButtonGroup.addButton ( RadioButtonRevSelL );
{ RevSelectionButtonGroup.addButton ( RadioButtonRevSelR );
RadioButtonRevSelL->setChecked ( true ); UpdateRevSelection();
}
else
{
RadioButtonRevSelR->setChecked ( true );
}
// connect on startup --- // connect on startup ---
@ -340,11 +335,9 @@ CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP,
this, SLOT ( OnSliderAudReverb ( int ) ) ); this, SLOT ( OnSliderAudReverb ( int ) ) );
// radio buttons // radio buttons
QObject::connect ( RadioButtonRevSelL, SIGNAL ( clicked() ), QObject::connect ( &RevSelectionButtonGroup,
this, SLOT ( OnRevSelL() ) ); SIGNAL ( buttonClicked ( QAbstractButton* ) ), this,
SLOT ( OnRevSelectionButtonGroupClicked ( QAbstractButton* ) ) );
QObject::connect ( RadioButtonRevSelR, SIGNAL ( clicked() ),
this, SLOT ( OnRevSelR() ) );
// line edits // line edits
QObject::connect ( LineEditFaderTag, SIGNAL ( textChanged ( const QString& ) ), QObject::connect ( LineEditFaderTag, SIGNAL ( textChanged ( const QString& ) ),
@ -376,6 +369,9 @@ CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP,
QObject::connect ( &ClientSettingsDlg, SIGNAL ( GUIDesignChanged() ), QObject::connect ( &ClientSettingsDlg, SIGNAL ( GUIDesignChanged() ),
this, SLOT ( OnGUIDesignChanged() ) ); this, SLOT ( OnGUIDesignChanged() ) );
QObject::connect ( &ClientSettingsDlg, SIGNAL ( StereoCheckBoxChanged() ),
this, SLOT ( OnStereoCheckBoxChanged() ) );
QObject::connect ( MainMixerBoard, SIGNAL ( ChangeChanGain ( int, double ) ), QObject::connect ( MainMixerBoard, SIGNAL ( ChangeChanGain ( int, double ) ),
this, SLOT ( OnChangeChanGain ( 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 ) void CLlconClientDlg::OnSliderAudInFader ( int value )
{ {
pClient->SetAudioInFader ( value ); pClient->SetAudioInFader ( value );
@ -535,6 +564,19 @@ void CLlconClientDlg::OnNumClientsChanged ( int iNewNumClients )
SetMyWindowTitle ( 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 ) void CLlconClientDlg::SetMyWindowTitle ( const int iNumClients )
{ {
// show number of connected clients in window title (and therefore also in // show number of connected clients in window title (and therefore also in

View file

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