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.

73 lines
1.6 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #include "cbase.h"
  7. // NOTE: This has to be the last file included!
  8. #include "tier0/memdbgon.h"
  9. class CSurroundTest : public CPointEntity
  10. {
  11. public:
  12. DECLARE_CLASS( CSurroundTest, CPointEntity );
  13. void FireCorrectOutput( inputdata_t &inputdata );
  14. void Spawn( void );
  15. private:
  16. COutputEvent m_On2Speakers;
  17. COutputEvent m_On4Speakers;
  18. COutputEvent m_On51Speakers;
  19. DECLARE_DATADESC();
  20. };
  21. LINK_ENTITY_TO_CLASS( point_surroundtest, CSurroundTest );
  22. BEGIN_DATADESC( CSurroundTest )
  23. DEFINE_INPUTFUNC( FIELD_VOID, "FireCorrectOutput", FireCorrectOutput ),
  24. DEFINE_OUTPUT( m_On2Speakers, "On2Speakers" ),
  25. DEFINE_OUTPUT( m_On4Speakers, "On4Speakers" ),
  26. DEFINE_OUTPUT( m_On51Speakers, "On51Speakers" ),
  27. END_DATADESC()
  28. enum
  29. {
  30. SND_SURROUND_HEADPHONES = 0,
  31. SND_SURROUND_2SPEAKERS = 2,
  32. SND_SURROUND_4SPEAKERS = 4,
  33. SND_SURROUND_51SPEAKERS,
  34. };
  35. void CSurroundTest::FireCorrectOutput( inputdata_t &inputdata )
  36. {
  37. ConVar const *pSurroundCVar = cvar->FindVar( "snd_surround_speakers" );
  38. if ( pSurroundCVar )
  39. {
  40. int iSetting = pSurroundCVar->GetInt();
  41. if ( iSetting == SND_SURROUND_HEADPHONES || iSetting == SND_SURROUND_2SPEAKERS )
  42. {
  43. m_On2Speakers.FireOutput( this, this );
  44. }
  45. else if ( iSetting == SND_SURROUND_4SPEAKERS )
  46. {
  47. m_On4Speakers.FireOutput( this, this );
  48. }
  49. else if ( iSetting == SND_SURROUND_51SPEAKERS )
  50. {
  51. m_On51Speakers.FireOutput( this, this );
  52. }
  53. }
  54. }
  55. void CSurroundTest::Spawn( void )
  56. {
  57. BaseClass::Spawn();
  58. }