annotate AudioPlayer.h @ 149:2b0c652cc165

12.02.13
author Ritor1
date Tue, 12 Feb 2013 10:17:11 +0600
parents 352b15291822
children 49728858c35e
rev   line source
0
Ritor1
parents:
diff changeset
1 #pragma once
Ritor1
parents:
diff changeset
2 #include "OSAPI.h"
Ritor1
parents:
diff changeset
3
Ritor1
parents:
diff changeset
4
Ritor1
parents:
diff changeset
5
Ritor1
parents:
diff changeset
6
Ritor1
parents:
diff changeset
7
Ritor1
parents:
diff changeset
8
Ritor1
parents:
diff changeset
9
Ritor1
parents:
diff changeset
10 #pragma pack(push, 1)
Ritor1
parents:
diff changeset
11 struct _PROVIDER {char unk_0;};
Ritor1
parents:
diff changeset
12 struct _SAMPLE {char unk_0;};
Ritor1
parents:
diff changeset
13 //struct _STREAM {char unk_0;};
Ritor1
parents:
diff changeset
14 struct _REDBOOK {char unk_0;};
Ritor1
parents:
diff changeset
15 struct _DIG_DRIVER {char unk_0;};
Ritor1
parents:
diff changeset
16 struct _SEQUENCE {char unk_0;};
Ritor1
parents:
diff changeset
17 #pragma pack(pop)
Ritor1
parents:
diff changeset
18
Ritor1
parents:
diff changeset
19
Ritor1
parents:
diff changeset
20
Ritor1
parents:
diff changeset
21 /* 22 */
Ritor1
parents:
diff changeset
22 #pragma pack(push, 1)
Ritor1
parents:
diff changeset
23 struct AudioPlayer_3DSample
Ritor1
parents:
diff changeset
24 {
Ritor1
parents:
diff changeset
25 inline AudioPlayer_3DSample()
Ritor1
parents:
diff changeset
26 {
Ritor1
parents:
diff changeset
27 hSample = 0;
Ritor1
parents:
diff changeset
28 field_4 = 0;
Ritor1
parents:
diff changeset
29 field_8 = 0;
Ritor1
parents:
diff changeset
30 field_C = 0;
Ritor1
parents:
diff changeset
31 }
Ritor1
parents:
diff changeset
32
Ritor1
parents:
diff changeset
33 void *hSample;
Ritor1
parents:
diff changeset
34 int field_4;
Ritor1
parents:
diff changeset
35 int field_8;
Ritor1
parents:
diff changeset
36 int field_C;
Ritor1
parents:
diff changeset
37 };
Ritor1
parents:
diff changeset
38 #pragma pack(pop)
Ritor1
parents:
diff changeset
39
Ritor1
parents:
diff changeset
40
Ritor1
parents:
diff changeset
41
Ritor1
parents:
diff changeset
42
Ritor1
parents:
diff changeset
43 /* 26 */
Ritor1
parents:
diff changeset
44 #pragma pack(push, 1)
Ritor1
parents:
diff changeset
45 struct SoundHeader
Ritor1
parents:
diff changeset
46 {
Ritor1
parents:
diff changeset
47 char pSoundName[40];
Ritor1
parents:
diff changeset
48 unsigned int uFileOffset;
Ritor1
parents:
diff changeset
49 unsigned int uCompressedSize;
Ritor1
parents:
diff changeset
50 unsigned int uDecompressedSize;
Ritor1
parents:
diff changeset
51 };
Ritor1
parents:
diff changeset
52 #pragma pack(pop)
Ritor1
parents:
diff changeset
53
Ritor1
parents:
diff changeset
54 /* 27 */
Ritor1
parents:
diff changeset
55 #pragma pack(push, 1)
Ritor1
parents:
diff changeset
56 struct MixerChannel
Ritor1
parents:
diff changeset
57 {
Ritor1
parents:
diff changeset
58 inline MixerChannel():
Ritor1
parents:
diff changeset
59 hSample(nullptr), dword_000004(0), uSourceTrackIdx(0), uSourceTrackID(0)
Ritor1
parents:
diff changeset
60 {}
Ritor1
parents:
diff changeset
61
Ritor1
parents:
diff changeset
62 _SAMPLE *hSample;
Ritor1
parents:
diff changeset
63 int dword_000004;
Ritor1
parents:
diff changeset
64 unsigned int uSourceTrackIdx;
Ritor1
parents:
diff changeset
65 unsigned int uSourceTrackID;
Ritor1
parents:
diff changeset
66 };
Ritor1
parents:
diff changeset
67 #pragma pack(pop)
Ritor1
parents:
diff changeset
68
Ritor1
parents:
diff changeset
69
Ritor1
parents:
diff changeset
70
Ritor1
parents:
diff changeset
71
Ritor1
parents:
diff changeset
72
Ritor1
parents:
diff changeset
73 /* 308 */
Ritor1
parents:
diff changeset
74 enum SoundID
Ritor1
parents:
diff changeset
75 {
Ritor1
parents:
diff changeset
76 SOUND_0 = 0,
Ritor1
parents:
diff changeset
77 SOUND_EnteringAHouse = 0x6,
Ritor1
parents:
diff changeset
78 SOUND_8 = 0x8,
Ritor1
parents:
diff changeset
79 SOUND_27 = 0x1B,
Ritor1
parents:
diff changeset
80 SOUND_Arcomage_LoseResources = 0x78,
Ritor1
parents:
diff changeset
81 SOUND_Arcomage_AddResources = 0x79,
Ritor1
parents:
diff changeset
82 SOUND_Arcomage_TowerWallDamage = 0x7A,
Ritor1
parents:
diff changeset
83 SOUND_Arcomage_DrawCard = 0x7B,
Ritor1
parents:
diff changeset
84 SOUND_Arcomage_ProductionDamage = 0x7D,
Ritor1
parents:
diff changeset
85 SOUND_Arcomage_ProductionUpgrade = 0x7E,
Ritor1
parents:
diff changeset
86 SOUND_Arcomage_127 = 0x7F,
Ritor1
parents:
diff changeset
87 SOUND_Arcomage_128 = 0x80,
Ritor1
parents:
diff changeset
88 SOUND_Arcomage_TowerUpgrade = 0x81,
Ritor1
parents:
diff changeset
89 SOUND_Arcomage_WallUpgrade = 0x84,
Ritor1
parents:
diff changeset
90 SOUND_GoldReceived = 0xC8,
Ritor1
parents:
diff changeset
91 SOUND_PlayerCantCastSpell = 0xD1,
Ritor1
parents:
diff changeset
92 SOUND_Bell = 0xD9,
Ritor1
parents:
diff changeset
93 SOUND_20001 = 0x4E21,
Ritor1
parents:
diff changeset
94 };
Ritor1
parents:
diff changeset
95
Ritor1
parents:
diff changeset
96
Ritor1
parents:
diff changeset
97 enum MusicID: unsigned __int32
Ritor1
parents:
diff changeset
98 {
Ritor1
parents:
diff changeset
99 MUSIC_Credits = 15
Ritor1
parents:
diff changeset
100 };
Ritor1
parents:
diff changeset
101
Ritor1
parents:
diff changeset
102 /* 20 */
Ritor1
parents:
diff changeset
103 #pragma pack(push, 1)
Ritor1
parents:
diff changeset
104 struct AudioPlayer
Ritor1
parents:
diff changeset
105 {
Ritor1
parents:
diff changeset
106 //----- (004A9669) --------------------------------------------------------
Ritor1
parents:
diff changeset
107 AudioPlayer():
Ritor1
parents:
diff changeset
108 bPlayerReady(false), b3DSoundInitialized(false),
Ritor1
parents:
diff changeset
109 hAILRedbook(nullptr), hStream(nullptr)
Ritor1
parents:
diff changeset
110 {
Ritor1
parents:
diff changeset
111 /*AudioPlayer_3DSample *v0; //ecx@1
Ritor1
parents:
diff changeset
112 signed int v1; //edi@1
Ritor1
parents:
diff changeset
113
Ritor1
parents:
diff changeset
114 v0 = p3DSamples;
Ritor1
parents:
diff changeset
115 v1 = 32;
Ritor1
parents:
diff changeset
116 do
Ritor1
parents:
diff changeset
117 {
Ritor1
parents:
diff changeset
118 v0->field_4 = 0;
Ritor1
parents:
diff changeset
119 v0->field_8 = 0;
Ritor1
parents:
diff changeset
120 v0->field_C = 0;
Ritor1
parents:
diff changeset
121 v0->hSample = 0;
Ritor1
parents:
diff changeset
122 ++v0;
Ritor1
parents:
diff changeset
123 --v1;
Ritor1
parents:
diff changeset
124 }
Ritor1
parents:
diff changeset
125 while (v1);*/
Ritor1
parents:
diff changeset
126 uMixerChannels = 16;
Ritor1
parents:
diff changeset
127 field_2D0_time_left = 256;
Ritor1
parents:
diff changeset
128 uNumRedbookTracks = 0;
Ritor1
parents:
diff changeset
129 uCurrentMusicTrackLength = 0;
Ritor1
parents:
diff changeset
130 field_2D4 = 0;
Ritor1
parents:
diff changeset
131 s3DSoundVolume = 127;
Ritor1
parents:
diff changeset
132 }
Ritor1
parents:
diff changeset
133
Ritor1
parents:
diff changeset
134 void SetMusicVolume(int vol);
Ritor1
parents:
diff changeset
135 void SetMasterVolume(unsigned int uVolume);
Ritor1
parents:
diff changeset
136 void _4AA258(int a2);
Ritor1
parents:
diff changeset
137 void PlaySound(SoundID eSoundID, signed int a3, unsigned int uNumRepeats, signed int a5, signed int a6, int a7, unsigned int uVolume, int sPlaybackRate);
Ritor1
parents:
diff changeset
138 void _4AAFCF();
Ritor1
parents:
diff changeset
139 void StopChannels(int uStartChannel, int uEndChannel);
Ritor1
parents:
diff changeset
140 void LoadAudioSnd();
Ritor1
parents:
diff changeset
141 void Initialize(HWND hWnd);
Ritor1
parents:
diff changeset
142 LSTATUS CheckA3DSupport(char a2);
Ritor1
parents:
diff changeset
143 void Release();
Ritor1
parents:
diff changeset
144 void _4ABE55(MixerChannel *pChannel);
Ritor1
parents:
diff changeset
145 void _4ABF23(AudioPlayer_3DSample *a2);
Ritor1
parents:
diff changeset
146 void SetEAXPreferences();
Ritor1
parents:
diff changeset
147 void SetMapEAX();
Ritor1
parents:
diff changeset
148 int _4AC0A2();
Ritor1
parents:
diff changeset
149 void PlayMusicTrack(enum MusicID eTrack);
Ritor1
parents:
diff changeset
150 void __cdecl MessWithChannels();
Ritor1
parents:
diff changeset
151
Ritor1
parents:
diff changeset
152
Ritor1
parents:
diff changeset
153 unsigned int bEAXSupported;
Ritor1
parents:
diff changeset
154 unsigned int b3DSoundInitialized;
Ritor1
parents:
diff changeset
155 int s3DSoundVolume;
Ritor1
parents:
diff changeset
156 struct _PROVIDER *h3DSoundProvider;
Ritor1
parents:
diff changeset
157 int uNum3DSamples;
Ritor1
parents:
diff changeset
158 struct AudioPlayer_3DSample p3DSamples[32];
Ritor1
parents:
diff changeset
159 int field_214;
Ritor1
parents:
diff changeset
160 int sRedbookVolume;
Ritor1
parents:
diff changeset
161 char p3DSoundProvider[128];
Ritor1
parents:
diff changeset
162 unsigned int bPlayerReady;
Ritor1
parents:
diff changeset
163 HWND hWindow;
Ritor1
parents:
diff changeset
164 struct _REDBOOK *hAILRedbook;
Ritor1
parents:
diff changeset
165 struct _DIG_DRIVER *hDigDriver;
Ritor1
parents:
diff changeset
166 int dword_0002AC;
Ritor1
parents:
diff changeset
167 struct _SEQUENCE *hSequence;
Ritor1
parents:
diff changeset
168 int dword_0002B4;
Ritor1
parents:
diff changeset
169 struct SoundHeader *pSoundHeaders;
Ritor1
parents:
diff changeset
170 HANDLE hAudioSnd;
Ritor1
parents:
diff changeset
171 unsigned int uNumSoundHeaders;
Ritor1
parents:
diff changeset
172 unsigned int uMasterVolume;
Ritor1
parents:
diff changeset
173 int dword_0002C8;
Ritor1
parents:
diff changeset
174 int dword_0002CC;
Ritor1
parents:
diff changeset
175 int field_2D0_time_left;
Ritor1
parents:
diff changeset
176 int field_2D4;
Ritor1
parents:
diff changeset
177 unsigned int uCurrentMusicTrackLength;
Ritor1
parents:
diff changeset
178 unsigned int uNumRedbookTracks;
Ritor1
parents:
diff changeset
179 unsigned int uCurrentMusicTrackStartMS;
Ritor1
parents:
diff changeset
180 unsigned int uCurrentMusicTrackEndMS;
Ritor1
parents:
diff changeset
181 struct MixerChannel pMixerChannels[16];
Ritor1
parents:
diff changeset
182 int uMixerChannels;
Ritor1
parents:
diff changeset
183 int field_3EC;
Ritor1
parents:
diff changeset
184 char pDeviceNames[16][128];
Ritor1
parents:
diff changeset
185 int array_000BF0[16];
Ritor1
parents:
diff changeset
186 int array_000C30[16];
Ritor1
parents:
diff changeset
187 unsigned int uNumDevices;
Ritor1
parents:
diff changeset
188 struct _STREAM *hStream;
Ritor1
parents:
diff changeset
189 char field_C78[8];
Ritor1
parents:
diff changeset
190 int cGameCDDriveLetter;
Ritor1
parents:
diff changeset
191 };
Ritor1
parents:
diff changeset
192 #pragma pack(pop)
Ritor1
parents:
diff changeset
193
Ritor1
parents:
diff changeset
194
Ritor1
parents:
diff changeset
195
Ritor1
parents:
diff changeset
196
Ritor1
parents:
diff changeset
197
Ritor1
parents:
diff changeset
198
Ritor1
parents:
diff changeset
199
Ritor1
parents:
diff changeset
200
Ritor1
parents:
diff changeset
201 /* 325 */
Ritor1
parents:
diff changeset
202 enum SOUND_DESC_TYPE : __int32
Ritor1
parents:
diff changeset
203 {
Ritor1
parents:
diff changeset
204 SOUND_DESC_LEVEL = 0x0,
Ritor1
parents:
diff changeset
205 SOUND_DESC_SYSTEM = 0x1,
Ritor1
parents:
diff changeset
206 SOUND_DESC_SWAP = 0x2,
Ritor1
parents:
diff changeset
207 SOUND_DESC_3 = 0x3,
Ritor1
parents:
diff changeset
208 SOUND_DESC_LOCK = 0x4,
Ritor1
parents:
diff changeset
209 };
Ritor1
parents:
diff changeset
210
Ritor1
parents:
diff changeset
211 /* 326 */
Ritor1
parents:
diff changeset
212 enum SOUND_DESC_FLAGS
Ritor1
parents:
diff changeset
213 {
Ritor1
parents:
diff changeset
214 SOUND_DESC_LOCKED = 0x1,
Ritor1
parents:
diff changeset
215 SOUND_DESC_3D = 0x2,
Ritor1
parents:
diff changeset
216 };
Ritor1
parents:
diff changeset
217
Ritor1
parents:
diff changeset
218
Ritor1
parents:
diff changeset
219
Ritor1
parents:
diff changeset
220
Ritor1
parents:
diff changeset
221 #pragma pack(push, 1)
Ritor1
parents:
diff changeset
222 struct SoundData
Ritor1
parents:
diff changeset
223 {
Ritor1
parents:
diff changeset
224 unsigned int uDataSize;
Ritor1
parents:
diff changeset
225 char pData[1];
Ritor1
parents:
diff changeset
226 };
Ritor1
parents:
diff changeset
227
Ritor1
parents:
diff changeset
228 struct SoundDesc
Ritor1
parents:
diff changeset
229 {
Ritor1
parents:
diff changeset
230 char pSoundName[32];
Ritor1
parents:
diff changeset
231 unsigned int uSoundID;
Ritor1
parents:
diff changeset
232 SOUND_DESC_TYPE eType;
Ritor1
parents:
diff changeset
233 int uFlags;
Ritor1
parents:
diff changeset
234 SoundData *pSoundData[17];
Ritor1
parents:
diff changeset
235 void *p3DSound;
Ritor1
parents:
diff changeset
236 int bDecompressed;
Ritor1
parents:
diff changeset
237 };
Ritor1
parents:
diff changeset
238 #pragma pack(pop)
Ritor1
parents:
diff changeset
239
Ritor1
parents:
diff changeset
240
Ritor1
parents:
diff changeset
241
Ritor1
parents:
diff changeset
242 #pragma pack(push, 1)
Ritor1
parents:
diff changeset
243 struct SoundList
Ritor1
parents:
diff changeset
244 {
Ritor1
parents:
diff changeset
245 inline SoundList():
Ritor1
parents:
diff changeset
246 uNumSounds(0), pSounds(nullptr), uTotalLoadedSoundSize(0)
Ritor1
parents:
diff changeset
247 {}
Ritor1
parents:
diff changeset
248
Ritor1
parents:
diff changeset
249 void Initialize();
Ritor1
parents:
diff changeset
250 __int16 LoadSound(int a1, unsigned int a3);
Ritor1
parents:
diff changeset
251 int LoadSound(unsigned int a2, LPVOID lpBuffer, int uBufferSizeLeft, int *pOutSoundSize, int a6);
Ritor1
parents:
diff changeset
252 SoundDesc *Release();
Ritor1
parents:
diff changeset
253 void _4A9D79(int a2);
Ritor1
parents:
diff changeset
254 void _4A9DCD(unsigned int uSoundID, char a3);
Ritor1
parents:
diff changeset
255 void ToFile();
Ritor1
parents:
diff changeset
256 void *FromFile(void *pSerialized);
Ritor1
parents:
diff changeset
257 int FromFileTxt(const char *Args);
Ritor1
parents:
diff changeset
258
Ritor1
parents:
diff changeset
259 unsigned int uNumSounds;
Ritor1
parents:
diff changeset
260 SoundDesc *pSounds;
Ritor1
parents:
diff changeset
261 unsigned int uTotalLoadedSoundSize;
Ritor1
parents:
diff changeset
262 };
Ritor1
parents:
diff changeset
263 #pragma pack(pop)
Ritor1
parents:
diff changeset
264
Ritor1
parents:
diff changeset
265
Ritor1
parents:
diff changeset
266
Ritor1
parents:
diff changeset
267
Ritor1
parents:
diff changeset
268
Ritor1
parents:
diff changeset
269 /* 241 */
Ritor1
parents:
diff changeset
270 #pragma pack(push, 1)
Ritor1
parents:
diff changeset
271 struct Sound
Ritor1
parents:
diff changeset
272 {
Ritor1
parents:
diff changeset
273 unsigned int uID;
24
352b15291822 18.01.13 (PlaySound work)
Ritor1
parents: 0
diff changeset
274 char SoundName[120];
0
Ritor1
parents:
diff changeset
275 SoundData *pSoundData;
Ritor1
parents:
diff changeset
276 };
Ritor1
parents:
diff changeset
277 #pragma pack(pop)
Ritor1
parents:
diff changeset
278
Ritor1
parents:
diff changeset
279
Ritor1
parents:
diff changeset
280
Ritor1
parents:
diff changeset
281
Ritor1
parents:
diff changeset
282 extern int Aureal3D_SplashScreen;
Ritor1
parents:
diff changeset
283 extern int Aureal3D_SplashAudio;
Ritor1
parents:
diff changeset
284 extern int uFindSound_BinSearch_ResultID; // weak
Ritor1
parents:
diff changeset
285 extern int uLastLoadedSoundID; // weak
Ritor1
parents:
diff changeset
286 extern int sLastTrackLengthMS;
Ritor1
parents:
diff changeset
287 extern Sound pSounds[3000];
Ritor1
parents:
diff changeset
288 extern AudioPlayer *pAudioPlayer;
Ritor1
parents:
diff changeset
289 extern SoundList *pSoundList;
Ritor1
parents:
diff changeset
290
Ritor1
parents:
diff changeset
291 extern unsigned __int8 uSoundVolumeMultiplier;
Ritor1
parents:
diff changeset
292 extern unsigned __int8 uVoicesVolumeMultiplier;
Ritor1
parents:
diff changeset
293 extern unsigned __int8 uMusicVolimeMultiplier;
Ritor1
parents:
diff changeset
294 extern int bWalkSound; // idb
Ritor1
parents:
diff changeset
295
Ritor1
parents:
diff changeset
296 extern float pSoundVolumeLevels[10]; // idb
Ritor1
parents:
diff changeset
297
Ritor1
parents:
diff changeset
298
Ritor1
parents:
diff changeset
299
Ritor1
parents:
diff changeset
300
Ritor1
parents:
diff changeset
301
Ritor1
parents:
diff changeset
302
Ritor1
parents:
diff changeset
303
Ritor1
parents:
diff changeset
304
Ritor1
parents:
diff changeset
305 /* 379 */
Ritor1
parents:
diff changeset
306 #pragma pack(push, 1)
Ritor1
parents:
diff changeset
307 struct stru339_spell_sound
Ritor1
parents:
diff changeset
308 {
Ritor1
parents:
diff changeset
309 int _494836(int uSoundID, int a6);
Ritor1
parents:
diff changeset
310
Ritor1
parents:
diff changeset
311 char pSounds[44744];
Ritor1
parents:
diff changeset
312 int field_AEC8[45];
Ritor1
parents:
diff changeset
313 int field_AF7C[18];
Ritor1
parents:
diff changeset
314 int field_AFC4;
Ritor1
parents:
diff changeset
315 int pSoundsSizes[2];
Ritor1
parents:
diff changeset
316 int pSoundsOffsets[2];
Ritor1
parents:
diff changeset
317 };
Ritor1
parents:
diff changeset
318 #pragma pack(pop)
Ritor1
parents:
diff changeset
319 extern stru339_spell_sound stru_A750F8[4];
Ritor1
parents:
diff changeset
320 extern stru339_spell_sound stru_AA1058[4];