support MIDI control faders in headless build (#483)
This commit is contained in:
parent
fefb5ade36
commit
e5174ef461
6 changed files with 42 additions and 24 deletions
|
@ -13,10 +13,11 @@
|
||||||
|
|
||||||
- improve server audio mix processing for better clipping behavior
|
- improve server audio mix processing for better clipping behavior
|
||||||
|
|
||||||
|
- support MIDI control faders in headless build (#483)
|
||||||
|
|
||||||
- bug fix: --showallservers ping column sort is alphabetic (#201)
|
- bug fix: --showallservers ping column sort is alphabetic (#201)
|
||||||
|
|
||||||
|
|
||||||
TODO If network configuration of client changes (e.g. Wifi to LAN) we may get audio issues for a period of time #426
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -470,7 +470,7 @@ void CChannelFader::SendFaderLevelToServer ( const double dLevel,
|
||||||
( !bOtherChannelIsSolo || IsSolo() ) );
|
( !bOtherChannelIsSolo || IsSolo() ) );
|
||||||
|
|
||||||
// emit signal for new fader gain value
|
// emit signal for new fader gain value
|
||||||
emit gainValueChanged ( CalcFaderGain ( dLevel ),
|
emit gainValueChanged ( MathUtils::CalcFaderGain ( dLevel ),
|
||||||
bIsMyOwnFader,
|
bIsMyOwnFader,
|
||||||
bIsGroupUpdate,
|
bIsGroupUpdate,
|
||||||
bSuppressServerUpdate,
|
bSuppressServerUpdate,
|
||||||
|
@ -569,7 +569,7 @@ void CChannelFader::SetMute ( const bool bState )
|
||||||
if ( !bOtherChannelIsSolo || IsSolo() )
|
if ( !bOtherChannelIsSolo || IsSolo() )
|
||||||
{
|
{
|
||||||
// mute was unchecked, get current fader value and apply
|
// mute was unchecked, get current fader value and apply
|
||||||
emit gainValueChanged ( CalcFaderGain ( GetFaderLevel() ), bIsMyOwnFader, false, false, -1 ); // set level ratio to in invalid value
|
emit gainValueChanged ( MathUtils::CalcFaderGain ( GetFaderLevel() ), bIsMyOwnFader, false, false, -1 ); // set level ratio to in invalid value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -771,23 +771,6 @@ void CChannelFader::SetChannelInfos ( const CChannelInfo& cChanInfo )
|
||||||
plblLabel->setToolTip ( strToolTip );
|
plblLabel->setToolTip ( strToolTip );
|
||||||
}
|
}
|
||||||
|
|
||||||
double CChannelFader::CalcFaderGain ( const double dValue )
|
|
||||||
{
|
|
||||||
// convert actual slider range in gain values
|
|
||||||
// and normalize so that maximum gain is 1
|
|
||||||
const double dInValueRange0_1 = dValue / AUD_MIX_FADER_MAX;
|
|
||||||
|
|
||||||
// map range from 0..1 to range -35..0 dB and calculate linear gain
|
|
||||||
if ( dValue == 0 )
|
|
||||||
{
|
|
||||||
return 0; // -infinity
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return pow ( 10, ( dInValueRange0_1 * 35 - 35 ) / 20 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************\
|
/******************************************************************************\
|
||||||
* CAudioMixerBoard *
|
* CAudioMixerBoard *
|
||||||
|
|
|
@ -84,7 +84,6 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void UpdateGroupIDDependencies();
|
void UpdateGroupIDDependencies();
|
||||||
double CalcFaderGain ( const double dValue );
|
|
||||||
void SetMute ( const bool bState );
|
void SetMute ( const bool bState );
|
||||||
void SetupFaderTag ( const ESkillLevel eSkillLevel );
|
void SetupFaderTag ( const ESkillLevel eSkillLevel );
|
||||||
void SendPanValueToServer ( const int iPan );
|
void SendPanValueToServer ( const int iPan );
|
||||||
|
|
|
@ -182,7 +182,7 @@ CClient::CClient ( const quint16 iPortNumber,
|
||||||
this, &CClient::OnSndCrdReinitRequest );
|
this, &CClient::OnSndCrdReinitRequest );
|
||||||
|
|
||||||
QObject::connect ( &Sound, &CSound::ControllerInFaderLevel,
|
QObject::connect ( &Sound, &CSound::ControllerInFaderLevel,
|
||||||
this, &CClient::ControllerInFaderLevel );
|
this, &CClient::OnControllerInFaderLevel );
|
||||||
|
|
||||||
QObject::connect ( &Socket, &CHighPrioSocket::InvalidPacketReceived,
|
QObject::connect ( &Socket, &CHighPrioSocket::InvalidPacketReceived,
|
||||||
this, &CClient::OnInvalidPacketReceived );
|
this, &CClient::OnInvalidPacketReceived );
|
||||||
|
@ -684,6 +684,22 @@ void CClient::OnHandledSignal ( int sigNum )
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CClient::OnControllerInFaderLevel ( int iChannelIdx,
|
||||||
|
int iValue )
|
||||||
|
{
|
||||||
|
// in case of a headless client the faders cannot be moved so we need
|
||||||
|
// to send the controller information directly to the server
|
||||||
|
#ifdef HEADLESS
|
||||||
|
// only apply new fader level if channel index is valid
|
||||||
|
if ( ( iChannelIdx >= 0 ) && ( iChannelIdx < MAX_NUM_CHANNELS ) )
|
||||||
|
{
|
||||||
|
SetRemoteChanGain ( iChannelIdx, MathUtils::CalcFaderGain ( iValue ), false );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
emit ControllerInFaderLevel ( iChannelIdx, iValue );
|
||||||
|
}
|
||||||
|
|
||||||
void CClient::Start()
|
void CClient::Start()
|
||||||
{
|
{
|
||||||
// init object
|
// init object
|
||||||
|
|
|
@ -372,7 +372,7 @@ protected:
|
||||||
|
|
||||||
CSignalHandler* pSignalHandler;
|
CSignalHandler* pSignalHandler;
|
||||||
|
|
||||||
public slots:
|
protected slots:
|
||||||
void OnHandledSignal ( int sigNum );
|
void OnHandledSignal ( int sigNum );
|
||||||
void OnSendProtMessage ( CVector<uint8_t> vecMessage );
|
void OnSendProtMessage ( CVector<uint8_t> vecMessage );
|
||||||
void OnInvalidPacketReceived ( CHostAddress RecHostAddr );
|
void OnInvalidPacketReceived ( CHostAddress RecHostAddr );
|
||||||
|
@ -397,6 +397,7 @@ public slots:
|
||||||
int iNumClients );
|
int iNumClients );
|
||||||
|
|
||||||
void OnSndCrdReinitRequest ( int iSndCrdResetType );
|
void OnSndCrdReinitRequest ( int iSndCrdResetType );
|
||||||
|
void OnControllerInFaderLevel ( int iChannelIdx, int iValue );
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void ConClientListMesReceived ( CVector<CChannelInfo> vecChanInfo );
|
void ConClientListMesReceived ( CVector<CChannelInfo> vecChanInfo );
|
||||||
|
|
18
src/util.h
18
src/util.h
|
@ -1278,6 +1278,24 @@ public:
|
||||||
{
|
{
|
||||||
return bXFade ? dPan : std::min ( 0.5, dPan ) * 2;
|
return bXFade ? dPan : std::min ( 0.5, dPan ) * 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// calculate linear gain from fader values which are in dB
|
||||||
|
static double CalcFaderGain ( const double dValue )
|
||||||
|
{
|
||||||
|
// convert actual slider range in gain values
|
||||||
|
// and normalize so that maximum gain is 1
|
||||||
|
const double dInValueRange0_1 = dValue / AUD_MIX_FADER_MAX;
|
||||||
|
|
||||||
|
// map range from 0..1 to range -35..0 dB and calculate linear gain
|
||||||
|
if ( dValue == 0 )
|
||||||
|
{
|
||||||
|
return 0; // -infinity
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return pow ( 10, ( dInValueRange0_1 * 35 - 35 ) / 20 );
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue