store fader solo state

This commit is contained in:
Volker Fischer 2014-01-19 10:51:31 +00:00
parent 27c5f29b1a
commit 180837f70b
9 changed files with 97 additions and 46 deletions

View File

@ -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

View File

@ -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<CChannelInfo>& 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<CChannelInfo>& 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<int> viOldStoredFaderLevels ( vecStoredFaderLevels );
CVector<int> viOldStoredFaderLevels ( vecStoredFaderLevels );
CVector<bool> 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;
}

View File

@ -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<QString> vecStoredFaderTags;
CVector<int> vecStoredFaderLevels;
CVector<bool> 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 );

View File

@ -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

View File

@ -269,6 +269,7 @@ public:
CChannelCoreInfo ChannelInfo;
CVector<QString> vecStoredFaderTags;
CVector<int> vecStoredFaderLevels;
CVector<bool> vecStoredFaderIsSolo;
// window position/state settings
QByteArray vecWindowPosMain;

View File

@ -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();

View File

@ -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

View File

@ -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 ) );

View File

@ -128,46 +128,45 @@ public:
// this function simply converts the type of size to integer
inline int Size() const { return std::vector<TData>::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<TData>::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<TData>::operator[] ( iPos );
}
inline CVector<TData>& operator= ( const CVector<TData>& 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<TData>::operator= ( vecI );
return *this;
}
#endif
};