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,
|
2534
|
77 SOUND_enter = 6,
|
|
78 SOUND_wooddrclose = 7,
|
|
79 SOUND_fireBall = 0x8,
|
|
80 SOUND_ClickMinus = 0x14,//20
|
|
81 SOUND_ClickMovingSelector = 0x15,//21
|
|
82 SOUND_ClickPlus = 0x17,//23
|
|
83 SOUND_ClickSkill = 0x18,//24
|
2502
|
84 SOUND_error = 27,
|
2534
|
85 SOUND_metal_vs_metal03h = 47,
|
2506
|
86 SOUND_48 = 0x30,
|
2534
|
87 SOUND_RunBadlands = 49,
|
|
88 SOUND_RunCarpet = 50,
|
|
89 SOUND_RunCooledLava = 51,
|
|
90 SOUND_RunDesert = 52,
|
|
91 SOUND_RunDirt = 53,
|
|
92 SOUND_RunGrass = 54,
|
|
93 SOUND_RunRoad = 57,
|
|
94 SOUND_RunSnow = 58,
|
|
95 SOUND_RunSwamp = 61,
|
|
96 SOUND_RunWater = 62,
|
|
97 SOUND_RunWaterIndoor = 63,
|
|
98 SOUND_RunWood = 64,
|
|
99 SOUND_SelectingANewCharacter = 66,
|
|
100 SOUND_shoot_blaster01 = 67,
|
|
101 SOUND_shoot_bow01 = 71,
|
2506
|
102 SOUND_StartMainChoice02 = 75,
|
2534
|
103 SOUND_swing_with_axe01 = 78,
|
|
104 SOUND_swing_with_axe03 = 80,
|
|
105 SOUND_swing_with_blunt_weapon01 = 81,
|
|
106 SOUND_swing_with_blunt_weapon03 = 83,
|
|
107 SOUND_swing_with_sword01 = 84,
|
|
108 SOUND_swing_with_sword02 = 85,
|
|
109 SOUND_WalkBadlands = 88,
|
|
110 SOUND_WalkCarpet = 89,
|
|
111 SOUND_WalkCooledLava = 90,
|
|
112 SOUND_WalkDesert = 91,
|
|
113 SOUND_WalkDirt = 92,
|
|
114 SOUND_WalkGrass = 93,
|
|
115 SOUND_WalkRoad = 96,
|
|
116 SOUND_WalkSnow = 97,
|
|
117 SOUND_WalkSwamp = 100,
|
|
118 SOUND_WalkWater = 101,
|
|
119 SOUND_WalkWaterIndoor = 102,
|
|
120 SOUND_WalkWood = 103,
|
|
121 SOUND_bricks_down = 0x78,//120
|
|
122 SOUND_bricks_up = 0x79,
|
|
123 SOUND_damage = 0x7A,
|
|
124 SOUND_deal = 0x7B,
|
|
125 SOUND_defeat = 0x7C,
|
|
126 SOUND_querry_up = 0x7D,
|
|
127 SOUND_querry_down = 0x7E,
|
|
128 SOUND_shuffle = 0x7F,
|
|
129 SOUND_title = 0x80,
|
|
130 SOUND_tower_up = 0x81,
|
|
131 SOUND_typing = 0x82,
|
|
132 SOUND_victory = 0x83,
|
|
133 SOUND_wall_up = 0x84,
|
|
134 SOUND_luteguitar = 133, // 85
|
|
135 SOUND_panflute = 134, // 86
|
|
136 SOUND_trumpet = 135, // 87
|
|
137 SOUND_gold01 = 0xC8,//200
|
|
138 SOUND_heal = 202,
|
|
139 SOUND_fizzle = 203,
|
|
140 SOUND_TurnPageU = 204,
|
|
141 SOUND_batlleen = 206,
|
|
142 SOUND_batllest = 207,
|
|
143 SOUND_openchest0101 = 208,
|
|
144 SOUND_spellfail0201 = 0xD1,
|
|
145 SOUND_drink = 0xD2,
|
|
146 SOUND_eat = 211, // D3
|
|
147 SOUND_gong = 0xD7,
|
|
148 SOUND_hurp = 0xD9,
|
|
149 SOUND_church = 0xDA, //218
|
|
150 SOUND_chimes = 0xDB,
|
|
151 SOUND_splash = 220,
|
|
152 SOUND_star1 = 0xDD,
|
|
153 SOUND_star2 = 0xDE,
|
|
154 SOUND_star4 = 0xE0,
|
|
155 SOUND_eradicate = 0xE1,
|
|
156 SOUND_eleccircle = 0xE2,
|
|
157 SOUND_encounter = 0xE3,
|
|
158 SOUND_openbook = 230,
|
|
159 SOUND_closebook = 231,
|
|
160 SOUND_hf445a = 5788,
|
|
161 SOUND_Haste = 10040,
|
|
162 SOUND_21fly03 = 11090,
|
|
163 SOUND_WaterWalk = 12040,
|
|
164 SOUND_Stoneskin = 13040,
|
|
165 SOUND_Bless = 14010,
|
|
166 SOUND_Fate = 14020,
|
|
167 SOUND_51heroism03 = 14060,
|
|
168 SOUND_94dayofprotection03 = 17070,
|
|
169 SOUND_9armageddon01 = 17080,
|
|
170 SOUND_Sacrifice2 = 18060,
|
|
171 SOUND_quest = 20001,
|
|
172
|
2502
|
173 };
|
|
174
|
|
175
|
|
176 enum MusicID: unsigned __int32
|
|
177 {
|
|
178 MUSIC_Credits = 15
|
|
179 };
|
|
180
|
|
181 /* 20 */
|
|
182 #pragma pack(push, 1)
|
|
183 struct AudioPlayer
|
|
184 {
|
|
185 //----- (004A9669) --------------------------------------------------------
|
|
186 AudioPlayer():
|
|
187 bPlayerReady(false), b3DSoundInitialized(false),
|
|
188 hAILRedbook(nullptr), hStream(nullptr)
|
|
189 {
|
|
190 /*AudioPlayer_3DSample *v0; //ecx@1
|
|
191 signed int v1; //edi@1
|
|
192
|
|
193 v0 = p3DSamples;
|
|
194 v1 = 32;
|
|
195 do
|
|
196 {
|
|
197 v0->field_4 = 0;
|
|
198 v0->field_8 = 0;
|
|
199 v0->field_C = 0;
|
|
200 v0->hSample = 0;
|
|
201 ++v0;
|
|
202 --v1;
|
|
203 }
|
|
204 while (v1);*/
|
|
205 uMixerChannels = 16;
|
|
206 field_2D0_time_left = 256;
|
|
207 uNumRedbookTracks = 0;
|
|
208 uCurrentMusicTrackLength = 0;
|
|
209 field_2D4 = 0;
|
|
210 s3DSoundVolume = 127;
|
|
211 }
|
|
212 inline ~AudioPlayer(){ Release(); };
|
|
213 void SetMusicVolume(int vol);
|
|
214 void SetMasterVolume(float fVolume);
|
|
215 void _4AA258(int a2);
|
|
216 void PlaySound(SoundID eSoundID, signed int a3, unsigned int uNumRepeats, signed int a5, signed int a6, int a7, float uVolume, int sPlaybackRate);
|
|
217 void UpdateSounds();
|
|
218 void StopChannels(int uStartChannel, int uEndChannel);
|
|
219 void LoadAudioSnd();//
|
|
220 void Initialize();//
|
|
221 void CheckA3DSupport(bool query);
|
|
222 void Release();
|
|
223 void FreeChannel(MixerChannel *pChannel);
|
|
224 void _4ABF23(AudioPlayer_3DSample *a2);
|
|
225 void SetEAXPreferences();
|
|
226 void SetMapEAX();
|
|
227 int _4AC0A2();
|
|
228 void PlayMusicTrack(enum MusicID eTrack);
|
|
229 void MessWithChannels();
|
|
230
|
|
231
|
|
232 unsigned int bEAXSupported;
|
|
233 unsigned int b3DSoundInitialized;
|
|
234 int s3DSoundVolume;
|
|
235 struct _PROVIDER *h3DSoundProvider;
|
|
236 int uNum3DSamples;
|
|
237 struct AudioPlayer_3DSample p3DSamples[32];
|
|
238 int field_214;
|
|
239 int sRedbookVolume;
|
|
240 char p3DSoundProvider[128];
|
|
241 unsigned int bPlayerReady;
|
|
242 //HWND hWindow;
|
|
243 class OSWindow *window;
|
|
244 struct _REDBOOK *hAILRedbook;
|
|
245 struct _DIG_DRIVER *hDigDriver;
|
|
246 int dword_0002AC;
|
|
247 struct _SEQUENCE *hSequence;
|
|
248 int dword_0002B4;
|
|
249 struct SoundHeader *pSoundHeaders;
|
|
250 HANDLE hAudioSnd;
|
|
251 unsigned int uNumSoundHeaders;
|
|
252 unsigned int uMasterVolume;
|
|
253 int dword_0002C8;
|
|
254 int dword_0002CC;
|
|
255 int field_2D0_time_left;
|
|
256 int field_2D4;
|
|
257 unsigned int uCurrentMusicTrackLength;
|
|
258 unsigned int uNumRedbookTracks;
|
|
259 unsigned int uCurrentMusicTrackStartMS;
|
|
260 unsigned int uCurrentMusicTrackEndMS;
|
|
261 struct MixerChannel pMixerChannels[16];
|
|
262 int uMixerChannels;
|
|
263 int field_3EC;
|
|
264 char pDeviceNames[16][128];
|
2534
|
265 int pFrequency[16];
|
2502
|
266 int array_000C30[16];
|
|
267 unsigned int uNumDevices;
|
|
268 struct _STREAM *hStream;
|
|
269 char field_C78[8];
|
|
270 int cGameCDDriveLetter;
|
|
271 };
|
|
272 #pragma pack(pop)
|
|
273
|
|
274
|
|
275
|
|
276
|
|
277
|
|
278
|
|
279
|
|
280
|
|
281 /* 325 */
|
|
282 enum SOUND_DESC_TYPE : __int32
|
|
283 {
|
|
284 SOUND_DESC_LEVEL = 0x0,
|
|
285 SOUND_DESC_SYSTEM = 0x1,
|
|
286 SOUND_DESC_SWAP = 0x2,
|
|
287 SOUND_DESC_3 = 0x3,
|
|
288 SOUND_DESC_LOCK = 0x4,
|
|
289 };
|
|
290
|
2506
|
291 struct TSearchRec
|
|
292 {
|
|
293 int Time;
|
|
294 int Size;
|
|
295 int Attr;
|
|
296 char Name[32];
|
|
297 int ExcludeAttr;
|
|
298 int FindHandle;
|
|
299 _WIN32_FIND_DATAA FindData;
|
|
300 } ;
|
|
301
|
2502
|
302 /* 326 */
|
|
303 enum SOUND_DESC_FLAGS
|
|
304 {
|
|
305 SOUND_DESC_LOCKED = 0x1,
|
|
306 SOUND_DESC_3D = 0x2,
|
|
307 };
|
|
308
|
|
309
|
|
310 #pragma pack(push, 1)
|
|
311 struct SoundData
|
|
312 {
|
|
313 unsigned int uDataSize;
|
|
314 char pData[1];
|
|
315 };
|
|
316
|
|
317 struct SoundDesc_mm6
|
|
318 {
|
|
319 inline bool Is3D() {return (uFlags & SOUND_DESC_3D) != 0;}
|
|
320
|
|
321 char pSoundName[32];
|
|
322 unsigned int uSoundID;
|
|
323 SOUND_DESC_TYPE eType;
|
|
324 int uFlags;
|
|
325 SoundData *pSoundData[17];
|
|
326 };
|
|
327
|
|
328 struct SoundDesc: public SoundDesc_mm6
|
|
329 {
|
|
330 void *p3DSound;
|
|
331 int bDecompressed;
|
|
332 };
|
|
333 #pragma pack(pop)
|
|
334
|
|
335
|
|
336
|
|
337 #pragma pack(push, 1)
|
|
338 struct SoundList
|
|
339 {
|
|
340 inline SoundList():
|
|
341 sNumSounds(0), pSL_Sounds(nullptr), uTotalLoadedSoundSize(0)
|
|
342 {}
|
|
343
|
|
344 void Initialize();
|
|
345 __int16 LoadSound(int a1, unsigned int a3);
|
|
346 int LoadSound(unsigned int a2, LPVOID lpBuffer, int uBufferSizeLeft, int *pOutSoundSize, int a6);
|
|
347 SoundDesc *Release();
|
|
348 void _4A9D79(int a2);
|
|
349 void UnloadSound(unsigned int uSoundID, char a3);
|
|
350 void ToFile();
|
|
351 void FromFile(void *data_mm6, void *data_mm7, void *data_mm8);
|
|
352 int FromFileTxt(const char *Args);
|
|
353
|
|
354 signed int sNumSounds;
|
|
355 SoundDesc *pSL_Sounds;
|
|
356 unsigned int uTotalLoadedSoundSize;
|
|
357 };
|
|
358 #pragma pack(pop)
|
|
359
|
|
360
|
|
361
|
|
362
|
|
363
|
|
364 /* 241 */
|
|
365 #pragma pack(push, 1)
|
|
366 struct Sound
|
|
367 {
|
|
368 unsigned int uID;
|
|
369 char SoundName[120];
|
|
370 SoundData *pSoundData;
|
|
371 };
|
|
372 #pragma pack(pop)
|
|
373
|
|
374
|
|
375
|
|
376
|
|
377 extern int Aureal3D_SplashScreen;
|
|
378 extern int Aureal3D_SplashAudio;
|
|
379 extern int uFindSound_BinSearch_ResultID; // weak
|
|
380 extern int uLastLoadedSoundID; // weak
|
|
381 extern int sLastTrackLengthMS;
|
|
382 extern std::array<Sound, 3000> pSounds;
|
|
383 extern AudioPlayer *pAudioPlayer;
|
|
384 extern SoundList *pSoundList;
|
|
385
|
|
386 extern unsigned __int8 uSoundVolumeMultiplier;
|
|
387 extern unsigned __int8 uVoicesVolumeMultiplier;
|
|
388 extern unsigned __int8 uMusicVolimeMultiplier;
|
|
389 extern int bWalkSound; // idb
|
|
390
|
|
391 extern std::array<float, 10> pSoundVolumeLevels; // idb
|
|
392
|
|
393
|
|
394
|
|
395
|
|
396
|
|
397
|
|
398
|
|
399
|
|
400 /* 379 */
|
|
401 #pragma pack(push, 1)
|
|
402 struct stru339_spell_sound
|
|
403 {
|
|
404 int AddPartySpellSound(int uSoundID, int a6);
|
|
405
|
|
406 char pSounds[44744];
|
|
407 int field_AEC8[45];
|
|
408 int field_AF7C[18];
|
|
409 int field_AFC4;
|
|
410 int pSoundsSizes[2];
|
|
411 int pSoundsOffsets[2];
|
|
412 };
|
|
413 #pragma pack(pop)
|
|
414 extern std::array<stru339_spell_sound, 4> stru_A750F8;
|
|
415 extern std::array<stru339_spell_sound, 4> AA1058_PartyQuickSpellSound;
|
|
416
|
|
417 struct SoundHeader *FindSound_BinSearch(unsigned int uStart, unsigned int uEnd, const char *pName);
|
|
418 struct SoundData *LoadSound(const char *pSoundName, struct SoundData *pOutBuff, unsigned int uID);
|
|
419 int __fastcall sub_4AB66C(int, int); // weak
|
|
420 int GetSoundStrengthByDistanceFromParty(int x, int y, int z);
|
|
421 void PlayLevelMusic();
|