bug fix: honour own fader and Mute button in Mute Myself (#148)

This commit is contained in:
Volker Fischer 2020-05-26 20:45:10 +02:00
parent f6e5120095
commit a49cb6408c
6 changed files with 47 additions and 19 deletions

View file

@ -316,6 +316,7 @@ void CChannelFader::Reset()
plblCountryFlag->setToolTipDuration ( iToolTipDurMs );
bOtherChannelIsSolo = false;
bIsMyOwnFader = false;
}
void CChannelFader::SetFaderLevel ( const int iLevel )
@ -379,7 +380,7 @@ void CChannelFader::SendFaderLevelToServer ( const int iLevel )
( !bOtherChannelIsSolo || IsSolo() ) )
{
// emit signal for new fader gain value
emit gainValueChanged ( CalcFaderGain ( iLevel ) );
emit gainValueChanged ( CalcFaderGain ( iLevel ), bIsMyOwnFader );
}
}
@ -399,7 +400,7 @@ void CChannelFader::SetMute ( const bool bState )
if ( bState )
{
// mute channel -> send gain of 0
emit gainValueChanged ( 0 );
emit gainValueChanged ( 0, bIsMyOwnFader );
}
else
{
@ -407,7 +408,7 @@ void CChannelFader::SetMute ( const bool bState )
if ( !bOtherChannelIsSolo || IsSolo() )
{
// mute was unchecked, get current fader value and apply
emit gainValueChanged ( CalcFaderGain ( GetFaderLevel() ) );
emit gainValueChanged ( CalcFaderGain ( GetFaderLevel() ), bIsMyOwnFader );
}
}
}
@ -657,7 +658,7 @@ inline void CAudioMixerBoard::connectFaderSignalsToMixerBoardSlots()
{
int iCurChanID = slotId - 1;
void ( CAudioMixerBoard::* pGainValueChanged )( double ) =
void ( CAudioMixerBoard::* pGainValueChanged )( double, bool ) =
&CAudioMixerBoardSlots<slotId>::OnChGainValueChanged;
void ( CAudioMixerBoard::* pPanValueChanged )( double ) =
@ -792,6 +793,12 @@ void CAudioMixerBoard::ApplyNewConClientList ( CVector<CChannelInfo>& vecChanInf
// the fader was not in use, reset everything for new client
vecpChanFader[i]->Reset();
// check if this is my own fader and set fader property
if ( i == iMyChannelID )
{
vecpChanFader[i]->SetIsMyOwnFader();
}
// show fader
vecpChanFader[i]->Show();
@ -918,9 +925,10 @@ void CAudioMixerBoard::UpdateSoloStates()
}
void CAudioMixerBoard::UpdateGainValue ( const int iChannelIdx,
const double dValue )
const double dValue,
const bool bIsMyOwnFader )
{
emit ChangeChanGain ( iChannelIdx, dValue );
emit ChangeChanGain ( iChannelIdx, dValue, bIsMyOwnFader );
}
void CAudioMixerBoard::UpdatePanValue ( const int iChannelIdx,

View file

@ -71,6 +71,7 @@ public:
int GetPanValue() { return pPan->value(); }
void Reset();
void SetChannelLevel ( const uint16_t iLevel );
void SetIsMyOwnFader() { bIsMyOwnFader = true; }
protected:
double CalcFaderGain ( const int value );
@ -100,6 +101,7 @@ protected:
QString strReceivedName;
bool bOtherChannelIsSolo;
bool bIsMyOwnFader;
public slots:
void OnLevelValueChanged ( int value ) { SendFaderLevelToServer ( value ); }
@ -107,7 +109,7 @@ public slots:
void OnMuteStateChanged ( int value );
signals:
void gainValueChanged ( double value );
void gainValueChanged ( double value, bool bIsMyOwnFader );
void panValueChanged ( double value );
void soloStateChanged ( int value );
};
@ -116,12 +118,13 @@ template<unsigned int slotId>
class CAudioMixerBoardSlots : public CAudioMixerBoardSlots<slotId - 1>
{
public:
void OnChGainValueChanged ( double dValue ) { UpdateGainValue ( slotId - 1, dValue ); }
void OnChGainValueChanged ( double dValue, bool bIsMyOwnFader ) { UpdateGainValue ( slotId - 1, dValue, bIsMyOwnFader ); }
void OnChPanValueChanged ( double dValue ) { UpdatePanValue ( slotId - 1, dValue ); }
protected:
virtual void UpdateGainValue ( const int iChannelIdx,
const double dValue ) = 0;
const double dValue,
const bool bIsMyOwnFader ) = 0;
virtual void UpdatePanValue ( const int iChannelIdx,
const double dValue ) = 0;
};
@ -147,7 +150,7 @@ public:
void SetDisplayPans ( const bool eNDP );
void SetPanIsSupported();
void SetRemoteFaderIsMute ( const int iChannelIdx, const bool bIsMute );
void SetMyChannelID ( const int iChanID ) { iMyChannelID = iChanID; }
void SetMyChannelID ( const int iChannelIdx ) { iMyChannelID = iChannelIdx; }
void SetFaderLevel ( const int iChannelIdx,
const int iValue );
@ -201,7 +204,8 @@ protected:
QString strServerName;
virtual void UpdateGainValue ( const int iChannelIdx,
const double dValue );
const double dValue,
const bool bIsMyOwnFader );
virtual void UpdatePanValue ( const int iChannelIdx,
const double dValue );
@ -209,7 +213,7 @@ protected:
inline void connectFaderSignalsToMixerBoardSlots();
signals:
void ChangeChanGain ( int iId, double dGain );
void ChangeChanGain ( int iId, double dGain, bool bIsMyOwnFader );
void ChangeChanPan ( int iId, double dPan );
void NumClientsChanged ( int iNewNumClients );
};

View file

@ -61,6 +61,7 @@ CClient::CClient ( const quint16 iPortNumber,
iNumAudioChannels ( 1 ),
bIsInitializationPhase ( true ),
bMuteOutStream ( false ),
dMuteOutStreamGain ( 1.0 ),
Socket ( &Channel, iPortNumber ),
Sound ( AudioCallback, this, iCtrlMIDIChannel, bNoAutoJackConnect, strNClientName ),
iAudioInFader ( AUD_FADER_IN_MIDDLE ),
@ -380,6 +381,19 @@ void CClient::SetDoAutoSockBufSize ( const bool bValue )
CreateServerJitterBufferMessage();
}
void CClient::SetRemoteChanGain ( const int iId,
const double dGain,
const bool bIsMyOwnFader )
{
// if this gain is for my own channel, apply the value for the Mute Myself function
if ( bIsMyOwnFader )
{
dMuteOutStreamGain = dGain;
}
Channel.SetRemoteChanGain ( iId, dGain );
}
bool CClient::SetServerAddr ( QString strNAddr )
{
CHostAddress HostAddress;
@ -877,6 +891,8 @@ void CClient::Init()
vecZeros.Init ( iStereoBlockSizeSam, 0 );
vecsStereoSndCrdMuteStream.Init ( iStereoBlockSizeSam );
dMuteOutStreamGain = 1.0;
opus_custom_encoder_ctl ( CurOpusEncoder,
OPUS_SET_BITRATE (
CalcBitRateBitsPerSecFromCodedBytes (
@ -1198,7 +1214,7 @@ fflush(pFileDelay);
for ( i = 0; i < iStereoBlockSizeSam; i++ )
{
vecsStereoSndCrd[i] = Double2Short (
static_cast<double> ( vecsStereoSndCrd[i] ) + vecsStereoSndCrdMuteStream[i] );
vecsStereoSndCrd[i] + vecsStereoSndCrdMuteStream[i] * dMuteOutStreamGain );
}
}

View file

@ -243,8 +243,7 @@ public:
void SetMuteOutStream ( const bool bDoMute ) { bMuteOutStream = bDoMute; }
void SetRemoteChanGain ( const int iId, const double dGain )
{ Channel.SetRemoteChanGain ( iId, dGain ); }
void SetRemoteChanGain ( const int iId, const double dGain, const bool bIsMyOwnFader );
void SetRemoteChanPan ( const int iId, const double dPan )
{ Channel.SetRemoteChanPan ( iId, dPan ); }
@ -343,6 +342,7 @@ protected:
int iNumAudioChannels;
bool bIsInitializationPhase;
bool bMuteOutStream;
double dMuteOutStreamGain;
CVector<unsigned char> vecCeltData;
CHighPrioSocket Socket;

View file

@ -526,8 +526,8 @@ CClientDlg::CClientDlg ( CClient* pNCliP,
QObject::connect ( &ClientSettingsDlg, SIGNAL ( NewClientLevelChanged() ),
this, SLOT ( OnNewClientLevelChanged() ) );
QObject::connect ( MainMixerBoard, SIGNAL ( ChangeChanGain ( int, double ) ),
this, SLOT ( OnChangeChanGain ( int, double ) ) );
QObject::connect ( MainMixerBoard, SIGNAL ( ChangeChanGain ( int, double, bool ) ),
this, SLOT ( OnChangeChanGain ( int, double, bool ) ) );
QObject::connect ( MainMixerBoard, SIGNAL ( ChangeChanPan ( int, double ) ),
this, SLOT ( OnChangeChanPan ( int, double ) ) );

View file

@ -169,8 +169,8 @@ public slots:
void OnChatTextReceived ( QString strChatText );
void OnLicenceRequired ( ELicenceType eLicenceType );
void OnChangeChanGain ( int iId, double dGain )
{ pClient->SetRemoteChanGain ( iId, dGain ); }
void OnChangeChanGain ( int iId, double dGain, bool bIsMyOwnFader )
{ pClient->SetRemoteChanGain ( iId, dGain, bIsMyOwnFader ); }
void OnChangeChanPan ( int iId, double dPan )
{ pClient->SetRemoteChanPan ( iId, dPan ); }