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

View file

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

View file

@ -61,6 +61,7 @@ CClient::CClient ( const quint16 iPortNumber,
iNumAudioChannels ( 1 ), iNumAudioChannels ( 1 ),
bIsInitializationPhase ( true ), bIsInitializationPhase ( true ),
bMuteOutStream ( false ), bMuteOutStream ( false ),
dMuteOutStreamGain ( 1.0 ),
Socket ( &Channel, iPortNumber ), Socket ( &Channel, iPortNumber ),
Sound ( AudioCallback, this, iCtrlMIDIChannel, bNoAutoJackConnect, strNClientName ), Sound ( AudioCallback, this, iCtrlMIDIChannel, bNoAutoJackConnect, strNClientName ),
iAudioInFader ( AUD_FADER_IN_MIDDLE ), iAudioInFader ( AUD_FADER_IN_MIDDLE ),
@ -380,6 +381,19 @@ void CClient::SetDoAutoSockBufSize ( const bool bValue )
CreateServerJitterBufferMessage(); 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 ) bool CClient::SetServerAddr ( QString strNAddr )
{ {
CHostAddress HostAddress; CHostAddress HostAddress;
@ -877,6 +891,8 @@ void CClient::Init()
vecZeros.Init ( iStereoBlockSizeSam, 0 ); vecZeros.Init ( iStereoBlockSizeSam, 0 );
vecsStereoSndCrdMuteStream.Init ( iStereoBlockSizeSam ); vecsStereoSndCrdMuteStream.Init ( iStereoBlockSizeSam );
dMuteOutStreamGain = 1.0;
opus_custom_encoder_ctl ( CurOpusEncoder, opus_custom_encoder_ctl ( CurOpusEncoder,
OPUS_SET_BITRATE ( OPUS_SET_BITRATE (
CalcBitRateBitsPerSecFromCodedBytes ( CalcBitRateBitsPerSecFromCodedBytes (
@ -1198,7 +1214,7 @@ fflush(pFileDelay);
for ( i = 0; i < iStereoBlockSizeSam; i++ ) for ( i = 0; i < iStereoBlockSizeSam; i++ )
{ {
vecsStereoSndCrd[i] = Double2Short ( 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 SetMuteOutStream ( const bool bDoMute ) { bMuteOutStream = bDoMute; }
void SetRemoteChanGain ( const int iId, const double dGain ) void SetRemoteChanGain ( const int iId, const double dGain, const bool bIsMyOwnFader );
{ Channel.SetRemoteChanGain ( iId, dGain ); }
void SetRemoteChanPan ( const int iId, const double dPan ) void SetRemoteChanPan ( const int iId, const double dPan )
{ Channel.SetRemoteChanPan ( iId, dPan ); } { Channel.SetRemoteChanPan ( iId, dPan ); }
@ -343,6 +342,7 @@ protected:
int iNumAudioChannels; int iNumAudioChannels;
bool bIsInitializationPhase; bool bIsInitializationPhase;
bool bMuteOutStream; bool bMuteOutStream;
double dMuteOutStreamGain;
CVector<unsigned char> vecCeltData; CVector<unsigned char> vecCeltData;
CHighPrioSocket Socket; CHighPrioSocket Socket;

View file

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

View file

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