diff --git a/ChangeLog b/ChangeLog index 4c94155f..70f99504 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,9 @@ - true stereo reverberation effect (previously it was a mono reverberation effect on both stereo channels) +- store fader solo state + +- bug fix: the fader level could not be changed if fader was on solo 3.3.3 diff --git a/src/audiomixerboard.cpp b/src/audiomixerboard.cpp index 770547e9..b1d560db 100755 --- a/src/audiomixerboard.cpp +++ b/src/audiomixerboard.cpp @@ -188,6 +188,12 @@ void CChannelFader::SetFaderLevel ( const int iLevel ) } } +void CChannelFader::SetFaderIsSolo ( const bool bIsSolo ) +{ + // changing the state automatically emits the signal, too + pcbSolo->setChecked ( bIsSolo ); +} + void CChannelFader::SendFaderLevelToServer ( const int iLevel ) { // if mute flag is set or other channel is on solo, do not apply the new @@ -234,7 +240,7 @@ void CChannelFader::UpdateSoloState ( const bool bNewOtherSoloState ) if ( !pcbMute->isChecked() ) { // mute channel if we are not solo but another channel is solo - SetMute ( ( !IsSolo() && bOtherChannelIsSolo ) ); + SetMute ( bOtherChannelIsSolo && !IsSolo() ); } } @@ -318,8 +324,9 @@ QString CChannelFader::GenFaderText ( const CChannelInfo& ChanInfo ) \******************************************************************************/ CAudioMixerBoard::CAudioMixerBoard ( QWidget* parent, Qt::WindowFlags ) : QGroupBox ( parent ), - vecStoredFaderTags ( MAX_NUM_STORED_FADER_LEVELS, "" ), - vecStoredFaderLevels ( MAX_NUM_STORED_FADER_LEVELS, AUD_MIX_FADER_MAX ) + vecStoredFaderTags ( MAX_NUM_STORED_FADER_SETTINGS, "" ), + vecStoredFaderLevels ( MAX_NUM_STORED_FADER_SETTINGS, AUD_MIX_FADER_MAX ), + vecStoredFaderIsSolo ( MAX_NUM_STORED_FADER_SETTINGS, false ) { // set title text (default: no server given) SetServerName ( "" ); @@ -414,7 +421,7 @@ void CAudioMixerBoard::HideAll() for ( int i = 0; i < MAX_NUM_CHANNELS; i++ ) { // before hiding the fader, store its level (if some conditions are fullfilled) - StoreFaderLevel ( vecpChanFader[i] ); + StoreFaderSettings ( vecpChanFader[i] ); vecpChanFader[i]->Hide(); } @@ -453,15 +460,16 @@ void CAudioMixerBoard::ApplyNewConClientList ( CVector& vecChanInf if ( vecpChanFader[i]->GetReceivedName().compare ( vecChanInfo[j].strName ) ) { // the text has actually changed, search in the list of - // stored gains if we have a matching entry - const int iStoredFaderLevel = - GetStoredFaderLevel ( vecChanInfo[j] ); + // stored settings if we have a matching entry + int iStoredFaderLevel; + bool bStoredFaderIsSolo; - // only apply retreived fader level if it is different from - // the default one - if ( iStoredFaderLevel != AUD_MIX_FADER_MAX ) + if ( GetStoredFaderSettings ( vecChanInfo[j], + iStoredFaderLevel, + bStoredFaderIsSolo ) ) { vecpChanFader[i]->SetFaderLevel ( iStoredFaderLevel ); + vecpChanFader[i]->SetFaderIsSolo ( bStoredFaderIsSolo ); } } @@ -488,7 +496,7 @@ void CAudioMixerBoard::ApplyNewConClientList ( CVector& vecChanInf if ( !bFaderIsUsed ) { // before hiding the fader, store its level (if some conditions are fullfilled) - StoreFaderLevel ( vecpChanFader[i] ); + StoreFaderSettings ( vecpChanFader[i] ); vecpChanFader[i]->Hide(); } @@ -533,39 +541,45 @@ void CAudioMixerBoard::OnGainValueChanged ( const int iChannelIdx, emit ChangeChanGain ( iChannelIdx, dValue ); } -void CAudioMixerBoard::StoreFaderLevel ( CChannelFader* pChanFader ) +void CAudioMixerBoard::StoreFaderSettings ( CChannelFader* pChanFader ) { // if the fader was visible and the name is not empty, we store the old gain if ( pChanFader->IsVisible() && !pChanFader->GetReceivedName().isEmpty() ) { - CVector viOldStoredFaderLevels ( vecStoredFaderLevels ); + CVector viOldStoredFaderLevels ( vecStoredFaderLevels ); + CVector vbOldStoredFaderIsSolo ( vecStoredFaderIsSolo ); // init temporary list count (may be overwritten later on) int iTempListCnt = 0; - // check if the new fader level is the default one -> in that case the - // entry must be deleted from the list if currently present in the list - const bool bNewLevelIsDefaultFaderLevel = - ( pChanFader->GetFaderLevel() == AUD_MIX_FADER_MAX ); + // check if the new fader level and solo state is the default one -> in + // that case the entry must be deleted from the list if currently + // present in the list + const bool bNewFaderLevelAndSoloIsDefault = + ( + ( pChanFader->GetFaderLevel() == AUD_MIX_FADER_MAX ) && + ( !pChanFader->IsSolo() ) // solo=OFF is the default + ); // if the new value is not the default value, put it on the top of the // list, otherwise just remove it from the list const int iOldIdx = vecStoredFaderTags.StringFiFoWithCompare ( pChanFader->GetReceivedName(), - !bNewLevelIsDefaultFaderLevel ); + !bNewFaderLevelAndSoloIsDefault ); - if ( !bNewLevelIsDefaultFaderLevel ) + if ( !bNewFaderLevelAndSoloIsDefault ) { - // current fader level is at the top of the list + // current fader level and solo state is at the top of the list vecStoredFaderLevels[0] = pChanFader->GetFaderLevel(); + vecStoredFaderIsSolo[0] = pChanFader->IsSolo(); iTempListCnt = 1; } - for ( int iIdx = 0; iIdx < MAX_NUM_STORED_FADER_LEVELS; iIdx++ ) + for ( int iIdx = 0; iIdx < MAX_NUM_STORED_FADER_SETTINGS; iIdx++ ) { // first check if we still have space in our data storage - if ( iTempListCnt < MAX_NUM_STORED_FADER_LEVELS ) + if ( iTempListCnt < MAX_NUM_STORED_FADER_SETTINGS ) { // check for the old index of the current entry (this has to be // skipped), note that per definition: the old index is an illegal @@ -573,6 +587,7 @@ void CAudioMixerBoard::StoreFaderLevel ( CChannelFader* pChanFader ) if ( iIdx != iOldIdx ) { vecStoredFaderLevels[iTempListCnt] = viOldStoredFaderLevels[iIdx]; + vecStoredFaderIsSolo[iTempListCnt] = vbOldStoredFaderIsSolo[iIdx]; iTempListCnt++; } @@ -581,22 +596,28 @@ void CAudioMixerBoard::StoreFaderLevel ( CChannelFader* pChanFader ) } } -int CAudioMixerBoard::GetStoredFaderLevel ( const CChannelInfo& ChanInfo ) +bool CAudioMixerBoard::GetStoredFaderSettings ( const CChannelInfo& ChanInfo, + int& iStoredFaderLevel, + bool& bStoredFaderIsSolo ) { // only do the check if the name string is not empty if ( !ChanInfo.strName.isEmpty() ) { - for ( int iIdx = 0; iIdx < MAX_NUM_STORED_FADER_LEVELS; iIdx++ ) + for ( int iIdx = 0; iIdx < MAX_NUM_STORED_FADER_SETTINGS; iIdx++ ) { // check if fader text is already known in the list if ( !vecStoredFaderTags[iIdx].compare ( ChanInfo.strName ) ) { - // use stored level value (return it) - return vecStoredFaderLevels[iIdx]; + // copy stored settings values + iStoredFaderLevel = vecStoredFaderLevels[iIdx]; + bStoredFaderIsSolo = vecStoredFaderIsSolo[iIdx]; + + // values found and copied, return OK + return true; } } } - // return default value - return AUD_MIX_FADER_MAX; + // return "not OK" since we did not find matching fader settings + return false; } diff --git a/src/audiomixerboard.h b/src/audiomixerboard.h index a5be1e22..642a309c 100755 --- a/src/audiomixerboard.h +++ b/src/audiomixerboard.h @@ -57,6 +57,7 @@ public: void UpdateSoloState ( const bool bNewOtherSoloState ); void SetFaderLevel ( const int iLevel ); + void SetFaderIsSolo ( const bool bIsSolo ); int GetFaderLevel() { return pFader->value(); } void Reset(); @@ -102,10 +103,13 @@ public: // settings CVector vecStoredFaderTags; CVector vecStoredFaderLevels; + CVector vecStoredFaderIsSolo; protected: - int GetStoredFaderLevel ( const CChannelInfo& ChanInfo ); - void StoreFaderLevel ( CChannelFader* pChanFader ); + bool GetStoredFaderSettings ( const CChannelInfo& ChanInfo, + int& iStoredFaderLevel, + bool& bStoredFaderIsSolo ); + void StoreFaderSettings ( CChannelFader* pChanFader ); void UpdateSoloStates(); void OnGainValueChanged ( const int iChannelIdx, const double dValue ); diff --git a/src/client.cpp b/src/client.cpp index dc4cea11..3cc92eae 100755 --- a/src/client.cpp +++ b/src/client.cpp @@ -29,8 +29,9 @@ CClient::CClient ( const quint16 iPortNumber ) : vstrIPAddress ( MAX_NUM_SERVER_ADDR_ITEMS, "" ), ChannelInfo (), - vecStoredFaderTags ( MAX_NUM_STORED_FADER_LEVELS, "" ), - vecStoredFaderLevels ( MAX_NUM_STORED_FADER_LEVELS, AUD_MIX_FADER_MAX ), + vecStoredFaderTags ( MAX_NUM_STORED_FADER_SETTINGS, "" ), + vecStoredFaderLevels ( MAX_NUM_STORED_FADER_SETTINGS, AUD_MIX_FADER_MAX ), + vecStoredFaderIsSolo ( MAX_NUM_STORED_FADER_SETTINGS, false ), vecWindowPosMain (), // empty array vecWindowPosSettings (), // empty array vecWindowPosChat (), // empty array diff --git a/src/client.h b/src/client.h index ec5b0c45..76216727 100755 --- a/src/client.h +++ b/src/client.h @@ -269,6 +269,7 @@ public: CChannelCoreInfo ChannelInfo; CVector vecStoredFaderTags; CVector vecStoredFaderLevels; + CVector vecStoredFaderIsSolo; // window position/state settings QByteArray vecWindowPosMain; diff --git a/src/clientdlg.cpp b/src/clientdlg.cpp index 4ca2eda0..1acf07b2 100755 --- a/src/clientdlg.cpp +++ b/src/clientdlg.cpp @@ -237,6 +237,7 @@ CClientDlg::CClientDlg ( CClient* pNCliP, // restore fader settings MainMixerBoard->vecStoredFaderTags = pClient->vecStoredFaderTags; MainMixerBoard->vecStoredFaderLevels = pClient->vecStoredFaderLevels; + MainMixerBoard->vecStoredFaderIsSolo = pClient->vecStoredFaderIsSolo; // init fader tag line edit and instrument picture edtFaderTag->setText ( pClient->ChannelInfo.strName ); @@ -564,6 +565,7 @@ void CClientDlg::closeEvent ( QCloseEvent* Event ) MainMixerBoard->HideAll(); pClient->vecStoredFaderTags = MainMixerBoard->vecStoredFaderTags; pClient->vecStoredFaderLevels = MainMixerBoard->vecStoredFaderLevels; + pClient->vecStoredFaderIsSolo = MainMixerBoard->vecStoredFaderIsSolo; // default implementation of this event handler routine Event->accept(); diff --git a/src/global.h b/src/global.h index 58c9fef9..98d3f666 100755 --- a/src/global.h +++ b/src/global.h @@ -171,8 +171,8 @@ LED bar: lbr // maximum number of elemts in the server address combo box #define MAX_NUM_SERVER_ADDR_ITEMS 6 -// maximum number of fader levels to be stored (together with the fader tags) -#define MAX_NUM_STORED_FADER_LEVELS 10 +// maximum number of fader settings to be stored (together with the fader tags) +#define MAX_NUM_STORED_FADER_SETTINGS 20 // defines for LED input level meter #define NUM_STEPS_INP_LEV_METER 8 diff --git a/src/settings.cpp b/src/settings.cpp index c24291d3..7433d2fd 100755 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -67,7 +67,7 @@ void CSettings::Load() } // stored fader tags - for ( iIdx = 0; iIdx < MAX_NUM_STORED_FADER_LEVELS; iIdx++ ) + for ( iIdx = 0; iIdx < MAX_NUM_STORED_FADER_SETTINGS; iIdx++ ) { pClient->vecStoredFaderTags[iIdx] = FromBase64ToString ( GetIniSetting ( IniXMLDocument, "client", @@ -75,15 +75,27 @@ void CSettings::Load() } // stored fader levels - for ( iIdx = 0; iIdx < MAX_NUM_STORED_FADER_LEVELS; iIdx++ ) + for ( iIdx = 0; iIdx < MAX_NUM_STORED_FADER_SETTINGS; iIdx++ ) { - if ( GetNumericIniSet ( IniXMLDocument, "client", QString ( "storedfaderlevel%1" ).arg ( iIdx ), - 0, AUD_MIX_FADER_MAX, iValue ) ) + if ( GetNumericIniSet ( IniXMLDocument, "client", + QString ( "storedfaderlevel%1" ).arg ( iIdx ), + 0, AUD_MIX_FADER_MAX, iValue ) ) { pClient->vecStoredFaderLevels[iIdx] = iValue; } } + // stored fader solo state + for ( iIdx = 0; iIdx < MAX_NUM_STORED_FADER_SETTINGS; iIdx++ ) + { + if ( GetFlagIniSet ( IniXMLDocument, "client", + QString ( "storedfaderissolo%1" ).arg ( iIdx ), + bValue ) ) + { + pClient->vecStoredFaderIsSolo[iIdx] = bValue; + } + } + // name pClient->ChannelInfo.strName = FromBase64ToString ( GetIniSetting ( IniXMLDocument, "client", "name_base64" ) ); @@ -331,7 +343,7 @@ void CSettings::Save() } // stored fader tags - for ( iIdx = 0; iIdx < MAX_NUM_STORED_FADER_LEVELS; iIdx++ ) + for ( iIdx = 0; iIdx < MAX_NUM_STORED_FADER_SETTINGS; iIdx++ ) { PutIniSetting ( IniXMLDocument, "client", QString ( "storedfadertag%1_base64" ).arg ( iIdx ), @@ -339,13 +351,21 @@ void CSettings::Save() } // stored fader levels - for ( iIdx = 0; iIdx < MAX_NUM_STORED_FADER_LEVELS; iIdx++ ) + for ( iIdx = 0; iIdx < MAX_NUM_STORED_FADER_SETTINGS; iIdx++ ) { SetNumericIniSet ( IniXMLDocument, "client", QString ( "storedfaderlevel%1" ).arg ( iIdx ), pClient->vecStoredFaderLevels[iIdx] ); } + // stored fader solo states + for ( iIdx = 0; iIdx < MAX_NUM_STORED_FADER_SETTINGS; iIdx++ ) + { + SetFlagIniSet ( IniXMLDocument, "client", + QString ( "storedfaderissolo%1" ).arg ( iIdx ), + pClient->vecStoredFaderIsSolo[iIdx] ); + } + // name PutIniSetting ( IniXMLDocument, "client", "name_base64", ToBase64 ( pClient->ChannelInfo.strName ) ); diff --git a/src/util.h b/src/util.h index b5c1fce5..7cc7669f 100755 --- a/src/util.h +++ b/src/util.h @@ -128,46 +128,45 @@ public: // this function simply converts the type of size to integer inline int Size() const { return std::vector::size(); } +#ifdef _DEBUG_ // This operator allows for a l-value assignment of this object: // CVector[x] = y is possible inline TData& operator[] ( const int iPos ) { -#ifdef _DEBUG_ if ( ( iPos < 0 ) || ( iPos > Size() - 1 ) ) { DebugError ( "Writing vector out of bounds", "Vector size", Size(), "New parameter", iPos ); } -#endif + return std::vector::operator[] ( iPos ); } inline TData operator[] ( const int iPos ) const { -#ifdef _DEBUG_ if ( ( iPos < 0 ) || ( iPos > Size() - 1 ) ) { DebugError ( "Reading vector out of bounds", "Vector size", Size(), "New parameter", iPos ); } -#endif + return std::vector::operator[] ( iPos ); } inline CVector& operator= ( const CVector& vecI ) { -#ifdef _DEBUG_ // vectors which shall be copied MUST have same size! if ( vecI.Size() != Size() ) { DebugError ( "Vector operator=() different size", "Vector size", Size(), "New parameter", vecI.Size() ); } -#endif + std::vector::operator= ( vecI ); return *this; } +#endif };