diff --git a/ChangeLog b/ChangeLog index d99a04d2..388d7c84 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,9 @@ - added new instrument pictures for "Recorder", "Streamer" and "Listener" +- the solo state of a mixer fader is not exclusive any more and the solo + state is preserved if the number of mixer faders changes + 3.3.2 diff --git a/src/audiomixerboard.cpp b/src/audiomixerboard.cpp index c11c06c8..fcc90f83 100755 --- a/src/audiomixerboard.cpp +++ b/src/audiomixerboard.cpp @@ -214,8 +214,8 @@ void CChannelFader::SetMute ( const bool bState ) } else { - // only unmute if no other channel is on solo - if ( !bOtherChannelIsSolo ) + // only unmute if we are not solot but an other channel is on solo + if ( !bOtherChannelIsSolo || IsSolo() ) { // mute was unchecked, get current fader value and apply emit gainValueChanged ( CalcFaderGain ( GetFaderLevel() ) ); @@ -223,41 +223,16 @@ void CChannelFader::SetMute ( const bool bState ) } } -void CChannelFader::ResetSoloState() -{ - // reset solo state -> since solo state means that this channel is not - // muted but all others, we simply have to uncheck the check box (make - // sure the setChecked does not fire a signal) - pcbSolo->blockSignals ( true ); - { - pcbSolo->setChecked ( false ); - } - pcbSolo->blockSignals ( false ); -} - -void CChannelFader::SetOtherSoloState ( const bool bState ) +void CChannelFader::UpdateSoloState ( const bool bNewOtherSoloState ) { // store state (must be done before the SetMute() call!) - bOtherChannelIsSolo = bState; + bOtherChannelIsSolo = bNewOtherSoloState; - // check if we are in solo on state, in that case we first have to disable - // our solo state since only one channel can be set to solo - if ( bState && pcbSolo->isChecked() ) - { - // we do not want to fire a signal with the following set function - // -> block signals temporarily - pcbSolo->blockSignals ( true ); - { - pcbSolo->setChecked ( false ); - } - pcbSolo->blockSignals ( false ); - } - - // if other channel is solo, mute this channel, else enable channel gain - // (only enable channel gain if local mute switch is not set to on) + // mute overwrites solo -> if mute is active, do not change anything if ( !pcbMute->isChecked() ) { - SetMute ( bState ); + // mute channel if we are not solo but another channel is solo + SetMute ( ( !IsSolo() && bOtherChannelIsSolo ) ); } } @@ -387,26 +362,26 @@ CAudioMixerBoard::CAudioMixerBoard ( QWidget* parent, Qt::WindowFlags ) : QObject::connect ( vecpChanFader[18], SIGNAL ( gainValueChanged ( double ) ), this, SLOT ( OnGainValueChangedCh18 ( double ) ) ); QObject::connect ( vecpChanFader[19], SIGNAL ( gainValueChanged ( double ) ), this, SLOT ( OnGainValueChangedCh19 ( double ) ) ); - QObject::connect ( vecpChanFader[0], SIGNAL ( soloStateChanged ( int ) ), this, SLOT ( OnChSoloStateChangedCh0 ( int ) ) ); - QObject::connect ( vecpChanFader[1], SIGNAL ( soloStateChanged ( int ) ), this, SLOT ( OnChSoloStateChangedCh1 ( int ) ) ); - QObject::connect ( vecpChanFader[2], SIGNAL ( soloStateChanged ( int ) ), this, SLOT ( OnChSoloStateChangedCh2 ( int ) ) ); - QObject::connect ( vecpChanFader[3], SIGNAL ( soloStateChanged ( int ) ), this, SLOT ( OnChSoloStateChangedCh3 ( int ) ) ); - QObject::connect ( vecpChanFader[4], SIGNAL ( soloStateChanged ( int ) ), this, SLOT ( OnChSoloStateChangedCh4 ( int ) ) ); - QObject::connect ( vecpChanFader[5], SIGNAL ( soloStateChanged ( int ) ), this, SLOT ( OnChSoloStateChangedCh5 ( int ) ) ); - QObject::connect ( vecpChanFader[6], SIGNAL ( soloStateChanged ( int ) ), this, SLOT ( OnChSoloStateChangedCh6 ( int ) ) ); - QObject::connect ( vecpChanFader[7], SIGNAL ( soloStateChanged ( int ) ), this, SLOT ( OnChSoloStateChangedCh7 ( int ) ) ); - QObject::connect ( vecpChanFader[8], SIGNAL ( soloStateChanged ( int ) ), this, SLOT ( OnChSoloStateChangedCh8 ( int ) ) ); - QObject::connect ( vecpChanFader[9], SIGNAL ( soloStateChanged ( int ) ), this, SLOT ( OnChSoloStateChangedCh9 ( int ) ) ); - QObject::connect ( vecpChanFader[10], SIGNAL ( soloStateChanged ( int ) ), this, SLOT ( OnChSoloStateChangedCh10 ( int ) ) ); - QObject::connect ( vecpChanFader[11], SIGNAL ( soloStateChanged ( int ) ), this, SLOT ( OnChSoloStateChangedCh11 ( int ) ) ); - QObject::connect ( vecpChanFader[12], SIGNAL ( soloStateChanged ( int ) ), this, SLOT ( OnChSoloStateChangedCh12 ( int ) ) ); - QObject::connect ( vecpChanFader[13], SIGNAL ( soloStateChanged ( int ) ), this, SLOT ( OnChSoloStateChangedCh13 ( int ) ) ); - QObject::connect ( vecpChanFader[14], SIGNAL ( soloStateChanged ( int ) ), this, SLOT ( OnChSoloStateChangedCh14 ( int ) ) ); - QObject::connect ( vecpChanFader[15], SIGNAL ( soloStateChanged ( int ) ), this, SLOT ( OnChSoloStateChangedCh15 ( int ) ) ); - QObject::connect ( vecpChanFader[16], SIGNAL ( soloStateChanged ( int ) ), this, SLOT ( OnChSoloStateChangedCh16 ( int ) ) ); - QObject::connect ( vecpChanFader[17], SIGNAL ( soloStateChanged ( int ) ), this, SLOT ( OnChSoloStateChangedCh17 ( int ) ) ); - QObject::connect ( vecpChanFader[18], SIGNAL ( soloStateChanged ( int ) ), this, SLOT ( OnChSoloStateChangedCh18 ( int ) ) ); - QObject::connect ( vecpChanFader[19], SIGNAL ( soloStateChanged ( int ) ), this, SLOT ( OnChSoloStateChangedCh19 ( int ) ) ); + QObject::connect ( vecpChanFader[0], SIGNAL ( soloStateChanged ( int ) ), this, SLOT ( OnChSoloStateChanged() ) ); + QObject::connect ( vecpChanFader[1], SIGNAL ( soloStateChanged ( int ) ), this, SLOT ( OnChSoloStateChanged() ) ); + QObject::connect ( vecpChanFader[2], SIGNAL ( soloStateChanged ( int ) ), this, SLOT ( OnChSoloStateChanged() ) ); + QObject::connect ( vecpChanFader[3], SIGNAL ( soloStateChanged ( int ) ), this, SLOT ( OnChSoloStateChanged() ) ); + QObject::connect ( vecpChanFader[4], SIGNAL ( soloStateChanged ( int ) ), this, SLOT ( OnChSoloStateChanged() ) ); + QObject::connect ( vecpChanFader[5], SIGNAL ( soloStateChanged ( int ) ), this, SLOT ( OnChSoloStateChanged() ) ); + QObject::connect ( vecpChanFader[6], SIGNAL ( soloStateChanged ( int ) ), this, SLOT ( OnChSoloStateChanged() ) ); + QObject::connect ( vecpChanFader[7], SIGNAL ( soloStateChanged ( int ) ), this, SLOT ( OnChSoloStateChanged() ) ); + QObject::connect ( vecpChanFader[8], SIGNAL ( soloStateChanged ( int ) ), this, SLOT ( OnChSoloStateChanged() ) ); + QObject::connect ( vecpChanFader[9], SIGNAL ( soloStateChanged ( int ) ), this, SLOT ( OnChSoloStateChanged() ) ); + QObject::connect ( vecpChanFader[10], SIGNAL ( soloStateChanged ( int ) ), this, SLOT ( OnChSoloStateChanged() ) ); + QObject::connect ( vecpChanFader[11], SIGNAL ( soloStateChanged ( int ) ), this, SLOT ( OnChSoloStateChanged() ) ); + QObject::connect ( vecpChanFader[12], SIGNAL ( soloStateChanged ( int ) ), this, SLOT ( OnChSoloStateChanged() ) ); + QObject::connect ( vecpChanFader[13], SIGNAL ( soloStateChanged ( int ) ), this, SLOT ( OnChSoloStateChanged() ) ); + QObject::connect ( vecpChanFader[14], SIGNAL ( soloStateChanged ( int ) ), this, SLOT ( OnChSoloStateChanged() ) ); + QObject::connect ( vecpChanFader[15], SIGNAL ( soloStateChanged ( int ) ), this, SLOT ( OnChSoloStateChanged() ) ); + QObject::connect ( vecpChanFader[16], SIGNAL ( soloStateChanged ( int ) ), this, SLOT ( OnChSoloStateChanged() ) ); + QObject::connect ( vecpChanFader[17], SIGNAL ( soloStateChanged ( int ) ), this, SLOT ( OnChSoloStateChanged() ) ); + QObject::connect ( vecpChanFader[18], SIGNAL ( soloStateChanged ( int ) ), this, SLOT ( OnChSoloStateChanged() ) ); + QObject::connect ( vecpChanFader[19], SIGNAL ( soloStateChanged ( int ) ), this, SLOT ( OnChSoloStateChanged() ) ); } void CAudioMixerBoard::SetServerName ( const QString& strNewServerName ) @@ -465,18 +440,12 @@ void CAudioMixerBoard::ApplyNewConClientList ( CVector& vecChanInf // check if fader was already in use -> preserve gain value if ( !vecpChanFader[i]->IsVisible() ) { + // the fader was not in use, reset everything for new client vecpChanFader[i]->Reset(); // show fader vecpChanFader[i]->Show(); } - else - { - // by definition disable all Solo switches if the number of - // channels at the server has changed - vecpChanFader[i]->SetOtherSoloState ( false ); - vecpChanFader[i]->ResetSoloState(); - } // restore gain (if new name is different from the current one) if ( vecpChanFader[i]->GetReceivedName().compare ( vecChanInfo[j].strName ) ) @@ -523,36 +492,37 @@ void CAudioMixerBoard::ApplyNewConClientList ( CVector& vecChanInf } } + // update the solo states since if any channel was on solo and a new client + // has just connected, the new channel must be muted + UpdateSoloStates(); + // emit status of connected clients emit NumClientsChanged ( iNumConnectedClients ); } -void CAudioMixerBoard::OnChSoloStateChanged ( const int iChannelIdx, - const int iValue ) +void CAudioMixerBoard::UpdateSoloStates() { - // if channel iChannelIdx has just activated the solo switch, mute all - // other channels, else enable them again - const bool bSetOtherSoloState = - ( static_cast ( iValue ) == Qt::Checked ); + // first check if any channel has a solo state active + bool bAnyChannelIsSolo = false; - // apply "other solo state" for all other channels for ( int i = 0; i < MAX_NUM_CHANNELS; i++ ) { - if ( i != iChannelIdx ) + // check if fader is in use and has solo state active + if ( vecpChanFader[i]->IsVisible() && vecpChanFader[i]->IsSolo() ) { - // check if fader is in use - if ( vecpChanFader[i]->IsVisible() ) - { - vecpChanFader[i]->SetOtherSoloState ( bSetOtherSoloState ); - } + bAnyChannelIsSolo = true; + continue; } } - // set "other solo state" always to false for the current fader at which the - // status was changed because if solo is enabled, it has to be "false" and - // in case solo is just disabled (check was removed by the user), also no - // other channel can be solo at this time - vecpChanFader[iChannelIdx]->SetOtherSoloState ( false ); + // now update the solo state of all active faders + for ( int i = 0; i < MAX_NUM_CHANNELS; i++ ) + { + if ( vecpChanFader[i]->IsVisible() ) + { + vecpChanFader[i]->UpdateSoloState ( bAnyChannelIsSolo ); + } + } } void CAudioMixerBoard::OnGainValueChanged ( const int iChannelIdx, diff --git a/src/audiomixerboard.h b/src/audiomixerboard.h index a8399695..e39b265e 100755 --- a/src/audiomixerboard.h +++ b/src/audiomixerboard.h @@ -52,11 +52,10 @@ public: void Show() { pFrame->show(); } void Hide() { pFrame->hide(); } bool IsVisible() { return pLabel->isVisible(); } + bool IsSolo() { return pcbSolo->isChecked(); } void SetGUIDesign ( const EGUIDesign eNewDesign ); - void ResetSoloState(); - void SetOtherSoloState ( const bool bState ); - + void UpdateSoloState ( const bool bNewOtherSoloState ); void SetFaderLevel ( const int iLevel ); int GetFaderLevel() { return pFader->value(); } void Reset(); @@ -107,8 +106,8 @@ public: protected: int GetStoredFaderLevel ( const CChannelInfo& ChanInfo ); void StoreFaderLevel ( CChannelFader* pChanFader ); + void UpdateSoloStates(); - void OnChSoloStateChanged ( const int iChannelIdx, const int iValue ); void OnGainValueChanged ( const int iChannelIdx, const double dValue ); CVector vecpChanFader; @@ -138,26 +137,7 @@ public slots: void OnGainValueChangedCh18 ( double dValue ) { OnGainValueChanged ( 18, dValue ); } void OnGainValueChangedCh19 ( double dValue ) { OnGainValueChanged ( 19, dValue ); } - void OnChSoloStateChangedCh0 ( int value ) { OnChSoloStateChanged ( 0, value ); } - void OnChSoloStateChangedCh1 ( int value ) { OnChSoloStateChanged ( 1, value ); } - void OnChSoloStateChangedCh2 ( int value ) { OnChSoloStateChanged ( 2, value ); } - void OnChSoloStateChangedCh3 ( int value ) { OnChSoloStateChanged ( 3, value ); } - void OnChSoloStateChangedCh4 ( int value ) { OnChSoloStateChanged ( 4, value ); } - void OnChSoloStateChangedCh5 ( int value ) { OnChSoloStateChanged ( 5, value ); } - void OnChSoloStateChangedCh6 ( int value ) { OnChSoloStateChanged ( 6, value ); } - void OnChSoloStateChangedCh7 ( int value ) { OnChSoloStateChanged ( 7, value ); } - void OnChSoloStateChangedCh8 ( int value ) { OnChSoloStateChanged ( 8, value ); } - void OnChSoloStateChangedCh9 ( int value ) { OnChSoloStateChanged ( 9, value ); } - void OnChSoloStateChangedCh10 ( int value ) { OnChSoloStateChanged ( 10, value ); } - void OnChSoloStateChangedCh11 ( int value ) { OnChSoloStateChanged ( 11, value ); } - void OnChSoloStateChangedCh12 ( int value ) { OnChSoloStateChanged ( 12, value ); } - void OnChSoloStateChangedCh13 ( int value ) { OnChSoloStateChanged ( 13, value ); } - void OnChSoloStateChangedCh14 ( int value ) { OnChSoloStateChanged ( 14, value ); } - void OnChSoloStateChangedCh15 ( int value ) { OnChSoloStateChanged ( 15, value ); } - void OnChSoloStateChangedCh16 ( int value ) { OnChSoloStateChanged ( 16, value ); } - void OnChSoloStateChangedCh17 ( int value ) { OnChSoloStateChanged ( 17, value ); } - void OnChSoloStateChangedCh18 ( int value ) { OnChSoloStateChanged ( 18, value ); } - void OnChSoloStateChangedCh19 ( int value ) { OnChSoloStateChanged ( 19, value ); } + void OnChSoloStateChanged() { UpdateSoloStates(); } signals: void ChangeChanGain ( int iId, double dGain );