fix code style issues introduced by contributed source code
This commit is contained in:
parent
78413826a5
commit
7dbd2c89d1
12 changed files with 94 additions and 100 deletions
|
@ -39,8 +39,7 @@ CChannelFader::CChannelFader ( QWidget* pNW,
|
||||||
pLevelsBox = new QWidget ( pFrame );
|
pLevelsBox = new QWidget ( pFrame );
|
||||||
plbrChannelLevel = new CMultiColorLEDBar ( pLevelsBox );
|
plbrChannelLevel = new CMultiColorLEDBar ( pLevelsBox );
|
||||||
pFader = new QSlider ( Qt::Vertical, pLevelsBox );
|
pFader = new QSlider ( Qt::Vertical, pLevelsBox );
|
||||||
|
pPan = new QSlider ( Qt::Horizontal, pLevelsBox );
|
||||||
pPan = new QSlider (Qt::Horizontal, pLevelsBox);
|
|
||||||
|
|
||||||
pMuteSoloBox = new QWidget ( pFrame );
|
pMuteSoloBox = new QWidget ( pFrame );
|
||||||
pcbMute = new QCheckBox ( tr ( "Mute" ), pMuteSoloBox );
|
pcbMute = new QCheckBox ( tr ( "Mute" ), pMuteSoloBox );
|
||||||
|
@ -67,9 +66,8 @@ CChannelFader::CChannelFader ( QWidget* pNW,
|
||||||
pFader->setTickInterval ( AUD_MIX_FADER_MAX / 9 );
|
pFader->setTickInterval ( AUD_MIX_FADER_MAX / 9 );
|
||||||
|
|
||||||
// setup panning slider
|
// setup panning slider
|
||||||
pPan->setRange( 0, AUD_MIX_PAN_MAX);
|
pPan->setRange ( 0, AUD_MIX_PAN_MAX );
|
||||||
pPan->setValue(AUD_MIX_PAN_MAX/2);
|
pPan->setValue ( AUD_MIX_PAN_MAX / 2 );
|
||||||
|
|
||||||
|
|
||||||
// setup fader tag label (black bold text which is centered)
|
// setup fader tag label (black bold text which is centered)
|
||||||
plblLabel->setTextFormat ( Qt::PlainText );
|
plblLabel->setTextFormat ( Qt::PlainText );
|
||||||
|
@ -127,8 +125,9 @@ CChannelFader::CChannelFader ( QWidget* pNW,
|
||||||
pFader->setAccessibleName ( tr ( "Local mix level setting of the current audio "
|
pFader->setAccessibleName ( tr ( "Local mix level setting of the current audio "
|
||||||
"channel at the server" ) );
|
"channel at the server" ) );
|
||||||
|
|
||||||
pPan->setWhatsThis ( "<b>" + tr ( "Panning") + ":</b>" + tr ( "Sets the panning position from Left to Right of the channel. "
|
pPan->setWhatsThis ( "<b>" + tr ( "Panning" ) + ":</b>" + tr (
|
||||||
" Works only in stero or preferably mono in/stereo out mode." ) );
|
"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" ) );
|
pPan->setAccessibleName ( tr ( "Local panning position of the current audio channel at the server" ) );
|
||||||
|
|
||||||
pcbMute->setWhatsThis ( "<b>" + tr ( "Mute" ) + ":</b> " + tr (
|
pcbMute->setWhatsThis ( "<b>" + tr ( "Mute" ) + ":</b> " + tr (
|
||||||
|
@ -260,7 +259,7 @@ void CChannelFader::Reset()
|
||||||
{
|
{
|
||||||
// init gain and pan value -> maximum value as definition according to server
|
// init gain and pan value -> maximum value as definition according to server
|
||||||
pFader->setValue ( AUD_MIX_FADER_MAX );
|
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
|
// reset mute/solo check boxes and level meter
|
||||||
pcbMute->setChecked ( false );
|
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
|
// first make a range check
|
||||||
if ( ( iPan >= 0 ) && ( iPan <= AUD_MIX_PAN_MAX ) )
|
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
|
// we set the new fader level in the GUI (slider control) and also tell the
|
||||||
// server about the change
|
// server about the change
|
||||||
pPan->setValue ( iPan );
|
pPan->setValue ( iPan );
|
||||||
SendPanValueToServer( iPan );
|
SendPanValueToServer ( iPan );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -337,8 +336,7 @@ void CChannelFader::SendFaderLevelToServer ( const int iLevel )
|
||||||
|
|
||||||
void CChannelFader::SendPanValueToServer ( const int iPan )
|
void CChannelFader::SendPanValueToServer ( const int iPan )
|
||||||
{
|
{
|
||||||
double dPan = static_cast<double> ( iPan ) / AUD_MIX_PAN_MAX;
|
emit panValueChanged ( static_cast<double> ( iPan ) / AUD_MIX_PAN_MAX );
|
||||||
emit panValueChanged ( dPan );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CChannelFader::OnMuteStateChanged ( int value )
|
void CChannelFader::OnMuteStateChanged ( int value )
|
||||||
|
@ -559,7 +557,7 @@ CAudioMixerBoard::CAudioMixerBoard ( QWidget* parent, Qt::WindowFlags ) :
|
||||||
QScrollArea ( parent ),
|
QScrollArea ( parent ),
|
||||||
vecStoredFaderTags ( MAX_NUM_STORED_FADER_SETTINGS, "" ),
|
vecStoredFaderTags ( MAX_NUM_STORED_FADER_SETTINGS, "" ),
|
||||||
vecStoredFaderLevels ( MAX_NUM_STORED_FADER_SETTINGS, AUD_MIX_FADER_MAX ),
|
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 ),
|
vecStoredFaderIsSolo ( MAX_NUM_STORED_FADER_SETTINGS, false ),
|
||||||
vecStoredFaderIsMute ( MAX_NUM_STORED_FADER_SETTINGS, false ),
|
vecStoredFaderIsMute ( MAX_NUM_STORED_FADER_SETTINGS, false ),
|
||||||
iNewClientFaderLevel ( 100 ),
|
iNewClientFaderLevel ( 100 ),
|
||||||
|
@ -839,7 +837,6 @@ void CAudioMixerBoard::UpdatePanValue ( const int iChannelIdx,
|
||||||
emit ChangeChanPan ( iChannelIdx, dValue );
|
emit ChangeChanPan ( iChannelIdx, dValue );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CAudioMixerBoard::StoreFaderSettings ( CChannelFader* pChanFader )
|
void CAudioMixerBoard::StoreFaderSettings ( CChannelFader* pChanFader )
|
||||||
{
|
{
|
||||||
// if the fader was visible and the name is not empty, we store the old gain
|
// if the fader was visible and the name is not empty, we store the old gain
|
||||||
|
|
|
@ -65,7 +65,7 @@ public:
|
||||||
void SetFaderIsSolo ( const bool bIsSolo );
|
void SetFaderIsSolo ( const bool bIsSolo );
|
||||||
void SetFaderIsMute ( const bool bIsMute );
|
void SetFaderIsMute ( const bool bIsMute );
|
||||||
int GetFaderLevel() { return pFader->value(); }
|
int GetFaderLevel() { return pFader->value(); }
|
||||||
int GetPanValue() {return pPan->value(); }
|
int GetPanValue() { return pPan->value(); }
|
||||||
void Reset();
|
void Reset();
|
||||||
void SetChannelLevel ( const uint16_t iLevel );
|
void SetChannelLevel ( const uint16_t iLevel );
|
||||||
|
|
||||||
|
@ -98,12 +98,12 @@ protected:
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void OnLevelValueChanged ( int value ) { SendFaderLevelToServer ( value ); }
|
void OnLevelValueChanged ( int value ) { SendFaderLevelToServer ( value ); }
|
||||||
void OnPanValueChanged ( int value ) {SendPanValueToServer ( value ); }
|
void OnPanValueChanged ( int value ) { SendPanValueToServer ( value ); }
|
||||||
void OnMuteStateChanged ( int value );
|
void OnMuteStateChanged ( int value );
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void gainValueChanged ( double value );
|
void gainValueChanged ( double value );
|
||||||
void panValueChanged (double value );
|
void panValueChanged ( double value );
|
||||||
void soloStateChanged ( int value );
|
void soloStateChanged ( int value );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -154,7 +154,7 @@ public:
|
||||||
int iNewClientFaderLevel;
|
int iNewClientFaderLevel;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool GetStoredFaderSettings (const CChannelInfo& ChanInfo,
|
bool GetStoredFaderSettings ( const CChannelInfo& ChanInfo,
|
||||||
int& iStoredFaderLevel,
|
int& iStoredFaderLevel,
|
||||||
int& iStoredPanValue,
|
int& iStoredPanValue,
|
||||||
bool& bStoredFaderIsSolo,
|
bool& bStoredFaderIsSolo,
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
// CChannel implementation *****************************************************
|
// CChannel implementation *****************************************************
|
||||||
CChannel::CChannel ( const bool bNIsServer ) :
|
CChannel::CChannel ( const bool bNIsServer ) :
|
||||||
vecdGains ( MAX_NUM_CHANNELS, 1.0 ),
|
vecdGains ( MAX_NUM_CHANNELS, 1.0 ),
|
||||||
vecdPannings ( MAX_NUM_CHANNELS, 0.5),
|
vecdPannings ( MAX_NUM_CHANNELS, 0.5 ),
|
||||||
bDoAutoSockBufSize ( true ),
|
bDoAutoSockBufSize ( true ),
|
||||||
iFadeInCnt ( 0 ),
|
iFadeInCnt ( 0 ),
|
||||||
iFadeInCntMax ( FADE_IN_NUM_FRAMES_DBLE_FRAMESIZE ),
|
iFadeInCntMax ( FADE_IN_NUM_FRAMES_DBLE_FRAMESIZE ),
|
||||||
|
@ -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 );
|
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 );
|
QMutexLocker locker ( &Mutex );
|
||||||
|
|
||||||
|
@ -368,7 +369,7 @@ void CChannel::OnChangeChanGain ( int iChanID,
|
||||||
void CChannel::OnChangeChanPan ( int iChanID,
|
void CChannel::OnChangeChanPan ( int iChanID,
|
||||||
double dNewPan )
|
double dNewPan )
|
||||||
{
|
{
|
||||||
SetPan( iChanID, dNewPan );
|
SetPan ( iChanID, dNewPan );
|
||||||
}
|
}
|
||||||
|
|
||||||
void CChannel::OnChangeChanInfo ( CChannelCoreInfo ChanInfo )
|
void CChannel::OnChangeChanInfo ( CChannelCoreInfo ChanInfo )
|
||||||
|
|
|
@ -197,7 +197,6 @@ protected:
|
||||||
|
|
||||||
// mixer and effect settings
|
// mixer and effect settings
|
||||||
CVector<double> vecdGains;
|
CVector<double> vecdGains;
|
||||||
|
|
||||||
CVector<double> vecdPannings;
|
CVector<double> vecdPannings;
|
||||||
|
|
||||||
// network jitter-buffer
|
// network jitter-buffer
|
||||||
|
|
|
@ -35,7 +35,7 @@ CClient::CClient ( const quint16 iPortNumber,
|
||||||
ChannelInfo (),
|
ChannelInfo (),
|
||||||
vecStoredFaderTags ( MAX_NUM_STORED_FADER_SETTINGS, "" ),
|
vecStoredFaderTags ( MAX_NUM_STORED_FADER_SETTINGS, "" ),
|
||||||
vecStoredFaderLevels ( MAX_NUM_STORED_FADER_SETTINGS, AUD_MIX_FADER_MAX ),
|
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 ),
|
vecStoredFaderIsSolo ( MAX_NUM_STORED_FADER_SETTINGS, false ),
|
||||||
vecStoredFaderIsMute ( MAX_NUM_STORED_FADER_SETTINGS, false ),
|
vecStoredFaderIsMute ( MAX_NUM_STORED_FADER_SETTINGS, false ),
|
||||||
iNewClientFaderLevel ( 100 ),
|
iNewClientFaderLevel ( 100 ),
|
||||||
|
|
|
@ -147,14 +147,10 @@ LED bar: lbr
|
||||||
// default network buffer size
|
// default network buffer size
|
||||||
#define DEF_NET_BUF_SIZE_NUM_BL 10 // number of blocks
|
#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
|
#define AUD_MIX_FADER_MAX 100
|
||||||
|
|
||||||
|
|
||||||
// audio mixer panning maximum value
|
|
||||||
#define AUD_MIX_PAN_MAX 100
|
#define AUD_MIX_PAN_MAX 100
|
||||||
|
|
||||||
|
|
||||||
// maximum number of recognized sound cards installed in the system,
|
// maximum number of recognized sound cards installed in the system,
|
||||||
// definition for "no device"
|
// definition for "no device"
|
||||||
#define MAX_NUMBER_SOUND_CARDS 129 // e.g. 16 inputs, 8 outputs + default entry (MacOS)
|
#define MAX_NUMBER_SOUND_CARDS 129 // e.g. 16 inputs, 8 outputs + default entry (MacOS)
|
||||||
|
|
|
@ -805,7 +805,32 @@ void CProtocol::CreateChanGainMes ( const int iChanID, const double dGain )
|
||||||
CreateAndSendMessage ( PROTMESSID_CHANNEL_GAIN, vecData );
|
CreateAndSendMessage ( PROTMESSID_CHANNEL_GAIN, vecData );
|
||||||
}
|
}
|
||||||
|
|
||||||
void CProtocol::CreateChanPanMes(const int iChanID, const double dPan)
|
bool CProtocol::EvaluateChanGainMes ( const CVector<uint8_t>& 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<int> ( GetValFromStream ( vecData, iPos, 1 ) );
|
||||||
|
|
||||||
|
// gain (read integer value)
|
||||||
|
const int iData = static_cast<int> ( GetValFromStream ( vecData, iPos, 2 ) );
|
||||||
|
|
||||||
|
// we convert the gain from integer to double with range 0..1
|
||||||
|
const double dNewGain = static_cast<double> ( iData ) / ( 1 << 15 );
|
||||||
|
|
||||||
|
// invoke message action
|
||||||
|
emit ChangeChanGain ( iCurID, dNewGain );
|
||||||
|
|
||||||
|
return false; // no error
|
||||||
|
}
|
||||||
|
|
||||||
|
void CProtocol::CreateChanPanMes ( const int iChanID, const double dPan )
|
||||||
{
|
{
|
||||||
CVector<uint8_t> vecData ( 3 ); // 3 bytes of data
|
CVector<uint8_t> vecData ( 3 ); // 3 bytes of data
|
||||||
int iPos = 0; // init position pointer
|
int iPos = 0; // init position pointer
|
||||||
|
@ -822,7 +847,7 @@ void CProtocol::CreateChanPanMes(const int iChanID, const double dPan)
|
||||||
CreateAndSendMessage ( PROTMESSID_CHANNEL_PAN, vecData );
|
CreateAndSendMessage ( PROTMESSID_CHANNEL_PAN, vecData );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CProtocol::EvaluateChanGainMes ( const CVector<uint8_t>& vecData )
|
bool CProtocol::EvaluateChanPanMes ( const CVector<uint8_t> &vecData )
|
||||||
{
|
{
|
||||||
int iPos = 0; // init position pointer
|
int iPos = 0; // init position pointer
|
||||||
|
|
||||||
|
@ -833,39 +858,10 @@ bool CProtocol::EvaluateChanGainMes ( const CVector<uint8_t>& vecData )
|
||||||
}
|
}
|
||||||
|
|
||||||
// channel ID
|
// channel ID
|
||||||
const int iCurID =
|
const int iCurID = static_cast<int> ( GetValFromStream ( vecData, iPos, 1 ) );
|
||||||
static_cast<int> ( GetValFromStream ( vecData, iPos, 1 ) );
|
|
||||||
|
|
||||||
// gain (read integer value)
|
|
||||||
const int iData =
|
|
||||||
static_cast<int> ( GetValFromStream ( vecData, iPos, 2 ) );
|
|
||||||
|
|
||||||
// we convert the gain from integer to double with range 0..1
|
|
||||||
const double dNewGain = static_cast<double> ( iData ) / ( 1 << 15 );
|
|
||||||
|
|
||||||
// invoke message action
|
|
||||||
emit ChangeChanGain ( iCurID, dNewGain );
|
|
||||||
|
|
||||||
return false; // no error
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CProtocol::EvaluateChanPanMes(const CVector<uint8_t> &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<int> ( GetValFromStream ( vecData, iPos, 1 ) );
|
|
||||||
|
|
||||||
// pan (read integer value)
|
// pan (read integer value)
|
||||||
const int iData =
|
const int iData = static_cast<int> ( GetValFromStream ( vecData, iPos, 2 ) );
|
||||||
static_cast<int> ( GetValFromStream ( vecData, iPos, 2 ) );
|
|
||||||
|
|
||||||
// we convert the gain from integer to double with range 0..1
|
// we convert the gain from integer to double with range 0..1
|
||||||
const double dNewPan = static_cast<double> ( iData ) / ( 1 << 15 );
|
const double dNewPan = static_cast<double> ( iData ) / ( 1 << 15 );
|
||||||
|
|
|
@ -843,11 +843,12 @@ JitterMeas.Measure();
|
||||||
// "vecChanIDsCurConChan" to query the IDs of the currently
|
// "vecChanIDsCurConChan" to query the IDs of the currently
|
||||||
// connected channels
|
// connected channels
|
||||||
vecvecdGains[i][j] = vecChannels[iCurChanID].GetGain ( vecChanIDsCurConChan[j] );
|
vecvecdGains[i][j] = vecChannels[iCurChanID].GetGain ( vecChanIDsCurConChan[j] );
|
||||||
|
|
||||||
// consider audio fade-in
|
// consider audio fade-in
|
||||||
vecvecdGains[i][j] *= vecChannels[vecChanIDsCurConChan[j]].GetFadeInGain();
|
vecvecdGains[i][j] *= vecChannels[vecChanIDsCurConChan[j]].GetFadeInGain();
|
||||||
|
|
||||||
//panning
|
// panning
|
||||||
vecvecdPannings[i][j] = vecChannels[iCurChanID].GetPan( vecChanIDsCurConChan[j] ); //((double)rand() / (double)(RAND_MAX)); //vecChannels[iCurChanID].GetGain ( vecChanIDsCurConChan[j] ); //TODO: GetPanning
|
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
|
// If the server frame size is smaller than the received OPUS frame size, we need a conversion
|
||||||
|
@ -1076,7 +1077,7 @@ opus_custom_encoder_ctl ( CurOpusEncoder,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Mix all audio data from all clients together.
|
/// @brief Mix all audio data from all clients together.
|
||||||
void CServer::ProcessData (const CVector<CVector<int16_t> >& vecvecsData,
|
void CServer::ProcessData ( const CVector<CVector<int16_t> >& vecvecsData,
|
||||||
const CVector<double>& vecdGains,
|
const CVector<double>& vecdGains,
|
||||||
const CVector<double>& vecdPannings,
|
const CVector<double>& vecdPannings,
|
||||||
const CVector<int>& vecNumAudioChannels,
|
const CVector<int>& vecNumAudioChannels,
|
||||||
|
@ -1154,10 +1155,11 @@ void CServer::ProcessData (const CVector<CVector<int16_t> >& vecvecsData,
|
||||||
// get a reference to the audio data and gain of the current client
|
// get a reference to the audio data and gain of the current client
|
||||||
const CVector<int16_t>& vecsData = vecvecsData[j];
|
const CVector<int16_t>& vecsData = vecvecsData[j];
|
||||||
const double dGain = vecdGains[j];
|
const double dGain = vecdGains[j];
|
||||||
|
|
||||||
|
// 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 dPan = vecdPannings[j];
|
||||||
const double dPanCoefL = sqrt(1-dPan); // faster: (1-dPan)
|
const double dPanCoefL = sqrt ( 1 - dPan ); // faster: ( 1 - dPan )
|
||||||
const double dPanCoefR = sqrt(dPan); // (dPan)
|
const double dPanCoefR = sqrt ( dPan ); // ( dPan )
|
||||||
// see http://write.flossmanuals.net/csound/b-panning-and-spatialization/ for better formula, if needed
|
|
||||||
|
|
||||||
// if channel gain is 1, avoid multiplication for speed optimization
|
// if channel gain is 1, avoid multiplication for speed optimization
|
||||||
if ( dGain == static_cast<double> ( 1.0 ) )
|
if ( dGain == static_cast<double> ( 1.0 ) )
|
||||||
|
@ -1169,11 +1171,11 @@ void CServer::ProcessData (const CVector<CVector<int16_t> >& vecvecsData,
|
||||||
{
|
{
|
||||||
// left channel
|
// left channel
|
||||||
vecsOutData[k] = Double2Short (
|
vecsOutData[k] = Double2Short (
|
||||||
static_cast<double> ( vecsOutData[k] ) + vecsData[i] * dPanCoefL);
|
static_cast<double> ( vecsOutData[k] ) + vecsData[i] * dPanCoefL );
|
||||||
|
|
||||||
// right channel
|
// right channel
|
||||||
vecsOutData[k + 1] = Double2Short (
|
vecsOutData[k + 1] = Double2Short (
|
||||||
static_cast<double> ( vecsOutData[k + 1] ) + vecsData[i] * dPanCoefR);
|
static_cast<double> ( vecsOutData[k + 1] ) + vecsData[i] * dPanCoefR );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1181,7 +1183,9 @@ void CServer::ProcessData (const CVector<CVector<int16_t> >& vecvecsData,
|
||||||
// stereo
|
// stereo
|
||||||
for ( i = 0; i < ( 2 * iServerFrameSizeSamples ); i++ )
|
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 (
|
vecsOutData[i] = Double2Short (
|
||||||
static_cast<double> ( vecsOutData[i] ) + vecsData[i] * pan );
|
static_cast<double> ( vecsOutData[i] ) + vecsData[i] * pan );
|
||||||
}
|
}
|
||||||
|
@ -1196,11 +1200,11 @@ void CServer::ProcessData (const CVector<CVector<int16_t> >& vecvecsData,
|
||||||
{
|
{
|
||||||
// left channel
|
// left channel
|
||||||
vecsOutData[k] = Double2Short (
|
vecsOutData[k] = Double2Short (
|
||||||
vecsOutData[k] + vecsData[i] * dGain * dPanCoefL);
|
vecsOutData[k] + vecsData[i] * dGain * dPanCoefL );
|
||||||
|
|
||||||
// right channel
|
// right channel
|
||||||
vecsOutData[k + 1] = Double2Short (
|
vecsOutData[k + 1] = Double2Short (
|
||||||
vecsOutData[k + 1] + vecsData[i] * dGain * dPanCoefR);
|
vecsOutData[k + 1] + vecsData[i] * dGain * dPanCoefR );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1208,10 +1212,11 @@ void CServer::ProcessData (const CVector<CVector<int16_t> >& vecvecsData,
|
||||||
// stereo
|
// stereo
|
||||||
for ( i = 0; i < ( 2 * iServerFrameSizeSamples ); i++ )
|
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)
|
||||||
|
double pan = ( i % 2 == 0 ) ? dPanCoefL : dPanCoefR;
|
||||||
|
|
||||||
vecsOutData[i] = Double2Short (
|
vecsOutData[i] = Double2Short (
|
||||||
vecsOutData[i] + vecsData[i] * dGain * pan );
|
vecsOutData[i] + vecsData[i] * dGain * pan );
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue