Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1 | pmbaty | 1 | /************************************************************************** |
2 | * |
||
3 | * Copyright (c) Microsoft Corporation. All rights reserved. |
||
4 | * |
||
5 | * File: xaudio2fx.h |
||
6 | * Content: Declarations for the audio effects included with XAudio2. |
||
7 | * |
||
8 | **************************************************************************/ |
||
9 | |||
10 | #ifndef __XAUDIO2FX_INCLUDED__ |
||
11 | #define __XAUDIO2FX_INCLUDED__ |
||
12 | |||
13 | |||
14 | /************************************************************************** |
||
15 | * |
||
16 | * XAudio2 effect class IDs. |
||
17 | * |
||
18 | **************************************************************************/ |
||
19 | |||
20 | #include "comdecl.h" // For DEFINE_CLSID and DEFINE_IID |
||
21 | |||
22 | // XAudio 2.0 (March 2008 SDK) |
||
23 | //DEFINE_CLSID(AudioVolumeMeter, C0C56F46, 29B1, 44E9, 99, 39, A3, 2C, E8, 68, 67, E2); |
||
24 | //DEFINE_CLSID(AudioVolumeMeter_Debug, C0C56F46, 29B1, 44E9, 99, 39, A3, 2C, E8, 68, 67, DB); |
||
25 | //DEFINE_CLSID(AudioReverb, 6F6EA3A9, 2CF5, 41CF, 91, C1, 21, 70, B1, 54, 00, 63); |
||
26 | //DEFINE_CLSID(AudioReverb_Debug, 6F6EA3A9, 2CF5, 41CF, 91, C1, 21, 70, B1, 54, 00, DB); |
||
27 | |||
28 | // XAudio 2.1 (June 2008 SDK) |
||
29 | //DEFINE_CLSID(AudioVolumeMeter, c1e3f122, a2ea, 442c, 85, 4f, 20, d9, 8f, 83, 57, a1); |
||
30 | //DEFINE_CLSID(AudioVolumeMeter_Debug, 6d97a461, b02d, 48ae, b5, 43, 82, bc, 35, fd, fa, e2); |
||
31 | //DEFINE_CLSID(AudioReverb, f4769300, b949, 4df9, b3, 33, 00, d3, 39, 32, e9, a6); |
||
32 | //DEFINE_CLSID(AudioReverb_Debug, aea2cabc, 8c7c, 46aa, ba, 44, 0e, 6d, 75, 88, a1, f2); |
||
33 | |||
34 | // XAudio 2.2 (August 2008 SDK) |
||
35 | //DEFINE_CLSID(AudioVolumeMeter, f5ca7b34, 8055, 42c0, b8, 36, 21, 61, 29, eb, 7e, 30); |
||
36 | //DEFINE_CLSID(AudioVolumeMeter_Debug, f796f5f7, 6059, 4a9f, 98, 2d, 61, ee, c2, ed, 67, ca); |
||
37 | //DEFINE_CLSID(AudioReverb, 629cf0de, 3ecc, 41e7, 99, 26, f7, e4, 3e, eb, ec, 51); |
||
38 | //DEFINE_CLSID(AudioReverb_Debug, 4aae4299, 3260, 46d4, 97, cc, 6c, c7, 60, c8, 53, 29); |
||
39 | |||
40 | // XAudio 2.3 (November 2008 SDK) |
||
41 | //DEFINE_CLSID(AudioVolumeMeter, e180344b, ac83, 4483, 95, 9e, 18, a5, c5, 6a, 5e, 19); |
||
42 | //DEFINE_CLSID(AudioVolumeMeter_Debug, 922a0a56, 7d13, 40ae, a4, 81, 3c, 6c, 60, f1, 14, 01); |
||
43 | //DEFINE_CLSID(AudioReverb, 9cab402c, 1d37, 44b4, 88, 6d, fa, 4f, 36, 17, 0a, 4c); |
||
44 | //DEFINE_CLSID(AudioReverb_Debug, eadda998, 3be6, 4505, 84, be, ea, 06, 36, 5d, b9, 6b); |
||
45 | |||
46 | // XAudio 2.4 (March 2009 SDK) |
||
47 | //DEFINE_CLSID(AudioVolumeMeter, c7338b95, 52b8, 4542, aa, 79, 42, eb, 01, 6c, 8c, 1c); |
||
48 | //DEFINE_CLSID(AudioVolumeMeter_Debug, 524bd872, 5c0b, 4217, bd, b8, 0a, 86, 81, 83, 0b, a5); |
||
49 | //DEFINE_CLSID(AudioReverb, 8bb7778b, 645b, 4475, 9a, 73, 1d, e3, 17, 0b, d3, af); |
||
50 | //DEFINE_CLSID(AudioReverb_Debug, da7738a2, cd0c, 4367, 9a, ac, d7, ea, d7, c6, 4f, 98); |
||
51 | |||
52 | // XAudio 2.5 (March 2009 SDK) |
||
53 | DEFINE_CLSID(AudioVolumeMeter, 2139e6da, c341, 4774, 9a, c3, b4, e0, 26, 34, 7f, 64); |
||
54 | DEFINE_CLSID(AudioVolumeMeter_Debug, a5cc4e13, ca00, 416b, a6, ee, 49, fe, e7, b5, 43, d0); |
||
55 | DEFINE_CLSID(AudioReverb, d06df0d0, 8518, 441e, 82, 2f, 54, 51, d5, c5, 95, b8); |
||
56 | DEFINE_CLSID(AudioReverb_Debug, 613604ec, 304c, 45ec, a4, ed, 7a, 1c, 61, 2e, 9e, 72); |
||
57 | |||
58 | // Ignore the rest of this header if only the GUID definitions were requested |
||
59 | #ifndef GUID_DEFS_ONLY |
||
60 | |||
61 | #ifdef _XBOX |
||
62 | #include <xobjbase.h> // Xbox COM declarations (IUnknown, etc) |
||
63 | #else |
||
64 | #include <objbase.h> // Windows COM declarations |
||
65 | #endif |
||
66 | #include <math.h> // For log10() |
||
67 | |||
68 | |||
69 | // All structures defined in this file should use tight packing |
||
70 | #pragma pack(push, 1) |
||
71 | |||
72 | |||
73 | /************************************************************************** |
||
74 | * |
||
75 | * Effect creation functions. On Windows, these are just inline functions |
||
76 | * that call CoCreateInstance and Initialize; the XAUDIO2FX_DEBUG flag can |
||
77 | * be used to select the debug version of the effects. On Xbox, these map |
||
78 | * to real functions included in xaudio2.lib, and the XAUDIO2FX_DEBUG flag |
||
79 | * is ignored; the application must link with the debug library to use the |
||
80 | * debug functionality. |
||
81 | * |
||
82 | **************************************************************************/ |
||
83 | |||
84 | // Use default values for some parameters if building C++ code |
||
85 | #ifdef __cplusplus |
||
86 | #define DEFAULT(x) =x |
||
87 | #else |
||
88 | #define DEFAULT(x) |
||
89 | #endif |
||
90 | |||
91 | #define XAUDIO2FX_DEBUG 1 // To select the debug version of an effect |
||
92 | |||
93 | #ifdef _XBOX |
||
94 | |||
95 | STDAPI CreateAudioVolumeMeter(__deref_out IUnknown** ppApo); |
||
96 | STDAPI CreateAudioReverb(__deref_out IUnknown** ppApo); |
||
97 | |||
98 | __inline HRESULT XAudio2CreateVolumeMeter(__deref_out IUnknown** ppApo, UINT32 /*Flags*/ DEFAULT(0)) |
||
99 | { |
||
100 | return CreateAudioVolumeMeter(ppApo); |
||
101 | } |
||
102 | |||
103 | __inline HRESULT XAudio2CreateReverb(__deref_out IUnknown** ppApo, UINT32 /*Flags*/ DEFAULT(0)) |
||
104 | { |
||
105 | return CreateAudioReverb(ppApo); |
||
106 | } |
||
107 | |||
108 | #else // Windows |
||
109 | |||
110 | __inline HRESULT XAudio2CreateVolumeMeter(__deref_out IUnknown** ppApo, UINT32 Flags DEFAULT(0)) |
||
111 | { |
||
112 | #ifdef __cplusplus |
||
113 | return CoCreateInstance((Flags & XAUDIO2FX_DEBUG) ? __uuidof(AudioVolumeMeter_Debug) |
||
114 | : __uuidof(AudioVolumeMeter), |
||
115 | NULL, CLSCTX_INPROC_SERVER, __uuidof(IUnknown), (void**)ppApo); |
||
116 | #else |
||
117 | return CoCreateInstance((Flags & XAUDIO2FX_DEBUG) ? &CLSID_AudioVolumeMeter_Debug |
||
118 | : &CLSID_AudioVolumeMeter, |
||
119 | NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void**)ppApo); |
||
120 | #endif |
||
121 | } |
||
122 | |||
123 | __inline HRESULT XAudio2CreateReverb(__deref_out IUnknown** ppApo, UINT32 Flags DEFAULT(0)) |
||
124 | { |
||
125 | #ifdef __cplusplus |
||
126 | return CoCreateInstance((Flags & XAUDIO2FX_DEBUG) ? __uuidof(AudioReverb_Debug) |
||
127 | : __uuidof(AudioReverb), |
||
128 | NULL, CLSCTX_INPROC_SERVER, __uuidof(IUnknown), (void**)ppApo); |
||
129 | #else |
||
130 | return CoCreateInstance((Flags & XAUDIO2FX_DEBUG) ? &CLSID_AudioReverb_Debug |
||
131 | : &CLSID_AudioReverb, |
||
132 | NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void**)ppApo); |
||
133 | #endif |
||
134 | } |
||
135 | |||
136 | #endif // #ifdef _XBOX |
||
137 | |||
138 | |||
139 | |||
140 | /************************************************************************** |
||
141 | * |
||
142 | * Volume meter parameters. |
||
143 | * The volume meter supports FLOAT32 audio formats and must be used in-place. |
||
144 | * |
||
145 | **************************************************************************/ |
||
146 | |||
147 | // XAUDIO2FX_VOLUMEMETER_LEVELS: Receives results from GetEffectParameters(). |
||
148 | // The user is responsible for allocating pPeakLevels, pRMSLevels, and |
||
149 | // initializing ChannelCount accordingly. |
||
150 | // The volume meter does not support SetEffectParameters(). |
||
151 | typedef struct XAUDIO2FX_VOLUMEMETER_LEVELS |
||
152 | { |
||
153 | float* pPeakLevels; // Peak levels table: receives maximum absolute level for each channel |
||
154 | // over a processing pass; may be NULL if pRMSLevls != NULL, |
||
155 | // otherwise must have at least ChannelCount elements. |
||
156 | float* pRMSLevels; // Root mean square levels table: receives RMS level for each channel |
||
157 | // over a processing pass; may be NULL if pPeakLevels != NULL, |
||
158 | // otherwise must have at least ChannelCount elements. |
||
159 | UINT32 ChannelCount; // Number of channels being processed by the volume meter APO |
||
160 | } XAUDIO2FX_VOLUMEMETER_LEVELS; |
||
161 | |||
162 | |||
163 | |||
164 | /************************************************************************** |
||
165 | * |
||
166 | * Reverb parameters. |
||
167 | * The reverb supports only FLOAT32 audio with the following channel |
||
168 | * configurations: |
||
169 | * Input: Mono Output: Mono |
||
170 | * Input: Stereo Output: Stereo |
||
171 | * Input: Stereo Output: 5.1 |
||
172 | * The framerate must be within [20000, 48000] Hz. |
||
173 | * |
||
174 | * When configured to mono, delay filters associated with the right channel |
||
175 | * are not executed. In this case, parameters such as PositionRight and |
||
176 | * PositionMatrixRight have no effect. This also means the reverb uses |
||
177 | * less CPU when configured to mono. |
||
178 | * |
||
179 | **************************************************************************/ |
||
180 | |||
181 | #define XAUDIO2FX_REVERB_MIN_FRAMERATE 20000 |
||
182 | #define XAUDIO2FX_REVERB_MAX_FRAMERATE 48000 |
||
183 | |||
184 | // XAUDIO2FX_REVERB_PARAMETERS: Native parameter set for the reverb effect |
||
185 | |||
186 | typedef struct XAUDIO2FX_REVERB_PARAMETERS |
||
187 | { |
||
188 | // ratio of wet (processed) signal to dry (original) signal |
||
189 | float WetDryMix; // [0, 100] (percentage) |
||
190 | |||
191 | // Delay times |
||
192 | UINT32 ReflectionsDelay; // [0, 300] in ms |
||
193 | BYTE ReverbDelay; // [0, 85] in ms |
||
194 | BYTE RearDelay; // [0, 5] in ms |
||
195 | |||
196 | // Indexed parameters |
||
197 | BYTE PositionLeft; // [0, 30] no units |
||
198 | BYTE PositionRight; // [0, 30] no units, ignored when configured to mono |
||
199 | BYTE PositionMatrixLeft; // [0, 30] no units |
||
200 | BYTE PositionMatrixRight; // [0, 30] no units, ignored when configured to mono |
||
201 | BYTE EarlyDiffusion; // [0, 15] no units |
||
202 | BYTE LateDiffusion; // [0, 15] no units |
||
203 | BYTE LowEQGain; // [0, 12] no units |
||
204 | BYTE LowEQCutoff; // [0, 9] no units |
||
205 | BYTE HighEQGain; // [0, 8] no units |
||
206 | BYTE HighEQCutoff; // [0, 14] no units |
||
207 | |||
208 | // Direct parameters |
||
209 | float RoomFilterFreq; // [20, 20000] in Hz |
||
210 | float RoomFilterMain; // [-100, 0] in dB |
||
211 | float RoomFilterHF; // [-100, 0] in dB |
||
212 | float ReflectionsGain; // [-100, 20] in dB |
||
213 | float ReverbGain; // [-100, 20] in dB |
||
214 | float DecayTime; // [0.1, inf] in seconds |
||
215 | float Density; // [0, 100] (percentage) |
||
216 | float RoomSize; // [1, 100] in feet |
||
217 | } XAUDIO2FX_REVERB_PARAMETERS; |
||
218 | |||
219 | |||
220 | // Maximum, minimum and default values for the parameters above |
||
221 | #define XAUDIO2FX_REVERB_MIN_WET_DRY_MIX 0.0f |
||
222 | #define XAUDIO2FX_REVERB_MIN_REFLECTIONS_DELAY 0 |
||
223 | #define XAUDIO2FX_REVERB_MIN_REVERB_DELAY 0 |
||
224 | #define XAUDIO2FX_REVERB_MIN_REAR_DELAY 0 |
||
225 | #define XAUDIO2FX_REVERB_MIN_POSITION 0 |
||
226 | #define XAUDIO2FX_REVERB_MIN_DIFFUSION 0 |
||
227 | #define XAUDIO2FX_REVERB_MIN_LOW_EQ_GAIN 0 |
||
228 | #define XAUDIO2FX_REVERB_MIN_LOW_EQ_CUTOFF 0 |
||
229 | #define XAUDIO2FX_REVERB_MIN_HIGH_EQ_GAIN 0 |
||
230 | #define XAUDIO2FX_REVERB_MIN_HIGH_EQ_CUTOFF 0 |
||
231 | #define XAUDIO2FX_REVERB_MIN_ROOM_FILTER_FREQ 20.0f |
||
232 | #define XAUDIO2FX_REVERB_MIN_ROOM_FILTER_MAIN -100.0f |
||
233 | #define XAUDIO2FX_REVERB_MIN_ROOM_FILTER_HF -100.0f |
||
234 | #define XAUDIO2FX_REVERB_MIN_REFLECTIONS_GAIN -100.0f |
||
235 | #define XAUDIO2FX_REVERB_MIN_REVERB_GAIN -100.0f |
||
236 | #define XAUDIO2FX_REVERB_MIN_DECAY_TIME 0.1f |
||
237 | #define XAUDIO2FX_REVERB_MIN_DENSITY 0.0f |
||
238 | #define XAUDIO2FX_REVERB_MIN_ROOM_SIZE 0.0f |
||
239 | |||
240 | #define XAUDIO2FX_REVERB_MAX_WET_DRY_MIX 100.0f |
||
241 | #define XAUDIO2FX_REVERB_MAX_REFLECTIONS_DELAY 300 |
||
242 | #define XAUDIO2FX_REVERB_MAX_REVERB_DELAY 85 |
||
243 | #define XAUDIO2FX_REVERB_MAX_REAR_DELAY 5 |
||
244 | #define XAUDIO2FX_REVERB_MAX_POSITION 30 |
||
245 | #define XAUDIO2FX_REVERB_MAX_DIFFUSION 15 |
||
246 | #define XAUDIO2FX_REVERB_MAX_LOW_EQ_GAIN 12 |
||
247 | #define XAUDIO2FX_REVERB_MAX_LOW_EQ_CUTOFF 9 |
||
248 | #define XAUDIO2FX_REVERB_MAX_HIGH_EQ_GAIN 8 |
||
249 | #define XAUDIO2FX_REVERB_MAX_HIGH_EQ_CUTOFF 14 |
||
250 | #define XAUDIO2FX_REVERB_MAX_ROOM_FILTER_FREQ 20000.0f |
||
251 | #define XAUDIO2FX_REVERB_MAX_ROOM_FILTER_MAIN 0.0f |
||
252 | #define XAUDIO2FX_REVERB_MAX_ROOM_FILTER_HF 0.0f |
||
253 | #define XAUDIO2FX_REVERB_MAX_REFLECTIONS_GAIN 20.0f |
||
254 | #define XAUDIO2FX_REVERB_MAX_REVERB_GAIN 20.0f |
||
255 | #define XAUDIO2FX_REVERB_MAX_DENSITY 100.0f |
||
256 | #define XAUDIO2FX_REVERB_MAX_ROOM_SIZE 100.0f |
||
257 | |||
258 | #define XAUDIO2FX_REVERB_DEFAULT_WET_DRY_MIX 100.0f |
||
259 | #define XAUDIO2FX_REVERB_DEFAULT_REFLECTIONS_DELAY 5 |
||
260 | #define XAUDIO2FX_REVERB_DEFAULT_REVERB_DELAY 5 |
||
261 | #define XAUDIO2FX_REVERB_DEFAULT_REAR_DELAY 5 |
||
262 | #define XAUDIO2FX_REVERB_DEFAULT_POSITION 6 |
||
263 | #define XAUDIO2FX_REVERB_DEFAULT_POSITION_MATRIX 27 |
||
264 | #define XAUDIO2FX_REVERB_DEFAULT_EARLY_DIFFUSION 8 |
||
265 | #define XAUDIO2FX_REVERB_DEFAULT_LATE_DIFFUSION 8 |
||
266 | #define XAUDIO2FX_REVERB_DEFAULT_LOW_EQ_GAIN 8 |
||
267 | #define XAUDIO2FX_REVERB_DEFAULT_LOW_EQ_CUTOFF 4 |
||
268 | #define XAUDIO2FX_REVERB_DEFAULT_HIGH_EQ_GAIN 8 |
||
269 | #define XAUDIO2FX_REVERB_DEFAULT_HIGH_EQ_CUTOFF 4 |
||
270 | #define XAUDIO2FX_REVERB_DEFAULT_ROOM_FILTER_FREQ 5000.0f |
||
271 | #define XAUDIO2FX_REVERB_DEFAULT_ROOM_FILTER_MAIN 0.0f |
||
272 | #define XAUDIO2FX_REVERB_DEFAULT_ROOM_FILTER_HF 0.0f |
||
273 | #define XAUDIO2FX_REVERB_DEFAULT_REFLECTIONS_GAIN 0.0f |
||
274 | #define XAUDIO2FX_REVERB_DEFAULT_REVERB_GAIN 0.0f |
||
275 | #define XAUDIO2FX_REVERB_DEFAULT_DECAY_TIME 1.0f |
||
276 | #define XAUDIO2FX_REVERB_DEFAULT_DENSITY 100.0f |
||
277 | #define XAUDIO2FX_REVERB_DEFAULT_ROOM_SIZE 100.0f |
||
278 | |||
279 | |||
280 | // XAUDIO2FX_REVERB_I3DL2_PARAMETERS: Parameter set compliant with the I3DL2 standard |
||
281 | |||
282 | typedef struct XAUDIO2FX_REVERB_I3DL2_PARAMETERS |
||
283 | { |
||
284 | // ratio of wet (processed) signal to dry (original) signal |
||
285 | float WetDryMix; // [0, 100] (percentage) |
||
286 | |||
287 | // Standard I3DL2 parameters |
||
288 | INT32 Room; // [-10000, 0] in mB (hundredths of decibels) |
||
289 | INT32 RoomHF; // [-10000, 0] in mB (hundredths of decibels) |
||
290 | float RoomRolloffFactor; // [0.0, 10.0] |
||
291 | float DecayTime; // [0.1, 20.0] in seconds |
||
292 | float DecayHFRatio; // [0.1, 2.0] |
||
293 | INT32 Reflections; // [-10000, 1000] in mB (hundredths of decibels) |
||
294 | float ReflectionsDelay; // [0.0, 0.3] in seconds |
||
295 | INT32 Reverb; // [-10000, 2000] in mB (hundredths of decibels) |
||
296 | float ReverbDelay; // [0.0, 0.1] in seconds |
||
297 | float Diffusion; // [0.0, 100.0] (percentage) |
||
298 | float Density; // [0.0, 100.0] (percentage) |
||
299 | float HFReference; // [20.0, 20000.0] in Hz |
||
300 | } XAUDIO2FX_REVERB_I3DL2_PARAMETERS; |
||
301 | |||
302 | |||
303 | // ReverbConvertI3DL2ToNative: Utility function to map from I3DL2 to native parameters |
||
304 | |||
305 | __inline void ReverbConvertI3DL2ToNative |
||
306 | ( |
||
307 | __in const XAUDIO2FX_REVERB_I3DL2_PARAMETERS* pI3DL2, |
||
308 | __out XAUDIO2FX_REVERB_PARAMETERS* pNative |
||
309 | ) |
||
310 | { |
||
311 | float reflectionsDelay; |
||
312 | float reverbDelay; |
||
313 | |||
314 | // RoomRolloffFactor is ignored |
||
315 | |||
316 | // These parameters have no equivalent in I3DL2 |
||
317 | pNative->RearDelay = XAUDIO2FX_REVERB_DEFAULT_REAR_DELAY; // 5 |
||
318 | pNative->PositionLeft = XAUDIO2FX_REVERB_DEFAULT_POSITION; // 6 |
||
319 | pNative->PositionRight = XAUDIO2FX_REVERB_DEFAULT_POSITION; // 6 |
||
320 | pNative->PositionMatrixLeft = XAUDIO2FX_REVERB_DEFAULT_POSITION_MATRIX; // 27 |
||
321 | pNative->PositionMatrixRight = XAUDIO2FX_REVERB_DEFAULT_POSITION_MATRIX; // 27 |
||
322 | pNative->RoomSize = XAUDIO2FX_REVERB_DEFAULT_ROOM_SIZE; // 100 |
||
323 | pNative->LowEQCutoff = 4; |
||
324 | pNative->HighEQCutoff = 6; |
||
325 | |||
326 | // The rest of the I3DL2 parameters map to the native property set |
||
327 | pNative->RoomFilterMain = (float)pI3DL2->Room / 100.0f; |
||
328 | pNative->RoomFilterHF = (float)pI3DL2->RoomHF / 100.0f; |
||
329 | |||
330 | if (pI3DL2->DecayHFRatio >= 1.0f) |
||
331 | { |
||
332 | INT32 index = (INT32)(-4.0 * log10(pI3DL2->DecayHFRatio)); |
||
333 | if (index < -8) index = -8; |
||
334 | pNative->LowEQGain = (BYTE)((index < 0) ? index + 8 : 8); |
||
335 | pNative->HighEQGain = 8; |
||
336 | pNative->DecayTime = pI3DL2->DecayTime * pI3DL2->DecayHFRatio; |
||
337 | } |
||
338 | else |
||
339 | { |
||
340 | INT32 index = (INT32)(4.0 * log10(pI3DL2->DecayHFRatio)); |
||
341 | if (index < -8) index = -8; |
||
342 | pNative->LowEQGain = 8; |
||
343 | pNative->HighEQGain = (BYTE)((index < 0) ? index + 8 : 8); |
||
344 | pNative->DecayTime = pI3DL2->DecayTime; |
||
345 | } |
||
346 | |||
347 | reflectionsDelay = pI3DL2->ReflectionsDelay * 1000.0f; |
||
348 | if (reflectionsDelay >= XAUDIO2FX_REVERB_MAX_REFLECTIONS_DELAY) // 300 |
||
349 | { |
||
350 | reflectionsDelay = (float)(XAUDIO2FX_REVERB_MAX_REFLECTIONS_DELAY - 1); |
||
351 | } |
||
352 | else if (reflectionsDelay <= 1) |
||
353 | { |
||
354 | reflectionsDelay = 1; |
||
355 | } |
||
356 | pNative->ReflectionsDelay = (UINT32)reflectionsDelay; |
||
357 | |||
358 | reverbDelay = pI3DL2->ReverbDelay * 1000.0f; |
||
359 | if (reverbDelay >= XAUDIO2FX_REVERB_MAX_REVERB_DELAY) // 85 |
||
360 | { |
||
361 | reverbDelay = (float)(XAUDIO2FX_REVERB_MAX_REVERB_DELAY - 1); |
||
362 | } |
||
363 | pNative->ReverbDelay = (BYTE)reverbDelay; |
||
364 | |||
365 | pNative->ReflectionsGain = pI3DL2->Reflections / 100.0f; |
||
366 | pNative->ReverbGain = pI3DL2->Reverb / 100.0f; |
||
367 | pNative->EarlyDiffusion = (BYTE)(15.0f * pI3DL2->Diffusion / 100.0f); |
||
368 | pNative->LateDiffusion = pNative->EarlyDiffusion; |
||
369 | pNative->Density = pI3DL2->Density; |
||
370 | pNative->RoomFilterFreq = pI3DL2->HFReference; |
||
371 | |||
372 | pNative->WetDryMix = pI3DL2->WetDryMix; |
||
373 | } |
||
374 | |||
375 | |||
376 | /************************************************************************** |
||
377 | * |
||
378 | * Standard I3DL2 reverb presets (100% wet). |
||
379 | * |
||
380 | **************************************************************************/ |
||
381 | |||
382 | #define XAUDIO2FX_I3DL2_PRESET_DEFAULT {100,-10000, 0,0.0f, 1.00f,0.50f,-10000,0.020f,-10000,0.040f,100.0f,100.0f,5000.0f} |
||
383 | #define XAUDIO2FX_I3DL2_PRESET_GENERIC {100, -1000, -100,0.0f, 1.49f,0.83f, -2602,0.007f, 200,0.011f,100.0f,100.0f,5000.0f} |
||
384 | #define XAUDIO2FX_I3DL2_PRESET_PADDEDCELL {100, -1000,-6000,0.0f, 0.17f,0.10f, -1204,0.001f, 207,0.002f,100.0f,100.0f,5000.0f} |
||
385 | #define XAUDIO2FX_I3DL2_PRESET_ROOM {100, -1000, -454,0.0f, 0.40f,0.83f, -1646,0.002f, 53,0.003f,100.0f,100.0f,5000.0f} |
||
386 | #define XAUDIO2FX_I3DL2_PRESET_BATHROOM {100, -1000,-1200,0.0f, 1.49f,0.54f, -370,0.007f, 1030,0.011f,100.0f, 60.0f,5000.0f} |
||
387 | #define XAUDIO2FX_I3DL2_PRESET_LIVINGROOM {100, -1000,-6000,0.0f, 0.50f,0.10f, -1376,0.003f, -1104,0.004f,100.0f,100.0f,5000.0f} |
||
388 | #define XAUDIO2FX_I3DL2_PRESET_STONEROOM {100, -1000, -300,0.0f, 2.31f,0.64f, -711,0.012f, 83,0.017f,100.0f,100.0f,5000.0f} |
||
389 | #define XAUDIO2FX_I3DL2_PRESET_AUDITORIUM {100, -1000, -476,0.0f, 4.32f,0.59f, -789,0.020f, -289,0.030f,100.0f,100.0f,5000.0f} |
||
390 | #define XAUDIO2FX_I3DL2_PRESET_CONCERTHALL {100, -1000, -500,0.0f, 3.92f,0.70f, -1230,0.020f, -2,0.029f,100.0f,100.0f,5000.0f} |
||
391 | #define XAUDIO2FX_I3DL2_PRESET_CAVE {100, -1000, 0,0.0f, 2.91f,1.30f, -602,0.015f, -302,0.022f,100.0f,100.0f,5000.0f} |
||
392 | #define XAUDIO2FX_I3DL2_PRESET_ARENA {100, -1000, -698,0.0f, 7.24f,0.33f, -1166,0.020f, 16,0.030f,100.0f,100.0f,5000.0f} |
||
393 | #define XAUDIO2FX_I3DL2_PRESET_HANGAR {100, -1000,-1000,0.0f,10.05f,0.23f, -602,0.020f, 198,0.030f,100.0f,100.0f,5000.0f} |
||
394 | #define XAUDIO2FX_I3DL2_PRESET_CARPETEDHALLWAY {100, -1000,-4000,0.0f, 0.30f,0.10f, -1831,0.002f, -1630,0.030f,100.0f,100.0f,5000.0f} |
||
395 | #define XAUDIO2FX_I3DL2_PRESET_HALLWAY {100, -1000, -300,0.0f, 1.49f,0.59f, -1219,0.007f, 441,0.011f,100.0f,100.0f,5000.0f} |
||
396 | #define XAUDIO2FX_I3DL2_PRESET_STONECORRIDOR {100, -1000, -237,0.0f, 2.70f,0.79f, -1214,0.013f, 395,0.020f,100.0f,100.0f,5000.0f} |
||
397 | #define XAUDIO2FX_I3DL2_PRESET_ALLEY {100, -1000, -270,0.0f, 1.49f,0.86f, -1204,0.007f, -4,0.011f,100.0f,100.0f,5000.0f} |
||
398 | #define XAUDIO2FX_I3DL2_PRESET_FOREST {100, -1000,-3300,0.0f, 1.49f,0.54f, -2560,0.162f, -613,0.088f, 79.0f,100.0f,5000.0f} |
||
399 | #define XAUDIO2FX_I3DL2_PRESET_CITY {100, -1000, -800,0.0f, 1.49f,0.67f, -2273,0.007f, -2217,0.011f, 50.0f,100.0f,5000.0f} |
||
400 | #define XAUDIO2FX_I3DL2_PRESET_MOUNTAINS {100, -1000,-2500,0.0f, 1.49f,0.21f, -2780,0.300f, -2014,0.100f, 27.0f,100.0f,5000.0f} |
||
401 | #define XAUDIO2FX_I3DL2_PRESET_QUARRY {100, -1000,-1000,0.0f, 1.49f,0.83f,-10000,0.061f, 500,0.025f,100.0f,100.0f,5000.0f} |
||
402 | #define XAUDIO2FX_I3DL2_PRESET_PLAIN {100, -1000,-2000,0.0f, 1.49f,0.50f, -2466,0.179f, -2514,0.100f, 21.0f,100.0f,5000.0f} |
||
403 | #define XAUDIO2FX_I3DL2_PRESET_PARKINGLOT {100, -1000, 0,0.0f, 1.65f,1.50f, -1363,0.008f, -1153,0.012f,100.0f,100.0f,5000.0f} |
||
404 | #define XAUDIO2FX_I3DL2_PRESET_SEWERPIPE {100, -1000,-1000,0.0f, 2.81f,0.14f, 429,0.014f, 648,0.021f, 80.0f, 60.0f,5000.0f} |
||
405 | #define XAUDIO2FX_I3DL2_PRESET_UNDERWATER {100, -1000,-4000,0.0f, 1.49f,0.10f, -449,0.007f, 1700,0.011f,100.0f,100.0f,5000.0f} |
||
406 | #define XAUDIO2FX_I3DL2_PRESET_SMALLROOM {100, -1000, -600,0.0f, 1.10f,0.83f, -400,0.005f, 500,0.010f,100.0f,100.0f,5000.0f} |
||
407 | #define XAUDIO2FX_I3DL2_PRESET_MEDIUMROOM {100, -1000, -600,0.0f, 1.30f,0.83f, -1000,0.010f, -200,0.020f,100.0f,100.0f,5000.0f} |
||
408 | #define XAUDIO2FX_I3DL2_PRESET_LARGEROOM {100, -1000, -600,0.0f, 1.50f,0.83f, -1600,0.020f, -1000,0.040f,100.0f,100.0f,5000.0f} |
||
409 | #define XAUDIO2FX_I3DL2_PRESET_MEDIUMHALL {100, -1000, -600,0.0f, 1.80f,0.70f, -1300,0.015f, -800,0.030f,100.0f,100.0f,5000.0f} |
||
410 | #define XAUDIO2FX_I3DL2_PRESET_LARGEHALL {100, -1000, -600,0.0f, 1.80f,0.70f, -2000,0.030f, -1400,0.060f,100.0f,100.0f,5000.0f} |
||
411 | #define XAUDIO2FX_I3DL2_PRESET_PLATE {100, -1000, -200,0.0f, 1.30f,0.90f, 0,0.002f, 0,0.010f,100.0f, 75.0f,5000.0f} |
||
412 | |||
413 | |||
414 | // Undo the #pragma pack(push, 1) at the top of this file |
||
415 | #pragma pack(pop) |
||
416 | |||
417 | #endif // #ifndef GUID_DEFS_ONLY |
||
418 | #endif // #ifndef __XAUDIO2FX_INCLUDED__ |