support storing group state

This commit is contained in:
Volker Fischer 2020-07-02 17:04:05 +02:00
parent 6df966a757
commit f22762d7ef
8 changed files with 88 additions and 56 deletions

View file

@ -5,7 +5,7 @@
3.5.9git
- bug fix: grouping faders in the client should be proportional (see discussion in #202)
- bug fix: grouping faders in the client should be proportional (see discussion in #202, #419)
TODO bug fix: incorrect selection of UI language (#408) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!

View file

@ -379,11 +379,6 @@ void CChannelFader::SetPanValue ( const int iPan )
}
}
void CChannelFader::SetFaderIsSelect ( const bool bIsSelected )
{
pcbGroup->setChecked ( bIsSelected );
}
void CChannelFader::SetFaderIsSolo ( const bool bIsSolo )
{
// changing the state automatically emits the signal, too
@ -665,6 +660,7 @@ CAudioMixerBoard::CAudioMixerBoard ( QWidget* parent, Qt::WindowFlags ) :
vecStoredPanValues ( MAX_NUM_STORED_FADER_SETTINGS, AUD_MIX_PAN_MAX / 2 ),
vecStoredFaderIsSolo ( MAX_NUM_STORED_FADER_SETTINGS, false ),
vecStoredFaderIsMute ( MAX_NUM_STORED_FADER_SETTINGS, false ),
vecStoredFaderGroupID ( MAX_NUM_STORED_FADER_SETTINGS, INVALID_INDEX ),
iNewClientFaderLevel ( 100 ),
bDisplayPans ( false ),
bIsPanSupported ( false ),
@ -967,17 +963,20 @@ void CAudioMixerBoard::ApplyNewConClientList ( CVector<CChannelInfo>& vecChanInf
int iStoredPanValue;
bool bStoredFaderIsSolo;
bool bStoredFaderIsMute;
int iGroupID;
if ( GetStoredFaderSettings ( vecChanInfo[j],
iStoredFaderLevel,
iStoredPanValue,
bStoredFaderIsSolo,
bStoredFaderIsMute ) )
bStoredFaderIsMute,
iGroupID ) )
{
vecpChanFader[i]->SetFaderLevel ( iStoredFaderLevel );
vecpChanFader[i]->SetPanValue ( iStoredPanValue );
vecpChanFader[i]->SetFaderIsSolo ( bStoredFaderIsSolo );
vecpChanFader[i]->SetFaderIsMute ( bStoredFaderIsMute );
vecpChanFader[i]->SetGroupID ( iGroupID ); // Must be the last to be set in the fader!
}
}
@ -1076,13 +1075,13 @@ void CAudioMixerBoard::UpdateGainValue ( const int iChannelIdx,
// if this fader is selected, all other in the group must be updated as
// 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 )
if ( ( vecpChanFader[iChannelIdx]->GetGroupID() != INVALID_INDEX ) && !bIsGroupUpdate )
{
for ( int i = 0; i < MAX_NUM_CHANNELS; i++ )
{
// update rest of faders selected
if ( vecpChanFader[i]->IsVisible() &&
vecpChanFader[i]->IsSelect() &&
( vecpChanFader[i]->GetGroupID() == vecpChanFader[iChannelIdx]->GetGroupID() ) &&
( i != iChannelIdx ) &&
( dLevelRatio >= 0 ) )
{
@ -1110,6 +1109,7 @@ void CAudioMixerBoard::StoreFaderSettings ( CChannelFader* pChanFader )
CVector<int> viOldStoredPanValues ( vecStoredPanValues );
CVector<int> vbOldStoredFaderIsSolo ( vecStoredFaderIsSolo );
CVector<int> vbOldStoredFaderIsMute ( vecStoredFaderIsMute );
CVector<int> vbOldStoredFaderGroupID ( vecStoredFaderGroupID );
// init temporary list count (may be overwritten later on)
int iTempListCnt = 0;
@ -1124,6 +1124,7 @@ void CAudioMixerBoard::StoreFaderSettings ( CChannelFader* pChanFader )
vecStoredPanValues[0] = pChanFader->GetPanValue();
vecStoredFaderIsSolo[0] = pChanFader->IsSolo();
vecStoredFaderIsMute[0] = pChanFader->IsMute();
vecStoredFaderGroupID[0] = pChanFader->GetGroupID();
iTempListCnt = 1;
for ( int iIdx = 0; iIdx < MAX_NUM_STORED_FADER_SETTINGS; iIdx++ )
@ -1140,6 +1141,7 @@ void CAudioMixerBoard::StoreFaderSettings ( CChannelFader* pChanFader )
vecStoredPanValues[iTempListCnt] = viOldStoredPanValues[iIdx];
vecStoredFaderIsSolo[iTempListCnt] = vbOldStoredFaderIsSolo[iIdx];
vecStoredFaderIsMute[iTempListCnt] = vbOldStoredFaderIsMute[iIdx];
vecStoredFaderGroupID[iTempListCnt] = vbOldStoredFaderGroupID[iIdx];
iTempListCnt++;
}
@ -1152,7 +1154,8 @@ bool CAudioMixerBoard::GetStoredFaderSettings ( const CChannelInfo& ChanInfo,
int& iStoredFaderLevel,
int& iStoredPanValue,
bool& bStoredFaderIsSolo,
bool& bStoredFaderIsMute )
bool& bStoredFaderIsMute,
int& iGroupID )
{
// only do the check if the name string is not empty
if ( !ChanInfo.strName.isEmpty() )
@ -1167,6 +1170,7 @@ bool CAudioMixerBoard::GetStoredFaderSettings ( const CChannelInfo& ChanInfo,
iStoredPanValue = vecStoredPanValues[iIdx];
bStoredFaderIsSolo = vecStoredFaderIsSolo[iIdx] != 0;
bStoredFaderIsMute = vecStoredFaderIsMute[iIdx] != 0;
iGroupID = vecStoredFaderGroupID[iIdx];
// values found and copied, return OK
return true;

View file

@ -57,7 +57,7 @@ public:
bool IsVisible() { return !pFrame->isHidden(); }
bool IsSolo() { return pcbSolo->isChecked(); }
bool IsMute() { return pcbMute->isChecked(); }
bool IsSelect() { return pcbGroup->isChecked(); }
int GetGroupID() { return pcbGroup->isChecked() ? 0 : INVALID_INDEX; }
void SetGUIDesign ( const EGUIDesign eNewDesign );
void SetDisplayChannelLevel ( const bool eNDCL );
bool GetDisplayChannelLevel();
@ -67,8 +67,8 @@ public:
void SetPanValue ( const int iPan );
void SetFaderIsSolo ( const bool bIsSolo );
void SetFaderIsMute ( const bool bIsMute );
void SetGroupID ( const int iGroupID ) { pcbGroup->setChecked ( iGroupID != INVALID_INDEX ); }
void SetRemoteFaderIsMute ( const bool bIsMute );
void SetFaderIsSelect ( const bool bIsMute );
void SetFaderLevel ( const double dLevel,
const bool bIsGroupUpdate = false );
@ -203,6 +203,7 @@ public:
CVector<int> vecStoredPanValues;
CVector<int> vecStoredFaderIsSolo;
CVector<int> vecStoredFaderIsMute;
CVector<int> vecStoredFaderGroupID;
int iNewClientFaderLevel;
protected:
@ -225,7 +226,8 @@ protected:
int& iStoredFaderLevel,
int& iStoredPanValue,
bool& bStoredFaderIsSolo,
bool& bStoredFaderIsMute );
bool& bStoredFaderIsMute,
int& iGroupID );
void StoreFaderSettings ( CChannelFader* pChanFader );
void UpdateSoloStates();

View file

@ -38,6 +38,7 @@ CClient::CClient ( const quint16 iPortNumber,
vecStoredPanValues ( MAX_NUM_STORED_FADER_SETTINGS, AUD_MIX_PAN_MAX / 2 ),
vecStoredFaderIsSolo ( MAX_NUM_STORED_FADER_SETTINGS, false ),
vecStoredFaderIsMute ( MAX_NUM_STORED_FADER_SETTINGS, false ),
vecStoredFaderGroupID ( MAX_NUM_STORED_FADER_SETTINGS, INVALID_INDEX ),
iNewClientFaderLevel ( 100 ),
bConnectDlgShowAllMusicians ( true ),
strClientName ( strNClientName ),

View file

@ -285,6 +285,7 @@ public:
CVector<int> vecStoredPanValues;
CVector<int> vecStoredFaderIsSolo;
CVector<int> vecStoredFaderIsMute;
CVector<int> vecStoredFaderGroupID;
int iNewClientFaderLevel;
bool bConnectDlgShowAllMusicians;
QString strClientName;

View file

@ -194,6 +194,7 @@ CClientDlg::CClientDlg ( CClient* pNCliP,
MainMixerBoard->vecStoredPanValues = pClient->vecStoredPanValues;
MainMixerBoard->vecStoredFaderIsSolo = pClient->vecStoredFaderIsSolo;
MainMixerBoard->vecStoredFaderIsMute = pClient->vecStoredFaderIsMute;
MainMixerBoard->vecStoredFaderGroupID = pClient->vecStoredFaderGroupID;
MainMixerBoard->iNewClientFaderLevel = pClient->iNewClientFaderLevel;
// init status label
@ -602,6 +603,7 @@ void CClientDlg::closeEvent ( QCloseEvent* Event )
pClient->vecStoredPanValues = MainMixerBoard->vecStoredPanValues;
pClient->vecStoredFaderIsSolo = MainMixerBoard->vecStoredFaderIsSolo;
pClient->vecStoredFaderIsMute = MainMixerBoard->vecStoredFaderIsMute;
pClient->vecStoredFaderGroupID = MainMixerBoard->vecStoredFaderGroupID;
pClient->iNewClientFaderLevel = MainMixerBoard->iNewClientFaderLevel;
pClient->bConnectDlgShowAllMusicians = ConnectDlg.GetShowAllMusicians();

View file

@ -152,6 +152,9 @@ LED bar: lbr
#define AUD_MIX_FADER_MAX 100
#define AUD_MIX_PAN_MAX 100
// maximum number of fader groups
#define MAX_NUM_FADER_GROUPS 10
// maximum number of recognized sound cards installed in the system
#define MAX_NUMBER_SOUND_CARDS 129 // e.g. 16 inputs, 8 outputs + default entry (MacOS)

View file

@ -278,6 +278,17 @@ void CClientSettings::ReadFromXML ( const QDomDocument& IniXMLDocument )
}
}
// stored fader group ID
for ( iIdx = 0; iIdx < MAX_NUM_STORED_FADER_SETTINGS; iIdx++ )
{
if ( GetNumericIniSet ( IniXMLDocument, "client",
QString ( "storedgroupid%1" ).arg ( iIdx ),
0, MAX_NUM_FADER_GROUPS, iValue ) )
{
pClient->vecStoredFaderGroupID[iIdx] = iValue;
}
}
// new client level
if ( GetNumericIniSet ( IniXMLDocument, "client", "newclientlevel",
0, 100, iValue ) )
@ -585,6 +596,14 @@ void CClientSettings::WriteToXML ( QDomDocument& IniXMLDocument )
pClient->vecStoredFaderIsMute[iIdx] != 0 );
}
// stored fader group ID
for ( iIdx = 0; iIdx < MAX_NUM_STORED_FADER_SETTINGS; iIdx++ )
{
SetNumericIniSet ( IniXMLDocument, "client",
QString ( "storedgroupid%1" ).arg ( iIdx ),
pClient->vecStoredFaderGroupID[iIdx] );
}
// new client level
SetNumericIniSet ( IniXMLDocument, "client", "newclientlevel",
pClient->iNewClientFaderLevel );