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.

118 lines
3.7 KiB

  1. //===== Copyright � 1996-2005, Valve Corporation, All rights reserved. ======//
  2. //
  3. // Purpose:
  4. //
  5. //===========================================================================//
  6. #ifndef ISOUNDSYSTEM_H
  7. #define ISOUNDSYSTEM_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "appframework/iappsystem.h"
  12. //-----------------------------------------------------------------------------
  13. // Forward declarations
  14. //-----------------------------------------------------------------------------
  15. class IAudioDevice;
  16. class CAudioSource;
  17. class CAudioMixer;
  18. //-----------------------------------------------------------------------------
  19. // Sound handle
  20. //-----------------------------------------------------------------------------
  21. typedef unsigned short AudioSourceHandle_t;
  22. enum
  23. {
  24. AUDIOSOURCEHANDLE_INVALID = (AudioSourceHandle_t)~0
  25. };
  26. //-----------------------------------------------------------------------------
  27. // Flags for FindAudioSource
  28. //-----------------------------------------------------------------------------
  29. enum FindAudioSourceFlags_t
  30. {
  31. FINDAUDIOSOURCE_NODELAY = 0x1,
  32. FINDAUDIOSOURCE_PREFETCH = 0x2,
  33. FINDAUDIOSOURCE_PLAYONCE = 0x4,
  34. };
  35. #include "soundsystem/audio_mix.h"
  36. /* filter types */
  37. enum audio_filter_type_t
  38. {
  39. FILTER_LOWPASS = 0, /* low pass filter */
  40. FILTER_HIGHPASS, /* High pass filter */
  41. FILTER_BANDPASS, /* band pass filter */
  42. FILTER_NOTCH, /* Notch Filter */
  43. FILTER_PEAKING_EQ, /* Peaking band EQ filter */
  44. FILTER_LOW_SHELF, /* Low shelf filter */
  45. FILTER_HIGH_SHELF /* High shelf filter */
  46. };
  47. class IAudioMix
  48. {
  49. public:
  50. virtual ~IAudioMix() {}
  51. virtual void Process( CAudioMixState *pState ) = 0;
  52. CAudioMixBuffer *m_pOutput;
  53. int m_nOutputChannelCount;
  54. };
  55. class CAudioMixState;
  56. class CAudioMixDescription;
  57. abstract_class ISoundSystem2
  58. {
  59. public:
  60. // NOTE: This is the new sound device architecture. It is a separate standalone piece of tech that does not interact with ISoundSystem's normal
  61. // entry points. Eventually these entry points will replace many of the entry points of ISoundSystem and this interface will transition to
  62. // the new architecture. This is just here for prototyping and testing.
  63. // NULL chooses default
  64. virtual IAudioDevice2 *CreateDevice( const audio_device_init_params_t *pParams ) = 0;
  65. virtual void DestroyDevice( IAudioDevice2 *pDevice ) = 0;
  66. virtual int EnumerateDevices( int nSubsystem, audio_device_description_t *pDeviceListOut, int nListCount ) = 0;
  67. virtual void HandleDeviceErrors( IAudioDevice2 *pDevice ) = 0;
  68. virtual IAudioMix *CreateMix( const CAudioMixDescription *pMixDescription ) = 0;
  69. virtual void DestroyMix( IAudioMix *pMix ) = 0;
  70. virtual CAudioProcessor *CreateFilter( audio_filter_type_t filterType, float fldbGain, float flCenterFrequency, float flBandWidth ) = 0;
  71. virtual CAudioProcessor *CreateMonoDSP( int nEffect, dspglobalvars_t *pGlobals ) = 0;
  72. };
  73. //-----------------------------------------------------------------------------
  74. // Purpose: DLL interface for low-level sound utilities
  75. //-----------------------------------------------------------------------------
  76. #define SOUNDSYSTEM_INTERFACE_VERSION "SoundSystem001"
  77. abstract_class ISoundSystem : public IAppSystem
  78. {
  79. public:
  80. virtual void Update( float time ) = 0;
  81. virtual void Flush( void ) = 0;
  82. virtual CAudioSource *FindOrAddSound( const char *filename ) = 0;
  83. virtual CAudioSource *LoadSound( const char *wavfile ) = 0;
  84. virtual void PlaySound( CAudioSource *source, float volume, CAudioMixer **ppMixer ) = 0;
  85. virtual bool IsSoundPlaying( CAudioMixer *pMixer ) = 0;
  86. virtual CAudioMixer *FindMixer( CAudioSource *source ) = 0;
  87. virtual void StopAll( void ) = 0;
  88. virtual void StopSound( CAudioMixer *mixer ) = 0;
  89. virtual void GetAudioDevices(CUtlVector< audio_device_description_t >& deviceListOut) const = 0;
  90. };
  91. #endif // ISOUNDSYSTEM_H