1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
|
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: Applicaton-level hooks for clients of the audio subsystem
//
// $NoKeywords: $
//=============================================================================//
#ifndef SOUNDSERVICE_H
#define SOUNDSERVICE_H
#if defined( _WIN32 )
#pragma once
#endif
class Vector;
class QAngle;
class CAudioSource;
typedef int SoundSource;
struct SpatializationInfo_t;
typedef void *FileNameHandle_t;
struct StartSoundParams_t;
#include "utlrbtree.h"
//-----------------------------------------------------------------------------
// Purpose: Services required by the audio system to function, this facade
// defines the bridge between the audio code and higher level
// systems.
//
// Note that some of these currently suggest that certain
// functionality would like to exist at a deeper layer so
// systems like audio can take advantage of them
// diectly (toml 05-02-02)
//-----------------------------------------------------------------------------
abstract_class ISoundServices
{
public:
//---------------------------------
// Allocate a block of memory that will be automatically
// cleaned up on level change
//---------------------------------
virtual void *LevelAlloc( int nBytes, const char *pszTag ) = 0;
//---------------------------------
// Notification that someone called S_ExtraUpdate()
//---------------------------------
virtual void OnExtraUpdate() = 0;
//---------------------------------
// Return false if the entity doesn't exist or is out of the PVS, in which case the sound shouldn't be heard.
//---------------------------------
virtual bool GetSoundSpatialization( int entIndex, SpatializationInfo_t& info ) = 0;
//---------------------------------
// This is the client's clock, which follows the servers and thus isn't 100% smooth all the time (it is in single player)
//---------------------------------
virtual float GetClientTime() = 0;
//---------------------------------
// This is the engine's filtered timer, it's pretty smooth all the time
//---------------------------------
virtual float GetHostTime() = 0;
//---------------------------------
//---------------------------------
virtual int GetViewEntity() = 0;
//---------------------------------
//---------------------------------
virtual float GetHostFrametime() = 0;
virtual void SetSoundFrametime( float realDt, float hostDt ) = 0;
//---------------------------------
//---------------------------------
virtual int GetServerCount() = 0;
//---------------------------------
//---------------------------------
virtual bool IsPlayer( SoundSource source ) = 0;
//---------------------------------
//---------------------------------
virtual void OnChangeVoiceStatus( int entity, bool status) = 0;
// Is the player fully connected (don't do DSP processing if not)
virtual bool IsConnected() = 0;
// Calls into client .dll with list of close caption tokens to construct a caption out of
virtual void EmitSentenceCloseCaption( char const *tokenstream ) = 0;
// Calls into client .dll with list of close caption tokens to construct a caption out of
virtual void EmitCloseCaption( char const *captionname, float duration ) = 0;
virtual char const *GetGameDir() = 0;
// If the game is paused, certain audio will pause, too (anything with phoneme/sentence data for now)
virtual bool IsGamePaused() = 0;
// If the game is not active, certain audio will pause
virtual bool IsGameActive() = 0;
// restarts the sound system externally
virtual void RestartSoundSystem() = 0;
virtual void GetAllSoundFilesReferencedInReslists( CUtlRBTree< FileNameHandle_t, int >& list ) = 0;
virtual void GetAllManifestFiles( CUtlRBTree< FileNameHandle_t, int >& list ) = 0;
virtual void GetAllSoundFilesInManifest( CUtlRBTree< FileNameHandle_t, int >& list, char const *manifestfile ) = 0;
virtual void CacheBuildingStart() = 0;
virtual void CacheBuildingUpdateProgress( float percent, char const *cachefile ) = 0;
virtual void CacheBuildingFinish() = 0;
// For building sound cache manifests
virtual int GetPrecachedSoundCount() = 0;
virtual char const *GetPrecachedSound( int index ) = 0;
virtual void OnSoundStarted( int guid, StartSoundParams_t& params, char const *soundname ) = 0;
virtual void OnSoundStopped( int guid, int soundsource, int channel, char const *soundname ) = 0;
virtual bool GetToolSpatialization( int iUserData, int guid, SpatializationInfo_t& info ) = 0;
#if defined( _XBOX )
virtual bool ShouldSuppressNonUISounds() = 0;
#endif
virtual char const *GetUILanguage() = 0;
};
//-------------------------------------
extern ISoundServices *g_pSoundServices;
//=============================================================================
#endif // SOUNDSERVICE_H
|