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.

135 lines
4.9 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Applicaton-level hooks for clients of the audio subsystem
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef SOUNDSERVICE_H
  8. #define SOUNDSERVICE_H
  9. #if defined( _WIN32 )
  10. #pragma once
  11. #endif
  12. class Vector;
  13. class QAngle;
  14. class CAudioSource;
  15. typedef int SoundSource;
  16. struct SpatializationInfo_t;
  17. typedef void *FileNameHandle_t;
  18. struct StartSoundParams_t;
  19. #include "cdll_int.h"
  20. #include "utlrbtree.h"
  21. //-----------------------------------------------------------------------------
  22. // Purpose: Services required by the audio system to function, this facade
  23. // defines the bridge between the audio code and higher level
  24. // systems.
  25. //
  26. // Note that some of these currently suggest that certain
  27. // functionality would like to exist at a deeper layer so
  28. // systems like audio can take advantage of them
  29. // diectly (toml 05-02-02)
  30. //-----------------------------------------------------------------------------
  31. abstract_class ISoundServices
  32. {
  33. public:
  34. //---------------------------------
  35. // Allocate a block of memory that will be automatically
  36. // cleaned up on level change
  37. //---------------------------------
  38. virtual void *LevelAlloc( int nBytes, const char *pszTag ) = 0;
  39. //---------------------------------
  40. // Notification that someone called S_ExtraUpdate()
  41. //---------------------------------
  42. virtual void OnExtraUpdate() = 0;
  43. //---------------------------------
  44. // Return false if the entity doesn't exist or is out of the PVS, in which case the sound shouldn't be heard.
  45. //---------------------------------
  46. virtual bool GetSoundSpatialization( int entIndex, SpatializationInfo_t& info ) = 0;
  47. //---------------------------------
  48. // This is the client's clock, which follows the servers and thus isn't 100% smooth all the time (it is in single player)
  49. //---------------------------------
  50. virtual float GetClientTime() = 0;
  51. //---------------------------------
  52. // This is the engine's filtered timer, it's pretty smooth all the time
  53. //---------------------------------
  54. virtual float GetHostTime() = 0;
  55. //---------------------------------
  56. //---------------------------------
  57. virtual int GetViewEntity( int nSlot ) = 0;
  58. //---------------------------------
  59. //---------------------------------
  60. virtual float GetHostFrametime() = 0;
  61. virtual void SetSoundFrametime( float realDt, float hostDt ) = 0;
  62. //---------------------------------
  63. //---------------------------------
  64. virtual int GetServerCount() = 0;
  65. //---------------------------------
  66. //---------------------------------
  67. virtual bool IsPlayer( SoundSource source ) = 0;
  68. // -1 if local player not spectating anyone, otherwise the index of the player being spectated
  69. virtual int GetSpectatorTarget( ClientDLLObserverMode_t *pObserverMode ) = 0;
  70. //---------------------------------
  71. //---------------------------------
  72. virtual void OnChangeVoiceStatus( int entity, int iSsSlot, bool status) = 0;
  73. // returns false if the player can't hear the other client due to game rules (eg. the other team)
  74. virtual bool GetPlayerAudible( int iPlayerIndex ) = 0;
  75. // Is the player fully connected (don't do DSP processing if not)
  76. virtual bool IsConnected() = 0;
  77. // Calls into client .dll with list of close caption tokens to construct a caption out of
  78. virtual void EmitSentenceCloseCaption( char const *tokenstream ) = 0;
  79. // Calls into client .dll with list of close caption tokens to construct a caption out of
  80. virtual void EmitCloseCaption( char const *captionname, float duration ) = 0;
  81. virtual char const *GetGameDir() = 0;
  82. // If the game is paused, certain audio will pause, too (anything with phoneme/sentence data for now)
  83. virtual bool IsGamePaused() = 0;
  84. // restarts the sound system externally
  85. virtual void RestartSoundSystem() = 0;
  86. virtual void GetAllSoundFilesReferencedInReslists( CUtlRBTree< FileNameHandle_t, int >& list ) = 0;
  87. virtual void GetAllManifestFiles( CUtlRBTree< FileNameHandle_t, int >& list ) = 0;
  88. virtual void GetAllSoundFilesInManifest( CUtlRBTree< FileNameHandle_t, int >& list, char const *manifestfile ) = 0;
  89. virtual void CacheBuildingStart() = 0;
  90. virtual void CacheBuildingUpdateProgress( float percent, char const *cachefile ) = 0;
  91. virtual void CacheBuildingFinish() = 0;
  92. // For building sound cache manifests
  93. virtual int GetPrecachedSoundCount() = 0;
  94. virtual char const *GetPrecachedSound( int index ) = 0;
  95. virtual void OnSoundStarted( int guid, StartSoundParams_t& params, char const *soundname ) = 0;
  96. virtual void OnSoundStopped( int guid, int soundsource, int channel, char const *soundname ) = 0;
  97. virtual bool GetToolSpatialization( int iUserData, int guid, SpatializationInfo_t& info ) = 0;
  98. virtual char const *GetUILanguage() = 0;
  99. };
  100. //-------------------------------------
  101. extern ISoundServices *g_pSoundServices;
  102. //=============================================================================
  103. #endif // SOUNDSERVICE_H