diff options
| author | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
|---|---|---|
| committer | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
| commit | 3bf9df6b2785fa6d951086978a3e66f49427166a (patch) | |
| tree | 2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /engine/audio/private/voice_sound_engine_interface.h | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'engine/audio/private/voice_sound_engine_interface.h')
| -rw-r--r-- | engine/audio/private/voice_sound_engine_interface.h | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/engine/audio/private/voice_sound_engine_interface.h b/engine/audio/private/voice_sound_engine_interface.h new file mode 100644 index 0000000..10fcb1a --- /dev/null +++ b/engine/audio/private/voice_sound_engine_interface.h @@ -0,0 +1,102 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// +// $NoKeywords: $ +//=============================================================================// + +#ifndef VOICE_SOUND_ENGINE_INTERFACE_H +#define VOICE_SOUND_ENGINE_INTERFACE_H +#pragma once + + +/*! @defgroup VoiceSoundEngineInterface VoiceSoundEngineInterface +Abstracts out the sound engine for the voice code. +GoldSrc and Src each have a different implementation of this. +@{ +*/ + + + +//! Max number of receiving voice channels. +#define VOICE_NUM_CHANNELS 5 + +// ----------------------------------------------------------------------------- // +// Functions for voice.cpp. +// ----------------------------------------------------------------------------- // + +//! Initialize the sound engine interface. +bool VoiceSE_Init(); + +//! Shutdown the sound engine interface. +void VoiceSE_Term(); + +//! Called each frame. +void VoiceSE_Idle(float frametime); + + +//! Start audio playback on the specified voice channel. +//! Voice_GetChannelAudio is called by the mixer for each active channel. +int VoiceSE_StartChannel( + //! Which channel to start. + int iChannel, + int iEntity, + bool bProximity, + int nViewEntityIndex + ); + +//! Stop audio playback on the specified voice channel. +void VoiceSE_EndChannel( + //! Which channel to stop. + int iChannel, + int iEntity + ); + +//! Starts the voice overdrive (lowers volume of all sounds other than voice). +void VoiceSE_StartOverdrive(); +void VoiceSE_EndOverdrive(); + +//! Control mouth movement for an entity. +void VoiceSE_InitMouth(int entnum); +void VoiceSE_CloseMouth(int entnum); +void VoiceSE_MoveMouth(int entnum, short *pSamples, int nSamples); + + +// ----------------------------------------------------------------------------- // +// Functions for voice.cpp to implement. +// ----------------------------------------------------------------------------- // + +//! This function is implemented in voice.cpp. Gives 16-bit signed mono samples to the mixer. +//! \return Number of samples actually gotten. +int Voice_GetOutputData( + //! The voice channel it wants samples from. + const int iChannel, + //! The buffer to copy the samples into. + char *copyBuf, + //! Maximum size of copyBuf. + const int copyBufSize, + //! Which sample to start at. + const int samplePosition, + //! How many samples to get. + const int sampleCount + ); + +// This is called when an audio source is deleted by the sound engine. The voice could +// should detach whatever it needs to in order to free up the specified channel. +void Voice_OnAudioSourceShutdown( int iChannel ); + + +// ----------------------------------------------------------------------------- // +// Functions for the sound engine. +// ----------------------------------------------------------------------------- // + +class CAudioSource; +CAudioSource* Voice_SetupAudioSource( int soundsource, int entchannel ); + + + +/*! @} End VoiceSoundEngineInterface group */ + + +#endif // VOICE_SOUND_ENGINE_INTERFACE_H |