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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
|
#pragma once
#include "AudioSamples.h"
#include "audio_enums.h"
#define MAX_VOLUME 127
#define MAX_FREQ DIGITALRATE
struct tSample {
int32 nOffset;
uint32 nSize;
int32 nFrequency;
int32 nLoopStart;
int32 nLoopEnd;
};
#ifdef GTA_PS2
#define PS2BANK(e) e
#else
#define PS2BANK(e) e = SFX_BANK_0
#endif // GTA_PS2
enum
{
SFX_BANK_0,
#ifdef GTA_PS2
SFX_BANK_GENERIC_EXTRA,
SFX_BANK_PED_COMMENTS,
SFX_BANK_FRONT_END_MENU,
#else
SFX_BANK_GENERIC_EXTRA = SFX_BANK_0,
SFX_BANK_FRONT_END_MENU = SFX_BANK_0,
SFX_BANK_PED_COMMENTS,
MAX_SFX_BANKS,
INVALID_SFX_BANK,
#endif
CAR_SFX_BANKS_OFFSET,
SFX_BANK_PONTIAC = CAR_SFX_BANKS_OFFSET,
SFX_BANK_PORSCHE,
SFX_BANK_SPIDER,
SFX_BANK_MERC,
SFX_BANK_TRUCK,
SFX_BANK_HOTROD,
SFX_BANK_COBRA,
SFX_BANK_PONTIAC_SLOW,
SFX_BANK_CADILLAC,
SFX_BANK_PATHFINDER,
SFX_BANK_PACARD,
SFX_BANK_GOLF_CART,
SFX_BANK_CAR_CHAINSAW,
SFX_BANK_RC,
SFX_BANK_RC_HELI,
SFX_BANK_CAR_UNUSED_4,
// bikes
SFX_BANK_VTWIN,
SFX_BANK_MOPED,
SFX_BANK_HONDA250,
SFX_BANK_SPORTS_BIKE,
SFX_BANK_BIKE_UNUSED_1,
SFX_BANK_BIKE_UNUSED_2,
SFX_BANK_BIKE_UNUSED_3,
SFX_BANK_BIKE_UNUSED_4,
SFX_BANK_BIKE_UNUSED_5,
SFX_BANK_BIKE_UNUSED_6,
// heli
SFX_BANK_HELI_APACHE,
SFX_BANK_HELI_UNUSED_1,
SFX_BANK_HELI_UNUSED_2,
SFX_BANK_HELI_UNUSED_3,
SFX_BANK_HELI_UNUSED_4,
// plane
SFX_BANK_PLANE_SEAPLANE,
SFX_BANK_PLANE_UNUSED_1,
SFX_BANK_PLANE_UNUSED_2,
SFX_BANK_PLANE_UNUSED_3,
SFX_BANK_PLANE_UNUSED_4,
PS2BANK(SFX_BANK_BUILDING_BANK_ALARM),
PS2BANK(SFX_BANK_BUILDING_SNORING),
PS2BANK(SFX_BANK_BUILDING_BAR_1),
PS2BANK(SFX_BANK_BUILDING_BAR_2),
PS2BANK(SFX_BANK_BUILDING_BAR_3),
PS2BANK(SFX_BANK_BUILDING_BAR_4),
PS2BANK(SFX_BANK_BUILDING_MALIBU_1),
PS2BANK(SFX_BANK_BUILDING_MALIBU_2),
PS2BANK(SFX_BANK_BUILDING_MALIBU_3),
PS2BANK(SFX_BANK_BUILDING_STRIP_1),
PS2BANK(SFX_BANK_BUILDING_STRIP_2),
PS2BANK(SFX_BANK_BUILDING_STRIP_3),
PS2BANK(SFX_BANK_BUILDING_CHURCH),
PS2BANK(SFX_BANK_BUILDING_FAN_1),
PS2BANK(SFX_BANK_BUILDING_FAN_2),
PS2BANK(SFX_BANK_BUILDING_INSECT_1),
PS2BANK(SFX_BANK_BUILDING_INSECT_2),
PS2BANK(SFX_BANK_BUILDING_18),
PS2BANK(SFX_BANK_BUILDING_19),
PS2BANK(SFX_BANK_BUILDING_20),
PS2BANK(SFX_BANK_BUILDING_21),
PS2BANK(SFX_BANK_FOOTSTEPS_GRASS),
PS2BANK(SFX_BANK_FOOTSTEPS_GRAVEL),
PS2BANK(SFX_BANK_FOOTSTEPS_WOOD),
PS2BANK(SFX_BANK_FOOTSTEPS_METAL),
PS2BANK(SFX_BANK_FOOTSTEPS_WATER),
PS2BANK(SFX_BANK_FOOTSTEPS_SAND),
#ifdef GTA_PS2
MAX_SFX_BANKS,
INVALID_SFX_BANK
#endif
};
#define MAX_PEDSFX 7
#define PED_BLOCKSIZE 160000
#define MAXPROVIDERS 64
#ifdef EXTERNAL_3D_SOUND
#define MAXCHANNELS (NUM_CHANNELS_GENERIC+1)
#define MAXCHANNELS_SURROUND (MAXCHANNELS-4)
#define MAX2DCHANNELS 3
#else
#define MAXCHANNELS 0
#define MAXCHANNELS_SURROUND 0
#define MAX2DCHANNELS NUM_CHANNELS
#endif
#define MAX_STREAMS 1
#define DIGITALRATE 32000
#define DIGITALBITS 16
#define DIGITALCHANNELS 2
#ifdef FIX_BUGS
#define MAX_DIGITAL_MIXER_CHANNELS (MAXCHANNELS+MAX_STREAMS*2+MAX2DCHANNELS)
#else
#define MAX_DIGITAL_MIXER_CHANNELS (MAXCHANNELS+MAX_STREAMS*2)
#endif
static_assert( NUM_CHANNELS == MAXCHANNELS + MAX2DCHANNELS, "The number of channels doesn't match with an enum" );
extern int gBankStartOffset[67];
class cSampleManager
{
uint8 m_nEffectsVolume;
uint8 m_nMusicVolume;
uint8 m_nMP3BoostVolume;
uint8 m_nEffectsFadeVolume;
uint8 m_nMusicFadeVolume;
bool8 m_nMonoMode;
char m_szCDRomRootPath[80];
bool8 m_bInitialised;
uint8 m_nNumberOfProviders;
char *m_aAudioProviders[MAXPROVIDERS];
tSample m_aSamples[TOTAL_AUDIO_SAMPLES];
char m_MiscomPath[260];
char m_WavFilesPath[260];
char m_MP3FilesPath[188];
void *m_aChannels[18];
public:
cSampleManager(void);
~cSampleManager(void);
#ifdef EXTERNAL_3D_SOUND
void SetSpeakerConfig(int32 nConfig);
uint32 GetMaximumSupportedChannels(void);
uint32 GetNum3DProvidersAvailable(void);
void SetNum3DProvidersAvailable(uint32 num);
char *Get3DProviderName(uint8 id);
void Set3DProviderName(uint8 id, char *name);
int8 GetCurrent3DProviderIndex(void);
int8 SetCurrent3DProvider(uint8 which);
int8 AutoDetect3DProviders();
#endif
bool8 IsMP3RadioChannelAvailable(void);
void ReleaseDigitalHandle (void);
void ReacquireDigitalHandle(void);
bool8 Initialise(void);
void Terminate (void);
bool8 CheckForAnAudioFileOnCD(void);
char GetCDAudioDriveLetter (void);
void UpdateEffectsVolume(void);
void SetEffectsMasterVolume(uint8 nVolume);
void SetMusicMasterVolume (uint8 nVolume);
void SetMP3BoostVolume (uint8 nVolume);
void SetEffectsFadeVolume (uint8 nVolume);
void SetMusicFadeVolume (uint8 nVolume);
void SetMonoMode (bool8 nMode);
bool8 LoadSampleBank (uint8 nBank);
void UnloadSampleBank (uint8 nBank);
bool8 IsSampleBankLoaded(uint8 nBank);
bool8 IsPedCommentLoaded(uint32 nComment);
bool8 LoadPedComment (uint32 nComment);
int32 GetBankContainingSound(uint32 offset);
int32 _GetPedCommentSlot(uint32 nComment);
int32 GetSampleBaseFrequency (uint32 nSample);
int32 GetSampleLoopStartOffset(uint32 nSample);
int32 GetSampleLoopEndOffset (uint32 nSample);
uint32 GetSampleLength (uint32 nSample);
bool8 UpdateReverb(void);
void SetChannelReverbFlag (uint32 nChannel, bool8 nReverbFlag);
bool8 InitialiseChannel (uint32 nChannel, uint32 nSfx, uint8 nBank);
#ifdef EXTERNAL_3D_SOUND
void SetChannelEmittingVolume(uint32 nChannel, uint32 nVolume);
void SetChannel3DPosition (uint32 nChannel, float fX, float fY, float fZ);
void SetChannel3DDistances (uint32 nChannel, float fMax, float fMin);
#endif
void SetChannelVolume (uint32 nChannel, uint32 nVolume);
void SetChannelPan (uint32 nChannel, uint32 nPan);
void SetChannelFrequency (uint32 nChannel, uint32 nFreq);
void SetChannelLoopPoints (uint32 nChannel, uint32 nLoopStart, int32 nLoopEnd);
void SetChannelLoopCount (uint32 nChannel, uint32 nLoopCount);
bool8 GetChannelUsedFlag (uint32 nChannel);
void StartChannel (uint32 nChannel);
void StopChannel (uint32 nChannel);
void PreloadStreamedFile (uint32 nFile, uint8 nStream = 0);
void PauseStream (bool8 nPauseFlag, uint8 nStream = 0);
void StartPreloadedStreamedFile (uint8 nStream = 0);
bool8 StartStreamedFile (uint32 nFile, uint32 nPos, uint8 nStream = 0);
void StopStreamedFile (uint8 nStream = 0);
int32 GetStreamedFilePosition (uint8 nStream = 0);
void SetStreamedVolumeAndPan(uint8 nVolume, uint8 nPan, bool8 nEffectFlag, uint8 nStream = 0);
int32 GetStreamedFileLength (uint8 nStream = 0);
bool8 IsStreamPlaying (uint8 nStream = 0);
void SetStreamedFileLoopFlag (bool8 nLoopFlag, uint8 nStream = 0);
#ifdef AUDIO_OAL
void Service(void);
#endif
bool8 InitialiseSampleBanks(void);
uint8 GetMusicVolume() const { return m_nMusicVolume; }
};
extern cSampleManager SampleManager;
extern uint32 BankStartOffset[MAX_SFX_BANKS];
static char StreamedNameTable[][40] = {
"AUDIO\\MUSIC\\HEAD",
"AUDIO\\MUSIC\\DOUBLE",
"AUDIO\\MUSIC\\KJAH",
"AUDIO\\MUSIC\\RISE",
"AUDIO\\MUSIC\\LIPS",
"AUDIO\\MUSIC\\MUNDO",
"AUDIO\\MUSI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