eax.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412
  1. /******************************************************************
  2. *
  3. * EAX.H - DirectSound3D Environmental Audio Extensions version 2.0
  4. * Updated July 8, 1999
  5. *
  6. *******************************************************************
  7. */
  8. #ifndef EAX_H_INCLUDED
  9. #define EAX_H_INCLUDED
  10. #include <dsound.h>
  11. #ifdef __cplusplus
  12. extern "C" {
  13. #endif // __cplusplus
  14. #pragma pack(push, 4)
  15. /*
  16. * EAX Wrapper Interface {4FF53B81-1CE0-11d3-AAB8-00A0C95949D5}
  17. */
  18. DEFINE_GUID(CLSID_EAXDirectSound,
  19. 0x4ff53b81,
  20. 0x1ce0,
  21. 0x11d3,
  22. 0xaa, 0xb8, 0x0, 0xa0, 0xc9, 0x59, 0x49, 0xd5);
  23. __declspec(dllimport) HRESULT WINAPI EAXDirectSoundCreate(GUID*, LPDIRECTSOUND*, IUnknown FAR *);
  24. typedef HRESULT (FAR PASCAL *LPEAXDIRECTSOUNDCREATE)(GUID*, LPDIRECTSOUND*, IUnknown FAR*);
  25. /*
  26. * EAX 2.0 listener property set {0306A6A8-B224-11d2-99E5-0000E8D8C722}
  27. */
  28. DEFINE_GUID(DSPROPSETID_EAX20_ListenerProperties,
  29. 0x306a6a8,
  30. 0xb224,
  31. 0x11d2,
  32. 0x99, 0xe5, 0x0, 0x0, 0xe8, 0xd8, 0xc7, 0x22);
  33. // For compatibility with future EAX versions:
  34. #define DSPROPSETID_EAX_ListenerProperties DSPROPSETID_EAX20_ListenerProperties
  35. typedef enum
  36. {
  37. DSPROPERTY_EAXLISTENER_NONE,
  38. DSPROPERTY_EAXLISTENER_ALLPARAMETERS,
  39. DSPROPERTY_EAXLISTENER_ROOM,
  40. DSPROPERTY_EAXLISTENER_ROOMHF,
  41. DSPROPERTY_EAXLISTENER_ROOMROLLOFFFACTOR,
  42. DSPROPERTY_EAXLISTENER_DECAYTIME,
  43. DSPROPERTY_EAXLISTENER_DECAYHFRATIO,
  44. DSPROPERTY_EAXLISTENER_REFLECTIONS,
  45. DSPROPERTY_EAXLISTENER_REFLECTIONSDELAY,
  46. DSPROPERTY_EAXLISTENER_REVERB,
  47. DSPROPERTY_EAXLISTENER_REVERBDELAY,
  48. DSPROPERTY_EAXLISTENER_ENVIRONMENT,
  49. DSPROPERTY_EAXLISTENER_ENVIRONMENTSIZE,
  50. DSPROPERTY_EAXLISTENER_ENVIRONMENTDIFFUSION,
  51. DSPROPERTY_EAXLISTENER_AIRABSORPTIONHF,
  52. DSPROPERTY_EAXLISTENER_FLAGS
  53. } DSPROPERTY_EAX_LISTENERPROPERTY;
  54. // OR these flags with property id
  55. #define DSPROPERTY_EAXLISTENER_IMMEDIATE 0x00000000 // changes take effect immediately
  56. #define DSPROPERTY_EAXLISTENER_DEFERRED 0x80000000 // changes take effect later
  57. #define DSPROPERTY_EAXLISTENER_COMMITDEFERREDSETTINGS (DSPROPERTY_EAXLISTENER_NONE | \
  58. DSPROPERTY_EAXLISTENER_IMMEDIATE)
  59. // Use this structure for DSPROPERTY_EAXLISTENER_ALLPARAMETERS
  60. // - all levels are hundredths of decibels
  61. // - all times are in seconds
  62. // - the reference for high frequency controls is 5 kHz
  63. //
  64. // NOTE: This structure may change in future EAX versions.
  65. // It is recommended to initialize fields by name:
  66. // myListener.lRoom = -1000;
  67. // myListener.lRoomHF = -100;
  68. // ...
  69. // myListener.dwFlags = myFlags /* see EAXLISTENERFLAGS below */ ;
  70. // instead of:
  71. // myListener = { -1000, -100, ... , 0x00000009 };
  72. // If you want to save and load presets in binary form, you
  73. // should define your own structure to insure future compatibility.
  74. //
  75. typedef struct _EAXLISTENERPROPERTIES
  76. {
  77. LONG lRoom; // room effect level at low frequencies
  78. LONG lRoomHF; // room effect high-frequency level re. low frequency level
  79. FLOAT flRoomRolloffFactor; // like DS3D flRolloffFactor but for room effect
  80. FLOAT flDecayTime; // reverberation decay time at low frequencies
  81. FLOAT flDecayHFRatio; // high-frequency to low-frequency decay time ratio
  82. LONG lReflections; // early reflections level relative to room effect
  83. FLOAT flReflectionsDelay; // initial reflection delay time
  84. LONG lReverb; // late reverberation level relative to room effect
  85. FLOAT flReverbDelay; // late reverberation delay time relative to initial reflection
  86. DWORD dwEnvironment; // sets all listener properties
  87. FLOAT flEnvironmentSize; // environment size in meters
  88. FLOAT flEnvironmentDiffusion; // environment diffusion
  89. FLOAT flAirAbsorptionHF; // change in level per meter at 5 kHz
  90. DWORD dwFlags; // modifies the behavior of properties
  91. } EAXLISTENERPROPERTIES, *LPEAXLISTENERPROPERTIES;
  92. // used by DSPROPERTY_EAXLISTENER_ENVIRONMENT
  93. enum
  94. {
  95. EAX_ENVIRONMENT_GENERIC,
  96. EAX_ENVIRONMENT_PADDEDCELL,
  97. EAX_ENVIRONMENT_ROOM,
  98. EAX_ENVIRONMENT_BATHROOM,
  99. EAX_ENVIRONMENT_LIVINGROOM,
  100. EAX_ENVIRONMENT_STONEROOM,
  101. EAX_ENVIRONMENT_AUDITORIUM,
  102. EAX_ENVIRONMENT_CONCERTHALL,
  103. EAX_ENVIRONMENT_CAVE,
  104. EAX_ENVIRONMENT_ARENA,
  105. EAX_ENVIRONMENT_HANGAR,
  106. EAX_ENVIRONMENT_CARPETEDHALLWAY,
  107. EAX_ENVIRONMENT_HALLWAY,
  108. EAX_ENVIRONMENT_STONECORRIDOR,
  109. EAX_ENVIRONMENT_ALLEY,
  110. EAX_ENVIRONMENT_FOREST,
  111. EAX_ENVIRONMENT_CITY,
  112. EAX_ENVIRONMENT_MOUNTAINS,
  113. EAX_ENVIRONMENT_QUARRY,
  114. EAX_ENVIRONMENT_PLAIN,
  115. EAX_ENVIRONMENT_PARKINGLOT,
  116. EAX_ENVIRONMENT_SEWERPIPE,
  117. EAX_ENVIRONMENT_UNDERWATER,
  118. EAX_ENVIRONMENT_DRUGGED,
  119. EAX_ENVIRONMENT_DIZZY,
  120. EAX_ENVIRONMENT_PSYCHOTIC,
  121. EAX_ENVIRONMENT_COUNT
  122. };
  123. // Used by DSPROPERTY_EAXLISTENER_FLAGS
  124. //
  125. // Note: The number and order of flags may change in future EAX versions.
  126. // It is recommended to use the flag defines as follows:
  127. // myFlags = EAXLISTENERFLAGS_DECAYTIMESCALE | EAXLISTENERFLAGS_REVERBSCALE;
  128. // instead of:
  129. // myFlags = 0x00000009;
  130. //
  131. // These flags determine what properties are affected by environment size.
  132. #define EAXLISTENERFLAGS_DECAYTIMESCALE 0x00000001 // reverberation decay time
  133. #define EAXLISTENERFLAGS_REFLECTIONSSCALE 0x00000002 // reflection level
  134. #define EAXLISTENERFLAGS_REFLECTIONSDELAYSCALE 0x00000004 // initial reflection delay time
  135. #define EAXLISTENERFLAGS_REVERBSCALE 0x00000008 // reflections level
  136. #define EAXLISTENERFLAGS_REVERBDELAYSCALE 0x00000010 // late reverberation delay time
  137. // This flag limits high-frequency decay time according to air absorption.
  138. #define EAXLISTENERFLAGS_DECAYHFLIMIT 0x00000020
  139. #define EAXLISTENERFLAGS_RESERVED 0xFFFFFFC0 // reserved future use
  140. // property ranges and defaults:
  141. #define EAXLISTENER_MINROOM (-10000)
  142. #define EAXLISTENER_MAXROOM 0
  143. #define EAXLISTENER_DEFAULTROOM (-1000)
  144. #define EAXLISTENER_MINROOMHF (-10000)
  145. #define EAXLISTENER_MAXROOMHF 0
  146. #define EAXLISTENER_DEFAULTROOMHF (-100)
  147. #define EAXLISTENER_MINROOMROLLOFFFACTOR 0.0f
  148. #define EAXLISTENER_MAXROOMROLLOFFFACTOR 10.0f
  149. #define EAXLISTENER_DEFAULTROOMROLLOFFFACTOR 0.0f
  150. #define EAXLISTENER_MINDECAYTIME 0.1f
  151. #define EAXLISTENER_MAXDECAYTIME 20.0f
  152. #define EAXLISTENER_DEFAULTDECAYTIME 1.49f
  153. #define EAXLISTENER_MINDECAYHFRATIO 0.1f
  154. #define EAXLISTENER_MAXDECAYHFRATIO 2.0f
  155. #define EAXLISTENER_DEFAULTDECAYHFRATIO 0.83f
  156. #define EAXLISTENER_MINREFLECTIONS (-10000)
  157. #define EAXLISTENER_MAXREFLECTIONS 1000
  158. #define EAXLISTENER_DEFAULTREFLECTIONS (-2602)
  159. #define EAXLISTENER_MINREFLECTIONSDELAY 0.0f
  160. #define EAXLISTENER_MAXREFLECTIONSDELAY 0.3f
  161. #define EAXLISTENER_DEFAULTREFLECTIONSDELAY 0.007f
  162. #define EAXLISTENER_MINREVERB (-10000)
  163. #define EAXLISTENER_MAXREVERB 2000
  164. #define EAXLISTENER_DEFAULTREVERB 200
  165. #define EAXLISTENER_MINREVERBDELAY 0.0f
  166. #define EAXLISTENER_MAXREVERBDELAY 0.1f
  167. #define EAXLISTENER_DEFAULTREVERBDELAY 0.011f
  168. #define EAXLISTENER_MINENVIRONMENT 0
  169. #define EAXLISTENER_MAXENVIRONMENT (EAX_ENVIRONMENT_COUNT-1)
  170. #define EAXLISTENER_DEFAULTENVIRONMENT EAX_ENVIRONMENT_GENERIC
  171. #define EAXLISTENER_MINENVIRONMENTSIZE 1.0f
  172. #define EAXLISTENER_MAXENVIRONMENTSIZE 100.0f
  173. #define EAXLISTENER_DEFAULTENVIRONMENTSIZE 7.5f
  174. #define EAXLISTENER_MINENVIRONMENTDIFFUSION 0.0f
  175. #define EAXLISTENER_MAXENVIRONMENTDIFFUSION 1.0f
  176. #define EAXLISTENER_DEFAULTENVIRONMENTDIFFUSION 1.0f
  177. #define EAXLISTENER_MINAIRABSORPTIONHF (-100.0f)
  178. #define EAXLISTENER_MAXAIRABSORPTIONHF 0.0f
  179. #define EAXLISTENER_DEFAULTAIRABSORPTIONHF (-5.0f)
  180. #define EAXLISTENER_DEFAULTFLAGS (EAXLISTENERFLAGS_DECAYTIMESCALE | \
  181. EAXLISTENERFLAGS_REFLECTIONSSCALE | \
  182. EAXLISTENERFLAGS_REFLECTIONSDELAYSCALE | \
  183. EAXLISTENERFLAGS_REVERBSCALE | \
  184. EAXLISTENERFLAGS_REVERBDELAYSCALE | \
  185. EAXLISTENERFLAGS_DECAYHFLIMIT)
  186. /*
  187. * EAX 2.0 buffer property set {0306A6A7-B224-11d2-99E5-0000E8D8C722}
  188. */
  189. DEFINE_GUID(DSPROPSETID_EAX20_BufferProperties,
  190. 0x306a6a7,
  191. 0xb224,
  192. 0x11d2,
  193. 0x99, 0xe5, 0x0, 0x0, 0xe8, 0xd8, 0xc7, 0x22);
  194. // For compatibility with future EAX versions:
  195. #define DSPROPSETID_EAX_BufferProperties DSPROPSETID_EAX20_BufferProperties
  196. typedef enum
  197. {
  198. DSPROPERTY_EAXBUFFER_NONE,
  199. DSPROPERTY_EAXBUFFER_ALLPARAMETERS,
  200. DSPROPERTY_EAXBUFFER_DIRECT,
  201. DSPROPERTY_EAXBUFFER_DIRECTHF,
  202. DSPROPERTY_EAXBUFFER_ROOM,
  203. DSPROPERTY_EAXBUFFER_ROOMHF,
  204. DSPROPERTY_EAXBUFFER_ROOMROLLOFFFACTOR,
  205. DSPROPERTY_EAXBUFFER_OBSTRUCTION,
  206. DSPROPERTY_EAXBUFFER_OBSTRUCTIONLFRATIO,
  207. DSPROPERTY_EAXBUFFER_OCCLUSION,
  208. DSPROPERTY_EAXBUFFER_OCCLUSIONLFRATIO,
  209. DSPROPERTY_EAXBUFFER_OCCLUSIONROOMRATIO,
  210. DSPROPERTY_EAXBUFFER_OUTSIDEVOLUMEHF,
  211. DSPROPERTY_EAXBUFFER_AIRABSORPTIONFACTOR,
  212. DSPROPERTY_EAXBUFFER_FLAGS
  213. } DSPROPERTY_EAX_BUFFERPROPERTY;
  214. // OR these flags with property id
  215. #define DSPROPERTY_EAXBUFFER_IMMEDIATE 0x00000000 // changes take effect immediately
  216. #define DSPROPERTY_EAXBUFFER_DEFERRED 0x80000000 // changes take effect later
  217. #define DSPROPERTY_EAXBUFFER_COMMITDEFERREDSETTINGS (DSPROPERTY_EAXBUFFER_NONE | \
  218. DSPROPERTY_EAXBUFFER_IMMEDIATE)
  219. // Use this structure for DSPROPERTY_EAXBUFFER_ALLPARAMETERS
  220. // - all levels are hundredths of decibels
  221. //
  222. // NOTE: This structure may change in future EAX versions.
  223. // It is recommended to initialize fields by name:
  224. // myBuffer.lDirect = 0;
  225. // myBuffer.lDirectHF = -200;
  226. // ...
  227. // myBuffer.dwFlags = myFlags /* see EAXBUFFERFLAGS below */ ;
  228. // instead of:
  229. // myBuffer = { 0, -200, ... , 0x00000003 };
  230. //
  231. typedef struct _EAXBUFFERPROPERTIES
  232. {
  233. LONG lDirect; // direct path level
  234. LONG lDirectHF; // direct path level at high frequencies
  235. LONG lRoom; // room effect level
  236. LONG lRoomHF; // room effect level at high frequencies
  237. FLOAT flRoomRolloffFactor; // like DS3D flRolloffFactor but for room effect
  238. LONG lObstruction; // main obstruction control (attenuation at high frequencies)
  239. FLOAT flObstructionLFRatio; // obstruction low-frequency level re. main control
  240. LONG lOcclusion; // main occlusion control (attenuation at high frequencies)
  241. FLOAT flOcclusionLFRatio; // occlusion low-frequency level re. main control
  242. FLOAT flOcclusionRoomRatio; // occlusion room effect level re. main control
  243. LONG lOutsideVolumeHF; // outside sound cone level at high frequencies
  244. FLOAT flAirAbsorptionFactor; // multiplies DSPROPERTY_EAXLISTENER_AIRABSORPTIONHF
  245. DWORD dwFlags; // modifies the behavior of properties
  246. } EAXBUFFERPROPERTIES, *LPEAXBUFFERPROPERTIES;
  247. // Used by DSPROPERTY_EAXBUFFER_FLAGS
  248. // TRUE: value is computed automatically - property is an offset
  249. // FALSE: value is used directly
  250. //
  251. // Note: The number and order of flags may change in future EAX versions.
  252. // To insure future compatibility, use flag defines as follows:
  253. // myFlags = EAXBUFFERFLAGS_DIRECTHFAUTO | EAXBUFFERFLAGS_ROOMAUTO;
  254. // instead of:
  255. // myFlags = 0x00000003;
  256. //
  257. #define EAXBUFFERFLAGS_DIRECTHFAUTO 0x00000001 // affects DSPROPERTY_EAXBUFFER_DIRECTHF
  258. #define EAXBUFFERFLAGS_ROOMAUTO 0x00000002 // affects DSPROPERTY_EAXBUFFER_ROOM
  259. #define EAXBUFFERFLAGS_ROOMHFAUTO 0x00000004 // affects DSPROPERTY_EAXBUFFER_ROOMHF
  260. #define EAXBUFFERFLAGS_RESERVED 0xFFFFFFF8 // reserved future use
  261. // property ranges and defaults:
  262. #define EAXBUFFER_MINDIRECT (-10000)
  263. #define EAXBUFFER_MAXDIRECT 1000
  264. #define EAXBUFFER_DEFAULTDIRECT 0
  265. #define EAXBUFFER_MINDIRECTHF (-10000)
  266. #define EAXBUFFER_MAXDIRECTHF 0
  267. #define EAXBUFFER_DEFAULTDIRECTHF 0
  268. #define EAXBUFFER_MINROOM (-10000)
  269. #define EAXBUFFER_MAXROOM 1000
  270. #define EAXBUFFER_DEFAULTROOM 0
  271. #define EAXBUFFER_MINROOMHF (-10000)
  272. #define EAXBUFFER_MAXROOMHF 0
  273. #define EAXBUFFER_DEFAULTROOMHF 0
  274. #define EAXBUFFER_MINROOMROLLOFFFACTOR 0.0f
  275. #define EAXBUFFER_MAXROOMROLLOFFFACTOR 10.f
  276. #define EAXBUFFER_DEFAULTROOMROLLOFFFACTOR 0.0f
  277. #define EAXBUFFER_MINOBSTRUCTION (-10000)
  278. #define EAXBUFFER_MAXOBSTRUCTION 0
  279. #define EAXBUFFER_DEFAULTOBSTRUCTION 0
  280. #define EAXBUFFER_MINOBSTRUCTIONLFRATIO 0.0f
  281. #define EAXBUFFER_MAXOBSTRUCTIONLFRATIO 1.0f
  282. #define EAXBUFFER_DEFAULTOBSTRUCTIONLFRATIO 0.0f
  283. #define EAXBUFFER_MINOCCLUSION (-10000)
  284. #define EAXBUFFER_MAXOCCLUSION 0
  285. #define EAXBUFFER_DEFAULTOCCLUSION 0
  286. #define EAXBUFFER_MINOCCLUSIONLFRATIO 0.0f
  287. #define EAXBUFFER_MAXOCCLUSIONLFRATIO 1.0f
  288. #define EAXBUFFER_DEFAULTOCCLUSIONLFRATIO 0.25f
  289. #define EAXBUFFER_MINOCCLUSIONROOMRATIO 0.0f
  290. #define EAXBUFFER_MAXOCCLUSIONROOMRATIO 10.0f
  291. #define EAXBUFFER_DEFAULTOCCLUSIONROOMRATIO 0.5f
  292. #define EAXBUFFER_MINOUTSIDEVOLUMEHF (-10000)
  293. #define EAXBUFFER_MAXOUTSIDEVOLUMEHF 0
  294. #define EAXBUFFER_DEFAULTOUTSIDEVOLUMEHF 0
  295. #define EAXBUFFER_MINAIRABSORPTIONFACTOR 0.0f
  296. #define EAXBUFFER_MAXAIRABSORPTIONFACTOR 10.0f
  297. #define EAXBUFFER_DEFAULTAIRABSORPTIONFACTOR 1.0f
  298. #define EAXBUFFER_DEFAULTFLAGS (EAXBUFFERFLAGS_DIRECTHFAUTO | \
  299. EAXBUFFERFLAGS_ROOMAUTO | \
  300. EAXBUFFERFLAGS_ROOMHFAUTO)
  301. // Material transmission presets
  302. // 3 values in this order:
  303. // 1: occlusion (or obstruction)
  304. // 2: occlusion LF Ratio (or obstruction LF Ratio)
  305. // 3: occlusion Room Ratio
  306. // Single window material preset
  307. #define EAX_MATERIAL_SINGLEWINDOW (-2800)
  308. #define EAX_MATERIAL_SINGLEWINDOWLF 0.71f
  309. #define EAX_MATERIAL_SINGLEWINDOWROOMRATIO 0.43f
  310. // Double window material preset
  311. #define EAX_MATERIAL_DOUBLEWINDOW (-5000)
  312. #define EAX_MATERIAL_DOUBLEWINDOWHF 0.40f
  313. #define EAX_MATERIAL_DOUBLEWINDOWROOMRATIO 0.24f
  314. // Thin door material preset
  315. #define EAX_MATERIAL_THINDOOR (-1800)
  316. #define EAX_MATERIAL_THINDOORLF 0.66f
  317. #define EAX_MATERIAL_THINDOORROOMRATIO 0.66f
  318. // Thick door material preset
  319. #define EAX_MATERIAL_THICKDOOR (-4400)
  320. #define EAX_MATERIAL_THICKDOORLF 0.64f
  321. #define EAX_MATERIAL_THICKDOORROOMRTATION 0.27f
  322. // Wood wall material preset
  323. #define EAX_MATERIAL_WOODWALL (-4000)
  324. #define EAX_MATERIAL_WOODWALLLF 0.50f
  325. #define EAX_MATERIAL_WOODWALLROOMRATIO 0.30f
  326. // Brick wall material preset
  327. #define EAX_MATERIAL_BRICKWALL (-5000)
  328. #define EAX_MATERIAL_BRICKWALLLF 0.60f
  329. #define EAX_MATERIAL_BRICKWALLROOMRATIO 0.24f
  330. // Stone wall material preset
  331. #define EAX_MATERIAL_STONEWALL (-6000)
  332. #define EAX_MATERIAL_STONEWALLLF 0.68f
  333. #define EAX_MATERIAL_STONEWALLROOMRATIO 0.20f
  334. // Curtain material preset
  335. #define EAX_MATERIAL_CURTAIN (-1200)
  336. #define EAX_MATERIAL_CURTAINLF 0.15f
  337. #define EAX_MATERIAL_CURTAINROOMRATIO 1.00f
  338. #pragma pack(pop)
  339. #ifdef __cplusplus
  340. }
  341. #endif // __cplusplus
  342. #endif