diff --git a/ChangeLog b/ChangeLog index ad33ce2c..45f39b16 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,8 @@ 3.3.11 +- added a new client fader level setting + - changed the MacOS audio interface to be future proof (do not use the Carbon Component Manager anymore) diff --git a/src/audiomixerboard.cpp b/src/audiomixerboard.cpp index 5731b56b..346f0b39 100755 --- a/src/audiomixerboard.cpp +++ b/src/audiomixerboard.cpp @@ -486,7 +486,9 @@ CAudioMixerBoard::CAudioMixerBoard ( QWidget* parent, Qt::WindowFlags ) : QGroupBox ( parent ), vecStoredFaderTags ( MAX_NUM_STORED_FADER_SETTINGS, "" ), vecStoredFaderLevels ( MAX_NUM_STORED_FADER_SETTINGS, AUD_MIX_FADER_MAX ), - vecStoredFaderIsSolo ( MAX_NUM_STORED_FADER_SETTINGS, false ) + vecStoredFaderIsSolo ( MAX_NUM_STORED_FADER_SETTINGS, false ), + iNewClientFaderLevel ( 100 ), + bNoFaderVisible ( true ) { // set title text (default: no server given) SetServerName ( "" ); @@ -586,6 +588,9 @@ void CAudioMixerBoard::HideAll() vecpChanFader[i]->Hide(); } + // set flag + bNoFaderVisible = true; + // emit status of connected clients emit NumClientsChanged ( 0 ); // -> no clients connected } @@ -614,6 +619,18 @@ void CAudioMixerBoard::ApplyNewConClientList ( CVector& vecChanInf // show fader vecpChanFader[i]->Show(); + + // Set the default initial fader level. Check first that + // this is not the initialization (i.e. previously there + // were no faders visible) to avoid that our own level is + // adjusted. The fader level of 100 % is the default in the + // server, in that case we do not have to do anything here. + if ( !bNoFaderVisible && ( iNewClientFaderLevel != 100 ) ) + { + // the value is in percent -> convert range + vecpChanFader[i]->SetFaderLevel ( static_cast ( + iNewClientFaderLevel / 100.0 * AUD_MIX_FADER_MAX ) ); + } } // restore gain (if new name is different from the current one) @@ -638,8 +655,8 @@ void CAudioMixerBoard::ApplyNewConClientList ( CVector& vecChanInf // update other channel infos (only available for new protocol // which is not compatible with old versions -> this way we make - // sure that the protocol which transferrs only the name does - // change the other client infos + // sure that the protocol which transfers only the name does + // change the other client infos) // #### COMPATIBILITY OLD VERSION, TO BE REMOVED #### -> the "if-condition" can be removed later on... if ( !vecChanInfo[j].bOnlyNameIsUsed ) { @@ -664,6 +681,9 @@ void CAudioMixerBoard::ApplyNewConClientList ( CVector& vecChanInf // has just connected, the new channel must be muted UpdateSoloStates(); + // update flag for "all faders are invisible" + bNoFaderVisible = ( iNumConnectedClients == 0 ); + // emit status of connected clients emit NumClientsChanged ( iNumConnectedClients ); } @@ -711,28 +731,15 @@ void CAudioMixerBoard::StoreFaderSettings ( CChannelFader* pChanFader ) // init temporary list count (may be overwritten later on) int iTempListCnt = 0; - // 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 + // put new value on the top of the list const int iOldIdx = vecStoredFaderTags.StringFiFoWithCompare ( pChanFader->GetReceivedName(), - !bNewFaderLevelAndSoloIsDefault ); + true ); - if ( !bNewFaderLevelAndSoloIsDefault ) - { - // current fader level and solo state is at the top of the list - vecStoredFaderLevels[0] = pChanFader->GetFaderLevel(); - vecStoredFaderIsSolo[0] = pChanFader->IsSolo(); - iTempListCnt = 1; - } + // 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_SETTINGS; iIdx++ ) { diff --git a/src/audiomixerboard.h b/src/audiomixerboard.h index 2fe72a41..d3082b53 100755 --- a/src/audiomixerboard.h +++ b/src/audiomixerboard.h @@ -107,6 +107,7 @@ public: CVector vecStoredFaderTags; CVector vecStoredFaderLevels; CVector vecStoredFaderIsSolo; + int iNewClientFaderLevel; protected: bool GetStoredFaderSettings ( const CChannelInfo& ChanInfo, @@ -119,6 +120,7 @@ protected: CVector vecpChanFader; QHBoxLayout* pMainLayout; + bool bNoFaderVisible; public slots: // CODE TAG: MAX_NUM_CHANNELS_TAG diff --git a/src/client.cpp b/src/client.cpp index e4d80060..d6505921 100755 --- a/src/client.cpp +++ b/src/client.cpp @@ -33,6 +33,7 @@ CClient::CClient ( const quint16 iPortNumber, vecStoredFaderTags ( MAX_NUM_STORED_FADER_SETTINGS, "" ), vecStoredFaderLevels ( MAX_NUM_STORED_FADER_SETTINGS, AUD_MIX_FADER_MAX ), vecStoredFaderIsSolo ( MAX_NUM_STORED_FADER_SETTINGS, false ), + iNewClientFaderLevel ( 100 ), vecWindowPosMain (), // empty array vecWindowPosSettings (), // empty array vecWindowPosChat (), // empty array diff --git a/src/client.h b/src/client.h index 096eac28..baa11d68 100755 --- a/src/client.h +++ b/src/client.h @@ -285,6 +285,7 @@ public: CVector vecStoredFaderTags; CVector vecStoredFaderLevels; CVector vecStoredFaderIsSolo; + int iNewClientFaderLevel; // window position/state settings QByteArray vecWindowPosMain; diff --git a/src/clientdlg.cpp b/src/clientdlg.cpp index 11593034..dac2dfb3 100755 --- a/src/clientdlg.cpp +++ b/src/clientdlg.cpp @@ -189,6 +189,7 @@ CClientDlg::CClientDlg ( CClient* pNCliP, MainMixerBoard->vecStoredFaderTags = pClient->vecStoredFaderTags; MainMixerBoard->vecStoredFaderLevels = pClient->vecStoredFaderLevels; MainMixerBoard->vecStoredFaderIsSolo = pClient->vecStoredFaderIsSolo; + MainMixerBoard->iNewClientFaderLevel = pClient->iNewClientFaderLevel; // init status label OnTimerStatus(); @@ -498,6 +499,9 @@ CClientDlg::CClientDlg ( CClient* pNCliP, QObject::connect ( &ClientSettingsDlg, SIGNAL ( AudioChannelsChanged() ), this, SLOT ( OnAudioChannelsChanged() ) ); + QObject::connect ( &ClientSettingsDlg, SIGNAL ( NewClientLevelChanged() ), + this, SLOT ( OnNewClientLevelChanged() ) ); + QObject::connect ( MainMixerBoard, SIGNAL ( ChangeChanGain ( int, double ) ), this, SLOT ( OnChangeChanGain ( int, double ) ) ); @@ -559,6 +563,7 @@ void CClientDlg::closeEvent ( QCloseEvent* Event ) pClient->vecStoredFaderTags = MainMixerBoard->vecStoredFaderTags; pClient->vecStoredFaderLevels = MainMixerBoard->vecStoredFaderLevels; pClient->vecStoredFaderIsSolo = MainMixerBoard->vecStoredFaderIsSolo; + pClient->iNewClientFaderLevel = MainMixerBoard->iNewClientFaderLevel; // default implementation of this event handler routine Event->accept(); diff --git a/src/clientdlg.h b/src/clientdlg.h index 6d4508ef..0a6dd556 100755 --- a/src/clientdlg.h +++ b/src/clientdlg.h @@ -193,4 +193,5 @@ public slots: void OnAudioChannelsChanged() { UpdateRevSelection(); } void OnNumClientsChanged ( int iNewNumClients ); + void OnNewClientLevelChanged() { MainMixerBoard->iNewClientFaderLevel = pClient->iNewClientFaderLevel; } }; diff --git a/src/clientsettingsdlg.cpp b/src/clientsettingsdlg.cpp index 3b2cb267..9d9abd0a 100755 --- a/src/clientsettingsdlg.cpp +++ b/src/clientsettingsdlg.cpp @@ -214,6 +214,18 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, QWidget* parent, cbxAudioQuality->setWhatsThis ( strAudioQuality ); cbxAudioQuality->setAccessibleName ( tr ( "Audio quality combo box" ) ); + // new client fader level + QString strNewClientLevel = tr ( "New Client Level: The " + "new client level setting defines the fader level of a new " + "connected client in percent. I.e. if a new client connects " + "to the current server, it will get the specified initial " + "fader level if no other fader level of a previous connection " + "of that client was already stored." ); + + lblNewClientLevel->setWhatsThis ( strNewClientLevel ); + edtNewClientLevel->setWhatsThis ( strNewClientLevel ); + edtNewClientLevel->setAccessibleName ( tr ( "New client level edit box" ) ); + // central server address QString strCentrServAddr = tr ( "Central Server Address: The " "central server address is the IP address or URL of the central server " @@ -272,6 +284,7 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, QWidget* parent, lblPingTimeValue->setText ( "---" ); lblOverallDelayValue->setText ( "---" ); lblUpstreamValue->setText ( "---" ); + edtNewClientLevel->setValidator ( new QIntValidator ( 0, 100, this ) ); // % range from 0-100 // init slider controls --- @@ -326,6 +339,9 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, QWidget* parent, } UpdateCentralServerDependency(); + // update new client fader level edit box + edtNewClientLevel->setText ( QString::number ( pClient->iNewClientFaderLevel ) ); + // set text for sound card buffer delay radio buttons rbtBufferDelayPreferred->setText ( GenSndCrdBufferDelayString ( FRAME_SIZE_FACTOR_PREFERRED * SYSTEM_FRAME_SIZE_SAMPLES, @@ -371,6 +387,9 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, QWidget* parent, QObject::connect ( edtCentralServerAddress, SIGNAL ( editingFinished() ), this, SLOT ( OnCentralServerAddressEditingFinished() ) ); + QObject::connect ( edtNewClientLevel, SIGNAL ( editingFinished() ), + this, SLOT ( OnNewClientLevelEditingFinished() ) ); + // combo boxes QObject::connect ( cbxSoundcard, SIGNAL ( activated ( int ) ), this, SLOT ( OnSoundcardActivated ( int ) ) ); @@ -686,6 +705,17 @@ void CClientSettingsDlg::OnCentralServerAddressEditingFinished() edtCentralServerAddress->text() ); } +void CClientSettingsDlg::OnNewClientLevelEditingFinished() +{ + // store new setting in the client + pClient->iNewClientFaderLevel = + edtNewClientLevel->text().toInt(); + + // inform that the level has changed and the mixer board settings must + // be updated + emit NewClientLevelChanged(); +} + void CClientSettingsDlg::OnSndCrdBufferDelayButtonGroupClicked ( QAbstractButton* button ) { if ( button == rbtBufferDelayPreferred ) diff --git a/src/clientsettingsdlg.h b/src/clientsettingsdlg.h index a817e620..a45ed539 100755 --- a/src/clientsettingsdlg.h +++ b/src/clientsettingsdlg.h @@ -92,6 +92,7 @@ protected: void OnGUIDesignFancyStateChanged ( int value ); void OnDefaultCentralServerStateChanged ( int value ); void OnCentralServerAddressEditingFinished(); + void OnNewClientLevelEditingFinished(); void OnSndCrdBufferDelayButtonGroupClicked ( QAbstractButton* button ); void OnSoundcardActivated ( int iSndDevIdx ); void OnLInChanActivated ( int iChanIdx ); @@ -105,4 +106,5 @@ protected: signals: void GUIDesignChanged(); void AudioChannelsChanged(); + void NewClientLevelChanged(); }; diff --git a/src/clientsettingsdlgbase.ui b/src/clientsettingsdlgbase.ui index db4ff860..4b9549c9 100755 --- a/src/clientsettingsdlgbase.ui +++ b/src/clientsettingsdlgbase.ui @@ -65,7 +65,16 @@ QFrame::Plain - + + 0 + + + 0 + + + 0 + + 0 @@ -485,6 +494,13 @@ + + + + New Client Level + + + @@ -495,6 +511,20 @@ + + + + + + + + + % + + + + + @@ -687,6 +717,7 @@ sldNetBufServer cbxAudioChannels cbxAudioQuality + edtNewClientLevel chbGUIDesignFancy chbDefaultCentralServer edtCentralServerAddress diff --git a/src/global.h b/src/global.h index e66b0cdf..75df0f4e 100755 --- a/src/global.h +++ b/src/global.h @@ -163,7 +163,7 @@ LED bar: lbr #define MAX_NUM_SERVER_ADDR_ITEMS 6 // maximum number of fader settings to be stored (together with the fader tags) -#define MAX_NUM_STORED_FADER_SETTINGS 20 +#define MAX_NUM_STORED_FADER_SETTINGS 40 // defines for LED input level meter #define NUM_STEPS_INP_LEV_METER 8 diff --git a/src/settings.cpp b/src/settings.cpp index 3d6dcc30..333cd33d 100755 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -88,6 +88,13 @@ void CSettings::Load() } } + // new client level + if ( GetNumericIniSet ( IniXMLDocument, "client", "newclientlevel", + 0, 100, iValue ) ) + { + pClient->iNewClientFaderLevel = iValue; + } + // name pClient->ChannelInfo.strName = FromBase64ToString ( GetIniSetting ( IniXMLDocument, "client", "name_base64" ) ); @@ -388,6 +395,10 @@ void CSettings::Save() pClient->vecStoredFaderIsSolo[iIdx] != false ); } + // new client level + SetNumericIniSet ( IniXMLDocument, "client", "newclientlevel", + pClient->iNewClientFaderLevel ); + // name PutIniSetting ( IniXMLDocument, "client", "name_base64", ToBase64 ( pClient->ChannelInfo.strName ) );