2013-01-23 11:41:13 +01:00
|
|
|
/******************************************************************************\
|
2020-01-01 15:41:43 +01:00
|
|
|
* Copyright (c) 2004-2020
|
2013-01-23 11:41:13 +01:00
|
|
|
*
|
|
|
|
* Author(s):
|
|
|
|
* Volker Fischer
|
|
|
|
*
|
|
|
|
******************************************************************************
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it under
|
|
|
|
* the terms of the GNU General Public License as published by the Free Software
|
2020-05-16 19:39:16 +02:00
|
|
|
* Foundation; either version 2 of the License, or (at your option) any later
|
2013-01-23 11:41:13 +01:00
|
|
|
* version.
|
|
|
|
*
|
2020-05-16 19:39:16 +02:00
|
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
2013-01-23 11:41:13 +01:00
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
2020-05-16 19:39:16 +02:00
|
|
|
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
2013-01-23 11:41:13 +01:00
|
|
|
* details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with
|
2020-05-16 19:39:16 +02:00
|
|
|
* this program; if not, write to the Free Software Foundation, Inc.,
|
2020-06-08 22:58:11 +02:00
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
2013-01-23 11:41:13 +01:00
|
|
|
*
|
|
|
|
\******************************************************************************/
|
|
|
|
|
2019-07-09 08:52:38 +02:00
|
|
|
#pragma once
|
2013-01-23 11:41:13 +01:00
|
|
|
|
|
|
|
#include <QFrame>
|
2020-03-30 19:53:30 +02:00
|
|
|
#include <QScrollArea>
|
2013-01-23 11:41:13 +01:00
|
|
|
#include <QGroupBox>
|
|
|
|
#include <QLabel>
|
|
|
|
#include <QCheckBox>
|
|
|
|
#include <QLayout>
|
|
|
|
#include <QString>
|
|
|
|
#include <QSlider>
|
2020-05-19 18:28:52 +02:00
|
|
|
#include <QDial>
|
2013-01-23 11:41:13 +01:00
|
|
|
#include <QSizePolicy>
|
|
|
|
#include <QHostAddress>
|
2020-06-08 17:34:45 +02:00
|
|
|
#include <QListWidget>
|
2013-01-23 11:41:13 +01:00
|
|
|
#include "global.h"
|
|
|
|
#include "util.h"
|
2020-03-29 23:40:53 +02:00
|
|
|
#include "multicolorledbar.h"
|
2013-01-23 11:41:13 +01:00
|
|
|
|
|
|
|
|
|
|
|
/* Classes ********************************************************************/
|
|
|
|
class CChannelFader : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2020-06-08 17:34:45 +02:00
|
|
|
CChannelFader ( QWidget* pNW );
|
2013-01-23 11:41:13 +01:00
|
|
|
|
2020-06-13 08:31:28 +02:00
|
|
|
QString GetReceivedName() { return cReceivedChanInfo.strName; }
|
|
|
|
int GetReceivedInstrument() { return cReceivedChanInfo.iInstrument; }
|
2015-01-30 21:53:43 +01:00
|
|
|
void SetChannelInfos ( const CChannelInfo& cChanInfo );
|
2013-01-23 11:41:13 +01:00
|
|
|
void Show() { pFrame->show(); }
|
|
|
|
void Hide() { pFrame->hide(); }
|
2020-04-26 15:27:14 +02:00
|
|
|
bool IsVisible() { return !pFrame->isHidden(); }
|
2013-09-10 18:24:55 +02:00
|
|
|
bool IsSolo() { return pcbSolo->isChecked(); }
|
2020-04-04 17:14:59 +02:00
|
|
|
bool IsMute() { return pcbMute->isChecked(); }
|
2020-06-20 17:44:34 +02:00
|
|
|
bool IsSelect() { return pcbGroup->isChecked(); }
|
2013-01-23 11:41:13 +01:00
|
|
|
void SetGUIDesign ( const EGUIDesign eNewDesign );
|
2020-03-29 23:40:53 +02:00
|
|
|
void SetDisplayChannelLevel ( const bool eNDCL );
|
2020-04-07 00:20:32 +02:00
|
|
|
bool GetDisplayChannelLevel();
|
2020-05-19 18:28:52 +02:00
|
|
|
void SetDisplayPans ( const bool eNDP );
|
2020-06-08 17:34:45 +02:00
|
|
|
QFrame* GetMainWidget() { return pFrame; }
|
2013-01-23 11:41:13 +01:00
|
|
|
|
2020-04-26 00:55:28 +02:00
|
|
|
void SetPanValue ( const int iPan );
|
2014-01-19 11:51:31 +01:00
|
|
|
void SetFaderIsSolo ( const bool bIsSolo );
|
2020-04-04 17:14:59 +02:00
|
|
|
void SetFaderIsMute ( const bool bIsMute );
|
2020-05-21 18:26:33 +02:00
|
|
|
void SetRemoteFaderIsMute ( const bool bIsMute );
|
2020-06-20 16:20:27 +02:00
|
|
|
void SetFaderIsSelect ( const bool bIsMute );
|
2020-06-20 20:29:43 +02:00
|
|
|
void SetFaderLevel ( const int iLevel,
|
|
|
|
const bool bIsGroupUpdate = false );
|
|
|
|
|
2013-02-24 10:03:57 +01:00
|
|
|
int GetFaderLevel() { return pFader->value(); }
|
2020-05-18 20:46:46 +02:00
|
|
|
int GetPanValue() { return pPan->value(); }
|
2013-02-27 22:28:38 +01:00
|
|
|
void Reset();
|
2020-03-29 23:40:53 +02:00
|
|
|
void SetChannelLevel ( const uint16_t iLevel );
|
2020-05-26 20:45:10 +02:00
|
|
|
void SetIsMyOwnFader() { bIsMyOwnFader = true; }
|
2020-06-20 20:29:43 +02:00
|
|
|
void UpdateSoloState ( const bool bNewOtherSoloState );
|
2013-01-23 11:41:13 +01:00
|
|
|
|
|
|
|
protected:
|
2015-12-09 18:11:16 +01:00
|
|
|
double CalcFaderGain ( const int value );
|
|
|
|
void SetMute ( const bool bState );
|
|
|
|
void SetupFaderTag ( const ESkillLevel eSkillLevel );
|
2020-06-20 20:29:43 +02:00
|
|
|
void SendPanValueToServer ( const int iPan );
|
|
|
|
void SendFaderLevelToServer ( const int iLevel,
|
|
|
|
const bool bIsGroupUpdate );
|
2013-01-23 11:41:13 +01:00
|
|
|
|
2020-03-29 23:40:53 +02:00
|
|
|
QFrame* pFrame;
|
2013-01-23 11:41:13 +01:00
|
|
|
|
2020-03-29 23:40:53 +02:00
|
|
|
QWidget* pLevelsBox;
|
|
|
|
QWidget* pMuteSoloBox;
|
|
|
|
CMultiColorLEDBar* plbrChannelLevel;
|
|
|
|
QSlider* pFader;
|
2020-05-19 18:28:52 +02:00
|
|
|
QDial* pPan;
|
|
|
|
QLabel* pPanLabel;
|
2020-05-21 18:26:33 +02:00
|
|
|
QLabel* pInfoLabel;
|
2020-06-11 16:42:50 +02:00
|
|
|
QHBoxLayout* pLabelGrid;
|
|
|
|
QVBoxLayout* pLabelPictGrid;
|
2013-02-27 22:28:38 +01:00
|
|
|
|
2020-03-29 23:40:53 +02:00
|
|
|
QCheckBox* pcbMute;
|
|
|
|
QCheckBox* pcbSolo;
|
2020-06-20 17:44:34 +02:00
|
|
|
QCheckBox* pcbGroup;
|
2020-03-29 23:40:53 +02:00
|
|
|
|
|
|
|
QGroupBox* pLabelInstBox;
|
|
|
|
QLabel* plblLabel;
|
|
|
|
QLabel* plblInstrument;
|
|
|
|
QLabel* plblCountryFlag;
|
|
|
|
|
2020-06-13 08:31:28 +02:00
|
|
|
CChannelInfo cReceivedChanInfo;
|
2020-03-29 23:40:53 +02:00
|
|
|
|
|
|
|
bool bOtherChannelIsSolo;
|
2020-05-26 20:45:10 +02:00
|
|
|
bool bIsMyOwnFader;
|
2020-06-20 19:04:50 +02:00
|
|
|
int iPreviousFaderLevel;
|
2013-01-23 11:41:13 +01:00
|
|
|
|
|
|
|
public slots:
|
2020-06-20 20:29:43 +02:00
|
|
|
void OnLevelValueChanged ( int value ) { SendFaderLevelToServer ( value, false ); }
|
2020-05-18 20:46:46 +02:00
|
|
|
void OnPanValueChanged ( int value ) { SendPanValueToServer ( value ); }
|
2013-01-23 11:41:13 +01:00
|
|
|
void OnMuteStateChanged ( int value );
|
|
|
|
|
|
|
|
signals:
|
2020-06-20 20:29:43 +02:00
|
|
|
void gainValueChanged ( double value,
|
|
|
|
bool bIsMyOwnFader,
|
|
|
|
bool bIsGroupUpdate,
|
|
|
|
int iDiffLevel );
|
|
|
|
|
2020-05-18 20:46:46 +02:00
|
|
|
void panValueChanged ( double value );
|
2013-01-23 11:41:13 +01:00
|
|
|
void soloStateChanged ( int value );
|
|
|
|
};
|
|
|
|
|
2020-04-18 12:20:31 +02:00
|
|
|
template<unsigned int slotId>
|
|
|
|
class CAudioMixerBoardSlots : public CAudioMixerBoardSlots<slotId - 1>
|
|
|
|
{
|
|
|
|
public:
|
2020-06-20 20:29:43 +02:00
|
|
|
void OnChGainValueChanged ( double dValue,
|
|
|
|
bool bIsMyOwnFader,
|
|
|
|
bool bIsGroupUpdate,
|
|
|
|
int iDiffLevel ) { UpdateGainValue ( slotId - 1,
|
|
|
|
dValue,
|
|
|
|
bIsMyOwnFader,
|
|
|
|
bIsGroupUpdate,
|
|
|
|
iDiffLevel ); }
|
|
|
|
|
2020-05-16 18:18:58 +02:00
|
|
|
void OnChPanValueChanged ( double dValue ) { UpdatePanValue ( slotId - 1, dValue ); }
|
2020-04-18 12:20:31 +02:00
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual void UpdateGainValue ( const int iChannelIdx,
|
2020-05-26 20:45:10 +02:00
|
|
|
const double dValue,
|
2020-06-20 19:04:50 +02:00
|
|
|
const bool bIsMyOwnFader,
|
2020-06-20 20:29:43 +02:00
|
|
|
const bool bIsGroupUpdate,
|
2020-06-20 19:04:50 +02:00
|
|
|
const int iDiffLevel ) = 0;
|
2020-06-20 20:29:43 +02:00
|
|
|
|
2020-05-16 18:18:58 +02:00
|
|
|
virtual void UpdatePanValue ( const int iChannelIdx,
|
2020-05-18 20:46:46 +02:00
|
|
|
const double dValue ) = 0;
|
2020-04-18 12:20:31 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
template<>
|
|
|
|
class CAudioMixerBoardSlots<0> {};
|
|
|
|
|
|
|
|
|
|
|
|
class CAudioMixerBoard :
|
2020-05-20 22:28:52 +02:00
|
|
|
public QGroupBox,
|
2020-04-18 12:20:31 +02:00
|
|
|
public CAudioMixerBoardSlots<MAX_NUM_CHANNELS>
|
2013-01-23 11:41:13 +01:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2020-06-20 20:29:43 +02:00
|
|
|
CAudioMixerBoard ( QWidget* parent = nullptr,
|
|
|
|
Qt::WindowFlags f = nullptr );
|
2013-01-23 11:41:13 +01:00
|
|
|
|
|
|
|
void HideAll();
|
2013-02-11 16:21:53 +01:00
|
|
|
void ApplyNewConClientList ( CVector<CChannelInfo>& vecChanInfo );
|
2013-01-23 11:41:13 +01:00
|
|
|
void SetServerName ( const QString& strNewServerName );
|
|
|
|
void SetGUIDesign ( const EGUIDesign eNewDesign );
|
2020-03-29 23:40:53 +02:00
|
|
|
void SetDisplayChannelLevels ( const bool eNDCL );
|
2020-05-22 20:26:04 +02:00
|
|
|
void SetDisplayPans ( const bool eNDP );
|
2020-05-19 18:28:52 +02:00
|
|
|
void SetPanIsSupported();
|
2020-05-21 18:26:33 +02:00
|
|
|
void SetRemoteFaderIsMute ( const int iChannelIdx, const bool bIsMute );
|
2020-05-26 20:45:10 +02:00
|
|
|
void SetMyChannelID ( const int iChannelIdx ) { iMyChannelID = iChannelIdx; }
|
2013-01-23 11:41:13 +01:00
|
|
|
|
2019-01-12 13:59:16 +01:00
|
|
|
void SetFaderLevel ( const int iChannelIdx,
|
|
|
|
const int iValue );
|
2019-01-12 13:45:08 +01:00
|
|
|
|
2020-06-13 08:51:05 +02:00
|
|
|
void ChangeFaderOrder ( const bool bDoSort,
|
|
|
|
const EChSortType eChSortType );
|
|
|
|
|
2020-03-29 23:40:53 +02:00
|
|
|
void SetChannelLevels ( const CVector<uint16_t>& vecChannelLevel );
|
|
|
|
|
2020-06-14 23:02:13 +02:00
|
|
|
void SetRecorderState ( const ERecorderState newRecorderState );
|
|
|
|
|
2020-06-20 16:20:27 +02:00
|
|
|
|
2013-02-28 21:54:47 +01:00
|
|
|
// settings
|
|
|
|
CVector<QString> vecStoredFaderTags;
|
|
|
|
CVector<int> vecStoredFaderLevels;
|
2020-05-16 19:11:54 +02:00
|
|
|
CVector<int> vecStoredPanValues;
|
2014-01-19 16:02:25 +01:00
|
|
|
CVector<int> vecStoredFaderIsSolo;
|
2020-04-04 17:14:59 +02:00
|
|
|
CVector<int> vecStoredFaderIsMute;
|
2015-11-25 16:52:00 +01:00
|
|
|
int iNewClientFaderLevel;
|
2013-02-28 21:54:47 +01:00
|
|
|
|
2013-01-23 11:41:13 +01:00
|
|
|
protected:
|
2020-05-20 22:28:52 +02:00
|
|
|
class CMixerBoardScrollArea : public QScrollArea
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CMixerBoardScrollArea ( QWidget* parent = nullptr ) : QScrollArea ( parent ) {}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual void resizeEvent ( QResizeEvent* event )
|
|
|
|
{
|
|
|
|
// if after a resize of the main window a vertical scroll bar is required, make
|
|
|
|
// sure that the fader label is visible (scroll down completely)
|
|
|
|
ensureVisible ( 0, 2000 ); // use a large value here
|
|
|
|
QScrollArea::resizeEvent ( event );
|
|
|
|
}
|
|
|
|
};
|
2020-05-20 21:21:22 +02:00
|
|
|
|
2020-05-18 20:46:46 +02:00
|
|
|
bool GetStoredFaderSettings ( const CChannelInfo& ChanInfo,
|
2014-01-19 11:51:31 +01:00
|
|
|
int& iStoredFaderLevel,
|
2020-05-16 19:11:54 +02:00
|
|
|
int& iStoredPanValue,
|
2020-04-04 17:14:59 +02:00
|
|
|
bool& bStoredFaderIsSolo,
|
2020-06-20 17:44:34 +02:00
|
|
|
bool& bStoredFaderIsMute );
|
2020-04-04 17:14:59 +02:00
|
|
|
|
2014-01-19 11:51:31 +01:00
|
|
|
void StoreFaderSettings ( CChannelFader* pChanFader );
|
2013-09-10 18:24:55 +02:00
|
|
|
void UpdateSoloStates();
|
2020-06-15 21:48:30 +02:00
|
|
|
void UpdateTitle();
|
2013-02-24 10:03:57 +01:00
|
|
|
|
2020-04-26 00:55:28 +02:00
|
|
|
void OnGainValueChanged ( const int iChannelIdx,
|
|
|
|
const double dValue );
|
|
|
|
|
2013-01-23 11:41:13 +01:00
|
|
|
CVector<CChannelFader*> vecpChanFader;
|
2020-05-20 22:28:52 +02:00
|
|
|
CMixerBoardScrollArea* pScrollArea;
|
2013-01-23 11:41:13 +01:00
|
|
|
QHBoxLayout* pMainLayout;
|
2020-03-29 23:40:53 +02:00
|
|
|
bool bDisplayChannelLevels;
|
2020-05-22 20:26:04 +02:00
|
|
|
bool bDisplayPans;
|
|
|
|
bool bIsPanSupported;
|
2015-11-25 16:52:00 +01:00
|
|
|
bool bNoFaderVisible;
|
2020-05-26 17:28:44 +02:00
|
|
|
int iMyChannelID;
|
2020-04-12 18:56:58 +02:00
|
|
|
QString strServerName;
|
2020-06-14 23:02:13 +02:00
|
|
|
ERecorderState eRecorderState;
|
2013-01-23 11:41:13 +01:00
|
|
|
|
2020-04-18 12:20:31 +02:00
|
|
|
virtual void UpdateGainValue ( const int iChannelIdx,
|
2020-05-26 20:45:10 +02:00
|
|
|
const double dValue,
|
2020-06-20 19:04:50 +02:00
|
|
|
const bool bIsMyOwnFader,
|
2020-06-20 20:29:43 +02:00
|
|
|
const bool bIsGroupUpdate,
|
2020-06-20 19:04:50 +02:00
|
|
|
const int iDiffLevel );
|
2020-06-20 20:29:43 +02:00
|
|
|
|
2020-05-16 18:18:58 +02:00
|
|
|
virtual void UpdatePanValue ( const int iChannelIdx,
|
2020-05-18 20:46:46 +02:00
|
|
|
const double dValue );
|
2020-04-18 12:20:31 +02:00
|
|
|
|
|
|
|
template<unsigned int slotId>
|
|
|
|
inline void connectFaderSignalsToMixerBoardSlots();
|
|
|
|
|
2013-01-23 11:41:13 +01:00
|
|
|
signals:
|
2020-05-26 20:45:10 +02:00
|
|
|
void ChangeChanGain ( int iId, double dGain, bool bIsMyOwnFader );
|
2020-04-26 00:55:28 +02:00
|
|
|
void ChangeChanPan ( int iId, double dPan );
|
2013-01-23 11:41:13 +01:00
|
|
|
void NumClientsChanged ( int iNewNumClients );
|
|
|
|
};
|