Add channel level LED bar

This commit is contained in:
Peter L Jones 2020-03-29 22:40:53 +01:00
parent a7a1549fe5
commit 8db54e8616
2 changed files with 110 additions and 29 deletions

View file

@ -35,17 +35,29 @@ CChannelFader::CChannelFader ( QWidget* pNW,
// QWidget takes the ownership of the pMainGrid so that this only has // QWidget takes the ownership of the pMainGrid so that this only has
// to be created locally in this constructor) // to be created locally in this constructor)
pFrame = new QFrame ( pNW ); pFrame = new QFrame ( pNW );
QVBoxLayout* pMainGrid = new QVBoxLayout ( pFrame );
pFader = new QSlider ( Qt::Vertical, pFrame ); pLevelsBox = new QWidget ( pFrame );
pcbMute = new QCheckBox ( "Mute", pFrame ); plbrChannelLevel = new CMultiColorLEDBar ( pLevelsBox );
pcbSolo = new QCheckBox ( "Solo", pFrame ); pFader = new QSlider ( Qt::Vertical, pLevelsBox );
pMuteSoloBox = new QWidget ( pFrame );
pcbMute = new QCheckBox ( "Mute", pMuteSoloBox );
pcbSolo = new QCheckBox ( "Solo", pMuteSoloBox );
pLabelInstBox = new QGroupBox ( pFrame ); pLabelInstBox = new QGroupBox ( pFrame );
plblLabel = new QLabel ( "", pFrame ); plblLabel = new QLabel ( "", pFrame );
plblInstrument = new QLabel ( pFrame ); plblInstrument = new QLabel ( pFrame );
plblCountryFlag = new QLabel ( pFrame ); plblCountryFlag = new QLabel ( pFrame );
QVBoxLayout* pMainGrid = new QVBoxLayout ( pFrame );
QHBoxLayout* pLevelsGrid = new QHBoxLayout ( pLevelsBox );
QVBoxLayout* pMuteSoloGrid = new QVBoxLayout ( pMuteSoloBox );
QHBoxLayout* pLabelGrid = new QHBoxLayout ( pLabelInstBox ); QHBoxLayout* pLabelGrid = new QHBoxLayout ( pLabelInstBox );
QVBoxLayout* pLabelPictGrid = new QVBoxLayout ( ); QVBoxLayout* pLabelPictGrid = new QVBoxLayout ( );
// setup channel level
plbrChannelLevel->setContentsMargins( 0, 3, 2, 3 );
// setup slider // setup slider
pFader->setPageStep ( 1 ); pFader->setPageStep ( 1 );
pFader->setTickPosition ( QSlider::TicksBothSides ); pFader->setTickPosition ( QSlider::TicksBothSides );
@ -62,18 +74,30 @@ CChannelFader::CChannelFader ( QWidget* pNW,
// set margins of the layouts to zero to get maximum space for the controls // set margins of the layouts to zero to get maximum space for the controls
pMainGrid->setContentsMargins ( 0, 0, 0, 0 ); pMainGrid->setContentsMargins ( 0, 0, 0, 0 );
pLevelsGrid->setContentsMargins ( 0, 0, 0, 0 );
pLevelsGrid->setSpacing ( 0 ); // only minimal space
pMuteSoloGrid->setContentsMargins ( 0, 0, 0, 0 );
pLabelGrid->setContentsMargins ( 0, 0, 0, 0 ); pLabelGrid->setContentsMargins ( 0, 0, 0, 0 );
pLabelGrid->setSpacing ( 2 ); // only minimal space between picture and text pLabelGrid->setSpacing ( 2 ); // only minimal space between picture and text
// add user controls to the grids // add user controls to the grids
pLabelPictGrid->addWidget ( plblCountryFlag, 0, Qt::AlignHCenter ); pLabelPictGrid->addWidget ( plblCountryFlag, 0, Qt::AlignHCenter );
pLabelPictGrid->addWidget ( plblInstrument, 0, Qt::AlignHCenter ); pLabelPictGrid->addWidget ( plblInstrument, 0, Qt::AlignHCenter );
pLabelGrid->addLayout ( pLabelPictGrid ); pLabelGrid->addLayout ( pLabelPictGrid );
pLabelGrid->addWidget ( plblLabel, 0, Qt::AlignVCenter ); pLabelGrid->addWidget ( plblLabel, 0, Qt::AlignVCenter );
pMainGrid->addWidget ( pFader, 0, Qt::AlignHCenter ); pLevelsGrid->addWidget ( plbrChannelLevel, 0, Qt::AlignRight );
pMainGrid->addWidget ( pcbMute, 0, Qt::AlignLeft ); pLevelsGrid->addWidget ( pFader, 0, Qt::AlignLeft );
pMainGrid->addWidget ( pcbSolo, 0, Qt::AlignLeft );
pMuteSoloGrid->addWidget ( pcbMute, 0, Qt::AlignLeft );
pMuteSoloGrid->addWidget ( pcbSolo, 0, Qt::AlignLeft );
pMainGrid->addWidget ( pLevelsBox, 0, Qt::AlignHCenter );
pMainGrid->addWidget ( pMuteSoloBox, 0, Qt::AlignHCenter );
pMainGrid->addWidget ( pLabelInstBox ); pMainGrid->addWidget ( pLabelInstBox );
// add fader frame to audio mixer board layout // add fader frame to audio mixer board layout
@ -83,17 +107,23 @@ CChannelFader::CChannelFader ( QWidget* pNW,
Reset(); Reset();
// add help text to controls // add help text to controls
plbrChannelLevel->setWhatsThis ( tr ( "<b>Channel Level:</b> Displays the "
"pre-fader audio level of this channel. All connected clients at the "
"server will be assigned an audio level, the same value for each client." ) );
plbrChannelLevel->setAccessibleName ( tr ( "Input level of the current audio "
"channel at the server" ) );
pFader->setWhatsThis ( tr ( "<b>Mixer Fader:</b> Adjusts the audio level of " pFader->setWhatsThis ( tr ( "<b>Mixer Fader:</b> Adjusts the audio level of "
"this channel. All connected clients at the server will be assigned " "this channel. All connected clients at the server will be assigned "
"an audio fader at each client." ) ); "an audio fader at each client, adjusting the local mix." ) );
pFader->setAccessibleName ( tr ( "Mixer level setting of the connected client " pFader->setAccessibleName ( tr ( "Local mix level setting of the current audio "
"at the server" ) ); "channel at the server" ) );
pcbMute->setWhatsThis ( tr ( "<b>Mute:</b> With the Mute checkbox, the current " pcbMute->setWhatsThis ( tr ( "<b>Mute:</b> With the Mute checkbox, the "
"audio channel can be muted." ) ); "audio channel can be muted." ) );
pcbMute->setAccessibleName ( tr ( "Mute button" ) ); pcbMute->setAccessibleName ( tr ( "Mute button" ) );
pcbSolo->setWhatsThis ( tr ( "<b>Solo:</b> With the Solo checkbox, the current " pcbSolo->setWhatsThis ( tr ( "<b>Solo:</b> With the Solo checkbox, the "
"audio channel can be set to solo which means that all other channels " "audio channel can be set to solo which means that all other channels "
"except of the current channel are muted. It is possible to set more than " "except of the current channel are muted. It is possible to set more than "
"one channel to solo." ) ); "one channel to solo." ) );
@ -158,6 +188,11 @@ void CChannelFader::SetGUIDesign ( const EGUIDesign eNewDesign )
} }
} }
void CChannelFader::SetDisplayChannelLevel ( const bool eNDCL )
{
plbrChannelLevel->setHidden( !eNDCL );
}
void CChannelFader::SetupFaderTag ( const ESkillLevel eSkillLevel ) void CChannelFader::SetupFaderTag ( const ESkillLevel eSkillLevel )
{ {
// setup group box for label/instrument picture: set a thick black border // setup group box for label/instrument picture: set a thick black border
@ -306,6 +341,11 @@ void CChannelFader::UpdateSoloState ( const bool bNewOtherSoloState )
} }
} }
void CChannelFader::SetChannelLevel ( const uint16_t iLevel )
{
plbrChannelLevel->setValue ( iLevel );
}
void CChannelFader::SetText ( const CChannelInfo& ChanInfo ) void CChannelFader::SetText ( const CChannelInfo& ChanInfo )
{ {
// store original received name // store original received name
@ -634,6 +674,17 @@ void CAudioMixerBoard::SetGUIDesign ( const EGUIDesign eNewDesign )
} }
} }
void CAudioMixerBoard::SetDisplayChannelLevels ( const bool eNDCL )
{
bDisplayChannelLevels = eNDCL;
// apply preference to child GUI controls
for ( int i = 0; i < MAX_NUM_CHANNELS; i++ )
{
vecpChanFader[i]->SetDisplayChannelLevel ( bDisplayChannelLevels );
}
}
void CAudioMixerBoard::HideAll() void CAudioMixerBoard::HideAll()
{ {
// make all controls invisible // make all controls invisible
@ -710,6 +761,9 @@ void CAudioMixerBoard::ApplyNewConClientList ( CVector<CChannelInfo>& vecChanInf
} }
} }
// At some future time a new level will arrive -- ???
vecpChanFader[i]->SetChannelLevel ( 0 );
// set the text in the fader // set the text in the fader
vecpChanFader[i]->SetText ( vecChanInfo[j] ); vecpChanFader[i]->SetText ( vecChanInfo[j] );
@ -857,3 +911,17 @@ bool CAudioMixerBoard::GetStoredFaderSettings ( const CChannelInfo& ChanInfo,
// return "not OK" since we did not find matching fader settings // return "not OK" since we did not find matching fader settings
return false; return false;
} }
void CAudioMixerBoard::SetChannelLevels ( const CVector<uint16_t>& vecChannelLevel )
{
const int iNumChannelLevels = vecChannelLevel.Size();
int i = 0;
for ( int iChId = 0; iChId < MAX_NUM_CHANNELS; iChId++ )
{
if ( vecpChanFader[iChId]->IsVisible() && i < iNumChannelLevels )
{
vecpChanFader[iChId]->SetChannelLevel ( vecChannelLevel[i++] );
}
}
}

View file

@ -36,6 +36,7 @@
#include <QHostAddress> #include <QHostAddress>
#include "global.h" #include "global.h"
#include "util.h" #include "util.h"
#include "multicolorledbar.h"
/* Classes ********************************************************************/ /* Classes ********************************************************************/
@ -55,6 +56,7 @@ public:
bool IsSolo() { return pcbSolo->isChecked(); } bool IsSolo() { return pcbSolo->isChecked(); }
bool IsMute() { return pcbMute->isChecked(); } bool IsMute() { return pcbMute->isChecked(); }
void SetGUIDesign ( const EGUIDesign eNewDesign ); void SetGUIDesign ( const EGUIDesign eNewDesign );
void SetDisplayChannelLevel ( const bool eNDCL );
void UpdateSoloState ( const bool bNewOtherSoloState ); void UpdateSoloState ( const bool bNewOtherSoloState );
void SetFaderLevel ( const int iLevel ); void SetFaderLevel ( const int iLevel );
@ -62,6 +64,7 @@ public:
void SetFaderIsMute ( const bool bIsMute ); void SetFaderIsMute ( const bool bIsMute );
int GetFaderLevel() { return pFader->value(); } int GetFaderLevel() { return pFader->value(); }
void Reset(); void Reset();
void SetChannelLevel ( const uint16_t iLevel );
protected: protected:
double CalcFaderGain ( const int value ); double CalcFaderGain ( const int value );
@ -70,10 +73,16 @@ protected:
void SetupFaderTag ( const ESkillLevel eSkillLevel ); void SetupFaderTag ( const ESkillLevel eSkillLevel );
QFrame* pFrame; QFrame* pFrame;
QGroupBox* pLabelInstBox;
QWidget* pLevelsBox;
QWidget* pMuteSoloBox;
CMultiColorLEDBar* plbrChannelLevel;
QSlider* pFader; QSlider* pFader;
QCheckBox* pcbMute; QCheckBox* pcbMute;
QCheckBox* pcbSolo; QCheckBox* pcbSolo;
QGroupBox* pLabelInstBox;
QLabel* plblLabel; QLabel* plblLabel;
QLabel* plblInstrument; QLabel* plblInstrument;
QLabel* plblCountryFlag; QLabel* plblCountryFlag;
@ -103,10 +112,13 @@ public:
void ApplyNewConClientList ( CVector<CChannelInfo>& vecChanInfo ); void ApplyNewConClientList ( CVector<CChannelInfo>& vecChanInfo );
void SetServerName ( const QString& strNewServerName ); void SetServerName ( const QString& strNewServerName );
void SetGUIDesign ( const EGUIDesign eNewDesign ); void SetGUIDesign ( const EGUIDesign eNewDesign );
void SetDisplayChannelLevels ( const bool eNDCL );
void SetFaderLevel ( const int iChannelIdx, void SetFaderLevel ( const int iChannelIdx,
const int iValue ); const int iValue );
void SetChannelLevels ( const CVector<uint16_t>& vecChannelLevel );
// settings // settings
CVector<QString> vecStoredFaderTags; CVector<QString> vecStoredFaderTags;
CVector<int> vecStoredFaderLevels; CVector<int> vecStoredFaderLevels;
@ -129,6 +141,7 @@ protected:
CVector<CChannelFader*> vecpChanFader; CVector<CChannelFader*> vecpChanFader;
QGroupBox* pGroupBox; QGroupBox* pGroupBox;
QHBoxLayout* pMainLayout; QHBoxLayout* pMainLayout;
bool bDisplayChannelLevels;
bool bNoFaderVisible; bool bNoFaderVisible;
public slots: public slots: