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,7 +39,6 @@ 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 );
|
||||||
|
@ -70,7 +69,6 @@ CChannelFader::CChannelFader ( QWidget* pNW,
|
||||||
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 );
|
||||||
plblLabel->setAlignment ( Qt::AlignHCenter | Qt::AlignVCenter );
|
plblLabel->setAlignment ( Qt::AlignHCenter | Qt::AlignVCenter );
|
||||||
|
@ -127,7 +125,8 @@ 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 (
|
||||||
|
"Sets the panning position from Left to Right of the channel. "
|
||||||
"Works only in stero or preferably mono in/stereo out mode." ) );
|
"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" ) );
|
||||||
|
|
||||||
|
@ -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 )
|
||||||
|
@ -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
|
||||||
|
|
|
@ -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 );
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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,6 +805,31 @@ void CProtocol::CreateChanGainMes ( const int iChanID, const double dGain )
|
||||||
CreateAndSendMessage ( PROTMESSID_CHANNEL_GAIN, vecData );
|
CreateAndSendMessage ( PROTMESSID_CHANNEL_GAIN, vecData );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 )
|
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
|
||||||
|
@ -822,33 +847,6 @@ 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 )
|
|
||||||
{
|
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CProtocol::EvaluateChanPanMes ( 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
|
||||||
|
@ -860,12 +858,10 @@ bool CProtocol::EvaluateChanPanMes(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 ) );
|
|
||||||
|
|
||||||
// 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
|
||||||
|
@ -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 ) )
|
||||||
|
@ -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 );
|
||||||
}
|
}
|
||||||
|
@ -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++ )
|
||||||
{
|
{
|
||||||
|
// get the correct pan value for the current channel (left or right)
|
||||||
double pan = ( i % 2 == 0 ) ? dPanCoefL : dPanCoefR;
|
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