XAudio2fx.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431
  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. #ifndef __XAUDIO2FX_INCLUDED__
  10. #define __XAUDIO2FX_INCLUDED__
  11. /**************************************************************************
  12. *
  13. * XAudio2 effect class IDs.
  14. *
  15. **************************************************************************/
  16. #include "comdecl.h" // For DEFINE_CLSID and DEFINE_IID
  17. // XAudio 2.0 (March 2008 SDK)
  18. //DEFINE_CLSID(AudioVolumeMeter, C0C56F46, 29B1, 44E9, 99, 39, A3, 2C, E8, 68, 67, E2);
  19. //DEFINE_CLSID(AudioVolumeMeter_Debug, C0C56F46, 29B1, 44E9, 99, 39, A3, 2C, E8, 68, 67, DB);
  20. //DEFINE_CLSID(AudioReverb, 6F6EA3A9, 2CF5, 41CF, 91, C1, 21, 70, B1, 54, 00, 63);
  21. //DEFINE_CLSID(AudioReverb_Debug, 6F6EA3A9, 2CF5, 41CF, 91, C1, 21, 70, B1, 54, 00, DB);
  22. // XAudio 2.1 (June 2008 SDK)
  23. //DEFINE_CLSID(AudioVolumeMeter, c1e3f122, a2ea, 442c, 85, 4f, 20, d9, 8f, 83, 57, a1);
  24. //DEFINE_CLSID(AudioVolumeMeter_Debug, 6d97a461, b02d, 48ae, b5, 43, 82, bc, 35, fd, fa, e2);
  25. //DEFINE_CLSID(AudioReverb, f4769300, b949, 4df9, b3, 33, 00, d3, 39, 32, e9, a6);
  26. //DEFINE_CLSID(AudioReverb_Debug, aea2cabc, 8c7c, 46aa, ba, 44, 0e, 6d, 75, 88, a1, f2);
  27. // XAudio 2.2 (August 2008 SDK)
  28. //DEFINE_CLSID(AudioVolumeMeter, f5ca7b34, 8055, 42c0, b8, 36, 21, 61, 29, eb, 7e, 30);
  29. //DEFINE_CLSID(AudioVolumeMeter_Debug, f796f5f7, 6059, 4a9f, 98, 2d, 61, ee, c2, ed, 67, ca);
  30. //DEFINE_CLSID(AudioReverb, 629cf0de, 3ecc, 41e7, 99, 26, f7, e4, 3e, eb, ec, 51);
  31. //DEFINE_CLSID(AudioReverb_Debug, 4aae4299, 3260, 46d4, 97, cc, 6c, c7, 60, c8, 53, 29);
  32. // XAudio 2.3 (November 2008 SDK)
  33. //DEFINE_CLSID(AudioVolumeMeter, e180344b, ac83, 4483, 95, 9e, 18, a5, c5, 6a, 5e, 19);
  34. //DEFINE_CLSID(AudioVolumeMeter_Debug, 922a0a56, 7d13, 40ae, a4, 81, 3c, 6c, 60, f1, 14, 01);
  35. //DEFINE_CLSID(AudioReverb, 9cab402c, 1d37, 44b4, 88, 6d, fa, 4f, 36, 17, 0a, 4c);
  36. //DEFINE_CLSID(AudioReverb_Debug, eadda998, 3be6, 4505, 84, be, ea, 06, 36, 5d, b9, 6b);
  37. // XAudio 2.4 (March 2009 SDK)
  38. //DEFINE_CLSID(AudioVolumeMeter, c7338b95, 52b8, 4542, aa, 79, 42, eb, 01, 6c, 8c, 1c);
  39. //DEFINE_CLSID(AudioVolumeMeter_Debug, 524bd872, 5c0b, 4217, bd, b8, 0a, 86, 81, 83, 0b, a5);
  40. //DEFINE_CLSID(AudioReverb, 8bb7778b, 645b, 4475, 9a, 73, 1d, e3, 17, 0b, d3, af);
  41. //DEFINE_CLSID(AudioReverb_Debug, da7738a2, cd0c, 4367, 9a, ac, d7, ea, d7, c6, 4f, 98);
  42. // XAudio 2.5 (March 2009 SDK)
  43. //DEFINE_CLSID(AudioVolumeMeter, 2139e6da, c341, 4774, 9a, c3, b4, e0, 26, 34, 7f, 64);
  44. //DEFINE_CLSID(AudioVolumeMeter_Debug, a5cc4e13, ca00, 416b, a6, ee, 49, fe, e7, b5, 43, d0);
  45. //DEFINE_CLSID(AudioReverb, d06df0d0, 8518, 441e, 82, 2f, 54, 51, d5, c5, 95, b8);
  46. //DEFINE_CLSID(AudioReverb_Debug, 613604ec, 304c, 45ec, a4, ed, 7a, 1c, 61, 2e, 9e, 72);
  47. // XAudio 2.6 (February 2010 SDK)
  48. //DEFINE_CLSID(AudioVolumeMeter, e48c5a3f, 93ef, 43bb, a0, 92, 2c, 7c, eb, 94, 6f, 27);
  49. //DEFINE_CLSID(AudioVolumeMeter_Debug, 9a9eaef7, a9e0, 4088, 9b, 1b, 9c, a0, 3a, 1a, ec, d4);
  50. //DEFINE_CLSID(AudioReverb, cecec95a, d894, 491a, be, e3, 5e, 10, 6f, b5, 9f, 2d);
  51. //DEFINE_CLSID(AudioReverb_Debug, 99a1c72e, 364c, 4c1b, 96, 23, fd, 5c, 8a, bd, 90, c7);
  52. // XAudio 2.7 (June 2010 SDK)
  53. DEFINE_CLSID(AudioVolumeMeter, cac1105f, 619b, 4d04, 83, 1a, 44, e1, cb, f1, 2d, 57);
  54. DEFINE_CLSID(AudioVolumeMeter_Debug, 2d9a0f9c, e67b, 4b24, ab, 44, 92, b3, e7, 70, c0, 20);
  55. DEFINE_CLSID(AudioReverb, 6a93130e, 1d53, 41d1, a9, cf, e7, 58, 80, 0b, b1, 79);
  56. DEFINE_CLSID(AudioReverb_Debug, c4f82dd4, cb4e, 4ce1, 8b, db, ee, 32, d4, 19, 82, 69);
  57. // Ignore the rest of this header if only the GUID definitions were requested
  58. #ifndef GUID_DEFS_ONLY
  59. #ifdef _XBOX
  60. #include <xobjbase.h> // Xbox COM declarations (IUnknown, etc)
  61. #else
  62. #include <objbase.h> // Windows COM declarations
  63. #endif
  64. #include <math.h> // For log10()
  65. // All structures defined in this file should use tight packing
  66. #pragma pack(push, 1)
  67. /**************************************************************************
  68. *
  69. * Effect creation functions. On Windows, these are just inline functions
  70. * that call CoCreateInstance and Initialize; the XAUDIO2FX_DEBUG flag can
  71. * be used to select the debug version of the effects. On Xbox, these map
  72. * to real functions included in xaudio2.lib, and the XAUDIO2FX_DEBUG flag
  73. * is ignored; the application must link with the debug library to use the
  74. * debug functionality.
  75. *
  76. **************************************************************************/
  77. // Use default values for some parameters if building C++ code
  78. #ifdef __cplusplus
  79. #define DEFAULT(x) =x
  80. #else
  81. #define DEFAULT(x)
  82. #endif
  83. #define XAUDIO2FX_DEBUG 1 // To select the debug version of an effect
  84. #ifdef _XBOX
  85. STDAPI CreateAudioVolumeMeter(__deref_out IUnknown** ppApo);
  86. STDAPI CreateAudioReverb(__deref_out IUnknown** ppApo);
  87. __inline HRESULT XAudio2CreateVolumeMeter(__deref_out IUnknown** ppApo, UINT32 /*Flags*/ DEFAULT(0))
  88. {
  89. return CreateAudioVolumeMeter(ppApo);
  90. }
  91. __inline HRESULT XAudio2CreateReverb(__deref_out IUnknown** ppApo, UINT32 /*Flags*/ DEFAULT(0))
  92. {
  93. return CreateAudioReverb(ppApo);
  94. }
  95. #else // Windows
  96. __inline HRESULT XAudio2CreateVolumeMeter(__deref_out IUnknown** ppApo, UINT32 Flags DEFAULT(0))
  97. {
  98. #ifdef __cplusplus
  99. return CoCreateInstance((Flags & XAUDIO2FX_DEBUG) ? __uuidof(AudioVolumeMeter_Debug)
  100. : __uuidof(AudioVolumeMeter),
  101. NULL, CLSCTX_INPROC_SERVER, __uuidof(IUnknown), (void**)ppApo);
  102. #else
  103. return CoCreateInstance((Flags & XAUDIO2FX_DEBUG) ? &CLSID_AudioVolumeMeter_Debug
  104. : &CLSID_AudioVolumeMeter,
  105. NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void**)ppApo);
  106. #endif
  107. }
  108. __inline HRESULT XAudio2CreateReverb(__deref_out IUnknown** ppApo, UINT32 Flags DEFAULT(0))
  109. {
  110. #ifdef __cplusplus
  111. return CoCreateInstance((Flags & XAUDIO2FX_DEBUG) ? __uuidof(AudioReverb_Debug)
  112. : __uuidof(AudioReverb),
  113. NULL, CLSCTX_INPROC_SERVER, __uuidof(IUnknown), (void**)ppApo);
  114. #else
  115. return CoCreateInstance((Flags & XAUDIO2FX_DEBUG) ? &CLSID_AudioReverb_Debug
  116. : &CLSID_AudioReverb,
  117. NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void**)ppApo);
  118. #endif
  119. }
  120. #endif // #ifdef _XBOX
  121. /**************************************************************************
  122. *
  123. * Volume meter parameters.
  124. * The volume meter supports FLOAT32 audio formats and must be used in-place.
  125. *
  126. **************************************************************************/
  127. // XAUDIO2FX_VOLUMEMETER_LEVELS: Receives results from GetEffectParameters().
  128. // The user is responsible for allocating pPeakLevels, pRMSLevels, and
  129. // initializing ChannelCount accordingly.
  130. // The volume meter does not support SetEffectParameters().
  131. typedef struct XAUDIO2FX_VOLUMEMETER_LEVELS
  132. {
  133. float* pPeakLevels; // Peak levels table: receives maximum absolute level for each channel
  134. // over a processing pass; may be NULL if pRMSLevls != NULL,
  135. // otherwise must have at least ChannelCount elements.
  136. float* pRMSLevels; // Root mean square levels table: receives RMS level for each channel
  137. // over a processing pass; may be NULL if pPeakLevels != NULL,
  138. // otherwise must have at least ChannelCount elements.
  139. UINT32 ChannelCount; // Number of channels being processed by the volume meter APO
  140. } XAUDIO2FX_VOLUMEMETER_LEVELS;
  141. /**************************************************************************
  142. *
  143. * Reverb parameters.
  144. * The reverb supports only FLOAT32 audio with the following channel
  145. * configurations:
  146. * Input: Mono Output: Mono
  147. * Input: Mono Output: 5.1
  148. * Input: Stereo Output: Stereo
  149. * Input: Stereo Output: 5.1
  150. * The framerate must be within [20000, 48000] Hz.
  151. *
  152. * When using mono input, delay filters associated with the right channel
  153. * are not executed. In this case, parameters such as PositionRight and
  154. * PositionMatrixRight have no effect. This also means the reverb uses
  155. * less CPU when hosted in a mono submix.
  156. *
  157. **************************************************************************/
  158. #define XAUDIO2FX_REVERB_MIN_FRAMERATE 20000
  159. #define XAUDIO2FX_REVERB_MAX_FRAMERATE 48000
  160. // XAUDIO2FX_REVERB_PARAMETERS: Native parameter set for the reverb effect
  161. typedef struct XAUDIO2FX_REVERB_PARAMETERS
  162. {
  163. // ratio of wet (processed) signal to dry (original) signal
  164. float WetDryMix; // [0, 100] (percentage)
  165. // Delay times
  166. UINT32 ReflectionsDelay; // [0, 300] in ms
  167. BYTE ReverbDelay; // [0, 85] in ms
  168. BYTE RearDelay; // [0, 5] in ms
  169. // Indexed parameters
  170. BYTE PositionLeft; // [0, 30] no units
  171. BYTE PositionRight; // [0, 30] no units, ignored when configured to mono
  172. BYTE PositionMatrixLeft; // [0, 30] no units
  173. BYTE PositionMatrixRight; // [0, 30] no units, ignored when configured to mono
  174. BYTE EarlyDiffusion; // [0, 15] no units
  175. BYTE LateDiffusion; // [0, 15] no units
  176. BYTE LowEQGain; // [0, 12] no units
  177. BYTE LowEQCutoff; // [0, 9] no units
  178. BYTE HighEQGain; // [0, 8] no units
  179. BYTE HighEQCutoff; // [0, 14] no units
  180. // Direct parameters
  181. float RoomFilterFreq; // [20, 20000] in Hz
  182. float RoomFilterMain; // [-100, 0] in dB
  183. float RoomFilterHF; // [-100, 0] in dB
  184. float ReflectionsGain; // [-100, 20] in dB
  185. float ReverbGain; // [-100, 20] in dB
  186. float DecayTime; // [0.1, inf] in seconds
  187. float Density; // [0, 100] (percentage)
  188. float RoomSize; // [1, 100] in feet
  189. } XAUDIO2FX_REVERB_PARAMETERS;
  190. // Maximum, minimum and default values for the parameters above
  191. #define XAUDIO2FX_REVERB_MIN_WET_DRY_MIX 0.0f
  192. #define XAUDIO2FX_REVERB_MIN_REFLECTIONS_DELAY 0
  193. #define XAUDIO2FX_REVERB_MIN_REVERB_DELAY 0
  194. #define XAUDIO2FX_REVERB_MIN_REAR_DELAY 0
  195. #define XAUDIO2FX_REVERB_MIN_POSITION 0
  196. #define XAUDIO2FX_REVERB_MIN_DIFFUSION 0
  197. #define XAUDIO2FX_REVERB_MIN_LOW_EQ_GAIN 0
  198. #define XAUDIO2FX_REVERB_MIN_LOW_EQ_CUTOFF 0
  199. #define XAUDIO2FX_REVERB_MIN_HIGH_EQ_GAIN 0
  200. #define XAUDIO2FX_REVERB_MIN_HIGH_EQ_CUTOFF 0
  201. #define XAUDIO2FX_REVERB_MIN_ROOM_FILTER_FREQ 20.0f
  202. #define XAUDIO2FX_REVERB_MIN_ROOM_FILTER_MAIN -100.0f
  203. #define XAUDIO2FX_REVERB_MIN_ROOM_FILTER_HF -100.0f
  204. #define XAUDIO2FX_REVERB_MIN_REFLECTIONS_GAIN -100.0f
  205. #define XAUDIO2FX_REVERB_MIN_REVERB_GAIN -100.0f
  206. #define XAUDIO2FX_REVERB_MIN_DECAY_TIME 0.1f
  207. #define XAUDIO2FX_REVERB_MIN_DENSITY 0.0f
  208. #define XAUDIO2FX_REVERB_MIN_ROOM_SIZE 0.0f
  209. #define XAUDIO2FX_REVERB_MAX_WET_DRY_MIX 100.0f
  210. #define XAUDIO2FX_REVERB_MAX_REFLECTIONS_DELAY 300
  211. #define XAUDIO2FX_REVERB_MAX_REVERB_DELAY 85
  212. #define XAUDIO2FX_REVERB_MAX_REAR_DELAY 5
  213. #define XAUDIO2FX_REVERB_MAX_POSITION 30
  214. #define XAUDIO2FX_REVERB_MAX_DIFFUSION 15
  215. #define XAUDIO2FX_REVERB_MAX_LOW_EQ_GAIN 12
  216. #define XAUDIO2FX_REVERB_MAX_LOW_EQ_CUTOFF 9
  217. #define XAUDIO2FX_REVERB_MAX_HIGH_EQ_GAIN 8
  218. #define XAUDIO2FX_REVERB_MAX_HIGH_EQ_CUTOFF 14
  219. #define XAUDIO2FX_REVERB_MAX_ROOM_FILTER_FREQ 20000.0f
  220. #define XAUDIO2FX_REVERB_MAX_ROOM_FILTER_MAIN 0.0f
  221. #define XAUDIO2FX_REVERB_MAX_ROOM_FILTER_HF 0.0f
  222. #define XAUDIO2FX_REVERB_MAX_REFLECTIONS_GAIN 20.0f
  223. #define XAUDIO2FX_REVERB_MAX_REVERB_GAIN 20.0f
  224. #define XAUDIO2FX_REVERB_MAX_DENSITY 100.0f
  225. #define XAUDIO2FX_REVERB_MAX_ROOM_SIZE 100.0f
  226. #define XAUDIO2FX_REVERB_DEFAULT_WET_DRY_MIX 100.0f
  227. #define XAUDIO2FX_REVERB_DEFAULT_REFLECTIONS_DELAY 5
  228. #define XAUDIO2FX_REVERB_DEFAULT_REVERB_DELAY 5
  229. #define XAUDIO2FX_REVERB_DEFAULT_REAR_DELAY 5
  230. #define XAUDIO2FX_REVERB_DEFAULT_POSITION 6
  231. #define XAUDIO2FX_REVERB_DEFAULT_POSITION_MATRIX 27
  232. #define XAUDIO2FX_REVERB_DEFAULT_EARLY_DIFFUSION 8
  233. #define XAUDIO2FX_REVERB_DEFAULT_LATE_DIFFUSION 8
  234. #define XAUDIO2FX_REVERB_DEFAULT_LOW_EQ_GAIN 8
  235. #define XAUDIO2FX_REVERB_DEFAULT_LOW_EQ_CUTOFF 4
  236. #define XAUDIO2FX_REVERB_DEFAULT_HIGH_EQ_GAIN 8
  237. #define XAUDIO2FX_REVERB_DEFAULT_HIGH_EQ_CUTOFF 4
  238. #define XAUDIO2FX_REVERB_DEFAULT_ROOM_FILTER_FREQ 5000.0f
  239. #define XAUDIO2FX_REVERB_DEFAULT_ROOM_FILTER_MAIN 0.0f
  240. #define XAUDIO2FX_REVERB_DEFAULT_ROOM_FILTER_HF 0.0f
  241. #define XAUDIO2FX_REVERB_DEFAULT_REFLECTIONS_GAIN 0.0f
  242. #define XAUDIO2FX_REVERB_DEFAULT_REVERB_GAIN 0.0f
  243. #define XAUDIO2FX_REVERB_DEFAULT_DECAY_TIME 1.0f
  244. #define XAUDIO2FX_REVERB_DEFAULT_DENSITY 100.0f
  245. #define XAUDIO2FX_REVERB_DEFAULT_ROOM_SIZE 100.0f
  246. // XAUDIO2FX_REVERB_I3DL2_PARAMETERS: Parameter set compliant with the I3DL2 standard
  247. typedef struct XAUDIO2FX_REVERB_I3DL2_PARAMETERS
  248. {
  249. // ratio of wet (processed) signal to dry (original) signal
  250. float WetDryMix; // [0, 100] (percentage)
  251. // Standard I3DL2 parameters
  252. INT32 Room; // [-10000, 0] in mB (hundredths of decibels)
  253. INT32 RoomHF; // [-10000, 0] in mB (hundredths of decibels)
  254. float RoomRolloffFactor; // [0.0, 10.0]
  255. float DecayTime; // [0.1, 20.0] in seconds
  256. float DecayHFRatio; // [0.1, 2.0]
  257. INT32 Reflections; // [-10000, 1000] in mB (hundredths of decibels)
  258. float ReflectionsDelay; // [0.0, 0.3] in seconds
  259. INT32 Reverb; // [-10000, 2000] in mB (hundredths of decibels)
  260. float ReverbDelay; // [0.0, 0.1] in seconds
  261. float Diffusion; // [0.0, 100.0] (percentage)
  262. float Density; // [0.0, 100.0] (percentage)
  263. float HFReference; // [20.0, 20000.0] in Hz
  264. } XAUDIO2FX_REVERB_I3DL2_PARAMETERS;
  265. // ReverbConvertI3DL2ToNative: Utility function to map from I3DL2 to native parameters
  266. __inline void ReverbConvertI3DL2ToNative
  267. (
  268. __in const XAUDIO2FX_REVERB_I3DL2_PARAMETERS* pI3DL2,
  269. __out XAUDIO2FX_REVERB_PARAMETERS* pNative
  270. )
  271. {
  272. float reflectionsDelay;
  273. float reverbDelay;
  274. // RoomRolloffFactor is ignored
  275. // These parameters have no equivalent in I3DL2
  276. pNative->RearDelay = XAUDIO2FX_REVERB_DEFAULT_REAR_DELAY; // 5
  277. pNative->PositionLeft = XAUDIO2FX_REVERB_DEFAULT_POSITION; // 6
  278. pNative->PositionRight = XAUDIO2FX_REVERB_DEFAULT_POSITION; // 6
  279. pNative->PositionMatrixLeft = XAUDIO2FX_REVERB_DEFAULT_POSITION_MATRIX; // 27
  280. pNative->PositionMatrixRight = XAUDIO2FX_REVERB_DEFAULT_POSITION_MATRIX; // 27
  281. pNative->RoomSize = XAUDIO2FX_REVERB_DEFAULT_ROOM_SIZE; // 100
  282. pNative->LowEQCutoff = 4;
  283. pNative->HighEQCutoff = 6;
  284. // The rest of the I3DL2 parameters map to the native property set
  285. pNative->RoomFilterMain = (float)pI3DL2->Room / 100.0f;
  286. pNative->RoomFilterHF = (float)pI3DL2->RoomHF / 100.0f;
  287. if (pI3DL2->DecayHFRatio >= 1.0f)
  288. {
  289. INT32 index = (INT32)(-4.0 * log10(pI3DL2->DecayHFRatio));
  290. if (index < -8) index = -8;
  291. pNative->LowEQGain = (BYTE)((index < 0) ? index + 8 : 8);
  292. pNative->HighEQGain = 8;
  293. pNative->DecayTime = pI3DL2->DecayTime * pI3DL2->DecayHFRatio;
  294. }
  295. else
  296. {
  297. INT32 index = (INT32)(4.0 * log10(pI3DL2->DecayHFRatio));
  298. if (index < -8) index = -8;
  299. pNative->LowEQGain = 8;
  300. pNative->HighEQGain = (BYTE)((index < 0) ? index + 8 : 8);
  301. pNative->DecayTime = pI3DL2->DecayTime;
  302. }
  303. reflectionsDelay = pI3DL2->ReflectionsDelay * 1000.0f;
  304. if (reflectionsDelay >= XAUDIO2FX_REVERB_MAX_REFLECTIONS_DELAY) // 300
  305. {
  306. reflectionsDelay = (float)(XAUDIO2FX_REVERB_MAX_REFLECTIONS_DELAY - 1);
  307. }
  308. else if (reflectionsDelay <= 1)
  309. {
  310. reflectionsDelay = 1;
  311. }
  312. pNative->ReflectionsDelay = (UINT32)reflectionsDelay;
  313. reverbDelay = pI3DL2->ReverbDelay * 1000.0f;
  314. if (reverbDelay >= XAUDIO2FX_REVERB_MAX_REVERB_DELAY) // 85
  315. {
  316. reverbDelay = (float)(XAUDIO2FX_REVERB_MAX_REVERB_DELAY - 1);
  317. }
  318. pNative->ReverbDelay = (BYTE)reverbDelay;
  319. pNative->ReflectionsGain = pI3DL2->Reflections / 100.0f;
  320. pNative->ReverbGain = pI3DL2->Reverb / 100.0f;
  321. pNative->EarlyDiffusion = (BYTE)(15.0f * pI3DL2->Diffusion / 100.0f);
  322. pNative->LateDiffusion = pNative->EarlyDiffusion;
  323. pNative->Density = pI3DL2->Density;
  324. pNative->RoomFilterFreq = pI3DL2->HFReference;
  325. pNative->WetDryMix = pI3DL2->WetDryMix;
  326. }
  327. /**************************************************************************
  328. *
  329. * Standard I3DL2 reverb presets (100% wet).
  330. *
  331. **************************************************************************/
  332. #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}
  333. #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}
  334. #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}
  335. #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}
  336. #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}
  337. #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}
  338. #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}
  339. #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}
  340. #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}
  341. #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}
  342. #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}
  343. #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}
  344. #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}
  345. #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}
  346. #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}
  347. #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}
  348. #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}
  349. #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}
  350. #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}
  351. #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}
  352. #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}
  353. #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}
  354. #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}
  355. #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}
  356. #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}
  357. #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}
  358. #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}
  359. #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}
  360. #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}
  361. #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}
  362. // Undo the #pragma pack(push, 1) at the top of this file
  363. #pragma pack(pop)
  364. #endif // #ifndef GUID_DEFS_ONLY
  365. #endif // #ifndef __XAUDIO2FX_INCLUDED__