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