Mercurial > mm7
annotate Media/Audio/AudioPlayer.h @ 2575:a76d408c5132 tip
DrawTranslucent -> DrawTextureGrayShade
Removed old texture drawing stuff
author | a.parshin |
---|---|
date | Wed, 09 Mar 2016 01:39:52 +0200 |
parents | d87bfbd3bb3b |
children |
rev | line source |
---|---|
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, |
2540 | 78 SOUND_WoodDoorClosing = 7, |
2534 | 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 { | |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2540
diff
changeset
|
178 MUSIC_MainMenu = 14, |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2540
diff
changeset
|
179 MUSIC_Credits = 15 |
2502 | 180 }; |
181 | |
182 /* 20 */ | |
183 #pragma pack(push, 1) | |
184 struct AudioPlayer | |
185 { | |
186 //----- (004A9669) -------------------------------------------------------- | |
187 AudioPlayer(): | |
188 bPlayerReady(false), b3DSoundInitialized(false), | |
189 hAILRedbook(nullptr), hStream(nullptr) | |
190 { | |
191 /*AudioPlayer_3DSample *v0; //ecx@1 | |
192 signed int v1; //edi@1 | |
193 | |
194 v0 = p3DSamples; | |
195 v1 = 32; | |
196 do | |
197 { | |
198 v0->field_4 = 0; | |
199 v0->field_8 = 0; | |
200 v0->field_C = 0; | |
201 v0->hSample = 0; | |
202 ++v0; | |
203 --v1; | |
204 } | |
205 while (v1);*/ | |
206 uMixerChannels = 16; | |
207 field_2D0_time_left = 256; | |
208 uNumRedbookTracks = 0; | |
209 uCurrentMusicTrackLength = 0; | |
210 field_2D4 = 0; | |
211 s3DSoundVolume = 127; | |
212 } | |
213 inline ~AudioPlayer(){ Release(); }; | |
214 void SetMusicVolume(int vol); | |
215 void SetMasterVolume(float fVolume); | |
216 void _4AA258(int a2); | |
217 void PlaySound(SoundID eSoundID, signed int a3, unsigned int uNumRepeats, signed int a5, signed int a6, int a7, float uVolume, int sPlaybackRate); | |
218 void UpdateSounds(); | |
219 void StopChannels(int uStartChannel, int uEndChannel); | |
220 void LoadAudioSnd();// | |
221 void Initialize();// | |
222 void CheckA3DSupport(bool query); | |
223 void Release(); | |
224 void FreeChannel(MixerChannel *pChannel); | |
225 void _4ABF23(AudioPlayer_3DSample *a2); | |
226 void SetEAXPreferences(); | |
227 void SetMapEAX(); | |
228 int _4AC0A2(); | |
229 void PlayMusicTrack(enum MusicID eTrack); | |
230 void MessWithChannels(); | |
231 | |
232 | |
233 unsigned int bEAXSupported; | |
234 unsigned int b3DSoundInitialized; | |
235 int s3DSoundVolume; | |
236 struct _PROVIDER *h3DSoundProvider; | |
237 int uNum3DSamples; | |
238 struct AudioPlayer_3DSample p3DSamples[32]; | |
239 int field_214; | |
240 int sRedbookVolume; | |
241 char p3DSoundProvider[128]; | |
242 unsigned int bPlayerReady; | |
243 //HWND hWindow; | |
244 class OSWindow *window; | |
245 struct _REDBOOK *hAILRedbook; | |
246 struct _DIG_DRIVER *hDigDriver; | |
247 int dword_0002AC; | |
248 struct _SEQUENCE *hSequence; | |
249 int dword_0002B4; | |
250 struct SoundHeader *pSoundHeaders; | |
251 HANDLE hAudioSnd; | |
252 unsigned int uNumSoundHeaders; | |
253 unsigned int uMasterVolume; | |
254 int dword_0002C8; | |
255 int dword_0002CC; | |
256 int field_2D0_time_left; | |
257 int field_2D4; | |
258 unsigned int uCurrentMusicTrackLength; | |
259 unsigned int uNumRedbookTracks; | |
260 unsigned int uCurrentMusicTrackStartMS; | |
261 unsigned int uCurrentMusicTrackEndMS; | |
262 struct MixerChannel pMixerChannels[16]; | |
263 int uMixerChannels; | |
264 int field_3EC; | |
265 char pDeviceNames[16][128]; | |
2534 | 266 int pFrequency[16]; |
2502 | 267 int array_000C30[16]; |
268 unsigned int uNumDevices; | |
269 struct _STREAM *hStream; | |
270 char field_C78[8]; | |
271 int cGameCDDriveLetter; | |
272 }; | |
273 #pragma pack(pop) | |
274 | |
275 | |
276 | |
277 | |
278 | |
279 | |
280 | |
281 | |
282 /* 325 */ | |
283 enum SOUND_DESC_TYPE : __int32 | |
284 { | |
285 SOUND_DESC_LEVEL = 0x0, | |
286 SOUND_DESC_SYSTEM = 0x1, | |
287 SOUND_DESC_SWAP = 0x2, | |
288 SOUND_DESC_3 = 0x3, | |
289 SOUND_DESC_LOCK = 0x4, | |
290 }; | |
291 | |
2506 | 292 struct TSearchRec |
293 { | |
294 int Time; | |
295 int Size; | |
296 int Attr; | |
297 char Name[32]; | |
298 int ExcludeAttr; | |
299 int FindHandle; | |
300 _WIN32_FIND_DATAA FindData; | |
301 } ; | |
302 | |
2502 | 303 /* 326 */ |
304 enum SOUND_DESC_FLAGS | |
305 { | |
306 SOUND_DESC_LOCKED = 0x1, | |
307 SOUND_DESC_3D = 0x2, | |
308 }; | |
309 | |
310 | |
311 #pragma pack(push, 1) | |
312 struct SoundData | |
313 { | |
314 unsigned int uDataSize; | |
315 char pData[1]; | |
316 }; | |
317 | |
318 struct SoundDesc_mm6 | |
319 { | |
320 inline bool Is3D() {return (uFlags & SOUND_DESC_3D) != 0;} | |
321 | |
322 char pSoundName[32]; | |
323 unsigned int uSoundID; | |
324 SOUND_DESC_TYPE eType; | |
325 int uFlags; | |
326 SoundData *pSoundData[17]; | |
327 }; | |
328 | |
329 struct SoundDesc: public SoundDesc_mm6 | |
330 { | |
331 void *p3DSound; | |
332 int bDecompressed; | |
333 }; | |
334 #pragma pack(pop) | |
335 | |
336 | |
337 | |
338 #pragma pack(push, 1) | |
339 struct SoundList | |
340 { | |
341 inline SoundList(): | |
342 sNumSounds(0), pSL_Sounds(nullptr), uTotalLoadedSoundSize(0) | |
343 {} | |
344 | |
345 void Initialize(); | |
346 __int16 LoadSound(int a1, unsigned int a3); | |
347 int LoadSound(unsigned int a2, LPVOID lpBuffer, int uBufferSizeLeft, int *pOutSoundSize, int a6); | |
348 SoundDesc *Release(); | |
349 void _4A9D79(int a2); | |
350 void UnloadSound(unsigned int uSoundID, char a3); | |
351 void ToFile(); | |
352 void FromFile(void *data_mm6, void *data_mm7, void *data_mm8); | |
353 int FromFileTxt(const char *Args); | |
354 | |
355 signed int sNumSounds; | |
356 SoundDesc *pSL_Sounds; | |
357 unsigned int uTotalLoadedSoundSize; | |
358 }; | |
359 #pragma pack(pop) | |
360 | |
361 | |
362 | |
363 | |
364 | |
365 /* 241 */ | |
366 #pragma pack(push, 1) | |
367 struct Sound | |
368 { | |
369 unsigned int uID; | |
370 char SoundName[120]; | |
371 SoundData *pSoundData; | |
372 }; | |
373 #pragma pack(pop) | |
374 | |
375 | |
376 | |
377 | |
378 extern int Aureal3D_SplashScreen; | |
379 extern int Aureal3D_SplashAudio; | |
380 extern int uFindSound_BinSearch_ResultID; // weak | |
381 extern int uLastLoadedSoundID; // weak | |
382 extern int sLastTrackLengthMS; | |
383 extern std::array<Sound, 3000> pSounds; | |
384 extern AudioPlayer *pAudioPlayer; | |
385 extern SoundList *pSoundList; | |
386 | |
387 extern unsigned __int8 uSoundVolumeMultiplier; | |
388 extern unsigned __int8 uVoicesVolumeMultiplier; | |
389 extern unsigned __int8 uMusicVolimeMultiplier; | |
390 extern int bWalkSound; // idb | |
391 | |
392 extern std::array<float, 10> pSoundVolumeLevels; // idb | |
393 | |
394 | |
395 | |
396 | |
397 | |
398 | |
399 | |
400 | |
401 /* 379 */ | |
402 #pragma pack(push, 1) | |
403 struct stru339_spell_sound | |
404 { | |
405 int AddPartySpellSound(int uSoundID, int a6); | |
406 | |
407 char pSounds[44744]; | |
408 int field_AEC8[45]; | |
409 int field_AF7C[18]; | |
410 int field_AFC4; | |
411 int pSoundsSizes[2]; | |
412 int pSoundsOffsets[2]; | |
413 }; | |
414 #pragma pack(pop) | |
415 extern std::array<stru339_spell_sound, 4> stru_A750F8; | |
416 extern std::array<stru339_spell_sound, 4> AA1058_PartyQuickSpellSound; | |
417 | |
418 struct SoundHeader *FindSound_BinSearch(unsigned int uStart, unsigned int uEnd, const char *pName); | |
419 struct SoundData *LoadSound(const char *pSoundName, struct SoundData *pOutBuff, unsigned int uID); | |
420 int __fastcall sub_4AB66C(int, int); // weak | |
421 int GetSoundStrengthByDistanceFromParty(int x, int y, int z); | |
422 void PlayLevelMusic(); |