added a new client fader level setting

This commit is contained in:
Volker Fischer 2015-11-25 15:52:00 +00:00
parent 1aa990b262
commit 7ace26f23e
12 changed files with 117 additions and 24 deletions

View file

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

View file

@ -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<CChannelInfo>& 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<int> (
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<CChannelInfo>& 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<CChannelInfo>& 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++ )
{

View file

@ -107,6 +107,7 @@ public:
CVector<QString> vecStoredFaderTags;
CVector<int> vecStoredFaderLevels;
CVector<int> vecStoredFaderIsSolo;
int iNewClientFaderLevel;
protected:
bool GetStoredFaderSettings ( const CChannelInfo& ChanInfo,
@ -119,6 +120,7 @@ protected:
CVector<CChannelFader*> vecpChanFader;
QHBoxLayout* pMainLayout;
bool bNoFaderVisible;
public slots:
// CODE TAG: MAX_NUM_CHANNELS_TAG

View file

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

View file

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

View file

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

View file

@ -193,4 +193,5 @@ public slots:
void OnAudioChannelsChanged() { UpdateRevSelection(); }
void OnNumClientsChanged ( int iNewNumClients );
void OnNewClientLevelChanged() { MainMixerBoard->iNewClientFaderLevel = pClient->iNewClientFaderLevel; }
};

View file

@ -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 ( "<b>New Client Level:</b> 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 ( "<b>Central Server Address:</b> 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 )

View file

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

View file

@ -65,7 +65,16 @@
<enum>QFrame::Plain</enum>
</property>
<layout class="QVBoxLayout">
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
@ -485,6 +494,13 @@
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lblNewClientLevel">
<property name="text">
<string>New Client Level</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
@ -495,6 +511,20 @@
<item>
<widget class="QComboBox" name="cbxAudioQuality"/>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLineEdit" name="edtNewClientLevel"/>
</item>
<item>
<widget class="QLabel" name="lblPercentUnit">
<property name="text">
<string>%</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
@ -687,6 +717,7 @@
<tabstop>sldNetBufServer</tabstop>
<tabstop>cbxAudioChannels</tabstop>
<tabstop>cbxAudioQuality</tabstop>
<tabstop>edtNewClientLevel</tabstop>
<tabstop>chbGUIDesignFancy</tabstop>
<tabstop>chbDefaultCentralServer</tabstop>
<tabstop>edtCentralServerAddress</tabstop>

View file

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

View file

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