Team Fortress 2 Source Code as on 22/4/2020
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.

128 lines
4.0 KiB

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