New Client Level now also applies if you enter a server
This commit is contained in:
parent
b576b389b4
commit
f6e5120095
13 changed files with 84 additions and 6 deletions
|
@ -11,10 +11,12 @@
|
|||
- display recorder state and latest recording directory in the server GUI,
|
||||
allow a new recording to be requested, by pljones (#228)
|
||||
|
||||
- New Client Level now also applies if you enter a server
|
||||
|
||||
- bug fix: audio fader sliders cannot be moved if the main windows is too small (#292)
|
||||
|
||||
|
||||
TODO create protocol message to inform client about its ID at the server
|
||||
TODO honour own fader and Mute button in Mute Myself (#148)
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -613,6 +613,7 @@ CAudioMixerBoard::CAudioMixerBoard ( QWidget* parent, Qt::WindowFlags ) :
|
|||
bDisplayPans ( false ),
|
||||
bIsPanSupported ( false ),
|
||||
bNoFaderVisible ( true ),
|
||||
iMyChannelID ( INVALID_INDEX ),
|
||||
strServerName ( "" )
|
||||
{
|
||||
// add group box and hboxlayout
|
||||
|
@ -756,6 +757,7 @@ void CAudioMixerBoard::HideAll()
|
|||
// set flags
|
||||
bIsPanSupported = false;
|
||||
bNoFaderVisible = true;
|
||||
iMyChannelID = INVALID_INDEX;
|
||||
|
||||
// emit status of connected clients
|
||||
emit NumClientsChanged ( 0 ); // -> no clients connected
|
||||
|
@ -796,9 +798,13 @@ void CAudioMixerBoard::ApplyNewConClientList ( CVector<CChannelInfo>& vecChanInf
|
|||
// 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
|
||||
// adjusted. If we have received our own channel ID, then
|
||||
// we can adjust the level even if no fader was visible.
|
||||
// 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 ) )
|
||||
if ( ( !bNoFaderVisible ||
|
||||
( ( iMyChannelID != INVALID_INDEX ) && ( iMyChannelID != i ) ) ) &&
|
||||
( iNewClientFaderLevel != 100 ) )
|
||||
{
|
||||
// the value is in percent -> convert range
|
||||
vecpChanFader[i]->SetFaderLevel ( static_cast<int> (
|
||||
|
|
|
@ -147,6 +147,7 @@ public:
|
|||
void SetDisplayPans ( const bool eNDP );
|
||||
void SetPanIsSupported();
|
||||
void SetRemoteFaderIsMute ( const int iChannelIdx, const bool bIsMute );
|
||||
void SetMyChannelID ( const int iChanID ) { iMyChannelID = iChanID; }
|
||||
|
||||
void SetFaderLevel ( const int iChannelIdx,
|
||||
const int iValue );
|
||||
|
@ -196,6 +197,7 @@ protected:
|
|||
bool bDisplayPans;
|
||||
bool bIsPanSupported;
|
||||
bool bNoFaderVisible;
|
||||
int iMyChannelID;
|
||||
QString strServerName;
|
||||
|
||||
virtual void UpdateGainValue ( const int iChannelIdx,
|
||||
|
|
|
@ -90,6 +90,10 @@ qRegisterMetaType<CHostAddress> ( "CHostAddress" );
|
|||
QObject::connect ( &Protocol, SIGNAL ( ChangeChanPan ( int, double ) ),
|
||||
this, SLOT ( OnChangeChanPan ( int, double ) ) );
|
||||
|
||||
QObject::connect ( &Protocol,
|
||||
SIGNAL ( ClientIDReceived ( int ) ),
|
||||
SIGNAL ( ClientIDReceived ( int ) ) );
|
||||
|
||||
QObject::connect ( &Protocol,
|
||||
SIGNAL ( MuteStateHasChangedReceived ( int, bool ) ),
|
||||
SIGNAL ( MuteStateHasChangedReceived ( int, bool ) ) );
|
||||
|
|
|
@ -157,6 +157,7 @@ public:
|
|||
Protocol.CreateJitBufMes ( iJitBufSize );
|
||||
}
|
||||
}
|
||||
void CreateClientIDMes ( const int iChanID ) { Protocol.CreateClientIDMes ( iChanID ); }
|
||||
void CreateReqNetwTranspPropsMes() { Protocol.CreateReqNetwTranspPropsMes(); }
|
||||
void CreateReqJitBufMes() { Protocol.CreateReqJitBufMes(); }
|
||||
void CreateReqConnClientsList() { Protocol.CreateReqConnClientsList(); }
|
||||
|
@ -278,6 +279,7 @@ signals:
|
|||
void ReqConnClientsList();
|
||||
void ConClientListMesReceived ( CVector<CChannelInfo> vecChanInfo );
|
||||
void ChanInfoHasChanged();
|
||||
void ClientIDReceived ( int iChanID );
|
||||
void MuteStateHasChanged ( int iChanID, bool bIsMuted );
|
||||
void MuteStateHasChangedReceived ( int iChanID, bool bIsMuted );
|
||||
void ReqChanInfo();
|
||||
|
|
|
@ -157,6 +157,10 @@ CClient::CClient ( const quint16 iPortNumber,
|
|||
SIGNAL ( ChatTextReceived ( QString ) ),
|
||||
SIGNAL ( ChatTextReceived ( QString ) ) );
|
||||
|
||||
QObject::connect ( &Channel,
|
||||
SIGNAL ( ClientIDReceived ( int ) ),
|
||||
SIGNAL ( ClientIDReceived ( int ) ) );
|
||||
|
||||
QObject::connect ( &Channel,
|
||||
SIGNAL ( MuteStateHasChangedReceived ( int, bool ) ),
|
||||
SIGNAL ( MuteStateHasChangedReceived ( int, bool ) ) );
|
||||
|
|
|
@ -424,6 +424,7 @@ public slots:
|
|||
signals:
|
||||
void ConClientListMesReceived ( CVector<CChannelInfo> vecChanInfo );
|
||||
void ChatTextReceived ( QString strChatText );
|
||||
void ClientIDReceived ( int iChanID );
|
||||
void MuteStateHasChangedReceived ( int iChanID, bool bIsMuted );
|
||||
void LicenceRequired ( ELicenceType eLicenceType );
|
||||
void VersionAndOSReceived ( COSUtil::EOpSystemType eOSType, QString strVersion );
|
||||
|
|
|
@ -461,6 +461,10 @@ CClientDlg::CClientDlg ( CClient* pNCliP,
|
|||
SIGNAL ( ChatTextReceived ( QString ) ),
|
||||
this, SLOT ( OnChatTextReceived ( QString ) ) );
|
||||
|
||||
QObject::connect ( pClient,
|
||||
SIGNAL ( ClientIDReceived ( int ) ),
|
||||
this, SLOT ( OnClientIDReceived ( int ) ) );
|
||||
|
||||
QObject::connect ( pClient,
|
||||
SIGNAL ( MuteStateHasChangedReceived ( int, bool ) ),
|
||||
this, SLOT ( OnMuteStateHasChangedReceived ( int, bool ) ) );
|
||||
|
|
|
@ -198,6 +198,9 @@ public slots:
|
|||
CVector<CChannelInfo> vecChanInfo )
|
||||
{ ConnectDlg.SetConnClientsList ( InetAddr, vecChanInfo ); }
|
||||
|
||||
void OnClientIDReceived ( int iChanID )
|
||||
{ MainMixerBoard->SetMyChannelID ( iChanID ); }
|
||||
|
||||
void OnMuteStateHasChangedReceived ( int iChanID, bool bIsMuted )
|
||||
{ MainMixerBoard->SetRemoteFaderIsMute ( iChanID, bIsMuted ); }
|
||||
|
||||
|
|
|
@ -57,6 +57,13 @@ MESSAGES (with connection)
|
|||
note: does not have any data -> n = 0
|
||||
|
||||
|
||||
- PROTMESSID_CLIENT_ID: Sends the current client ID to the client
|
||||
|
||||
+---------------------------------+
|
||||
| 1 byte channel ID of the client |
|
||||
+---------------------------------+
|
||||
|
||||
|
||||
- PROTMESSID_CHANNEL_GAIN: Gain of channel
|
||||
|
||||
+-------------------+--------------+
|
||||
|
@ -168,6 +175,7 @@ MESSAGES (with connection)
|
|||
| 1 byte licence type |
|
||||
+---------------------+
|
||||
|
||||
|
||||
- PROTMESSID_REQ_CHANNEL_LEVEL_LIST: Opt in or out of the channel level list
|
||||
|
||||
+---------------+
|
||||
|
@ -176,6 +184,7 @@ MESSAGES (with connection)
|
|||
|
||||
option is boolean, true to opt in, false to opt out
|
||||
|
||||
|
||||
- PROTMESSID_VERSION_AND_OS: Version number and operating system
|
||||
|
||||
+-------------------------+------------------+------------------------------+
|
||||
|
@ -589,6 +598,10 @@ if ( rand() < ( RAND_MAX / 2 ) ) return false;
|
|||
bRet = EvaluateReqJitBufMes();
|
||||
break;
|
||||
|
||||
case PROTMESSID_CLIENT_ID:
|
||||
bRet = EvaluateClientIDMes ( vecbyMesBodyData );
|
||||
break;
|
||||
|
||||
case PROTMESSID_CHANNEL_GAIN:
|
||||
bRet = EvaluateChanGainMes ( vecbyMesBodyData );
|
||||
break;
|
||||
|
@ -798,6 +811,37 @@ bool CProtocol::EvaluateReqJitBufMes()
|
|||
return false; // no error
|
||||
}
|
||||
|
||||
void CProtocol::CreateClientIDMes ( const int iChanID )
|
||||
{
|
||||
CVector<uint8_t> vecData ( 1 ); // 1 byte of data
|
||||
int iPos = 0; // init position pointer
|
||||
|
||||
// build data vector
|
||||
// channel ID
|
||||
PutValOnStream ( vecData, iPos, static_cast<uint32_t> ( iChanID ), 1 );
|
||||
|
||||
CreateAndSendMessage ( PROTMESSID_CLIENT_ID, vecData );
|
||||
}
|
||||
|
||||
bool CProtocol::EvaluateClientIDMes ( const CVector<uint8_t>& vecData )
|
||||
{
|
||||
int iPos = 0; // init position pointer
|
||||
|
||||
// check size
|
||||
if ( vecData.Size() != 1 )
|
||||
{
|
||||
return true; // return error code
|
||||
}
|
||||
|
||||
// channel ID
|
||||
const int iCurID = static_cast<int> ( GetValFromStream ( vecData, iPos, 1 ) );
|
||||
|
||||
// invoke message action
|
||||
emit ClientIDReceived ( iCurID );
|
||||
|
||||
return false; // no error
|
||||
}
|
||||
|
||||
void CProtocol::CreateChanGainMes ( const int iChanID, const double dGain )
|
||||
{
|
||||
CVector<uint8_t> vecData ( 3 ); // 3 bytes of data
|
||||
|
|
|
@ -58,6 +58,7 @@
|
|||
#define PROTMESSID_VERSION_AND_OS 29 // version number and operating system
|
||||
#define PROTMESSID_CHANNEL_PAN 30 // set channel pan for mix
|
||||
#define PROTMESSID_MUTE_STATE_CHANGED 31 // mute state of your signal at another client has changed
|
||||
#define PROTMESSID_CLIENT_ID 32 // current user ID and server status
|
||||
|
||||
// message IDs of connection less messages (CLM)
|
||||
// DEFINITION -> start at 1000, end at 1999, see IsConnectionLessMessageID
|
||||
|
@ -98,6 +99,7 @@ public:
|
|||
|
||||
void CreateJitBufMes ( const int iJitBufSize );
|
||||
void CreateReqJitBufMes();
|
||||
void CreateClientIDMes ( const int iChanID );
|
||||
void CreateChanGainMes ( const int iChanID, const double dGain );
|
||||
void CreateChanPanMes ( const int iChanID, const double dPan );
|
||||
void CreateMuteStateHasChangedMes ( const int iChanID, const bool bIsMuted );
|
||||
|
@ -223,6 +225,7 @@ protected:
|
|||
|
||||
bool EvaluateJitBufMes ( const CVector<uint8_t>& vecData );
|
||||
bool EvaluateReqJitBufMes();
|
||||
bool EvaluateClientIDMes ( const CVector<uint8_t>& vecData );
|
||||
bool EvaluateChanGainMes ( const CVector<uint8_t>& vecData );
|
||||
bool EvaluateChanPanMes ( const CVector<uint8_t>& vecData );
|
||||
bool EvaluateMuteStateHasChangedMes ( const CVector<uint8_t>& vecData );
|
||||
|
@ -284,6 +287,7 @@ signals:
|
|||
void ChangeJittBufSize ( int iNewJitBufSize );
|
||||
void ReqJittBufSize();
|
||||
void ChangeNetwBlSiFact ( int iNewNetwBlSiFact );
|
||||
void ClientIDReceived ( int iChanID );
|
||||
void ChangeChanGain ( int iChanID, double dNewGain );
|
||||
void ChangeChanPan ( int iChanID, double dNewPan );
|
||||
void MuteStateHasChangedReceived ( int iCurID, bool bIsMuted );
|
||||
|
|
|
@ -466,7 +466,7 @@ CServer::CServer ( const int iNewMaxNumChan,
|
|||
|
||||
QObject::connect ( &ServerListManager,
|
||||
SIGNAL ( SvrRegStatusChanged() ),
|
||||
this, SLOT ( OnSvrRegStatusChanged() ) );
|
||||
SIGNAL ( SvrRegStatusChanged() ) );
|
||||
|
||||
QObject::connect( &JamRecorder,
|
||||
SIGNAL ( RecordingSessionStarted ( QString ) ),
|
||||
|
@ -553,6 +553,10 @@ void CServer::SendProtMessage ( int iChID, CVector<uint8_t> vecMessage )
|
|||
void CServer::OnNewConnection ( int iChID,
|
||||
CHostAddress RecHostAddr )
|
||||
{
|
||||
// inform the client about its own ID at the server (note that this
|
||||
// must be the first message to be sent for a new connection)
|
||||
vecChannels[iChID].CreateClientIDMes ( iChID );
|
||||
|
||||
// on a new connection we query the network transport properties for the
|
||||
// audio packets (to use the correct network block size and audio
|
||||
// compression properties, etc.)
|
||||
|
|
|
@ -450,8 +450,6 @@ public slots:
|
|||
ServerListManager.StoreRegistrationResult ( eResult );
|
||||
}
|
||||
|
||||
void OnSvrRegStatusChanged() { emit SvrRegStatusChanged(); }
|
||||
|
||||
void OnCLUnregisterServerReceived ( CHostAddress InetAddr )
|
||||
{
|
||||
ServerListManager.CentralServerUnregisterServer ( InetAddr );
|
||||
|
|
Loading…
Reference in a new issue