1 // Copyright 2001-2018 Crytek GmbH / Crytek Group. All rights reserved.
8 #include <CryLobby/ICryVoice.h>
10 #include "CryMatchMaking.h"
14 #define MAX_LOCAL_TALKERS 4
15 #define MAX_REMOTE_TALKERS 16
17 #define NET_MICROPHONE_DEBUG 0
19 typedef uint32 CryVoiceRemoteUserID
;
20 const CryVoiceRemoteUserID CryVoiceInvalidRemoteUserID
= 0xffffffff;
22 class CCryVoice
: public CMultiThreadRefCount
, public ICryVoice
25 CCryVoice(CCryLobby
* pLobby
, CCryLobbyService
* pService
);
27 virtual void Mute(uint32 localUser
, CryUserID remoteUser
, bool mute
);
28 virtual void MuteLocalPlayer(uint32 localUser
, bool mute
);
29 virtual bool IsMuted(uint32 localUser
, CryUserID remoteUser
);
30 virtual void MuteExternally(uint32 localUser
, CryUserID remoteUser
, bool mute
);
31 virtual bool IsMutedExternally(uint32 localUser
, CryUserID remoteUser
);
32 virtual bool IsSpeaking(uint32 localUser
, CryUserID remoteUser
);
33 virtual bool IsSpeaking(uint32 localUser
) = 0;
34 virtual bool IsMicrophoneConnected(CryUserID userID
);
36 virtual void EnablePushToTalk(uint32 localUser
, bool bSet
) {}
37 virtual bool IsPushToTalkEnabled(uint32 localUser
) { return false; }
38 virtual void PushToTalkButtonDown(uint32 localUser
) {}
39 virtual void PushToTalkButtonUp(uint32 localUser
) {}
40 virtual void SetVoicePlaybackVolume(uint32 localUser
, float volume
) {}
41 virtual float GetVoicePlaybackVolume(uint32 localUser
) { return 0.0f
; }
44 ECryLobbyError
Initialise();
45 CryVoiceRemoteUserID
RegisterRemoteUser(CryLobbyConnectionID connectionID
, CryUserID remoteUser
);
46 void UnRegisterRemoteUser(CryVoiceRemoteUserID user
);
47 CryVoiceRemoteUserID
GetRemoteUser(CryUserID remoteUser
);
49 virtual void SendMicrophoneNotification(uint32 remoteUserID
) = 0;
50 virtual void SendMicrophoneRequest(uint32 remoteUserID
) = 0;
52 void Tick(CTimeValue tv
);
56 UF_REGISTERED
= BIT(0),
57 UF_IS_SPEAKING
= BIT(1),
58 UF_IS_MICROPHONE_CONNECTED
= BIT(2),
59 UF_REQUEST_MICROPHONE_STATUS
= BIT(3),
60 UF_SEND_MICROPHONE_STATUS
= BIT(4),
62 UF_PLATFORM_FLAGS_START_BIT
= 16 // Not a bit
67 LUF_IS_MUTED
= BIT(0),
72 CryLobbyConnectionID m_connectionID
;
74 uint32 m_remoteUserFlags
;
77 enum eRelationshipFlags
79 RF_MUTED_GAME
= BIT(0),
80 RF_MUTED_EXTERNAL
= BIT(1),
81 RF_PLAYBACK_ON
= BIT(2),
83 RF_PLATFORM_FLAGS_START_BIT
= 16 // Not a bit
86 struct SUserRelationship
88 uint32 m_relationshipFlags
;
91 CTimeValue m_notificationTimer
;
93 CCryLobbyService
* m_pService
;
94 SRemoteUser
* m_pRemoteUsers
[MAX_REMOTE_TALKERS
];
95 uint16 m_localUserFlags
[MAX_LOCAL_TALKERS
];
96 SUserRelationship
* m_pUserRelationship
[MAX_LOCAL_TALKERS
][MAX_REMOTE_TALKERS
];
98 uint32 m_numLocalTalkers
;
99 uint32 m_numRemoteTalkers
;
103 #endif // USE_CRY_VOICE
104 #endif // __CRYVOICE_H__