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.

102 lines
2.9 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //
  6. // $NoKeywords: $
  7. //=============================================================================//
  8. #ifndef VOICE_SOUND_ENGINE_INTERFACE_H
  9. #define VOICE_SOUND_ENGINE_INTERFACE_H
  10. #pragma once
  11. /*! @defgroup VoiceSoundEngineInterface VoiceSoundEngineInterface
  12. Abstracts out the sound engine for the voice code.
  13. GoldSrc and Src each have a different implementation of this.
  14. @{
  15. */
  16. //! Max number of receiving voice channels.
  17. #define VOICE_NUM_CHANNELS 5
  18. // ----------------------------------------------------------------------------- //
  19. // Functions for voice.cpp.
  20. // ----------------------------------------------------------------------------- //
  21. //! Initialize the sound engine interface.
  22. bool VoiceSE_Init();
  23. //! Shutdown the sound engine interface.
  24. void VoiceSE_Term();
  25. //! Called each frame.
  26. void VoiceSE_Idle(float frametime);
  27. //! Start audio playback on the specified voice channel.
  28. //! Voice_GetChannelAudio is called by the mixer for each active channel.
  29. int VoiceSE_StartChannel(
  30. //! Which channel to start.
  31. int iChannel,
  32. int iEntity,
  33. bool bProximity,
  34. int nViewEntityIndex
  35. );
  36. //! Stop audio playback on the specified voice channel.
  37. void VoiceSE_EndChannel(
  38. //! Which channel to stop.
  39. int iChannel,
  40. int iEntity
  41. );
  42. //! Starts the voice overdrive (lowers volume of all sounds other than voice).
  43. void VoiceSE_StartOverdrive();
  44. void VoiceSE_EndOverdrive();
  45. //! Control mouth movement for an entity.
  46. void VoiceSE_InitMouth(int entnum);
  47. void VoiceSE_CloseMouth(int entnum);
  48. void VoiceSE_MoveMouth(int entnum, short *pSamples, int nSamples);
  49. // ----------------------------------------------------------------------------- //
  50. // Functions for voice.cpp to implement.
  51. // ----------------------------------------------------------------------------- //
  52. //! This function is implemented in voice.cpp. Gives 16-bit signed mono samples to the mixer.
  53. //! \return Number of samples actually gotten.
  54. int Voice_GetOutputData(
  55. //! The voice channel it wants samples from.
  56. const int iChannel,
  57. //! The buffer to copy the samples into.
  58. char *copyBuf,
  59. //! Maximum size of copyBuf.
  60. const int copyBufSize,
  61. //! Which sample to start at.
  62. const int samplePosition,
  63. //! How many samples to get.
  64. const int sampleCount
  65. );
  66. // This is called when an audio source is deleted by the sound engine. The voice could
  67. // should detach whatever it needs to in order to free up the specified channel.
  68. void Voice_OnAudioSourceShutdown( int iChannel );
  69. // ----------------------------------------------------------------------------- //
  70. // Functions for the sound engine.
  71. // ----------------------------------------------------------------------------- //
  72. class CAudioSource;
  73. CAudioSource* Voice_SetupAudioSource( int soundsource, int entchannel );
  74. /*! @} End VoiceSoundEngineInterface group */
  75. #endif // VOICE_SOUND_ENGINE_INTERFACE_H