Merge pull request #366 from pljones/feature/295-define-and-send-recorder-state

#295 Part 2: Define and send recorder state
This commit is contained in:
Volker Fischer 2020-06-15 17:20:09 +02:00 committed by GitHub
commit d4e09a4680
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 62 additions and 2 deletions

View file

@ -168,6 +168,9 @@ public:
void CreateConClientListMes ( const CVector<CChannelInfo>& vecChanInfo ) void CreateConClientListMes ( const CVector<CChannelInfo>& vecChanInfo )
{ Protocol.CreateConClientListMes ( vecChanInfo ); } { Protocol.CreateConClientListMes ( vecChanInfo ); }
void CreateRecorderStateMes ( const ERecorderState eRecorderState )
{ Protocol.CreateRecorderStateMes ( eRecorderState ); }
CNetworkTransportProps GetNetworkTransportPropsFromCurrentSettings(); CNetworkTransportProps GetNetworkTransportPropsFromCurrentSettings();
bool ChannelLevelsRequired() const { return bChannelLevelsRequired; } bool ChannelLevelsRequired() const { return bChannelLevelsRequired; }

View file

@ -610,6 +610,9 @@ void CServer::OnNewConnection ( int iChID,
// send version info (for, e.g., feature activation in the client) // send version info (for, e.g., feature activation in the client)
vecChannels[iChID].CreateVersionAndOSMes(); vecChannels[iChID].CreateVersionAndOSMes();
// send recording state message on connection
vecChannels[iChID].CreateRecorderStateMes ( GetRecorderState() );
// reset the conversion buffers // reset the conversion buffers
DoubleFrameSizeConvBufIn[iChID].Reset(); DoubleFrameSizeConvBufIn[iChID].Reset();
DoubleFrameSizeConvBufOut[iChID].Reset(); DoubleFrameSizeConvBufOut[iChID].Reset();
@ -721,6 +724,9 @@ void CServer::RequestNewRecording()
{ {
emit RestartRecorder(); emit RestartRecorder();
} }
// send recording state message - doesn't hurt
CreateAndSendRecorderStateForAllConChannels();
} }
void CServer::SetEnableRecording ( bool bNewEnableRecording ) void CServer::SetEnableRecording ( bool bNewEnableRecording )
@ -747,6 +753,9 @@ void CServer::SetEnableRecording ( bool bNewEnableRecording )
emit StopRecorder(); emit StopRecorder();
} }
} }
// send recording state message
CreateAndSendRecorderStateForAllConChannels();
} }
void CServer::Start() void CServer::Start()
@ -759,6 +768,9 @@ void CServer::Start()
// emit start signal // emit start signal
emit Started(); emit Started();
// send recording state message
CreateAndSendRecorderStateForAllConChannels();
} }
} }
@ -778,6 +790,9 @@ void CServer::Stop()
// emit stopped signal // emit stopped signal
emit Stopped(); emit Stopped();
// send recording state message - to no one
CreateAndSendRecorderStateForAllConChannels();
} }
} }
@ -1330,6 +1345,42 @@ void CServer::CreateAndSendChatTextForAllConChannels ( const int iCurChanID
} }
} }
void CServer::CreateAndSendRecorderStateForAllConChannels()
{
// get recorder state
ERecorderState eRecorderState = GetRecorderState();
// now send recorder state to all connected clients
for ( int i = 0; i < iMaxNumChannels; i++ )
{
if ( vecChannels[i].IsConnected() )
{
// send message
vecChannels[i].CreateRecorderStateMes ( eRecorderState );
}
}
}
ERecorderState CServer::GetRecorderState()
{
// return recorder state
if ( bRecorderInitialised )
{
if ( bEnableRecording )
{
return RS_RECORDING;
}
else
{
return RS_NOT_ENABLED;
}
}
else
{
return RS_NOT_INITIALISED;
}
}
void CServer::CreateOtherMuteStateChanged ( const int iCurChanID, void CServer::CreateOtherMuteStateChanged ( const int iCurChanID,
const int iOtherChanID, const int iOtherChanID,
const bool bIsMuted ) const bool bIsMuted )

View file

@ -273,6 +273,10 @@ protected:
virtual void CreateAndSendChatTextForAllConChannels ( const int iCurChanID, virtual void CreateAndSendChatTextForAllConChannels ( const int iCurChanID,
const QString& strChatText ); const QString& strChatText );
virtual void CreateAndSendRecorderStateForAllConChannels();
ERecorderState GetRecorderState();
virtual void CreateOtherMuteStateChanged ( const int iCurChanID, virtual void CreateOtherMuteStateChanged ( const int iCurChanID,
const int iOtherChanID, const int iOtherChanID,
const bool bIsMuted ); const bool bIsMuted );

View file

@ -566,8 +566,10 @@ enum ELicenceType
// Server jam recorder state enum ---------------------------------------------- // Server jam recorder state enum ----------------------------------------------
enum ERecorderState enum ERecorderState
{ {
RS_UNDEFINED = 0 RS_UNDEFINED = 0,
// ... to be defined ... RS_NOT_INITIALISED = 1,
RS_NOT_ENABLED = 2,
RS_RECORDING = 3
}; };