WIP: backup checkin of new feature "show mute state of others"
This commit is contained in:
parent
017796919c
commit
4b8c7de166
10 changed files with 129 additions and 11 deletions
|
@ -90,6 +90,10 @@ qRegisterMetaType<CHostAddress> ( "CHostAddress" );
|
||||||
QObject::connect ( &Protocol, SIGNAL ( ChangeChanPan ( int, double ) ),
|
QObject::connect ( &Protocol, SIGNAL ( ChangeChanPan ( int, double ) ),
|
||||||
this, SLOT ( OnChangeChanPan ( int, double ) ) );
|
this, SLOT ( OnChangeChanPan ( int, double ) ) );
|
||||||
|
|
||||||
|
QObject::connect ( &Protocol,
|
||||||
|
SIGNAL ( MuteStateHasChangedReceived ( int, bool ) ),
|
||||||
|
SIGNAL ( MuteStateHasChangedReceived ( int, bool ) ) );
|
||||||
|
|
||||||
QObject::connect ( &Protocol, SIGNAL ( ChangeChanInfo ( CChannelCoreInfo ) ),
|
QObject::connect ( &Protocol, SIGNAL ( ChangeChanInfo ( CChannelCoreInfo ) ),
|
||||||
this, SLOT ( OnChangeChanInfo ( CChannelCoreInfo ) ) );
|
this, SLOT ( OnChangeChanInfo ( CChannelCoreInfo ) ) );
|
||||||
|
|
||||||
|
@ -258,6 +262,16 @@ void CChannel::SetGain ( const int iChanID,
|
||||||
// set value (make sure channel ID is in range)
|
// set value (make sure channel ID is in range)
|
||||||
if ( ( iChanID >= 0 ) && ( iChanID < MAX_NUM_CHANNELS ) )
|
if ( ( iChanID >= 0 ) && ( iChanID < MAX_NUM_CHANNELS ) )
|
||||||
{
|
{
|
||||||
|
// signal mute change
|
||||||
|
if ( ( vecdGains[iChanID] == 0 ) && ( dNewGain > 0 ) )
|
||||||
|
{
|
||||||
|
emit MuteStateHasChanged ( iChanID, false );
|
||||||
|
}
|
||||||
|
if ( ( vecdGains[iChanID] > 0 ) && ( dNewGain == 0 ) )
|
||||||
|
{
|
||||||
|
emit MuteStateHasChanged ( iChanID, true );
|
||||||
|
}
|
||||||
|
|
||||||
vecdGains[iChanID] = dNewGain;
|
vecdGains[iChanID] = dNewGain;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,6 +106,7 @@ public:
|
||||||
|
|
||||||
void CreateReqChanInfoMes() { Protocol.CreateReqChanInfoMes(); }
|
void CreateReqChanInfoMes() { Protocol.CreateReqChanInfoMes(); }
|
||||||
void CreateVersionAndOSMes() { Protocol.CreateVersionAndOSMes(); }
|
void CreateVersionAndOSMes() { Protocol.CreateVersionAndOSMes(); }
|
||||||
|
void CreateMuteStateHasChangedMes ( const int iChanID, const bool bIsMuted ) { Protocol.CreateMuteStateHasChangedMes ( iChanID, bIsMuted ); }
|
||||||
|
|
||||||
void SetGain ( const int iChanID, const double dNewGain );
|
void SetGain ( const int iChanID, const double dNewGain );
|
||||||
double GetGain ( const int iChanID );
|
double GetGain ( const int iChanID );
|
||||||
|
@ -277,6 +278,8 @@ signals:
|
||||||
void ReqConnClientsList();
|
void ReqConnClientsList();
|
||||||
void ConClientListMesReceived ( CVector<CChannelInfo> vecChanInfo );
|
void ConClientListMesReceived ( CVector<CChannelInfo> vecChanInfo );
|
||||||
void ChanInfoHasChanged();
|
void ChanInfoHasChanged();
|
||||||
|
void MuteStateHasChanged ( int iChanID, bool bIsMuted );
|
||||||
|
void MuteStateHasChangedReceived ( int iChanID, bool bIsMuted );
|
||||||
void ReqChanInfo();
|
void ReqChanInfo();
|
||||||
void ChatTextReceived ( QString strChatText );
|
void ChatTextReceived ( QString strChatText );
|
||||||
void ReqNetTranspProps();
|
void ReqNetTranspProps();
|
||||||
|
|
|
@ -156,6 +156,10 @@ CClient::CClient ( const quint16 iPortNumber,
|
||||||
SIGNAL ( ChatTextReceived ( QString ) ),
|
SIGNAL ( ChatTextReceived ( QString ) ),
|
||||||
SIGNAL ( ChatTextReceived ( QString ) ) );
|
SIGNAL ( ChatTextReceived ( QString ) ) );
|
||||||
|
|
||||||
|
QObject::connect ( &Channel,
|
||||||
|
SIGNAL ( MuteStateHasChangedReceived ( int, bool ) ),
|
||||||
|
SIGNAL ( MuteStateHasChangedReceived ( int, bool ) ) );
|
||||||
|
|
||||||
QObject::connect ( &Channel,
|
QObject::connect ( &Channel,
|
||||||
SIGNAL ( LicenceRequired ( ELicenceType ) ),
|
SIGNAL ( LicenceRequired ( ELicenceType ) ),
|
||||||
SIGNAL ( LicenceRequired ( ELicenceType ) ) );
|
SIGNAL ( LicenceRequired ( ELicenceType ) ) );
|
||||||
|
|
|
@ -420,6 +420,7 @@ public slots:
|
||||||
signals:
|
signals:
|
||||||
void ConClientListMesReceived ( CVector<CChannelInfo> vecChanInfo );
|
void ConClientListMesReceived ( CVector<CChannelInfo> vecChanInfo );
|
||||||
void ChatTextReceived ( QString strChatText );
|
void ChatTextReceived ( QString strChatText );
|
||||||
|
void MuteStateHasChangedReceived ( int iChanID, bool bIsMuted );
|
||||||
void LicenceRequired ( ELicenceType eLicenceType );
|
void LicenceRequired ( ELicenceType eLicenceType );
|
||||||
void VersionAndOSReceived ( COSUtil::EOpSystemType eOSType, QString strVersion );
|
void VersionAndOSReceived ( COSUtil::EOpSystemType eOSType, QString strVersion );
|
||||||
void PingTimeReceived ( int iPingTime );
|
void PingTimeReceived ( int iPingTime );
|
||||||
|
|
|
@ -466,6 +466,10 @@ CClientDlg::CClientDlg ( CClient* pNCliP,
|
||||||
SIGNAL ( ChatTextReceived ( QString ) ),
|
SIGNAL ( ChatTextReceived ( QString ) ),
|
||||||
this, SLOT ( OnChatTextReceived ( QString ) ) );
|
this, SLOT ( OnChatTextReceived ( QString ) ) );
|
||||||
|
|
||||||
|
QObject::connect ( pClient,
|
||||||
|
SIGNAL ( MuteStateHasChangedReceived ( int, bool ) ),
|
||||||
|
this, SLOT ( OnMuteStateHasChangedReceived ( int, bool ) ) );
|
||||||
|
|
||||||
// This connection is a special case. On receiving a licence required message via the
|
// This connection is a special case. On receiving a licence required message via the
|
||||||
// protocol, a modal licence dialog is opened. Since this blocks the thread, we need
|
// protocol, a modal licence dialog is opened. Since this blocks the thread, we need
|
||||||
// a queued connection to make sure the core protocol mechanism is not blocked, too.
|
// a queued connection to make sure the core protocol mechanism is not blocked, too.
|
||||||
|
@ -776,6 +780,14 @@ void CClientDlg::OnChatTextReceived ( QString strChatText )
|
||||||
UpdateDisplay();
|
UpdateDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CClientDlg::OnMuteStateHasChangedReceived ( int iChanID, bool bIsMuted )
|
||||||
|
{
|
||||||
|
|
||||||
|
// TEST
|
||||||
|
qDebug() << "mute state changed: iChanID " << iChanID << " bIsMuted " << bIsMuted;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void CClientDlg::OnLicenceRequired ( ELicenceType eLicenceType )
|
void CClientDlg::OnLicenceRequired ( ELicenceType eLicenceType )
|
||||||
{
|
{
|
||||||
// right now only the creative common licence is supported
|
// right now only the creative common licence is supported
|
||||||
|
|
|
@ -167,6 +167,7 @@ public slots:
|
||||||
|
|
||||||
void OnConClientListMesReceived ( CVector<CChannelInfo> vecChanInfo );
|
void OnConClientListMesReceived ( CVector<CChannelInfo> vecChanInfo );
|
||||||
void OnChatTextReceived ( QString strChatText );
|
void OnChatTextReceived ( QString strChatText );
|
||||||
|
void OnMuteStateHasChangedReceived ( int iChanID, bool bIsMuted );
|
||||||
void OnLicenceRequired ( ELicenceType eLicenceType );
|
void OnLicenceRequired ( ELicenceType eLicenceType );
|
||||||
|
|
||||||
void OnChangeChanGain ( int iId, double dGain )
|
void OnChangeChanGain ( int iId, double dGain )
|
||||||
|
|
|
@ -71,6 +71,13 @@ MESSAGES (with connection)
|
||||||
+-------------------+-----------------+
|
+-------------------+-----------------+
|
||||||
|
|
||||||
|
|
||||||
|
- PROTMESSID_MUTE_STATE_CHANGED: Mute state of your signal at another client has changed
|
||||||
|
|
||||||
|
+-------------------+-----------------+
|
||||||
|
| 1 byte channel ID | 1 byte is muted |
|
||||||
|
+-------------------+-----------------+
|
||||||
|
|
||||||
|
|
||||||
- PROTMESSID_CONN_CLIENTS_LIST: Information about connected clients
|
- PROTMESSID_CONN_CLIENTS_LIST: Information about connected clients
|
||||||
|
|
||||||
for each connected client append following data:
|
for each connected client append following data:
|
||||||
|
@ -590,6 +597,10 @@ if ( rand() < ( RAND_MAX / 2 ) ) return false;
|
||||||
bRet = EvaluateChanPanMes ( vecbyMesBodyData );
|
bRet = EvaluateChanPanMes ( vecbyMesBodyData );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PROTMESSID_MUTE_STATE_CHANGED:
|
||||||
|
bRet = EvaluateMuteStateHasChangedMes ( vecbyMesBodyData );
|
||||||
|
break;
|
||||||
|
|
||||||
case PROTMESSID_CONN_CLIENTS_LIST:
|
case PROTMESSID_CONN_CLIENTS_LIST:
|
||||||
bRet = EvaluateConClientListMes ( vecbyMesBodyData );
|
bRet = EvaluateConClientListMes ( vecbyMesBodyData );
|
||||||
break;
|
break;
|
||||||
|
@ -872,6 +883,43 @@ bool CProtocol::EvaluateChanPanMes ( const CVector<uint8_t> &vecData )
|
||||||
return false; // no error
|
return false; // no error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CProtocol::CreateMuteStateHasChangedMes ( const int iChanID, const bool bIsMuted )
|
||||||
|
{
|
||||||
|
CVector<uint8_t> vecData ( 2 ); // 2 bytes of data
|
||||||
|
int iPos = 0; // init position pointer
|
||||||
|
|
||||||
|
// build data vector
|
||||||
|
// channel ID
|
||||||
|
PutValOnStream ( vecData, iPos, static_cast<uint32_t> ( iChanID ), 1 );
|
||||||
|
|
||||||
|
// mute state
|
||||||
|
PutValOnStream ( vecData, iPos, static_cast<uint32_t> ( bIsMuted ), 1 );
|
||||||
|
|
||||||
|
CreateAndSendMessage ( PROTMESSID_MUTE_STATE_CHANGED, vecData );
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CProtocol::EvaluateMuteStateHasChangedMes ( const CVector<uint8_t> &vecData )
|
||||||
|
{
|
||||||
|
int iPos = 0; // init position pointer
|
||||||
|
|
||||||
|
// check size
|
||||||
|
if ( vecData.Size() != 2 )
|
||||||
|
{
|
||||||
|
return true; // return error code
|
||||||
|
}
|
||||||
|
|
||||||
|
// channel ID
|
||||||
|
const int iCurID = static_cast<int> ( GetValFromStream ( vecData, iPos, 1 ) );
|
||||||
|
|
||||||
|
// mute state
|
||||||
|
const bool bIsMuted = static_cast<bool> ( GetValFromStream ( vecData, iPos, 1 ) );
|
||||||
|
|
||||||
|
// invoke message action
|
||||||
|
emit MuteStateHasChangedReceived ( iCurID, bIsMuted );
|
||||||
|
|
||||||
|
return false; // no error
|
||||||
|
}
|
||||||
|
|
||||||
void CProtocol::CreateConClientListMes ( const CVector<CChannelInfo>& vecChanInfo )
|
void CProtocol::CreateConClientListMes ( const CVector<CChannelInfo>& vecChanInfo )
|
||||||
{
|
{
|
||||||
const int iNumClients = vecChanInfo.Size();
|
const int iNumClients = vecChanInfo.Size();
|
||||||
|
|
|
@ -57,6 +57,7 @@
|
||||||
#define PROTMESSID_REQ_CHANNEL_LEVEL_LIST 28 // request the channel level list
|
#define PROTMESSID_REQ_CHANNEL_LEVEL_LIST 28 // request the channel level list
|
||||||
#define PROTMESSID_VERSION_AND_OS 29 // version number and operating system
|
#define PROTMESSID_VERSION_AND_OS 29 // version number and operating system
|
||||||
#define PROTMESSID_CHANNEL_PAN 30 // set channel pan for mix
|
#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
|
||||||
|
|
||||||
// message IDs of connection less messages (CLM)
|
// message IDs of connection less messages (CLM)
|
||||||
// DEFINITION -> start at 1000, end at 1999, see IsConnectionLessMessageID
|
// DEFINITION -> start at 1000, end at 1999, see IsConnectionLessMessageID
|
||||||
|
@ -99,6 +100,7 @@ public:
|
||||||
void CreateReqJitBufMes();
|
void CreateReqJitBufMes();
|
||||||
void CreateChanGainMes ( const int iChanID, const double dGain );
|
void CreateChanGainMes ( const int iChanID, const double dGain );
|
||||||
void CreateChanPanMes ( const int iChanID, const double dPan );
|
void CreateChanPanMes ( const int iChanID, const double dPan );
|
||||||
|
void CreateMuteStateHasChangedMes ( const int iChanID, const bool bIsMuted );
|
||||||
void CreateConClientListMes ( const CVector<CChannelInfo>& vecChanInfo );
|
void CreateConClientListMes ( const CVector<CChannelInfo>& vecChanInfo );
|
||||||
void CreateReqConnClientsList();
|
void CreateReqConnClientsList();
|
||||||
void CreateChanInfoMes ( const CChannelCoreInfo ChanInfo );
|
void CreateChanInfoMes ( const CChannelCoreInfo ChanInfo );
|
||||||
|
@ -223,6 +225,7 @@ protected:
|
||||||
bool EvaluateReqJitBufMes();
|
bool EvaluateReqJitBufMes();
|
||||||
bool EvaluateChanGainMes ( const CVector<uint8_t>& vecData );
|
bool EvaluateChanGainMes ( const CVector<uint8_t>& vecData );
|
||||||
bool EvaluateChanPanMes ( const CVector<uint8_t>& vecData );
|
bool EvaluateChanPanMes ( const CVector<uint8_t>& vecData );
|
||||||
|
bool EvaluateMuteStateHasChangedMes ( const CVector<uint8_t>& vecData );
|
||||||
bool EvaluateConClientListMes ( const CVector<uint8_t>& vecData );
|
bool EvaluateConClientListMes ( const CVector<uint8_t>& vecData );
|
||||||
bool EvaluateReqConnClientsList();
|
bool EvaluateReqConnClientsList();
|
||||||
bool EvaluateChanInfoMes ( const CVector<uint8_t>& vecData );
|
bool EvaluateChanInfoMes ( const CVector<uint8_t>& vecData );
|
||||||
|
@ -283,6 +286,7 @@ signals:
|
||||||
void ChangeNetwBlSiFact ( int iNewNetwBlSiFact );
|
void ChangeNetwBlSiFact ( int iNewNetwBlSiFact );
|
||||||
void ChangeChanGain ( int iChanID, double dNewGain );
|
void ChangeChanGain ( int iChanID, double dNewGain );
|
||||||
void ChangeChanPan ( int iChanID, double dNewPan );
|
void ChangeChanPan ( int iChanID, double dNewPan );
|
||||||
|
void MuteStateHasChangedReceived ( int iCurID, bool bIsMuted );
|
||||||
void ConClientListMesReceived ( CVector<CChannelInfo> vecChanInfo );
|
void ConClientListMesReceived ( CVector<CChannelInfo> vecChanInfo );
|
||||||
void ServerFullMesReceived();
|
void ServerFullMesReceived();
|
||||||
void ReqConnClientsList();
|
void ReqConnClientsList();
|
||||||
|
|
|
@ -497,6 +497,9 @@ inline void CServer::connectChannelSignalsToServerSlots()
|
||||||
void ( CServer::* pOnChatTextReceivedCh )( QString ) =
|
void ( CServer::* pOnChatTextReceivedCh )( QString ) =
|
||||||
&CServerSlots<slotId>::OnChatTextReceivedCh;
|
&CServerSlots<slotId>::OnChatTextReceivedCh;
|
||||||
|
|
||||||
|
void ( CServer::* pOnMuteStateHasChangedCh )( int, bool ) =
|
||||||
|
&CServerSlots<slotId>::OnMuteStateHasChangedCh;
|
||||||
|
|
||||||
void ( CServer::* pOnServerAutoSockBufSizeChangeCh )( int ) =
|
void ( CServer::* pOnServerAutoSockBufSizeChangeCh )( int ) =
|
||||||
&CServerSlots<slotId>::OnServerAutoSockBufSizeChangeCh;
|
&CServerSlots<slotId>::OnServerAutoSockBufSizeChangeCh;
|
||||||
|
|
||||||
|
@ -516,6 +519,10 @@ inline void CServer::connectChannelSignalsToServerSlots()
|
||||||
QObject::connect ( &vecChannels[iCurChanID], &CChannel::ChatTextReceived,
|
QObject::connect ( &vecChannels[iCurChanID], &CChannel::ChatTextReceived,
|
||||||
this, pOnChatTextReceivedCh );
|
this, pOnChatTextReceivedCh );
|
||||||
|
|
||||||
|
// other mute state has changed
|
||||||
|
QObject::connect ( &vecChannels[iCurChanID], &CChannel::MuteStateHasChanged,
|
||||||
|
this, pOnMuteStateHasChangedCh );
|
||||||
|
|
||||||
// auto socket buffer size change
|
// auto socket buffer size change
|
||||||
QObject::connect ( &vecChannels[iCurChanID], &CChannel::ServerAutoSockBufSizeChange,
|
QObject::connect ( &vecChannels[iCurChanID], &CChannel::ServerAutoSockBufSizeChange,
|
||||||
this, pOnServerAutoSockBufSizeChangeCh );
|
this, pOnServerAutoSockBufSizeChangeCh );
|
||||||
|
@ -1310,6 +1317,17 @@ void CServer::CreateAndSendChatTextForAllConChannels ( const int iCurChanID
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CServer::CreateOtherMuteStateChanged ( const int iCurChanID,
|
||||||
|
const int iOtherChanID,
|
||||||
|
const bool bIsMuted )
|
||||||
|
{
|
||||||
|
if ( vecChannels[iCurChanID].IsConnected() )
|
||||||
|
{
|
||||||
|
// send message
|
||||||
|
vecChannels[iCurChanID].CreateMuteStateHasChangedMes ( iOtherChanID, bIsMuted );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int CServer::GetFreeChan()
|
int CServer::GetFreeChan()
|
||||||
{
|
{
|
||||||
// look for a free channel
|
// look for a free channel
|
||||||
|
|
15
src/server.h
15
src/server.h
|
@ -117,10 +117,10 @@ signals:
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
template<unsigned int slotId>
|
template<unsigned int slotId>
|
||||||
class CServerSlots : public CServerSlots<slotId - 1>
|
class CServerSlots : public CServerSlots<slotId - 1>
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void OnSendProtMessCh ( CVector<uint8_t> mess ) { SendProtMessage ( slotId - 1, mess ); }
|
void OnSendProtMessCh ( CVector<uint8_t> mess ) { SendProtMessage ( slotId - 1, mess ); }
|
||||||
void OnReqConnClientsListCh() { CreateAndSendChanListForThisChan ( slotId - 1 ); }
|
void OnReqConnClientsListCh() { CreateAndSendChanListForThisChan ( slotId - 1 ); }
|
||||||
|
@ -130,6 +130,11 @@ public:
|
||||||
CreateAndSendChatTextForAllConChannels ( slotId - 1, strChatText );
|
CreateAndSendChatTextForAllConChannels ( slotId - 1, strChatText );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OnMuteStateHasChangedCh ( int iChanID, bool bIsMuted )
|
||||||
|
{
|
||||||
|
CreateOtherMuteStateChanged ( slotId - 1, iChanID, bIsMuted );
|
||||||
|
}
|
||||||
|
|
||||||
void OnServerAutoSockBufSizeChangeCh ( int iNNumFra )
|
void OnServerAutoSockBufSizeChangeCh ( int iNNumFra )
|
||||||
{
|
{
|
||||||
CreateAndSendJitBufMessage ( slotId - 1, iNNumFra );
|
CreateAndSendJitBufMessage ( slotId - 1, iNNumFra );
|
||||||
|
@ -144,6 +149,10 @@ protected:
|
||||||
virtual void CreateAndSendChatTextForAllConChannels ( const int iCurChanID,
|
virtual void CreateAndSendChatTextForAllConChannels ( const int iCurChanID,
|
||||||
const QString& strChatText ) = 0;
|
const QString& strChatText ) = 0;
|
||||||
|
|
||||||
|
virtual void CreateOtherMuteStateChanged ( const int iCurChanID,
|
||||||
|
const int iOtherChanID,
|
||||||
|
const bool bIsMuted ) = 0;
|
||||||
|
|
||||||
virtual void CreateAndSendJitBufMessage ( const int iCurChanID,
|
virtual void CreateAndSendJitBufMessage ( const int iCurChanID,
|
||||||
const int iNNumFra ) = 0;
|
const int iNNumFra ) = 0;
|
||||||
};
|
};
|
||||||
|
@ -256,6 +265,10 @@ protected:
|
||||||
virtual void CreateAndSendChatTextForAllConChannels ( const int iCurChanID,
|
virtual void CreateAndSendChatTextForAllConChannels ( const int iCurChanID,
|
||||||
const QString& strChatText );
|
const QString& strChatText );
|
||||||
|
|
||||||
|
virtual void CreateOtherMuteStateChanged ( const int iCurChanID,
|
||||||
|
const int iOtherChanID,
|
||||||
|
const bool bIsMuted );
|
||||||
|
|
||||||
virtual void CreateAndSendJitBufMessage ( const int iCurChanID,
|
virtual void CreateAndSendJitBufMessage ( const int iCurChanID,
|
||||||
const int iNNumFra );
|
const int iNNumFra );
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue