2502
|
1 #pragma once
|
|
2 #include "OSAPI.h"
|
|
3 #include "Media/MediaPlayer.h"
|
|
4
|
|
5
|
|
6
|
|
7
|
|
8
|
|
9
|
|
10 #pragma pack(push, 1)
|
|
11 struct _PROVIDER {char unk_0;};
|
|
12 struct _SAMPLE {char unk_0;};
|
|
13 //struct _STREAM {char unk_0;};
|
|
14 struct _REDBOOK {char unk_0;};
|
|
15 struct _DIG_DRIVER {char unk_0;};
|
|
16 struct _SEQUENCE {char unk_0;};
|
|
17 #pragma pack(pop)
|
|
18
|
|
19
|
|
20
|
|
21 /* 22 */
|
|
22 #pragma pack(push, 1)
|
|
23 struct AudioPlayer_3DSample
|
|
24 {
|
|
25 inline AudioPlayer_3DSample()
|
|
26 {
|
|
27 hSample = 0;
|
|
28 field_4 = 0;
|
|
29 field_8 = 0;
|
|
30 field_C = 0;
|
|
31 }
|
|
32
|
|
33 void *hSample;
|
|
34 int field_4;
|
|
35 int field_8;
|
|
36 int field_C;
|
|
37 };
|
|
38 #pragma pack(pop)
|
|
39
|
|
40
|
|
41
|
|
42
|
|
43 /* 26 */
|
|
44 /*#pragma pack(push, 1)
|
|
45 struct SoundHeader
|
|
46 {
|
|
47 char pSoundName[40];
|
|
48 unsigned int uFileOffset;
|
|
49 unsigned int uCompressedSize;
|
|
50 unsigned int uDecompressedSize;
|
|
51 };
|
|
52 #pragma pack(pop)*/
|
|
53
|
|
54 /* 27 */
|
|
55 #pragma pack(push, 1)
|
|
56 struct MixerChannel
|
|
57 {
|
|
58 inline MixerChannel():
|
|
59 hSample(nullptr), source_pid(0), uSourceTrackIdx(0), uSourceTrackID(0)
|
|
60 {}
|
|
61
|
|
62 _SAMPLE *hSample;
|
|
63 int source_pid;
|
|
64 unsigned int uSourceTrackIdx;
|
|
65 unsigned int uSourceTrackID;
|
|
66 };
|
|
67 #pragma pack(pop)
|
|
68
|
|
69
|
|
70
|
|
71
|
|
72
|
|
73 /* 308 */
|
|
74 enum SoundID
|
|
75 {
|
|
76 SOUND_Invalid = 0,
|
|
77 SOUND_EnteringAHouse = 6,
|
2506
|
78 SOUND_WoodDRClose = 7,
|
|
79 SOUND_Explosion = 0x8,
|
|
80 SOUND_20 = 0x14,
|
|
81 SOUND_21 = 0x15,
|
|
82 SOUND_23 = 0x17,
|
|
83 SOUND_24 = 0x18,
|
2502
|
84 SOUND_error = 27,
|
2506
|
85 SOUND_47 = 0x2F,
|
|
86 SOUND_48 = 0x30,
|
|
87 SOUND_50 = 50,
|
2502
|
88 SOUND_RunAlongWater = 63,
|
|
89 SOUND_RunAlong3DModel = 64,
|
|
90 SOUND_Button = 66,
|
|
91 SOUND_67 = 67,
|
|
92 SOUND_71 = 71,
|
2506
|
93 SOUND_StartMainChoice02 = 75,
|
2502
|
94 SOUND_78 = 78,
|
|
95 SOUND_80 = 80,
|
|
96 SOUND_81 = 81,
|
|
97 SOUND_83 = 83,
|
|
98 SOUND_84 = 84,
|
|
99 SOUND_85 = 85,
|
2506
|
100 SOUND_89 = 89,
|
2502
|
101 SOUND_WalkAlongWater = 102,
|
|
102 SOUND_WalkAlong3DModel = 103,
|
|
103 SOUND_Arcomage_LoseResources = 0x78,
|
|
104 SOUND_Arcomage_AddResources = 0x79,
|
|
105 SOUND_Arcomage_TowerWallDamage = 0x7A,
|
|
106 SOUND_Arcomage_DrawCard = 0x7B,
|
|
107 SOUND_Arcomage_124 = 0x7C,
|
|
108 SOUND_Arcomage_ProductionDamage = 0x7D,
|
|
109 SOUND_Arcomage_ProductionUpgrade = 0x7E,
|
|
110 SOUND_Arcomage_127 = 0x7F,
|
|
111 SOUND_Arcomage_128 = 0x80,
|
|
112 SOUND_Arcomage_TowerUpgrade = 0x81,
|
|
113 SOUND_Arcomage_130 = 0x82,
|
|
114 SOUND_Arcomage_131 = 0x83,
|
|
115 SOUND_Arcomage_WallUpgrade = 0x84,
|
|
116 SOUND_PlayLute = 133, // 85
|
|
117 SOUND_PlayFaeriePipes = 134, // 86
|
|
118 SOUND_PlayGryphonheartsTrumpet = 135, // 87
|
|
119 SOUND_GoldReceived = 0xC8,
|
|
120 SOUND_203 = 203,
|
2506
|
121 SOUND_204 = 204,
|
2502
|
122 SOUND_206 = 206,
|
|
123 SOUND_207 = 207,
|
|
124 SOUND_OpenChest = 208,
|
|
125 SOUND_PlayerCantCastSpell = 0xD1,
|
2506
|
126 SOUND_210 = 0xD2,
|
2502
|
127 SOUND_EatApple = 211, // D3
|
2506
|
128 SOUND_215 = 0xD7,
|
2502
|
129 SOUND_Bell = 0xD9,
|
2506
|
130 SOUND_shurch = 0xDA, //218
|
|
131 SOUND_219 = 0xDB,
|
|
132 SOUND_221 = 0xDD,
|
|
133 SOUND_222 = 0xDE,
|
|
134 SOUND_224 = 0xE0,
|
|
135 SOUND_225 = 0xE1,
|
|
136 SOUND_226 = 0xE2,
|
|
137 SOUND_227 = 0xE3,
|
2502
|
138 SOUND_OpenBook = 230,
|
|
139 SOUND_CloseBook = 231,
|
2506
|
140 SOUND_hf445a = 0x169C,
|
2502
|
141 SOUND_11090 = 11090,
|
|
142 SOUND_12040 = 12040,
|
|
143 SOUND_Arena_Welcome = 14060,
|
|
144 SOUND_20001 = 0x4E21,
|
|
145 };
|
|
146
|
|
147
|
|
148 enum MusicID: unsigned __int32
|
|
149 {
|
|
150 MUSIC_Credits = 15
|
|
151 };
|
|
152
|
|
153 /* 20 */
|
|
154 #pragma pack(push, 1)
|
|
155 struct AudioPlayer
|
|
156 {
|
|
157 //----- (004A9669) --------------------------------------------------------
|
|
158 AudioPlayer():
|
|
159 bPlayerReady(false), b3DSoundInitialized(false),
|
|
160 hAILRedbook(nullptr), hStream(nullptr)
|
|
161 {
|
|
162 /*AudioPlayer_3DSample *v0; //ecx@1
|
|
163 signed int v1; //edi@1
|
|
164
|
|
165 v0 = p3DSamples;
|
|
166 v1 = 32;
|
|
167 do
|
|
168 {
|
|
169 v0->field_4 = 0;
|
|
170 v0->field_8 = 0;
|
|
171 v0->field_C = 0;
|
|
172 v0->hSample = 0;
|
|
173 ++v0;
|
|
174 --v1;
|
|
175 }
|
|
176 while (v1);*/
|
|
177 uMixerChannels = 16;
|
|
178 field_2D0_time_left = 256;
|
|
179 uNumRedbookTracks = 0;
|
|
180 uCurrentMusicTrackLength = 0;
|
|
181 field_2D4 = 0;
|
|
182 s3DSoundVolume = 127;
|
|
183 }
|
|
184 inline ~AudioPlayer(){ Release(); };
|
|
185 void SetMusicVolume(int vol);
|
|
186 void SetMasterVolume(float fVolume);
|
|
187 void _4AA258(int a2);
|
|
188 void PlaySound(SoundID eSoundID, signed int a3, unsigned int uNumRepeats, signed int a5, signed int a6, int a7, float uVolume, int sPlaybackRate);
|
|
189 void UpdateSounds();
|
|
190 void StopChannels(int uStartChannel, int uEndChannel);
|
|
191 void LoadAudioSnd();//
|
|
192 void Initialize();//
|
|
193 void CheckA3DSupport(bool query);
|
|
194 void Release();
|
|
195 void FreeChannel(MixerChannel *pChannel);
|
|
196 void _4ABF23(AudioPlayer_3DSample *a2);
|
|
197 void SetEAXPreferences();
|
|
198 void SetMapEAX();
|
|
199 int _4AC0A2();
|
|
200 void PlayMusicTrack(enum MusicID eTrack);
|
|
201 void MessWithChannels();
|
|
202
|
|
203
|
|
204 unsigned int bEAXSupported;
|
|
205 unsigned int b3DSoundInitialized;
|
|
206 int s3DSoundVolume;
|
|
207 struct _PROVIDER *h3DSoundProvider;
|
|
208 int uNum3DSamples;
|
|
209 struct AudioPlayer_3DSample p3DSamples[32];
|
|
210 int field_214;
|
|
211 int sRedbookVolume;
|
|
212 char p3DSoundProvider[128];
|
|
213 unsigned int bPlayerReady;
|
|
214 //HWND hWindow;
|
|
215 class OSWindow *window;
|
|
216 struct _REDBOOK *hAILRedbook;
|
|
217 struct _DIG_DRIVER *hDigDriver;
|
|
218 int dword_0002AC;
|
|
219 struct _SEQUENCE *hSequence;
|
|
220 int dword_0002B4;
|
|
221 struct SoundHeader *pSoundHeaders;
|
|
222 HANDLE hAudioSnd;
|
|
223 unsigned int uNumSoundHeaders;
|
|
224 unsigned int uMasterVolume;
|
|
225 int dword_0002C8;
|
|
226 int dword_0002CC;
|
|
227 int field_2D0_time_left;
|
|
228 int field_2D4;
|
|
229 unsigned int uCurrentMusicTrackLength;
|
|
230 unsigned int uNumRedbookTracks;
|
|
231 unsigned int uCurrentMusicTrackStartMS;
|
|
232 unsigned int uCurrentMusicTrackEndMS;
|
|
233 struct MixerChannel pMixerChannels[16];
|
|
234 int uMixerChannels;
|
|
235 int field_3EC;
|
|
236 char pDeviceNames[16][128];
|
|
237 int array_000BF0[16];
|
|
238 int array_000C30[16];
|
|
239 unsigned int uNumDevices;
|
|
240 struct _STREAM *hStream;
|
|
241 char field_C78[8];
|
|
242 int cGameCDDriveLetter;
|
|
243 };
|
|
244 #pragma pack(pop)
|
|
245
|
|
246
|
|
247
|
|
248
|
|
249
|
|
250
|
|
251
|
|
252
|
|
253 /* 325 */
|
|
254 enum SOUND_DESC_TYPE : __int32
|
|
255 {
|
|
256 SOUND_DESC_LEVEL = 0x0,
|
|
257 SOUND_DESC_SYSTEM = 0x1,
|
|
258 SOUND_DESC_SWAP = 0x2,
|
|
259 SOUND_DESC_3 = 0x3,
|
|
260 SOUND_DESC_LOCK = 0x4,
|
|
261 };
|
|
262
|
2506
|
263 struct TSearchRec
|
|
264 {
|
|
265 int Time;
|
|
266 int Size;
|
|
267 int Attr;
|
|
268 char Name[32];
|
|
269 int ExcludeAttr;
|
|
270 int FindHandle;
|
|
271 _WIN32_FIND_DATAA FindData;
|
|
272 } ;
|
|
273
|
2502
|
274 /* 326 */
|
|
275 enum SOUND_DESC_FLAGS
|
|
276 {
|
|
277 SOUND_DESC_LOCKED = 0x1,
|
|
278 SOUND_DESC_3D = 0x2,
|
|
279 };
|
|
280
|
|
281
|
|
282 #pragma pack(push, 1)
|
|
283 struct SoundData
|
|
284 {
|
|
285 unsigned int uDataSize;
|
|
286 char pData[1];
|
|
287 };
|
|
288
|
|
289 struct SoundDesc_mm6
|
|
290 {
|
|
291 inline bool Is3D() {return (uFlags & SOUND_DESC_3D) != 0;}
|
|
292
|
|
293 char pSoundName[32];
|
|
294 unsigned int uSoundID;
|
|
295 SOUND_DESC_TYPE eType;
|
|
296 int uFlags;
|
|
297 SoundData *pSoundData[17];
|
|
298 };
|
|
299
|
|
300 struct SoundDesc: public SoundDesc_mm6
|
|
301 {
|
|
302 void *p3DSound;
|
|
303 int bDecompressed;
|
|
304 };
|
|
305 #pragma pack(pop)
|
|
306
|
|
307
|
|
308
|
|
309 #pragma pack(push, 1)
|
|
310 struct SoundList
|
|
311 {
|
|
312 inline SoundList():
|
|
313 sNumSounds(0), pSL_Sounds(nullptr), uTotalLoadedSoundSize(0)
|
|
314 {}
|
|
315
|
|
316 void Initialize();
|
|
317 __int16 LoadSound(int a1, unsigned int a3);
|
|
318 int LoadSound(unsigned int a2, LPVOID lpBuffer, int uBufferSizeLeft, int *pOutSoundSize, int a6);
|
|
319 SoundDesc *Release();
|
|
320 void _4A9D79(int a2);
|
|
321 void UnloadSound(unsigned int uSoundID, char a3);
|
|
322 void ToFile();
|
|
323 void FromFile(void *data_mm6, void *data_mm7, void *data_mm8);
|
|
324 int FromFileTxt(const char *Args);
|
|
325
|
|
326 signed int sNumSounds;
|
|
327 SoundDesc *pSL_Sounds;
|
|
328 unsigned int uTotalLoadedSoundSize;
|
|
329 };
|
|
330 #pragma pack(pop)
|
|
331
|
|
332
|
|
333
|
|
334
|
|
335
|
|
336 /* 241 */
|
|
337 #pragma pack(push, 1)
|
|
338 struct Sound
|
|
339 {
|
|
340 unsigned int uID;
|
|
341 char SoundName[120];
|
|
342 SoundData *pSoundData;
|
|
343 };
|
|
344 #pragma pack(pop)
|
|
345
|
|
346
|
|
347
|
|
348
|
|
349 extern int Aureal3D_SplashScreen;
|
|
350 extern int Aureal3D_SplashAudio;
|
|
351 extern int uFindSound_BinSearch_ResultID; // weak
|
|
352 extern int uLastLoadedSoundID; // weak
|
|
353 extern int sLastTrackLengthMS;
|
|
354 extern std::array<Sound, 3000> pSounds;
|
|
355 extern AudioPlayer *pAudioPlayer;
|
|
356 extern SoundList *pSoundList;
|
|
357
|
|
358 extern unsigned __int8 uSoundVolumeMultiplier;
|
|
359 extern unsigned __int8 uVoicesVolumeMultiplier;
|
|
360 extern unsigned __int8 uMusicVolimeMultiplier;
|
|
361 extern int bWalkSound; // idb
|
|
362
|
|
363 extern std::array<float, 10> pSoundVolumeLevels; // idb
|
|
364
|
|
365
|
|
366
|
|
367
|
|
368
|
|
369
|
|
370
|
|
371
|
|
372 /* 379 */
|
|
373 #pragma pack(push, 1)
|
|
374 struct stru339_spell_sound
|
|
375 {
|
|
376 int AddPartySpellSound(int uSoundID, int a6);
|
|
377
|
|
378 char pSounds[44744];
|
|
379 int field_AEC8[45];
|
|
380 int field_AF7C[18];
|
|
381 int field_AFC4;
|
|
382 int pSoundsSizes[2];
|
|
383 int pSoundsOffsets[2];
|
|
384 };
|
|
385 #pragma pack(pop)
|
|
386 extern std::array<stru339_spell_sound, 4> stru_A750F8;
|
|
387 extern std::array<stru339_spell_sound, 4> AA1058_PartyQuickSpellSound;
|
|
388
|
|
389 struct SoundHeader *FindSound_BinSearch(unsigned int uStart, unsigned int uEnd, const char *pName);
|
|
390 struct SoundData *LoadSound(const char *pSoundName, struct SoundData *pOutBuff, unsigned int uID);
|
|
391 int __fastcall sub_4AB66C(int, int); // weak
|
|
392 int GetSoundStrengthByDistanceFromParty(int x, int y, int z);
|
|
393 void PlayLevelMusic();
|