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