Mercurial > mm7
annotate AudioPlayer.h @ 1424:5930342f092b
fall to the water
author | Ritor1 |
---|---|
date | Tue, 30 Jul 2013 15:14:46 +0600 |
parents | 3881d2f94eb1 |
children | 934074e7fcc1 |
rev | line source |
---|---|
0 | 1 #pragma once |
2 #include "OSAPI.h" | |
3 | |
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(): | |
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, |
0 | 77 SOUND_EnteringAHouse = 0x6, |
978 | 78 SOUND_7 = 7, |
0 | 79 SOUND_8 = 0x8, |
80 SOUND_27 = 0x1B, | |
1424 | 81 SOUND_64 = 64, |
187 | 82 SOUND_Button = 66, |
295 | 83 SOUND_67 = 67, |
84 SOUND_71 = 71, | |
388 | 85 SOUND_Button2 = 75, |
295 | 86 SOUND_78 = 78, |
87 SOUND_80 = 80, | |
88 SOUND_81 = 81, | |
89 SOUND_83 = 83, | |
90 SOUND_84 = 84, | |
91 SOUND_85 = 85, | |
1424 | 92 SOUND_103 = 103, |
0 | 93 SOUND_Arcomage_LoseResources = 0x78, |
94 SOUND_Arcomage_AddResources = 0x79, | |
95 SOUND_Arcomage_TowerWallDamage = 0x7A, | |
96 SOUND_Arcomage_DrawCard = 0x7B, | |
1183 | 97 SOUND_Arcomage_124 = 0x7C, |
0 | 98 SOUND_Arcomage_ProductionDamage = 0x7D, |
99 SOUND_Arcomage_ProductionUpgrade = 0x7E, | |
100 SOUND_Arcomage_127 = 0x7F, | |
101 SOUND_Arcomage_128 = 0x80, | |
102 SOUND_Arcomage_TowerUpgrade = 0x81, | |
1183 | 103 SOUND_Arcomage_130 = 0x82, |
104 SOUND_Arcomage_131 = 0x83, | |
0 | 105 SOUND_Arcomage_WallUpgrade = 0x84, |
106 SOUND_GoldReceived = 0xC8, | |
1413 | 107 SOUND_203 = 203, |
108 SOUND_206 = 206, | |
109 SOUND_207 = 207, | |
426 | 110 SOUND_OpenChest = 208, |
0 | 111 SOUND_PlayerCantCastSpell = 0xD1, |
112 SOUND_Bell = 0xD9, | |
1004 | 113 SOUND_OpenBook = 230, |
114 SOUND_CloseBook = 231, | |
1413 | 115 SOUND_11090 = 11090, |
116 SOUND_12040 = 12040, | |
0 | 117 SOUND_20001 = 0x4E21, |
118 }; | |
119 | |
120 | |
121 enum MusicID: unsigned __int32 | |
122 { | |
123 MUSIC_Credits = 15 | |
124 }; | |
125 | |
126 /* 20 */ | |
127 #pragma pack(push, 1) | |
128 struct AudioPlayer | |
129 { | |
130 //----- (004A9669) -------------------------------------------------------- | |
131 AudioPlayer(): | |
132 bPlayerReady(false), b3DSoundInitialized(false), | |
133 hAILRedbook(nullptr), hStream(nullptr) | |
134 { | |
135 /*AudioPlayer_3DSample *v0; //ecx@1 | |
136 signed int v1; //edi@1 | |
137 | |
138 v0 = p3DSamples; | |
139 v1 = 32; | |
140 do | |
141 { | |
142 v0->field_4 = 0; | |
143 v0->field_8 = 0; | |
144 v0->field_C = 0; | |
145 v0->hSample = 0; | |
146 ++v0; | |
147 --v1; | |
148 } | |
149 while (v1);*/ | |
150 uMixerChannels = 16; | |
151 field_2D0_time_left = 256; | |
152 uNumRedbookTracks = 0; | |
153 uCurrentMusicTrackLength = 0; | |
154 field_2D4 = 0; | |
155 s3DSoundVolume = 127; | |
156 } | |
157 | |
158 void SetMusicVolume(int vol); | |
328 | 159 void SetMasterVolume(float fVolume); |
0 | 160 void _4AA258(int a2); |
161 void PlaySound(SoundID eSoundID, signed int a3, unsigned int uNumRepeats, signed int a5, signed int a6, int a7, unsigned int uVolume, int sPlaybackRate); | |
378 | 162 void UpdateSounds(); |
0 | 163 void StopChannels(int uStartChannel, int uEndChannel); |
164 void LoadAudioSnd(); | |
165 void Initialize(HWND hWnd); | |
166 LSTATUS CheckA3DSupport(char a2); | |
167 void Release(); | |
764 | 168 void FreeChannel(MixerChannel *pChannel); |
0 | 169 void _4ABF23(AudioPlayer_3DSample *a2); |
170 void SetEAXPreferences(); | |
171 void SetMapEAX(); | |
172 int _4AC0A2(); | |
173 void PlayMusicTrack(enum MusicID eTrack); | |
174 void __cdecl MessWithChannels(); | |
175 | |
176 | |
177 unsigned int bEAXSupported; | |
178 unsigned int b3DSoundInitialized; | |
179 int s3DSoundVolume; | |
180 struct _PROVIDER *h3DSoundProvider; | |
181 int uNum3DSamples; | |
182 struct AudioPlayer_3DSample p3DSamples[32]; | |
183 int field_214; | |
184 int sRedbookVolume; | |
185 char p3DSoundProvider[128]; | |
186 unsigned int bPlayerReady; | |
187 HWND hWindow; | |
188 struct _REDBOOK *hAILRedbook; | |
189 struct _DIG_DRIVER *hDigDriver; | |
190 int dword_0002AC; | |
191 struct _SEQUENCE *hSequence; | |
192 int dword_0002B4; | |
193 struct SoundHeader *pSoundHeaders; | |
194 HANDLE hAudioSnd; | |
195 unsigned int uNumSoundHeaders; | |
196 unsigned int uMasterVolume; | |
197 int dword_0002C8; | |
198 int dword_0002CC; | |
199 int field_2D0_time_left; | |
200 int field_2D4; | |
201 unsigned int uCurrentMusicTrackLength; | |
202 unsigned int uNumRedbookTracks; | |
203 unsigned int uCurrentMusicTrackStartMS; | |
204 unsigned int uCurrentMusicTrackEndMS; | |
205 struct MixerChannel pMixerChannels[16]; | |
206 int uMixerChannels; | |
207 int field_3EC; | |
208 char pDeviceNames[16][128]; | |
209 int array_000BF0[16]; | |
210 int array_000C30[16]; | |
211 unsigned int uNumDevices; | |
212 struct _STREAM *hStream; | |
213 char field_C78[8]; | |
214 int cGameCDDriveLetter; | |
215 }; | |
216 #pragma pack(pop) | |
217 | |
218 | |
219 | |
220 | |
221 | |
222 | |
223 | |
224 | |
225 /* 325 */ | |
226 enum SOUND_DESC_TYPE : __int32 | |
227 { | |
228 SOUND_DESC_LEVEL = 0x0, | |
229 SOUND_DESC_SYSTEM = 0x1, | |
230 SOUND_DESC_SWAP = 0x2, | |
231 SOUND_DESC_3 = 0x3, | |
232 SOUND_DESC_LOCK = 0x4, | |
233 }; | |
234 | |
235 /* 326 */ | |
236 enum SOUND_DESC_FLAGS | |
237 { | |
238 SOUND_DESC_LOCKED = 0x1, | |
239 SOUND_DESC_3D = 0x2, | |
240 }; | |
241 | |
242 | |
243 | |
244 | |
245 #pragma pack(push, 1) | |
246 struct SoundData | |
247 { | |
248 unsigned int uDataSize; | |
249 char pData[1]; | |
250 }; | |
251 | |
252 struct SoundDesc | |
253 { | |
1113
39eaa6b00141
something to bool cast (performance warning) mostly fixed
Grumpy7
parents:
1004
diff
changeset
|
254 inline bool Is3D() {return (uFlags & SOUND_DESC_3D) != 0;} |
388 | 255 |
0 | 256 char pSoundName[32]; |
257 unsigned int uSoundID; | |
258 SOUND_DESC_TYPE eType; | |
259 int uFlags; | |
260 SoundData *pSoundData[17]; | |
261 void *p3DSound; | |
262 int bDecompressed; | |
263 }; | |
264 #pragma pack(pop) | |
265 | |
266 | |
267 | |
268 #pragma pack(push, 1) | |
269 struct SoundList | |
270 { | |
271 inline SoundList(): | |
764 | 272 sNumSounds(0), pSounds(nullptr), uTotalLoadedSoundSize(0) |
0 | 273 {} |
274 | |
275 void Initialize(); | |
276 __int16 LoadSound(int a1, unsigned int a3); | |
277 int LoadSound(unsigned int a2, LPVOID lpBuffer, int uBufferSizeLeft, int *pOutSoundSize, int a6); | |
278 SoundDesc *Release(); | |
279 void _4A9D79(int a2); | |
764 | 280 void UnloadSound(unsigned int uSoundID, char a3); |
0 | 281 void ToFile(); |
282 void *FromFile(void *pSerialized); | |
283 int FromFileTxt(const char *Args); | |
284 | |
764 | 285 signed int sNumSounds; |
0 | 286 SoundDesc *pSounds; |
287 unsigned int uTotalLoadedSoundSize; | |
288 }; | |
289 #pragma pack(pop) | |
290 | |
291 | |
292 | |
293 | |
294 | |
295 /* 241 */ | |
296 #pragma pack(push, 1) | |
297 struct Sound | |
298 { | |
299 unsigned int uID; | |
24 | 300 char SoundName[120]; |
0 | 301 SoundData *pSoundData; |
302 }; | |
303 #pragma pack(pop) | |
304 | |
305 | |
306 | |
307 | |
308 extern int Aureal3D_SplashScreen; | |
309 extern int Aureal3D_SplashAudio; | |
310 extern int uFindSound_BinSearch_ResultID; // weak | |
311 extern int uLastLoadedSoundID; // weak | |
312 extern int sLastTrackLengthMS; | |
1202 | 313 extern std::array<Sound, 3000> pSounds; |
0 | 314 extern AudioPlayer *pAudioPlayer; |
315 extern SoundList *pSoundList; | |
316 | |
317 extern unsigned __int8 uSoundVolumeMultiplier; | |
318 extern unsigned __int8 uVoicesVolumeMultiplier; | |
319 extern unsigned __int8 uMusicVolimeMultiplier; | |
320 extern int bWalkSound; // idb | |
321 | |
1202 | 322 extern std::array<float, 10> pSoundVolumeLevels; // idb |
0 | 323 |
324 | |
325 | |
326 | |
327 | |
328 | |
329 | |
330 | |
331 /* 379 */ | |
332 #pragma pack(push, 1) | |
333 struct stru339_spell_sound | |
334 { | |
335 int _494836(int uSoundID, int a6); | |
336 | |
337 char pSounds[44744]; | |
338 int field_AEC8[45]; | |
339 int field_AF7C[18]; | |
340 int field_AFC4; | |
341 int pSoundsSizes[2]; | |
342 int pSoundsOffsets[2]; | |
343 }; | |
344 #pragma pack(pop) | |
1202 | 345 extern std::array<stru339_spell_sound, 4> stru_A750F8; |
346 extern std::array<stru339_spell_sound, 4> stru_AA1058; |