fix of: when changing a large group of faders, the volume change is very very slow, also the feedback from server, it seems the protocol is overloaded totally

This commit is contained in:
Volker Fischer 2020-06-20 20:29:43 +02:00
parent 7f037f21e2
commit 2c0b8a6119
3 changed files with 59 additions and 35 deletions

View file

@ -21,9 +21,7 @@
TODO grouping does not work as expected: TODO grouping does not work as expected:
- when changing a large group of faders, the volume change is very very slow, also the feedback from server, it seems the protocol is overloaded totally
- vertical space between check boxes should be smaller - vertical space between check boxes should be smaller
- get rid of bIsSelected
TODO minimum height of faders (dependent on style) TODO minimum height of faders (dependent on style)

View file

@ -313,7 +313,7 @@ void CChannelFader::Reset()
iPreviousFaderLevel = AUD_MIX_FADER_MAX; iPreviousFaderLevel = AUD_MIX_FADER_MAX;
pPan->setValue ( AUD_MIX_PAN_MAX / 2 ); pPan->setValue ( AUD_MIX_PAN_MAX / 2 );
// reset mute/solo/select check boxes and level meter // reset mute/solo/group check boxes and level meter
pcbMute->setChecked ( false ); pcbMute->setChecked ( false );
pcbSolo->setChecked ( false ); pcbSolo->setChecked ( false );
pcbGroup->setChecked ( false ); pcbGroup->setChecked ( false );
@ -339,15 +339,20 @@ void CChannelFader::Reset()
bIsMyOwnFader = false; bIsMyOwnFader = false;
} }
void CChannelFader::SetFaderLevel ( const int iLevel ) void CChannelFader::SetFaderLevel ( const int iLevel,
const bool bIsGroupUpdate )
{ {
// first make a range check // first make a range check
if ( ( iLevel >= 0 ) && ( iLevel <= AUD_MIX_FADER_MAX ) ) if ( ( iLevel >= 0 ) && ( iLevel <= AUD_MIX_FADER_MAX ) )
{ {
// we set the new fader level in the GUI (slider control) and also tell the // we set the new fader level in the GUI (slider control) and also tell the
// server about the change // server about the change (block the signal of the fader since we want to
// call SendFaderLevelToServer with a special additional parameter)
pFader->blockSignals ( true );
pFader->setValue ( iLevel ); pFader->setValue ( iLevel );
SendFaderLevelToServer ( iLevel ); pFader->blockSignals ( false );
SendFaderLevelToServer ( iLevel, bIsGroupUpdate );
} }
} }
@ -356,10 +361,9 @@ void CChannelFader::SetPanValue ( const int iPan )
// first make a range check // first make a range check
if ( ( iPan >= 0 ) && ( iPan <= AUD_MIX_PAN_MAX ) ) if ( ( iPan >= 0 ) && ( iPan <= AUD_MIX_PAN_MAX ) )
{ {
// we set the new fader level in the GUI (slider control) and also tell the // we set the new fader level in the GUI (slider control) which then
// server about the change // emits to signal to tell the server about the change (implicitly)
pPan->setValue ( iPan ); pPan->setValue ( iPan );
SendPanValueToServer ( iPan );
} }
} }
@ -393,7 +397,8 @@ void CChannelFader::SetRemoteFaderIsMute ( const bool bIsMute )
} }
} }
void CChannelFader::SendFaderLevelToServer ( const int iLevel ) void CChannelFader::SendFaderLevelToServer ( const int iLevel,
const bool bIsGroupUpdate )
{ {
// if mute flag is set or other channel is on solo, do not apply the new // if mute flag is set or other channel is on solo, do not apply the new
// fader value (exception: we are on solo, in that case we ignore the // fader value (exception: we are on solo, in that case we ignore the
@ -402,7 +407,10 @@ 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 ), bIsMyOwnFader, iLevel - iPreviousFaderLevel ); emit gainValueChanged ( CalcFaderGain ( iLevel ),
bIsMyOwnFader,
bIsGroupUpdate,
iLevel - iPreviousFaderLevel );
iPreviousFaderLevel = iLevel; iPreviousFaderLevel = iLevel;
} }
@ -424,7 +432,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, bIsMyOwnFader, 0 ); emit gainValueChanged ( 0, bIsMyOwnFader, false, 0 );
} }
else else
{ {
@ -432,7 +440,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, 0 ); emit gainValueChanged ( CalcFaderGain ( GetFaderLevel() ), bIsMyOwnFader, false, 0 );
} }
} }
} }
@ -691,7 +699,7 @@ inline void CAudioMixerBoard::connectFaderSignalsToMixerBoardSlots()
{ {
int iCurChanID = slotId - 1; int iCurChanID = slotId - 1;
void ( CAudioMixerBoard::* pGainValueChanged )( double, bool, int ) = void ( CAudioMixerBoard::* pGainValueChanged )( double, bool, bool, int ) =
&CAudioMixerBoardSlots<slotId>::OnChGainValueChanged; &CAudioMixerBoardSlots<slotId>::OnChGainValueChanged;
void ( CAudioMixerBoard::* pPanValueChanged )( double ) = void ( CAudioMixerBoard::* pPanValueChanged )( double ) =
@ -1023,27 +1031,25 @@ void CAudioMixerBoard::UpdateSoloStates()
void CAudioMixerBoard::UpdateGainValue ( const int iChannelIdx, void CAudioMixerBoard::UpdateGainValue ( const int iChannelIdx,
const double dValue, const double dValue,
const bool bIsMyOwnFader, const bool bIsMyOwnFader,
const bool bIsGroupUpdate,
const int iDiffLevel ) const int iDiffLevel )
{ {
// update current gain // update current gain
emit ChangeChanGain ( iChannelIdx, dValue, bIsMyOwnFader ); emit ChangeChanGain ( iChannelIdx, dValue, bIsMyOwnFader );
// if this fader is selected, all other selected must be updated as well // if this fader is selected, all other in the group must be updated as
if ( vecpChanFader[iChannelIdx]->IsSelect() ) // well (note that we do not have to update if this is already a group update
// to avoid an infinite loop)
if ( vecpChanFader[iChannelIdx]->IsSelect() && !bIsGroupUpdate )
{ {
for ( int i = 0; i < MAX_NUM_CHANNELS; i++ ) for ( int i = 0; i < MAX_NUM_CHANNELS; i++ )
{ {
// update rest of faders selected // update rest of faders selected
if ( vecpChanFader[i]->IsVisible() && vecpChanFader[i]->IsSelect() && ( i != iChannelIdx ) ) if ( vecpChanFader[i]->IsVisible() && vecpChanFader[i]->IsSelect() && ( i != iChannelIdx ) )
{ {
// temporaly unselect so it does not repeat this again and again... // synchronize faders with moving fader level (it is important
vecpChanFader[i]->SetFaderIsSelect ( false ); // to set the group flag to avoid inifinite looping)
vecpChanFader[i]->SetFaderLevel ( vecpChanFader[i]->GetFaderLevel() + iDiffLevel, true );
// "move" faders with moving fader level
vecpChanFader[i]->SetFaderLevel ( vecpChanFader[i]->GetFaderLevel() + iDiffLevel );
// back to selected status
vecpChanFader[i]->SetFaderIsSelect ( true );
} }
} }
} }

View file

@ -64,25 +64,28 @@ public:
void SetDisplayPans ( const bool eNDP ); void SetDisplayPans ( const bool eNDP );
QFrame* GetMainWidget() { return pFrame; } QFrame* GetMainWidget() { return pFrame; }
void UpdateSoloState ( const bool bNewOtherSoloState );
void SetFaderLevel ( const int iLevel );
void SetPanValue ( const int iPan ); void SetPanValue ( const int iPan );
void SetFaderIsSolo ( const bool bIsSolo ); void SetFaderIsSolo ( const bool bIsSolo );
void SetFaderIsMute ( const bool bIsMute ); void SetFaderIsMute ( const bool bIsMute );
void SetRemoteFaderIsMute ( const bool bIsMute ); void SetRemoteFaderIsMute ( const bool bIsMute );
void SetFaderIsSelect ( const bool bIsMute ); void SetFaderIsSelect ( const bool bIsMute );
void SetFaderLevel ( const int iLevel,
const bool bIsGroupUpdate = false );
int GetFaderLevel() { return pFader->value(); } int GetFaderLevel() { return pFader->value(); }
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; } void SetIsMyOwnFader() { bIsMyOwnFader = true; }
void UpdateSoloState ( const bool bNewOtherSoloState );
protected: protected:
double CalcFaderGain ( const int value ); double CalcFaderGain ( const int value );
void SetMute ( const bool bState ); void SetMute ( const bool bState );
void SendFaderLevelToServer ( const int iLevel );
void SendPanValueToServer ( const int iPan );
void SetupFaderTag ( const ESkillLevel eSkillLevel ); void SetupFaderTag ( const ESkillLevel eSkillLevel );
void SendPanValueToServer ( const int iPan );
void SendFaderLevelToServer ( const int iLevel,
const bool bIsGroupUpdate );
QFrame* pFrame; QFrame* pFrame;
@ -112,12 +115,16 @@ protected:
int iPreviousFaderLevel; int iPreviousFaderLevel;
public slots: public slots:
void OnLevelValueChanged ( int value ) { SendFaderLevelToServer ( value ); } void OnLevelValueChanged ( int value ) { SendFaderLevelToServer ( value, false ); }
void OnPanValueChanged ( int value ) { SendPanValueToServer ( value ); } void OnPanValueChanged ( int value ) { SendPanValueToServer ( value ); }
void OnMuteStateChanged ( int value ); void OnMuteStateChanged ( int value );
signals: signals:
void gainValueChanged ( double value, bool bIsMyOwnFader, int iDiffLevel ); void gainValueChanged ( double value,
bool bIsMyOwnFader,
bool bIsGroupUpdate,
int iDiffLevel );
void panValueChanged ( double value ); void panValueChanged ( double value );
void soloStateChanged ( int value ); void soloStateChanged ( int value );
}; };
@ -126,14 +133,24 @@ template<unsigned int slotId>
class CAudioMixerBoardSlots : public CAudioMixerBoardSlots<slotId - 1> class CAudioMixerBoardSlots : public CAudioMixerBoardSlots<slotId - 1>
{ {
public: public:
void OnChGainValueChanged ( double dValue, bool bIsMyOwnFader, int iDiffLevel ) { UpdateGainValue ( slotId - 1, dValue, bIsMyOwnFader, iDiffLevel ); } void OnChGainValueChanged ( double dValue,
bool bIsMyOwnFader,
bool bIsGroupUpdate,
int iDiffLevel ) { UpdateGainValue ( slotId - 1,
dValue,
bIsMyOwnFader,
bIsGroupUpdate,
iDiffLevel ); }
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, const double dValue,
const bool bIsMyOwnFader, const bool bIsMyOwnFader,
const bool bIsGroupUpdate,
const int iDiffLevel ) = 0; const int iDiffLevel ) = 0;
virtual void UpdatePanValue ( const int iChannelIdx, virtual void UpdatePanValue ( const int iChannelIdx,
const double dValue ) = 0; const double dValue ) = 0;
}; };
@ -149,7 +166,8 @@ class CAudioMixerBoard :
Q_OBJECT Q_OBJECT
public: public:
CAudioMixerBoard ( QWidget* parent = nullptr, Qt::WindowFlags f = nullptr ); CAudioMixerBoard ( QWidget* parent = nullptr,
Qt::WindowFlags f = nullptr );
void HideAll(); void HideAll();
void ApplyNewConClientList ( CVector<CChannelInfo>& vecChanInfo ); void ApplyNewConClientList ( CVector<CChannelInfo>& vecChanInfo );
@ -223,7 +241,9 @@ protected:
virtual void UpdateGainValue ( const int iChannelIdx, virtual void UpdateGainValue ( const int iChannelIdx,
const double dValue, const double dValue,
const bool bIsMyOwnFader, const bool bIsMyOwnFader,
const bool bIsGroupUpdate,
const int iDiffLevel ); const int iDiffLevel );
virtual void UpdatePanValue ( const int iChannelIdx, virtual void UpdatePanValue ( const int iChannelIdx,
const double dValue ); const double dValue );