From 7dbd2c89d1392720e50e2b146f561f9ac105a9c0 Mon Sep 17 00:00:00 2001 From: Volker Fischer Date: Mon, 18 May 2020 20:46:46 +0200 Subject: [PATCH] fix code style issues introduced by contributed source code --- src/audiomixerboard.cpp | 35 +++++++++++------------ src/audiomixerboard.h | 14 +++++----- src/channel.cpp | 11 ++++---- src/channel.h | 3 +- src/client.cpp | 2 +- src/client.h | 2 +- src/clientdlg.cpp | 2 +- src/clientdlg.h | 2 +- src/global.h | 6 +--- src/protocol.cpp | 62 +++++++++++++++++++---------------------- src/protocol.h | 2 +- src/server.cpp | 53 +++++++++++++++++++---------------- 12 files changed, 94 insertions(+), 100 deletions(-) diff --git a/src/audiomixerboard.cpp b/src/audiomixerboard.cpp index 01969ffb..f610df81 100644 --- a/src/audiomixerboard.cpp +++ b/src/audiomixerboard.cpp @@ -39,8 +39,7 @@ CChannelFader::CChannelFader ( QWidget* pNW, pLevelsBox = new QWidget ( pFrame ); plbrChannelLevel = new CMultiColorLEDBar ( pLevelsBox ); pFader = new QSlider ( Qt::Vertical, pLevelsBox ); - - pPan = new QSlider (Qt::Horizontal, pLevelsBox); + pPan = new QSlider ( Qt::Horizontal, pLevelsBox ); pMuteSoloBox = new QWidget ( pFrame ); pcbMute = new QCheckBox ( tr ( "Mute" ), pMuteSoloBox ); @@ -67,9 +66,8 @@ CChannelFader::CChannelFader ( QWidget* pNW, pFader->setTickInterval ( AUD_MIX_FADER_MAX / 9 ); // setup panning slider - pPan->setRange( 0, AUD_MIX_PAN_MAX); - pPan->setValue(AUD_MIX_PAN_MAX/2); - + pPan->setRange ( 0, AUD_MIX_PAN_MAX ); + pPan->setValue ( AUD_MIX_PAN_MAX / 2 ); // setup fader tag label (black bold text which is centered) plblLabel->setTextFormat ( Qt::PlainText ); @@ -103,7 +101,7 @@ CChannelFader::CChannelFader ( QWidget* pNW, pMuteSoloGrid->addWidget ( pcbMute, 0, Qt::AlignLeft ); pMuteSoloGrid->addWidget ( pcbSolo, 0, Qt::AlignLeft ); - pMainGrid->addWidget ( pPan, 0, Qt::AlignCenter ); + pMainGrid->addWidget ( pPan, 0, Qt::AlignCenter ); pMainGrid->addWidget ( pLevelsBox, 0, Qt::AlignHCenter ); pMainGrid->addWidget ( pMuteSoloBox, 0, Qt::AlignHCenter ); pMainGrid->addWidget ( pLabelInstBox ); @@ -127,8 +125,9 @@ CChannelFader::CChannelFader ( QWidget* pNW, pFader->setAccessibleName ( tr ( "Local mix level setting of the current audio " "channel at the server" ) ); - pPan->setWhatsThis ( "" + tr ( "Panning") + ":" + tr ( "Sets the panning position from Left to Right of the channel. " - " Works only in stero or preferably mono in/stereo out mode." ) ); + pPan->setWhatsThis ( "" + tr ( "Panning" ) + ":" + tr ( + "Sets the panning position from Left to Right of the channel. " + "Works only in stero or preferably mono in/stereo out mode." ) ); pPan->setAccessibleName ( tr ( "Local panning position of the current audio channel at the server" ) ); pcbMute->setWhatsThis ( "" + tr ( "Mute" ) + ": " + tr ( @@ -158,7 +157,7 @@ CChannelFader::CChannelFader ( QWidget* pNW, this, SLOT ( OnLevelValueChanged ( int ) ) ); QObject::connect ( pPan, SIGNAL ( valueChanged ( int ) ), - this, SLOT ( OnPanValueChanged ( int ) ) ); + this, SLOT ( OnPanValueChanged ( int ) ) ); QObject::connect ( pcbMute, SIGNAL ( stateChanged ( int ) ), this, SLOT ( OnMuteStateChanged ( int ) ) ); @@ -260,7 +259,7 @@ void CChannelFader::Reset() { // init gain and pan value -> maximum value as definition according to server pFader->setValue ( AUD_MIX_FADER_MAX ); - pPan->setValue ( AUD_MIX_PAN_MAX/2 ); + pPan->setValue ( AUD_MIX_PAN_MAX / 2 ); // reset mute/solo check boxes and level meter pcbMute->setChecked ( false ); @@ -298,7 +297,7 @@ void CChannelFader::SetFaderLevel ( const int iLevel ) } } -void CChannelFader::SetPanValue(const int iPan) +void CChannelFader::SetPanValue ( const int iPan ) { // first make a range check if ( ( iPan >= 0 ) && ( iPan <= AUD_MIX_PAN_MAX ) ) @@ -306,7 +305,7 @@ void CChannelFader::SetPanValue(const int iPan) // we set the new fader level in the GUI (slider control) and also tell the // server about the change pPan->setValue ( iPan ); - SendPanValueToServer( iPan ); + SendPanValueToServer ( iPan ); } } @@ -337,8 +336,7 @@ void CChannelFader::SendFaderLevelToServer ( const int iLevel ) void CChannelFader::SendPanValueToServer ( const int iPan ) { - double dPan = static_cast ( iPan ) / AUD_MIX_PAN_MAX; - emit panValueChanged ( dPan ); + emit panValueChanged ( static_cast ( iPan ) / AUD_MIX_PAN_MAX ); } void CChannelFader::OnMuteStateChanged ( int value ) @@ -559,7 +557,7 @@ CAudioMixerBoard::CAudioMixerBoard ( QWidget* parent, Qt::WindowFlags ) : QScrollArea ( parent ), vecStoredFaderTags ( MAX_NUM_STORED_FADER_SETTINGS, "" ), vecStoredFaderLevels ( MAX_NUM_STORED_FADER_SETTINGS, AUD_MIX_FADER_MAX ), - vecStoredPanValues ( MAX_NUM_STORED_FADER_SETTINGS, AUD_MIX_PAN_MAX/2), + vecStoredPanValues ( MAX_NUM_STORED_FADER_SETTINGS, AUD_MIX_PAN_MAX / 2 ), vecStoredFaderIsSolo ( MAX_NUM_STORED_FADER_SETTINGS, false ), vecStoredFaderIsMute ( MAX_NUM_STORED_FADER_SETTINGS, false ), iNewClientFaderLevel ( 100 ), @@ -752,7 +750,7 @@ void CAudioMixerBoard::ApplyNewConClientList ( CVector& vecChanInf bStoredFaderIsMute ) ) { vecpChanFader[i]->SetFaderLevel ( iStoredFaderLevel ); - vecpChanFader[i]->SetPanValue ( iStoredPanValue ); + vecpChanFader[i]->SetPanValue ( iStoredPanValue ); vecpChanFader[i]->SetFaderIsSolo ( bStoredFaderIsSolo ); vecpChanFader[i]->SetFaderIsMute ( bStoredFaderIsMute ); } @@ -834,12 +832,11 @@ void CAudioMixerBoard::UpdateGainValue ( const int iChannelIdx, } void CAudioMixerBoard::UpdatePanValue ( const int iChannelIdx, - const double dValue ) + const double dValue ) { emit ChangeChanPan ( iChannelIdx, dValue ); } - void CAudioMixerBoard::StoreFaderSettings ( CChannelFader* pChanFader ) { // if the fader was visible and the name is not empty, we store the old gain @@ -904,7 +901,7 @@ bool CAudioMixerBoard::GetStoredFaderSettings ( const CChannelInfo& ChanInfo, { // copy stored settings values iStoredFaderLevel = vecStoredFaderLevels[iIdx]; - iStoredPanValue = vecStoredPanValues[iIdx]; + iStoredPanValue = vecStoredPanValues[iIdx]; bStoredFaderIsSolo = vecStoredFaderIsSolo[iIdx] != 0; bStoredFaderIsMute = vecStoredFaderIsMute[iIdx] != 0; diff --git a/src/audiomixerboard.h b/src/audiomixerboard.h index e59aeaf4..1af7cc07 100644 --- a/src/audiomixerboard.h +++ b/src/audiomixerboard.h @@ -65,7 +65,7 @@ public: void SetFaderIsSolo ( const bool bIsSolo ); void SetFaderIsMute ( const bool bIsMute ); int GetFaderLevel() { return pFader->value(); } - int GetPanValue() {return pPan->value(); } + int GetPanValue() { return pPan->value(); } void Reset(); void SetChannelLevel ( const uint16_t iLevel ); @@ -82,7 +82,7 @@ protected: QWidget* pMuteSoloBox; CMultiColorLEDBar* plbrChannelLevel; QSlider* pFader; - QSlider* pPan; + QSlider* pPan; QCheckBox* pcbMute; QCheckBox* pcbSolo; @@ -98,12 +98,12 @@ protected: public slots: void OnLevelValueChanged ( int value ) { SendFaderLevelToServer ( value ); } - void OnPanValueChanged ( int value ) {SendPanValueToServer ( value ); } + void OnPanValueChanged ( int value ) { SendPanValueToServer ( value ); } void OnMuteStateChanged ( int value ); signals: void gainValueChanged ( double value ); - void panValueChanged (double value ); + void panValueChanged ( double value ); void soloStateChanged ( int value ); }; @@ -118,7 +118,7 @@ protected: virtual void UpdateGainValue ( const int iChannelIdx, const double dValue ) = 0; virtual void UpdatePanValue ( const int iChannelIdx, - const double dValue ) = 0; + const double dValue ) = 0; }; template<> @@ -154,7 +154,7 @@ public: int iNewClientFaderLevel; protected: - bool GetStoredFaderSettings (const CChannelInfo& ChanInfo, + bool GetStoredFaderSettings ( const CChannelInfo& ChanInfo, int& iStoredFaderLevel, int& iStoredPanValue, bool& bStoredFaderIsSolo, @@ -176,7 +176,7 @@ protected: virtual void UpdateGainValue ( const int iChannelIdx, const double dValue ); virtual void UpdatePanValue ( const int iChannelIdx, - const double dValue ); + const double dValue ); template inline void connectFaderSignalsToMixerBoardSlots(); diff --git a/src/channel.cpp b/src/channel.cpp index 38f05cec..a7228826 100755 --- a/src/channel.cpp +++ b/src/channel.cpp @@ -28,7 +28,7 @@ // CChannel implementation ***************************************************** CChannel::CChannel ( const bool bNIsServer ) : vecdGains ( MAX_NUM_CHANNELS, 1.0 ), - vecdPannings ( MAX_NUM_CHANNELS, 0.5), + vecdPannings ( MAX_NUM_CHANNELS, 0.5 ), bDoAutoSockBufSize ( true ), iFadeInCnt ( 0 ), iFadeInCntMax ( FADE_IN_NUM_FRAMES_DBLE_FRAMESIZE ), @@ -88,7 +88,7 @@ qRegisterMetaType ( "CHostAddress" ); this, SLOT ( OnChangeChanGain ( int, double ) ) ); QObject::connect( &Protocol, SIGNAL ( ChangeChanPan ( int, double ) ), - this, SLOT ( OnChangeChanPan ( int, double ) ) ); + this, SLOT ( OnChangeChanPan ( int, double ) ) ); QObject::connect( &Protocol, SIGNAL ( ChangeChanInfo ( CChannelCoreInfo ) ), this, SLOT ( OnChangeChanInfo ( CChannelCoreInfo ) ) ); @@ -273,7 +273,8 @@ double CChannel::GetGain ( const int iChanID ) } } -void CChannel::SetPan(const int iChanID, const double dNewPan) +void CChannel::SetPan ( const int iChanID, + const double dNewPan ) { QMutexLocker locker ( &Mutex ); @@ -284,7 +285,7 @@ void CChannel::SetPan(const int iChanID, const double dNewPan) } } -double CChannel::GetPan(const int iChanID) +double CChannel::GetPan ( const int iChanID ) { QMutexLocker locker ( &Mutex ); @@ -368,7 +369,7 @@ void CChannel::OnChangeChanGain ( int iChanID, void CChannel::OnChangeChanPan ( int iChanID, double dNewPan ) { - SetPan( iChanID, dNewPan ); + SetPan ( iChanID, dNewPan ); } void CChannel::OnChangeChanInfo ( CChannelCoreInfo ChanInfo ) diff --git a/src/channel.h b/src/channel.h index 7a60ea3e..19506454 100755 --- a/src/channel.h +++ b/src/channel.h @@ -118,7 +118,7 @@ public: { Protocol.CreateChanGainMes ( iId, dGain ); } void SetRemoteChanPan ( const int iId, const double dPan ) - { Protocol.CreateChanPanMes ( iId, dPan ); } + { Protocol.CreateChanPanMes ( iId, dPan ); } bool SetSockBufNumFrames ( const int iNewNumFrames, const bool bPreserve = false ); @@ -197,7 +197,6 @@ protected: // mixer and effect settings CVector vecdGains; - CVector vecdPannings; // network jitter-buffer diff --git a/src/client.cpp b/src/client.cpp index d68dc19c..ec3c2cf2 100755 --- a/src/client.cpp +++ b/src/client.cpp @@ -35,7 +35,7 @@ CClient::CClient ( const quint16 iPortNumber, ChannelInfo (), vecStoredFaderTags ( MAX_NUM_STORED_FADER_SETTINGS, "" ), vecStoredFaderLevels ( MAX_NUM_STORED_FADER_SETTINGS, AUD_MIX_FADER_MAX ), - vecStoredPanValues ( MAX_NUM_STORED_FADER_SETTINGS, AUD_MIX_PAN_MAX/2 ), + vecStoredPanValues ( MAX_NUM_STORED_FADER_SETTINGS, AUD_MIX_PAN_MAX / 2 ), vecStoredFaderIsSolo ( MAX_NUM_STORED_FADER_SETTINGS, false ), vecStoredFaderIsMute ( MAX_NUM_STORED_FADER_SETTINGS, false ), iNewClientFaderLevel ( 100 ), diff --git a/src/client.h b/src/client.h index 48898321..b019e2ef 100755 --- a/src/client.h +++ b/src/client.h @@ -246,7 +246,7 @@ public: { Channel.SetRemoteChanGain ( iId, dGain ); } void SetRemoteChanPan ( const int iId, const double dPan ) - { Channel.SetRemoteChanPan ( iId, dPan ); } + { Channel.SetRemoteChanPan ( iId, dPan ); } void SetRemoteInfo() { Channel.SetRemoteInfo ( ChannelInfo ); } diff --git a/src/clientdlg.cpp b/src/clientdlg.cpp index bd748a09..b5640479 100755 --- a/src/clientdlg.cpp +++ b/src/clientdlg.cpp @@ -523,7 +523,7 @@ CClientDlg::CClientDlg ( CClient* pNCliP, this, SLOT ( OnChangeChanGain ( int, double ) ) ); QObject::connect ( MainMixerBoard, SIGNAL ( ChangeChanPan ( int, double ) ), - this, SLOT ( OnChangeChanPan ( int, double ) ) ); + this, SLOT ( OnChangeChanPan ( int, double ) ) ); QObject::connect ( MainMixerBoard, SIGNAL ( NumClientsChanged ( int ) ), this, SLOT ( OnNumClientsChanged ( int ) ) ); diff --git a/src/clientdlg.h b/src/clientdlg.h index ccff42c8..5af19cb3 100755 --- a/src/clientdlg.h +++ b/src/clientdlg.h @@ -167,7 +167,7 @@ public slots: { pClient->SetRemoteChanGain ( iId, dGain ); } void OnChangeChanPan ( int iId, double dPan ) - { pClient->SetRemoteChanPan ( iId, dPan ); } + { pClient->SetRemoteChanPan ( iId, dPan ); } void OnNewLocalInputText ( QString strChatText ) { pClient->CreateChatTextMes ( strChatText ); } diff --git a/src/global.h b/src/global.h index e87d859c..089bd317 100755 --- a/src/global.h +++ b/src/global.h @@ -147,14 +147,10 @@ LED bar: lbr // default network buffer size #define DEF_NET_BUF_SIZE_NUM_BL 10 // number of blocks -// audio mixer fader maximum value +// audio mixer fader and panning maximum value #define AUD_MIX_FADER_MAX 100 - - -// audio mixer panning maximum value #define AUD_MIX_PAN_MAX 100 - // maximum number of recognized sound cards installed in the system, // definition for "no device" #define MAX_NUMBER_SOUND_CARDS 129 // e.g. 16 inputs, 8 outputs + default entry (MacOS) diff --git a/src/protocol.cpp b/src/protocol.cpp index 26f7b47f..ba279e85 100755 --- a/src/protocol.cpp +++ b/src/protocol.cpp @@ -805,7 +805,32 @@ void CProtocol::CreateChanGainMes ( const int iChanID, const double dGain ) CreateAndSendMessage ( PROTMESSID_CHANNEL_GAIN, vecData ); } -void CProtocol::CreateChanPanMes(const int iChanID, const double dPan) +bool CProtocol::EvaluateChanGainMes ( const CVector& vecData ) +{ + int iPos = 0; // init position pointer + + // check size + if ( vecData.Size() != 3 ) + { + return true; // return error code + } + + // channel ID + const int iCurID = static_cast ( GetValFromStream ( vecData, iPos, 1 ) ); + + // gain (read integer value) + const int iData = static_cast ( GetValFromStream ( vecData, iPos, 2 ) ); + + // we convert the gain from integer to double with range 0..1 + const double dNewGain = static_cast ( iData ) / ( 1 << 15 ); + + // invoke message action + emit ChangeChanGain ( iCurID, dNewGain ); + + return false; // no error +} + +void CProtocol::CreateChanPanMes ( const int iChanID, const double dPan ) { CVector vecData ( 3 ); // 3 bytes of data int iPos = 0; // init position pointer @@ -822,7 +847,7 @@ void CProtocol::CreateChanPanMes(const int iChanID, const double dPan) CreateAndSendMessage ( PROTMESSID_CHANNEL_PAN, vecData ); } -bool CProtocol::EvaluateChanGainMes ( const CVector& vecData ) +bool CProtocol::EvaluateChanPanMes ( const CVector &vecData ) { int iPos = 0; // init position pointer @@ -833,39 +858,10 @@ bool CProtocol::EvaluateChanGainMes ( const CVector& vecData ) } // channel ID - const int iCurID = - static_cast ( GetValFromStream ( vecData, iPos, 1 ) ); - - // gain (read integer value) - const int iData = - static_cast ( GetValFromStream ( vecData, iPos, 2 ) ); - - // we convert the gain from integer to double with range 0..1 - const double dNewGain = static_cast ( iData ) / ( 1 << 15 ); - - // invoke message action - emit ChangeChanGain ( iCurID, dNewGain ); - - return false; // no error -} - -bool CProtocol::EvaluateChanPanMes(const CVector &vecData) -{ - int iPos = 0; // init position pointer - - // check size - if ( vecData.Size() != 3 ) - { - return true; // return error code - } - - // channel ID - const int iCurID = - static_cast ( GetValFromStream ( vecData, iPos, 1 ) ); + const int iCurID = static_cast ( GetValFromStream ( vecData, iPos, 1 ) ); // pan (read integer value) - const int iData = - static_cast ( GetValFromStream ( vecData, iPos, 2 ) ); + const int iData = static_cast ( GetValFromStream ( vecData, iPos, 2 ) ); // we convert the gain from integer to double with range 0..1 const double dNewPan = static_cast ( iData ) / ( 1 << 15 ); diff --git a/src/protocol.h b/src/protocol.h index 4b19174e..f24bba82 100644 --- a/src/protocol.h +++ b/src/protocol.h @@ -282,7 +282,7 @@ signals: void ReqJittBufSize(); void ChangeNetwBlSiFact ( int iNewNetwBlSiFact ); void ChangeChanGain ( int iChanID, double dNewGain ); - void ChangeChanPan ( int iChanID, double dNewPan ); + void ChangeChanPan ( int iChanID, double dNewPan ); void ConClientListMesReceived ( CVector vecChanInfo ); void ServerFullMesReceived(); void ReqConnClientsList(); diff --git a/src/server.cpp b/src/server.cpp index 1c8301f3..38955a82 100755 --- a/src/server.cpp +++ b/src/server.cpp @@ -340,7 +340,7 @@ CServer::CServer ( const int iNewMaxNumChan, // allocate worst case memory for the temporary vectors vecChanIDsCurConChan.Init ( iMaxNumChannels ); vecvecdGains.Init ( iMaxNumChannels ); - vecvecdPannings.Init ( iMaxNumChannels ); + vecvecdPannings.Init ( iMaxNumChannels ); vecvecsData.Init ( iMaxNumChannels ); vecNumAudioChannels.Init ( iMaxNumChannels ); vecNumFrameSizeConvBlocks.Init ( iMaxNumChannels ); @@ -351,7 +351,7 @@ CServer::CServer ( const int iNewMaxNumChan, { // init vectors storing information of all channels vecvecdGains[i].Init ( iMaxNumChannels ); - vecvecdPannings[i].Init ( iMaxNumChannels ); + vecvecdPannings[i].Init ( iMaxNumChannels ); // we always use stereo audio buffers (see "vecsSendData") vecvecsData[i].Init ( 2 /* stereo */ * DOUBLE_SYSTEM_FRAME_SIZE_SAMPLES /* worst case buffer size */ ); @@ -843,11 +843,12 @@ JitterMeas.Measure(); // "vecChanIDsCurConChan" to query the IDs of the currently // connected channels vecvecdGains[i][j] = vecChannels[iCurChanID].GetGain ( vecChanIDsCurConChan[j] ); + // consider audio fade-in vecvecdGains[i][j] *= vecChannels[vecChanIDsCurConChan[j]].GetFadeInGain(); - //panning - vecvecdPannings[i][j] = vecChannels[iCurChanID].GetPan( vecChanIDsCurConChan[j] ); //((double)rand() / (double)(RAND_MAX)); //vecChannels[iCurChanID].GetGain ( vecChanIDsCurConChan[j] ); //TODO: GetPanning + // panning + vecvecdPannings[i][j] = vecChannels[iCurChanID].GetPan ( vecChanIDsCurConChan[j] ); } // If the server frame size is smaller than the received OPUS frame size, we need a conversion @@ -1076,13 +1077,13 @@ opus_custom_encoder_ctl ( CurOpusEncoder, } /// @brief Mix all audio data from all clients together. -void CServer::ProcessData (const CVector >& vecvecsData, - const CVector& vecdGains, - const CVector& vecdPannings, - const CVector& vecNumAudioChannels, - CVector& vecsOutData, - const int iCurNumAudChan, - const int iNumClients ) +void CServer::ProcessData ( const CVector >& vecvecsData, + const CVector& vecdGains, + const CVector& vecdPannings, + const CVector& vecNumAudioChannels, + CVector& vecsOutData, + const int iCurNumAudChan, + const int iNumClients ) { int i, j, k; @@ -1154,10 +1155,11 @@ void CServer::ProcessData (const CVector >& vecvecsData, // get a reference to the audio data and gain of the current client const CVector& vecsData = vecvecsData[j]; const double dGain = vecdGains[j]; - const double dPan = vecdPannings[j]; - const double dPanCoefL = sqrt(1-dPan); // faster: (1-dPan) - const double dPanCoefR = sqrt(dPan); // (dPan) - // see http://write.flossmanuals.net/csound/b-panning-and-spatialization/ for better formula, if needed + + // calculate pan coefficient, see http://write.flossmanuals.net/csound/b-panning-and-spatialization/ for better formula, if needed + const double dPan = vecdPannings[j]; + const double dPanCoefL = sqrt ( 1 - dPan ); // faster: ( 1 - dPan ) + const double dPanCoefR = sqrt ( dPan ); // ( dPan ) // if channel gain is 1, avoid multiplication for speed optimization if ( dGain == static_cast ( 1.0 ) ) @@ -1169,11 +1171,11 @@ void CServer::ProcessData (const CVector >& vecvecsData, { // left channel vecsOutData[k] = Double2Short ( - static_cast ( vecsOutData[k] ) + vecsData[i] * dPanCoefL); + static_cast ( vecsOutData[k] ) + vecsData[i] * dPanCoefL ); // right channel vecsOutData[k + 1] = Double2Short ( - static_cast ( vecsOutData[k + 1] ) + vecsData[i] * dPanCoefR); + static_cast ( vecsOutData[k + 1] ) + vecsData[i] * dPanCoefR ); } } else @@ -1181,9 +1183,11 @@ void CServer::ProcessData (const CVector >& vecvecsData, // stereo for ( i = 0; i < ( 2 * iServerFrameSizeSamples ); i++ ) { - double pan = (i%2==0) ? dPanCoefL : dPanCoefR; + // get the correct pan value for the current channel (left or right) + const double pan = ( i % 2 == 0 ) ? dPanCoefL : dPanCoefR; + vecsOutData[i] = Double2Short ( - static_cast ( vecsOutData[i] ) + vecsData[i] * pan ); + static_cast ( vecsOutData[i] ) + vecsData[i] * pan ); } } } @@ -1196,11 +1200,11 @@ void CServer::ProcessData (const CVector >& vecvecsData, { // left channel vecsOutData[k] = Double2Short ( - vecsOutData[k] + vecsData[i] * dGain * dPanCoefL); + vecsOutData[k] + vecsData[i] * dGain * dPanCoefL ); // right channel vecsOutData[k + 1] = Double2Short ( - vecsOutData[k + 1] + vecsData[i] * dGain * dPanCoefR); + vecsOutData[k + 1] + vecsData[i] * dGain * dPanCoefR ); } } else @@ -1208,10 +1212,11 @@ void CServer::ProcessData (const CVector >& vecvecsData, // stereo for ( i = 0; i < ( 2 * iServerFrameSizeSamples ); i++ ) { - double pan = (i%2==0) ? dPanCoefL : dPanCoefR; - vecsOutData[i] = Double2Short ( - vecsOutData[i] + vecsData[i] * dGain * pan ); + // get the correct pan value for the current channel (left or right) + double pan = ( i % 2 == 0 ) ? dPanCoefL : dPanCoefR; + vecsOutData[i] = Double2Short ( + vecsOutData[i] + vecsData[i] * dGain * pan ); } } }