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.

137 lines
4.4 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //
  7. //=============================================================================//
  8. #ifndef SOUND_PRIVATE_H
  9. #define SOUND_PRIVATE_H
  10. #pragma once
  11. #include "basetypes.h"
  12. #include "snd_fixedint.h"
  13. #include "snd_audio_source.h"
  14. // Forward declarations
  15. struct portable_samplepair_t;
  16. struct channel_t;
  17. typedef int SoundSource;
  18. class CAudioSource;
  19. struct channel_t;
  20. class CSfxTable;
  21. class IAudioDevice;
  22. // ====================================================================
  23. #define SAMPLE_16BIT_SHIFT 1
  24. void S_Startup (void);
  25. void S_FlushSoundData(int rate);
  26. #ifdef PLATFORM_WINDOWS_PC
  27. extern HRESULT SetupWindowsMixerPreferences( float flMasterVolume = 1.0f, bool bDuckingOptOut = true );
  28. #endif
  29. CAudioSource *S_LoadSound( CSfxTable *s, channel_t *ch, SoundError &soundError );
  30. void S_TouchSound( char *sample );
  31. CSfxTable *S_FindName( const char *name, int *pInCache );
  32. // spatializes a channel
  33. void SND_Spatialize(channel_t *ch);
  34. void SND_ActivateChannel( channel_t *ch );
  35. // shutdown the DMA xfer.
  36. void SNDDMA_Shutdown(void);
  37. // ====================================================================
  38. // User-setable variables
  39. // ====================================================================
  40. extern int64 g_paintedtime;
  41. extern bool snd_initialized;
  42. extern class Vector listener_origin[ MAX_SPLITSCREEN_CLIENTS ];
  43. void S_LocalSound (char *s);
  44. void SND_InitScaletable (void);
  45. void S_AmbientOff (void);
  46. void S_AmbientOn (void);
  47. void S_FreeChannel(channel_t *ch);
  48. // resync the sample-timing adjustment clock (for scheduling a group of waves with precise timing - e.g. machine gun sounds)
  49. extern void S_SyncClockAdjust( clocksync_index_t syncIndex );
  50. //=============================================================================
  51. // UNDONE: Move this global?
  52. #if USE_AUDIO_DEVICE_V1
  53. extern IAudioDevice *g_AudioDevice;
  54. #else
  55. extern IAudioDevice2 *g_AudioDevice;
  56. #endif
  57. #ifdef __cplusplus
  58. extern "C" {
  59. #endif // __cplusplus
  60. void S_TransferStereo16 (void *pOutput, const portable_samplepair_t *pfront, int64 lpaintedtime, int64 endtime);
  61. void S_TransferPaintBuffer(void *pOutput, const portable_samplepair_t *pfront, int64 lpaintedtime, int64 endtime);
  62. void S_MixBufferUpsample2x( int count, portable_samplepair_t *pbuffer, portable_samplepair_t *pfiltermem, int cfltmem, int filtertype );
  63. extern void Mix8MonoWavtype( channel_t *pChannel, portable_samplepair_t *pOutput, float *volume, byte *pData, int inputOffset, fixedint rateScaleFix, int outCount );
  64. extern void Mix8StereoWavtype(channel_t *pChannel, portable_samplepair_t *pOutput, float *volume, byte *pData, int inputOffset, fixedint rateScaleFix, int outCount);
  65. extern void Mix16MonoWavtype(channel_t *pChannel, portable_samplepair_t *pOutput, float *volume, short *pData, int inputOffset, fixedint rateScaleFix, int outCount);
  66. extern void Mix16StereoWavtype(channel_t *pChannel, portable_samplepair_t *pOutput, float *volume, short *pData, int inputOffset, fixedint rateScaleFix, int outCount);
  67. extern void SND_MoveMouth8(channel_t *pChannel, CAudioSource *pSource, int count);
  68. extern void SND_MouthEnvelopeFollower( channel_t *pChannel, char *pData, int count );
  69. extern void SND_CloseMouth(channel_t *pChannel);
  70. extern void SND_InitMouth( channel_t *pChannel );
  71. extern void SND_ClearMouth( channel_t *pChannel );
  72. extern bool SND_ShouldPause( channel_t *pChannel );
  73. extern bool SND_IsRecording();
  74. extern void SND_MouthUpdateAll();
  75. void MIX_PaintChannels( int64 endtime, bool bIsUnderwater );
  76. // Play a big of zeroed out sound
  77. void MIX_PaintNullChannels( int64 endtime );
  78. bool AllocDsps( bool bLoadPresetFile );
  79. void FreeDsps( bool bReleaseTemplateMemory );
  80. void CheckNewDspPresets( void );
  81. void DSP_Process( int idsp, portable_samplepair_t *pbfront, portable_samplepair_t *pbrear, portable_samplepair_t *pbcenter, int sampleCount );
  82. void DSP_ClearState();
  83. extern int idsp_room;
  84. extern int idsp_water;
  85. extern int idsp_player;
  86. extern int idsp_facingaway;
  87. extern int idsp_speaker;
  88. extern int idsp_spatial;
  89. extern float g_DuckScale;
  90. extern int g_DuckScaleInt256;
  91. // Legacy DSP Routines
  92. void SX_Init (void);
  93. void SX_Free (void);
  94. void SX_ReloadRoomFX();
  95. void SX_RoomFX(int64 endtime, int fFilter, int fTimefx);
  96. // DSP Routines
  97. void DSP_InitAll(bool bLoadPresetFile);
  98. void DSP_FreeAll(void);
  99. #ifdef __cplusplus
  100. }
  101. #endif // __cplusplus
  102. #endif // SOUND_PRIVATE_H