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.

68 lines
2.7 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef SND_DMA_H
  8. #define SND_DMA_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. extern ConVar snd_obscured_gain_db;
  13. extern ConVar snd_showstart;
  14. extern ConVar snd_refdb;
  15. extern ConVar snd_refdist;
  16. extern float snd_refdb_dist_mult;
  17. extern bool snd_initialized;
  18. extern int g_snd_trace_count;
  19. // convert sound db level to approximate sound source radius,
  20. // used only for determining how much of sound is obscured by world
  21. #define SND_RADIUS_MAX (20.0 * 12.0) // max sound source radius
  22. #define SND_RADIUS_MIN (2.0 * 12.0) // min sound source radius
  23. #define SND_DB_MAX 140.0 // max db of any sound source
  24. #define SND_DB_MED 90.0 // db at which compression curve changes
  25. #define SND_DB_MIN 60.0 // min db of any sound source
  26. inline float dB_To_Radius ( float db )
  27. {
  28. return SND_RADIUS_MIN + (SND_RADIUS_MAX - SND_RADIUS_MIN) * (db - SND_DB_MIN) / (SND_DB_MAX - SND_DB_MIN);
  29. }
  30. class CScratchPad;
  31. const int MASK_BLOCK_AUDIO = CONTENTS_SOLID|CONTENTS_MOVEABLE|CONTENTS_WINDOW;
  32. #define SNDLVL_TO_DIST_MULT( sndlvl ) ( sndlvl ? ((snd_refdb_dist_mult / FastPow10( (float)sndlvl / 20 )) / snd_refdist.GetFloat()) : 0 )
  33. #define DIST_MULT_TO_SNDLVL( dist_mult ) (soundlevel_t)(int)( dist_mult ? ( 20 * log10( (float)(snd_refdb_dist_mult / (dist_mult * snd_refdist.GetFloat()) )) ) : 0 )
  34. float SND_GetGainFromMult( float gain, float dist_mult, vec_t dist );
  35. float SND_GetDspMix( channel_t *pchannel, int idist, float flSndlvl );
  36. bool SND_ChannelOkToTrace( channel_t *ch );
  37. float SND_GetGainObscured( int nSlot, gain_t *gs, const channel_t *ch, const Vector &vecListenerOrigin, bool fplayersound, bool flooping, bool bAttenuated, bool bOkayToTrace, Vector *pOrigin = NULL );
  38. float S_GetDashboarMusicMixValue( );
  39. float SND_GetFacingDirection( channel_t *pChannel, const Vector &vecListenerOrigin, const QAngle &source_angles );
  40. void SND_MergeVolumes( const float build_volumes[ MAX_SPLITSCREEN_CLIENTS ][CCHANVOLUMES/2], float volumes[CCHANVOLUMES/2] );
  41. void ConvertListenerVectorTo2D( Vector *pvforward, const Vector *pvright );
  42. void ChannelSetVolTargets( channel_t *pch, float *pvolumes, int ivol_offset, int cvol );
  43. void S_StartSoundEntryByHash( HSOUNDSCRIPTHASH nHandle );
  44. channel_t *S_FindChannelByScriptHash( HSOUNDSCRIPTHASH nHandle );
  45. void S_StopChannel( channel_t *pChannel );
  46. channel_t *S_FindChannelByGuid( int guid );
  47. bool SND_IsInGame();
  48. float SND_FadeToNewGain( gain_t *gs, const channel_t *ch, float gain_new );
  49. bool SND_IsLongWave( channel_t pChannel );
  50. float dB_To_Gain( float );
  51. #endif // SND_DMA_H