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.

98 lines
2.9 KiB

  1. //====== Copyright � 1996-2005, Valve Corporation, All rights reserved. =======
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================
  6. #ifndef SNDINFO_H
  7. #define SNDINFO_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. class Vector;
  12. #include "utlsymbol.h"
  13. // Handy defines for EmitSound
  14. #define SOUND_FROM_LOCAL_PLAYER -1
  15. #define SOUND_FROM_WORLD 0
  16. // These are used to feed a soundlevel to the sound system and have it use
  17. // goldsrc-type attenuation. We should use this as little as possible and
  18. // phase it out as soon as possible.
  19. // Take a regular sndlevel and convert it to compatibility mode.
  20. #define SNDLEVEL_TO_COMPATIBILITY_MODE( x ) ((soundlevel_t)(int)( (x) + 256 ))
  21. // Take a compatibility-mode sndlevel and get the REAL sndlevel out of it.
  22. #define SNDLEVEL_FROM_COMPATIBILITY_MODE( x ) ((soundlevel_t)(int)( (x) - 256 ))
  23. // Tells if the given sndlevel is marked as compatibility mode.
  24. #define SNDLEVEL_IS_COMPATIBILITY_MODE( x ) ( (x) >= 256 )
  25. // Sound guids are assigned on the server starting at 1
  26. // On the client, they are assigned by the sound system starting at 0x80000001
  27. typedef uint32 SoundGuid_t;
  28. #define INVALID_SOUND_GUID (SoundGuid_t)0
  29. //-----------------------------------------------------------------------------
  30. // Purpose: Client side only
  31. //-----------------------------------------------------------------------------
  32. struct SndInfo_t
  33. {
  34. // Sound Guid
  35. SoundGuid_t m_nGuid;
  36. FileNameHandle_t m_filenameHandle; // filesystem filename handle - call IFilesystem to conver this to a string
  37. CEntityIndex m_nSoundSource;
  38. int m_nChannel;
  39. // If a sound is being played through a speaker entity (e.g., on a monitor,), this is the
  40. // entity upon which to show the lips moving, if the sound has sentence data
  41. CEntityIndex m_nSpeakerEntity;
  42. float m_flVolume;
  43. float m_flLastSpatializedVolume;
  44. // Radius of this sound effect (spatialization is different within the radius)
  45. float m_flRadius;
  46. int m_nPitch;
  47. Vector *m_pOrigin;
  48. Vector *m_pDirection;
  49. // if true, assume sound source can move and update according to entity
  50. bool m_bUpdatePositions;
  51. // true if playing linked sentence
  52. bool m_bIsSentence;
  53. // if true, bypass all dsp processing for this sound (ie: music)
  54. bool m_bDryMix;
  55. // true if sound is playing through in-game speaker entity.
  56. bool m_bSpeaker;
  57. // for snd_show, networked sounds get colored differently than local sounds
  58. bool m_bFromServer;
  59. };
  60. //-----------------------------------------------------------------------------
  61. // Hearing info
  62. //-----------------------------------------------------------------------------
  63. struct AudioState_t
  64. {
  65. AudioState_t()
  66. {
  67. Clear();
  68. }
  69. void Clear()
  70. {
  71. m_Origin.Init();
  72. m_Angles.Init();
  73. m_nViewEntity.SetRaw( -1 );
  74. m_bValid = false;
  75. m_bIsUnderwater = false;
  76. }
  77. Vector m_Origin;
  78. QAngle m_Angles;
  79. CEntityIndex m_nViewEntity;
  80. bool m_bIsUnderwater : 1;
  81. bool m_bValid : 1;
  82. };
  83. #endif // SNDINFO_H