summaryrefslogtreecommitdiff
path: root/game/shared/soundenvelope.h
diff options
context:
space:
mode:
authorFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
committerFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
commit3bf9df6b2785fa6d951086978a3e66f49427166a (patch)
tree2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /game/shared/soundenvelope.h
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'game/shared/soundenvelope.h')
-rw-r--r--game/shared/soundenvelope.h91
1 files changed, 91 insertions, 0 deletions
diff --git a/game/shared/soundenvelope.h b/game/shared/soundenvelope.h
new file mode 100644
index 0000000..5a84b59
--- /dev/null
+++ b/game/shared/soundenvelope.h
@@ -0,0 +1,91 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $Workfile: $
+// $Date: $
+// $NoKeywords: $
+//=============================================================================//
+
+#ifndef SOUNDENVELOPE_H
+#define SOUNDENVELOPE_H
+
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include "engine/IEngineSound.h"
+
+class CSoundPatch;
+
+enum soundcommands_t
+{
+ SOUNDCTRL_CHANGE_VOLUME,
+ SOUNDCTRL_CHANGE_PITCH,
+ SOUNDCTRL_STOP,
+ SOUNDCTRL_DESTROY,
+};
+
+//Envelope point
+struct envelopePoint_t
+{
+ float amplitudeMin, amplitudeMax;
+ float durationMin, durationMax;
+};
+
+//Envelope description
+struct envelopeDescription_t
+{
+ envelopePoint_t *pPoints;
+ int nNumPoints;
+};
+
+class IRecipientFilter;
+
+abstract_class CSoundEnvelopeController
+{
+public:
+ virtual void SystemReset( void ) = 0;
+ virtual void SystemUpdate( void ) = 0;
+ virtual void Play( CSoundPatch *pSound, float volume, float pitch, float flStartTime = 0 ) = 0;
+ virtual void CommandAdd( CSoundPatch *pSound, float executeDeltaTime, soundcommands_t command, float commandTime, float value ) = 0;
+ virtual void CommandClear( CSoundPatch *pSound ) = 0;
+ virtual void Shutdown( CSoundPatch *pSound ) = 0;
+
+ virtual CSoundPatch *SoundCreate( IRecipientFilter& filter, int nEntIndex, const char *pSoundName ) = 0;
+ virtual CSoundPatch *SoundCreate( IRecipientFilter& filter, int nEntIndex, int channel, const char *pSoundName,
+ float attenuation ) = 0;
+ virtual CSoundPatch *SoundCreate( IRecipientFilter& filter, int nEntIndex, int channel, const char *pSoundName,
+ soundlevel_t soundlevel ) = 0;
+ virtual CSoundPatch *SoundCreate( IRecipientFilter& filter, int nEntIndex, const EmitSound_t &es ) = 0;
+ virtual void SoundDestroy( CSoundPatch * ) = 0;
+ virtual void SoundChangePitch( CSoundPatch *pSound, float pitchTarget, float deltaTime ) = 0;
+ virtual void SoundChangeVolume( CSoundPatch *pSound, float volumeTarget, float deltaTime ) = 0;
+ virtual void SoundFadeOut( CSoundPatch *pSound, float deltaTime, bool destroyOnFadeout = false ) = 0;
+ virtual float SoundGetPitch( CSoundPatch *pSound ) = 0;
+ virtual float SoundGetVolume( CSoundPatch *pSound ) = 0;
+
+ virtual float SoundPlayEnvelope( CSoundPatch *pSound, soundcommands_t soundCommand, envelopePoint_t *points, int numPoints ) = 0;
+ virtual float SoundPlayEnvelope( CSoundPatch *pSound, soundcommands_t soundCommand, envelopeDescription_t *envelope ) = 0;
+
+ virtual void CheckLoopingSoundsForPlayer( CBasePlayer *pPlayer ) = 0;
+
+ virtual string_t SoundGetName( CSoundPatch *pSound ) = 0;
+ static CSoundEnvelopeController &GetController( void );
+
+ virtual void SoundSetCloseCaptionDuration( CSoundPatch *pSound, float flDuration ) = 0;
+};
+
+
+//-----------------------------------------------------------------------------
+// Save/restore
+//-----------------------------------------------------------------------------
+class ISaveRestoreOps;
+
+ISaveRestoreOps *GetSoundSaveRestoreOps( );
+
+#define DEFINE_SOUNDPATCH(name) \
+ { FIELD_CUSTOM, #name, { offsetof(classNameTypedef,name), 0 }, 1, FTYPEDESC_SAVE, NULL, GetSoundSaveRestoreOps( ), NULL }
+
+
+#endif // SOUNDENVELOPE_H