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