BVB Source Codes

CRYENGINE Show VoiceController.cpp Source code

Return Download CRYENGINE: download VoiceController.cpp Source code - Download CRYENGINE Source code - Type:.cpp
  1. // Copyright 2001-2016 Crytek GmbH / Crytek Group. All rights reserved.
  2.  
  3. #include "StdAfx.h"
  4. #include "VoiceController.h"
  5. #include "GameClientChannel.h"
  6. #include "GameContext.h"
  7.  
  8. #ifndef OLD_VOICE_SYSTEM_DEPRECATED
  9.  
  10. CVoiceController::CVoiceController(CGameContext* pGameContext)
  11. {
  12.         m_pNetContext = pGameContext->GetNetContext();
  13.         m_pMicrophone = NULL;
  14.  
  15.         m_enabled = false;
  16.         m_recording = false;
  17.  
  18.         if (!pGameContext->HasContextFlag(eGSF_LocalOnly))
  19.         {
  20.                 m_pMicrophone = gEnv->pAudioSystem->CreateMicrophone(0, 0, 0, 0);
  21.  
  22.                 if (m_pMicrophone)
  23.                         m_recording = m_pMicrophone->Record(0, 16, 8000, 16000);
  24.         }
  25.         else
  26.                 m_pMicrophone = 0;
  27. }
  28.  
  29. CVoiceController::~CVoiceController()
  30. {
  31.         if (m_pMicrophone)
  32.                 m_pMicrophone->Stop();
  33.         SAFE_RELEASE(m_pMicrophone);
  34. }
  35.  
  36. void CVoiceController::Enable(const bool e)
  37. {
  38.         if (e != m_enabled)
  39.         {
  40.                 if (m_enabled && m_recording)
  41.                         m_DataReader.m_pMicrophone = 0;
  42.  
  43.                 if (e)
  44.                         m_DataReader.m_pMicrophone = m_pMicrophone;
  45.  
  46.                 m_enabled = e;
  47.         }
  48. }
  49.  
  50. bool CVoiceController::Init()
  51. {
  52.         return true;
  53. }
  54.  
  55. void CVoiceController::PlayerIdSet(EntityId id)
  56. {
  57.         if (m_pNetContext && m_pNetContext->GetVoiceContext())
  58.                 m_pNetContext->GetVoiceContext()->SetVoiceDataReader(id, &m_DataReader);
  59. }
  60.  
  61. #endif
  62.  
downloadVoiceController.cpp Source code - Download CRYENGINE Source code
Related Source Codes/Software:
postal - 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top