Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

90 lines
2.9 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=====================================================================================//
  6. #ifndef SND_DEV_PS3AUDIO_H
  7. #define SND_DEV_PS3AUDIO_H
  8. #pragma once
  9. #include "audio_pch.h"
  10. #include "inetmessage.h"
  11. #include "netmessages.h"
  12. #include "engine/ienginevoice.h"
  13. class IAudioDevice;
  14. IAudioDevice *Audio_CreatePS3AudioDevice( bool bInitVoice );
  15. #define PS3_SUPPORT_XVOICE
  16. #ifdef PS3_SUPPORT_XVOICE
  17. class CEngineVoicePs3 : public IEngineVoice
  18. {
  19. public:
  20. CEngineVoicePs3();
  21. static const float MAX_VOICE_BUFFER_TIME = 0.200f; // 200ms
  22. void VoiceInit( void );
  23. void VoiceShutdown( void );
  24. void AddPlayerToVoiceList( XUID xPlayer, int iController, uint64 uiFlags );
  25. void RemovePlayerFromVoiceList( XUID xPlayer, int iController );
  26. bool VoiceUpdateData( int iCtrlr );
  27. void GetVoiceData( int iCtrlr, CCLCMsg_VoiceData_t *pData );
  28. void GetVoiceData( int iController, const byte **ppvVoiceDataBuffer, unsigned int *pnumVoiceDataBytes );
  29. void VoiceSendData( int iCtrlr, INetChannel *pChannel );
  30. void VoiceResetLocalData( int iCtrlr );
  31. void PlayIncomingVoiceData( XUID xuid, const byte *pbData, unsigned int dwDataSize, const bool *bAudiblePlayers = NULL );
  32. void UpdateHUDVoiceStatus( void );
  33. void GetRemoteTalkers( int *pNumTalkers, XUID *pRemoteTalkers );
  34. void SetPlaybackPriority( XUID remoteTalker, int iController, int iAllowPlayback );
  35. bool IsLocalPlayerTalking( int controlerID );
  36. bool IsPlayerTalking( XUID uid );
  37. bool IsHeadsetPresent( int id );
  38. void RemoveAllTalkers();
  39. void PlayPortInterruptHandler();
  40. private:
  41. // Local chat data
  42. static const uint8 m_numVoiceUsers = 1;
  43. inline int GetVoiceUserIndex( int iController ) const { return 0; }
  44. inline int GetVoiceDeviceNumber( int iController ) const { return 0; }
  45. static const WORD m_ChatBufferSize = 16*1024;
  46. BYTE m_ChatBuffer[ m_numVoiceUsers ][ m_ChatBufferSize ];
  47. WORD m_wLocalDataSize[ m_numVoiceUsers ];
  48. enum VoiceState_t
  49. {
  50. kVoiceNotInitialized,
  51. kVoiceInit,
  52. kVoiceOpen
  53. };
  54. VoiceState_t m_bUserRegistered[ m_numVoiceUsers ]; //This is to handle a bug in UnregisterLocalTalker where it crashes on
  55. //unregistering a local talker who has not been registered if the
  56. //controller id is non-0.
  57. // Last voice data sent
  58. float m_dwLastVoiceSend[ m_numVoiceUsers ];
  59. //
  60. // PS3 playback parameters
  61. //
  62. int CreateVoicePortsLocal( uint64 uiFlags );
  63. uint32 m_memContainer;
  64. uint32 m_portIMic, m_portOVoice, m_portIVoiceEcho, m_portOPcm, m_portOEarphone, m_portOSendForRemote;
  65. struct RemoteTalker_t
  66. {
  67. XUID m_xuid;
  68. uint32 m_portIRemoteVoice;
  69. uint64 m_uiFlags;
  70. float m_flLastTalkTimestamp;
  71. };
  72. int CreateVoicePortsRemote( RemoteTalker_t &rt );
  73. CUtlVector< RemoteTalker_t > m_arrRemoteTalkers;
  74. };
  75. CEngineVoicePs3 *Audio_GetXVoice( void );
  76. #endif
  77. #endif // SND_DEV_PS3AUDIO_H