only show level meters if the server actually supports it and sends network packets with levels to the client

This commit is contained in:
Volker Fischer 2020-04-07 00:20:32 +02:00
parent 70c499a82a
commit ac21104cd0
2 changed files with 24 additions and 5 deletions

View file

@ -193,6 +193,11 @@ void CChannelFader::SetDisplayChannelLevel ( const bool eNDCL )
plbrChannelLevel->setHidden ( !eNDCL );
}
bool CChannelFader::GetDisplayChannelLevel()
{
return !plbrChannelLevel->isHidden();
}
void CChannelFader::SetupFaderTag ( const ESkillLevel eSkillLevel )
{
// setup group box for label/instrument picture: set a thick black border
@ -678,10 +683,15 @@ void CAudioMixerBoard::SetDisplayChannelLevels ( const bool eNDCL )
{
bDisplayChannelLevels = eNDCL;
// apply preference to child GUI controls
// only update hiding the levels immediately, showing the levels
// is only applied if the server actually transmits levels
if ( !bDisplayChannelLevels )
{
// hide all level meters
for ( int i = 0; i < MAX_NUM_CHANNELS; i++ )
{
vecpChanFader[i]->SetDisplayChannelLevel ( bDisplayChannelLevels );
vecpChanFader[i]->SetDisplayChannelLevel ( false );
}
}
}
@ -693,6 +703,7 @@ void CAudioMixerBoard::HideAll()
// before hiding the fader, store its level (if some conditions are fullfilled)
StoreFaderSettings ( vecpChanFader[i] );
vecpChanFader[i]->SetDisplayChannelLevel ( false );
vecpChanFader[i]->Hide();
}
@ -922,6 +933,13 @@ void CAudioMixerBoard::SetChannelLevels ( const CVector<uint16_t>& vecChannelLev
if ( vecpChanFader[iChId]->IsVisible() && i < iNumChannelLevels )
{
vecpChanFader[iChId]->SetChannelLevel ( vecChannelLevel[i++] );
// show level only if we successfully received levels from the
// server (if server does not support levels, do not show levels)
if ( bDisplayChannelLevels && !vecpChanFader[iChId]->GetDisplayChannelLevel() )
{
vecpChanFader[iChId]->SetDisplayChannelLevel ( true );
}
}
}
}

View file

@ -57,6 +57,7 @@ public:
bool IsMute() { return pcbMute->isChecked(); }
void SetGUIDesign ( const EGUIDesign eNewDesign );
void SetDisplayChannelLevel ( const bool eNDCL );
bool GetDisplayChannelLevel();
void UpdateSoloState ( const bool bNewOtherSoloState );
void SetFaderLevel ( const int iLevel );