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
@ -659,19 +654,20 @@ double CChannelFader::CalcFaderGain ( const double dValue )
* CAudioMixerBoard *
\******************************************************************************/
CAudioMixerBoard::CAudioMixerBoard ( QWidget* parent, Qt::WindowFlags ) :
QGroupBox ( parent ),
vecStoredFaderTags ( MAX_NUM_STORED_FADER_SETTINGS, "" ),
vecStoredFaderLevels ( MAX_NUM_STORED_FADER_SETTINGS, AUD_MIX_FADER_MAX ),
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 ),
iNewClientFaderLevel ( 100 ),
bDisplayPans ( false ),
bIsPanSupported ( false ),
bNoFaderVisible ( true ),
iMyChannelID ( INVALID_INDEX ),
strServerName ( "" ),
eRecorderState ( RS_UNDEFINED )
QGroupBox ( parent ),
vecStoredFaderTags ( MAX_NUM_STORED_FADER_SETTINGS, "" ),
vecStoredFaderLevels ( MAX_NUM_STORED_FADER_SETTINGS, AUD_MIX_FADER_MAX ),
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 ),
bNoFaderVisible ( true ),
iMyChannelID ( INVALID_INDEX ),
strServerName ( "" ),
eRecorderState ( RS_UNDEFINED )
{
// add group box and hboxlayout
QHBoxLayout* pGroupBoxLayout = new QHBoxLayout ( this );
@ -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 ) )
{
@ -1106,10 +1105,11 @@ void CAudioMixerBoard::StoreFaderSettings ( CChannelFader* pChanFader )
if ( pChanFader->IsVisible() &&
!pChanFader->GetReceivedName().isEmpty() )
{
CVector<int> viOldStoredFaderLevels ( vecStoredFaderLevels );
CVector<int> viOldStoredPanValues ( vecStoredPanValues );
CVector<int> vbOldStoredFaderIsSolo ( vecStoredFaderIsSolo );
CVector<int> vbOldStoredFaderIsMute ( vecStoredFaderIsMute );
CVector<int> viOldStoredFaderLevels ( vecStoredFaderLevels );
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;
@ -1120,11 +1120,12 @@ void CAudioMixerBoard::StoreFaderSettings ( CChannelFader* pChanFader )
true );
// current fader level and solo state is at the top of the list
vecStoredFaderLevels[0] = pChanFader->GetFaderLevel();
vecStoredPanValues[0] = pChanFader->GetPanValue();
vecStoredFaderIsSolo[0] = pChanFader->IsSolo();
vecStoredFaderIsMute[0] = pChanFader->IsMute();
iTempListCnt = 1;
vecStoredFaderLevels[0] = pChanFader->GetFaderLevel();
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++ )
{
@ -1136,10 +1137,11 @@ void CAudioMixerBoard::StoreFaderSettings ( CChannelFader* pChanFader )
// index in case the entry was not present in the vector before
if ( iIdx != iOldIdx )
{
vecStoredFaderLevels[iTempListCnt] = viOldStoredFaderLevels[iIdx];
vecStoredPanValues[iTempListCnt] = viOldStoredPanValues[iIdx];
vecStoredFaderIsSolo[iTempListCnt] = vbOldStoredFaderIsSolo[iIdx];
vecStoredFaderIsMute[iTempListCnt] = vbOldStoredFaderIsMute[iIdx];
vecStoredFaderLevels[iTempListCnt] = viOldStoredFaderLevels[iIdx];
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

@ -50,25 +50,25 @@ public:
CChannelFader ( QWidget* pNW );
QString GetReceivedName() { return cReceivedChanInfo.strName; }
int GetReceivedInstrument() { return cReceivedChanInfo.iInstrument; }
void SetChannelInfos ( const CChannelInfo& cChanInfo );
void Show() { pFrame->show(); }
void Hide() { pFrame->hide(); }
bool IsVisible() { return !pFrame->isHidden(); }
bool IsSolo() { return pcbSolo->isChecked(); }
bool IsMute() { return pcbMute->isChecked(); }
bool IsSelect() { return pcbGroup->isChecked(); }
void SetGUIDesign ( const EGUIDesign eNewDesign );
void SetDisplayChannelLevel ( const bool eNDCL );
bool GetDisplayChannelLevel();
void SetDisplayPans ( const bool eNDP );
int GetReceivedInstrument() { return cReceivedChanInfo.iInstrument; }
void SetChannelInfos ( const CChannelInfo& cChanInfo );
void Show() { pFrame->show(); }
void Hide() { pFrame->hide(); }
bool IsVisible() { return !pFrame->isHidden(); }
bool IsSolo() { return pcbSolo->isChecked(); }
bool IsMute() { return pcbMute->isChecked(); }
int GetGroupID() { return pcbGroup->isChecked() ? 0 : INVALID_INDEX; }
void SetGUIDesign ( const EGUIDesign eNewDesign );
void SetDisplayChannelLevel ( const bool eNDCL );
bool GetDisplayChannelLevel();
void SetDisplayPans ( const bool eNDP );
QFrame* GetMainWidget() { return pFrame; }
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

@ -189,12 +189,13 @@ CClientDlg::CClientDlg ( CClient* pNCliP,
MainMixerBoard->SetDisplayChannelLevels ( pClient->GetDisplayChannelLevels() );
// restore fader settings
MainMixerBoard->vecStoredFaderTags = pClient->vecStoredFaderTags;
MainMixerBoard->vecStoredFaderLevels = pClient->vecStoredFaderLevels;
MainMixerBoard->vecStoredPanValues = pClient->vecStoredPanValues;
MainMixerBoard->vecStoredFaderIsSolo = pClient->vecStoredFaderIsSolo;
MainMixerBoard->vecStoredFaderIsMute = pClient->vecStoredFaderIsMute;
MainMixerBoard->iNewClientFaderLevel = pClient->iNewClientFaderLevel;
MainMixerBoard->vecStoredFaderTags = pClient->vecStoredFaderTags;
MainMixerBoard->vecStoredFaderLevels = pClient->vecStoredFaderLevels;
MainMixerBoard->vecStoredPanValues = pClient->vecStoredPanValues;
MainMixerBoard->vecStoredFaderIsSolo = pClient->vecStoredFaderIsSolo;
MainMixerBoard->vecStoredFaderIsMute = pClient->vecStoredFaderIsMute;
MainMixerBoard->vecStoredFaderGroupID = pClient->vecStoredFaderGroupID;
MainMixerBoard->iNewClientFaderLevel = pClient->iNewClientFaderLevel;
// init status label
OnTimerStatus();
@ -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 );