Mercurial > mm7
annotate AudioPlayer.h @ 2499:68cdef6879a0
engine folder
author | Ritor1 |
---|---|
date | Fri, 19 Sep 2014 02:57:42 +0600 |
parents | 0683c0a38282 |
children |
rev | line source |
---|---|
0 | 1 #pragma once |
2 #include "OSAPI.h" | |
2455 | 3 #include "MediaPlayer.h" |
0 | 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 */ | |
2455 | 44 /*#pragma pack(push, 1) |
0 | 45 struct SoundHeader |
46 { | |
47 char pSoundName[40]; | |
48 unsigned int uFileOffset; | |
49 unsigned int uCompressedSize; | |
50 unsigned int uDecompressedSize; | |
51 }; | |
2455 | 52 #pragma pack(pop)*/ |
0 | 53 |
54 /* 27 */ | |
55 #pragma pack(push, 1) | |
56 struct MixerChannel | |
57 { | |
58 inline MixerChannel(): | |
378 | 59 hSample(nullptr), source_pid(0), uSourceTrackIdx(0), uSourceTrackID(0) |
0 | 60 {} |
61 | |
62 _SAMPLE *hSample; | |
378 | 63 int source_pid; |
0 | 64 unsigned int uSourceTrackIdx; |
65 unsigned int uSourceTrackID; | |
66 }; | |
67 #pragma pack(pop) | |
68 | |
69 | |
70 | |
71 | |
72 | |
73 /* 308 */ | |
74 enum SoundID | |
75 { | |
388 | 76 SOUND_Invalid = 0, |
2487 | 77 SOUND_EnteringAHouse = 6, |
978 | 78 SOUND_7 = 7, |
0 | 79 SOUND_8 = 0x8, |
1754 | 80 SOUND_24 = 24, |
81 SOUND_error = 27, | |
2084 | 82 SOUND_RunAlongWater = 63, |
2023 | 83 SOUND_RunAlong3DModel = 64, |
187 | 84 SOUND_Button = 66, |
295 | 85 SOUND_67 = 67, |
86 SOUND_71 = 71, | |
388 | 87 SOUND_Button2 = 75, |
295 | 88 SOUND_78 = 78, |
89 SOUND_80 = 80, | |
90 SOUND_81 = 81, | |
91 SOUND_83 = 83, | |
92 SOUND_84 = 84, | |
93 SOUND_85 = 85, | |
2084 | 94 SOUND_WalkAlongWater = 102, |
2023 | 95 SOUND_WalkAlong3DModel = 103, |
0 | 96 SOUND_Arcomage_LoseResources = 0x78, |
97 SOUND_Arcomage_AddResources = 0x79, | |
98 SOUND_Arcomage_TowerWallDamage = 0x7A, | |
99 SOUND_Arcomage_DrawCard = 0x7B, | |
1183 | 100 SOUND_Arcomage_124 = 0x7C, |
0 | 101 SOUND_Arcomage_ProductionDamage = 0x7D, |
102 SOUND_Arcomage_ProductionUpgrade = 0x7E, | |
103 SOUND_Arcomage_127 = 0x7F, | |
104 SOUND_Arcomage_128 = 0x80, | |
105 SOUND_Arcomage_TowerUpgrade = 0x81, | |
1183 | 106 SOUND_Arcomage_130 = 0x82, |
107 SOUND_Arcomage_131 = 0x83, | |
0 | 108 SOUND_Arcomage_WallUpgrade = 0x84, |
1459 | 109 SOUND_PlayLute = 133, // 85 |
110 SOUND_PlayFaeriePipes = 134, // 86 | |
111 SOUND_PlayGryphonheartsTrumpet = 135, // 87 | |
0 | 112 SOUND_GoldReceived = 0xC8, |
1413 | 113 SOUND_203 = 203, |
114 SOUND_206 = 206, | |
115 SOUND_207 = 207, | |
426 | 116 SOUND_OpenChest = 208, |
0 | 117 SOUND_PlayerCantCastSpell = 0xD1, |
1459 | 118 SOUND_EatApple = 211, // D3 |
0 | 119 SOUND_Bell = 0xD9, |
1004 | 120 SOUND_OpenBook = 230, |
121 SOUND_CloseBook = 231, | |
1413 | 122 SOUND_11090 = 11090, |
123 SOUND_12040 = 12040, | |
2373 | 124 SOUND_Arena_Welcome = 14060, |
0 | 125 SOUND_20001 = 0x4E21, |
126 }; | |
127 | |
128 | |
129 enum MusicID: unsigned __int32 | |
130 { | |
131 MUSIC_Credits = 15 | |
132 }; | |
133 | |
134 /* 20 */ | |
135 #pragma pack(push, 1) | |
136 struct AudioPlayer | |
137 { | |
138 //----- (004A9669) -------------------------------------------------------- | |
139 AudioPlayer(): | |
140 bPlayerReady(false), b3DSoundInitialized(false), | |
141 hAILRedbook(nullptr), hStream(nullptr) | |
142 { | |
143 /*AudioPlayer_3DSample *v0; //ecx@1 | |
144 signed int v1; //edi@1 | |
145 | |
146 v0 = p3DSamples; | |
147 v1 = 32; | |
148 do | |
149 { | |
150 v0->field_4 = 0; | |
151 v0->field_8 = 0; | |
152 v0->field_C = 0; | |
153 v0->hSample = 0; | |
154 ++v0; | |
155 --v1; | |
156 } | |
157 while (v1);*/ | |
158 uMixerChannels = 16; | |
159 field_2D0_time_left = 256; | |
160 uNumRedbookTracks = 0; | |
161 uCurrentMusicTrackLength = 0; | |
162 field_2D4 = 0; | |
163 s3DSoundVolume = 127; | |
164 } | |
2448 | 165 inline ~AudioPlayer(){ Release(); }; |
0 | 166 void SetMusicVolume(int vol); |
328 | 167 void SetMasterVolume(float fVolume); |
0 | 168 void _4AA258(int a2); |
2113 | 169 void PlaySound(SoundID eSoundID, signed int a3, unsigned int uNumRepeats, signed int a5, signed int a6, int a7, float uVolume, int sPlaybackRate); |
378 | 170 void UpdateSounds(); |
0 | 171 void StopChannels(int uStartChannel, int uEndChannel); |
2455 | 172 void LoadAudioSnd();// |
173 void Initialize();// | |
2152 | 174 void CheckA3DSupport(bool query); |
0 | 175 void Release(); |
764 | 176 void FreeChannel(MixerChannel *pChannel); |
0 | 177 void _4ABF23(AudioPlayer_3DSample *a2); |
178 void SetEAXPreferences(); | |
179 void SetMapEAX(); | |
180 int _4AC0A2(); | |
181 void PlayMusicTrack(enum MusicID eTrack); | |
1458 | 182 void MessWithChannels(); |
0 | 183 |
184 | |
185 unsigned int bEAXSupported; | |
186 unsigned int b3DSoundInitialized; | |
187 int s3DSoundVolume; | |
188 struct _PROVIDER *h3DSoundProvider; | |
189 int uNum3DSamples; | |
190 struct AudioPlayer_3DSample p3DSamples[32]; | |
191 int field_214; | |
192 int sRedbookVolume; | |
193 char p3DSoundProvider[128]; | |
194 unsigned int bPlayerReady; | |
1802 | 195 //HWND hWindow; |
196 class OSWindow *window; | |
0 | 197 struct _REDBOOK *hAILRedbook; |
198 struct _DIG_DRIVER *hDigDriver; | |
199 int dword_0002AC; | |
200 struct _SEQUENCE *hSequence; | |
201 int dword_0002B4; | |
202 struct SoundHeader *pSoundHeaders; | |
203 HANDLE hAudioSnd; | |
204 unsigned int uNumSoundHeaders; | |
205 unsigned int uMasterVolume; | |
206 int dword_0002C8; | |
207 int dword_0002CC; | |
208 int field_2D0_time_left; | |
209 int field_2D4; | |
210 unsigned int uCurrentMusicTrackLength; | |
211 unsigned int uNumRedbookTracks; | |
212 unsigned int uCurrentMusicTrackStartMS; | |
213 unsigned int uCurrentMusicTrackEndMS; | |
214 struct MixerChannel pMixerChannels[16]; | |
215 int uMixerChannels; | |
216 int field_3EC; | |
217 char pDeviceNames[16][128]; | |
218 int array_000BF0[16]; | |
219 int array_000C30[16]; | |
220 unsigned int uNumDevices; | |
221 struct _STREAM *hStream; | |
222 char field_C78[8]; | |
223 int cGameCDDriveLetter; | |
224 }; | |
225 #pragma pack(pop) | |
226 | |
227 | |
228 | |
229 | |
230 | |
231 | |
232 | |
233 | |
234 /* 325 */ | |
235 enum SOUND_DESC_TYPE : __int32 | |
236 { | |
237 SOUND_DESC_LEVEL = 0x0, | |
238 SOUND_DESC_SYSTEM = 0x1, | |
239 SOUND_DESC_SWAP = 0x2, | |
240 SOUND_DESC_3 = 0x3, | |
241 SOUND_DESC_LOCK = 0x4, | |
242 }; | |
243 | |
244 /* 326 */ | |
245 enum SOUND_DESC_FLAGS | |
246 { | |
247 SOUND_DESC_LOCKED = 0x1, | |
248 SOUND_DESC_3D = 0x2, | |
249 }; | |
250 | |
251 | |
252 #pragma pack(push, 1) | |
253 struct SoundData | |
254 { | |
255 unsigned int uDataSize; | |
256 char pData[1]; | |
257 }; | |
258 | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1459
diff
changeset
|
259 struct SoundDesc_mm6 |
0 | 260 { |
1113
39eaa6b00141
something to bool cast (performance warning) mostly fixed
Grumpy7
parents:
1004
diff
changeset
|
261 inline bool Is3D() {return (uFlags & SOUND_DESC_3D) != 0;} |
388 | 262 |
0 | 263 char pSoundName[32]; |
264 unsigned int uSoundID; | |
265 SOUND_DESC_TYPE eType; | |
266 int uFlags; | |
267 SoundData *pSoundData[17]; | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1459
diff
changeset
|
268 }; |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1459
diff
changeset
|
269 |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1459
diff
changeset
|
270 struct SoundDesc: public SoundDesc_mm6 |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1459
diff
changeset
|
271 { |
0 | 272 void *p3DSound; |
273 int bDecompressed; | |
274 }; | |
275 #pragma pack(pop) | |
276 | |
277 | |
278 | |
279 #pragma pack(push, 1) | |
280 struct SoundList | |
281 { | |
282 inline SoundList(): | |
2113 | 283 sNumSounds(0), pSL_Sounds(nullptr), uTotalLoadedSoundSize(0) |
0 | 284 {} |
285 | |
286 void Initialize(); | |
287 __int16 LoadSound(int a1, unsigned int a3); | |
288 int LoadSound(unsigned int a2, LPVOID lpBuffer, int uBufferSizeLeft, int *pOutSoundSize, int a6); | |
289 SoundDesc *Release(); | |
290 void _4A9D79(int a2); | |
764 | 291 void UnloadSound(unsigned int uSoundID, char a3); |
0 | 292 void ToFile(); |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1459
diff
changeset
|
293 void FromFile(void *data_mm6, void *data_mm7, void *data_mm8); |
0 | 294 int FromFileTxt(const char *Args); |
295 | |
764 | 296 signed int sNumSounds; |
2113 | 297 SoundDesc *pSL_Sounds; |
0 | 298 unsigned int uTotalLoadedSoundSize; |
299 }; | |
300 #pragma pack(pop) | |
301 | |
302 | |
303 | |
304 | |
305 | |
306 /* 241 */ | |
307 #pragma pack(push, 1) | |
308 struct Sound | |
309 { | |
310 unsigned int uID; | |
24 | 311 char SoundName[120]; |
0 | 312 SoundData *pSoundData; |
313 }; | |
314 #pragma pack(pop) | |
315 | |
316 | |
317 | |
318 | |
319 extern int Aureal3D_SplashScreen; | |
320 extern int Aureal3D_SplashAudio; | |
321 extern int uFindSound_BinSearch_ResultID; // weak | |
322 extern int uLastLoadedSoundID; // weak | |
323 extern int sLastTrackLengthMS; | |
1202 | 324 extern std::array<Sound, 3000> pSounds; |
0 | 325 extern AudioPlayer *pAudioPlayer; |
326 extern SoundList *pSoundList; | |
327 | |
328 extern unsigned __int8 uSoundVolumeMultiplier; | |
329 extern unsigned __int8 uVoicesVolumeMultiplier; | |
330 extern unsigned __int8 uMusicVolimeMultiplier; | |
331 extern int bWalkSound; // idb | |
332 | |
1202 | 333 extern std::array<float, 10> pSoundVolumeLevels; // idb |
0 | 334 |
335 | |
336 | |
337 | |
338 | |
339 | |
340 | |
341 | |
342 /* 379 */ | |
343 #pragma pack(push, 1) | |
344 struct stru339_spell_sound | |
345 { | |
2184 | 346 int AddPartySpellSound(int uSoundID, int a6); |
0 | 347 |
348 char pSounds[44744]; | |
349 int field_AEC8[45]; | |
350 int field_AF7C[18]; | |
351 int field_AFC4; | |
352 int pSoundsSizes[2]; | |
353 int pSoundsOffsets[2]; | |
354 }; | |
355 #pragma pack(pop) | |
1202 | 356 extern std::array<stru339_spell_sound, 4> stru_A750F8; |
2184 | 357 extern std::array<stru339_spell_sound, 4> AA1058_PartyQuickSpellSound; |
2343 | 358 |
359 struct SoundHeader *FindSound_BinSearch(unsigned int uStart, unsigned int uEnd, const char *pName); | |
360 struct SoundData *LoadSound(const char *pSoundName, struct SoundData *pOutBuff, unsigned int uID); | |
361 int __fastcall sub_4AB66C(int, int); // weak | |
362 int GetSoundStrengthByDistanceFromParty(int x, int y, int z); | |
363 void PlayLevelMusic(); |