fixes for reverberation in stereo mode (disable channel selection and apply reverb on both channels)
This commit is contained in:
parent
a5f95bf4c7
commit
7362dae229
6 changed files with 109 additions and 41 deletions
|
@ -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,13 +635,29 @@ 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 ( bUseStereo )
|
||||||
|
{
|
||||||
|
// for stereo always apply reverberation effect on both channels
|
||||||
|
for ( i = 0; i < iStereoBlockSizeSam; i += 2 )
|
||||||
|
{
|
||||||
|
// left channel
|
||||||
|
vecdAudioStereo[i] +=
|
||||||
|
dRevLev * AudioReverbL.ProcessSample ( vecdAudioStereo[i] );
|
||||||
|
|
||||||
|
// right channel
|
||||||
|
vecdAudioStereo[i + 1] +=
|
||||||
|
dRevLev * AudioReverbR.ProcessSample ( vecdAudioStereo[i + 1] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if ( bReverbOnLeftChan )
|
if ( bReverbOnLeftChan )
|
||||||
{
|
{
|
||||||
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] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -649,7 +666,8 @@ void CClient::ProcessAudioDataIntern ( CVector<int16_t>& vecsStereoSndCrd )
|
||||||
{
|
{
|
||||||
// right channel
|
// right channel
|
||||||
vecdAudioStereo[i] +=
|
vecdAudioStereo[i] +=
|
||||||
dRevLev * AudioReverb.ProcessSample ( vecdAudioStereo[i] );
|
dRevLev * AudioReverbR.ProcessSample ( vecdAudioStereo[i] );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -102,4 +102,5 @@ protected:
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void GUIDesignChanged();
|
void GUIDesignChanged();
|
||||||
|
void StereoCheckBoxChanged();
|
||||||
};
|
};
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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"
|
||||||
|
@ -79,6 +80,7 @@ protected:
|
||||||
void SetMyWindowTitle ( const int iNumClients );
|
void SetMyWindowTitle ( const int iNumClients );
|
||||||
void ShowChatWindow();
|
void ShowChatWindow();
|
||||||
void UpdateAudioFaderSlider();
|
void UpdateAudioFaderSlider();
|
||||||
|
void UpdateRevSelection();
|
||||||
void ConnectDisconnect ( const bool bDoStart );
|
void ConnectDisconnect ( const bool bDoStart );
|
||||||
|
|
||||||
CClient* pClient;
|
CClient* pClient;
|
||||||
|
@ -94,6 +96,8 @@ protected:
|
||||||
QMenu* pViewMenu;
|
QMenu* pViewMenu;
|
||||||
QMenuBar* pMenu;
|
QMenuBar* pMenu;
|
||||||
|
|
||||||
|
QButtonGroup RevSelectionButtonGroup;
|
||||||
|
|
||||||
CClientSettingsDlg ClientSettingsDlg;
|
CClientSettingsDlg ClientSettingsDlg;
|
||||||
CChatDlg ChatDlg;
|
CChatDlg ChatDlg;
|
||||||
|
|
||||||
|
@ -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 );
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue