xaudio2.idl 38 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270
  1. /*
  2. * Copyright (c) 2015 Mark Harmstone
  3. *
  4. * This library is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU Lesser General Public
  6. * License as published by the Free Software Foundation; either
  7. * version 2.1 of the License, or (at your option) any later version.
  8. *
  9. * This library is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * Lesser General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Lesser General Public
  15. * License along with this library; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  17. */
  18. import "unknwn.idl";
  19. import "mmdeviceapi.idl";
  20. import "audiosessiontypes.h";
  21. cpp_quote("#include <pshpack1.h>")
  22. [
  23. uuid(fac23f48-31f5-45a8-b49b-5225d61401aa)
  24. ]
  25. coclass XAudio20 {
  26. interface IUnknown;
  27. }
  28. [
  29. uuid(e21a7345-eb21-468e-be50-804db97cf708)
  30. ]
  31. coclass XAudio21 {
  32. interface IUnknown;
  33. }
  34. [
  35. uuid(b802058a-464a-42db-bc10-b650d6f2586a)
  36. ]
  37. coclass XAudio22 {
  38. interface IUnknown;
  39. }
  40. [
  41. uuid(4c5e637a-16c7-4de3-9c46-5ed22181962d)
  42. ]
  43. coclass XAudio23 {
  44. interface IUnknown;
  45. }
  46. [
  47. uuid(03219e78-5bc3-44d1-b92e-f63d89cc6526)
  48. ]
  49. coclass XAudio24 {
  50. interface IUnknown;
  51. }
  52. [
  53. uuid(4c9b6dde-6809-46e6-a278-9b6a97588670)
  54. ]
  55. coclass XAudio25 {
  56. interface IUnknown;
  57. }
  58. [
  59. uuid(3eda9b49-2085-498b-9bb2-39a6778493de)
  60. ]
  61. coclass XAudio26 {
  62. interface IUnknown;
  63. }
  64. [
  65. uuid(5a508685-a254-4fba-9b82-9a24b00306af)
  66. ]
  67. coclass XAudio27 {
  68. interface IUnknown;
  69. }
  70. [
  71. uuid(db05ea35-0329-4d4b-a53a-6dead03d3852)
  72. ]
  73. coclass XAudio2Debug {
  74. interface IUnknown;
  75. }
  76. cpp_quote("#if 0")
  77. typedef struct WAVEFORMATEX
  78. {
  79. WORD wFormatTag;
  80. WORD nChannels;
  81. DWORD nSamplesPerSec;
  82. DWORD nAvgBytesPerSec;
  83. WORD nBlockAlign;
  84. WORD wBitsPerSample;
  85. WORD cbSize;
  86. } WAVEFORMATEX;
  87. typedef struct {
  88. WAVEFORMATEX Format;
  89. union {
  90. WORD wValidBitsPerSample;
  91. WORD wSamplesPerBlock;
  92. WORD wReserved;
  93. } Samples;
  94. DWORD dwChannelMask;
  95. GUID SubFormat;
  96. } WAVEFORMATEXTENSIBLE, *PWAVEFORMATEXTENSIBLE;
  97. cpp_quote("#else")
  98. cpp_quote("#include <mmreg.h>")
  99. cpp_quote("#endif")
  100. interface IXAudio2Voice;
  101. typedef enum XAUDIO2_WINDOWS_PROCESSOR_SPECIFIER
  102. {
  103. Processor1 = 0x00000001,
  104. Processor2 = 0x00000002,
  105. Processor3 = 0x00000004,
  106. Processor4 = 0x00000008,
  107. Processor5 = 0x00000010,
  108. Processor6 = 0x00000020,
  109. Processor7 = 0x00000040,
  110. Processor8 = 0x00000080,
  111. Processor9 = 0x00000100,
  112. Processor10 = 0x00000200,
  113. Processor11 = 0x00000400,
  114. Processor12 = 0x00000800,
  115. Processor13 = 0x00001000,
  116. Processor14 = 0x00002000,
  117. Processor15 = 0x00004000,
  118. Processor16 = 0x00008000,
  119. Processor17 = 0x00010000,
  120. Processor18 = 0x00020000,
  121. Processor19 = 0x00040000,
  122. Processor20 = 0x00080000,
  123. Processor21 = 0x00100000,
  124. Processor22 = 0x00200000,
  125. Processor23 = 0x00400000,
  126. Processor24 = 0x00800000,
  127. Processor25 = 0x01000000,
  128. Processor26 = 0x02000000,
  129. Processor27 = 0x04000000,
  130. Processor28 = 0x08000000,
  131. Processor29 = 0x10000000,
  132. Processor30 = 0x20000000,
  133. Processor31 = 0x40000000,
  134. Processor32 = 0x80000000,
  135. XAUDIO2_ANY_PROCESSOR = 0xffffffff,
  136. XAUDIO2_DEFAULT_PROCESSOR = XAUDIO2_ANY_PROCESSOR
  137. } XAUDIO2_WINDOWS_PROCESSOR_SPECIFIER, XAUDIO2_PROCESSOR;
  138. typedef struct XAUDIO2_PERFORMANCE_DATA
  139. {
  140. UINT64 AudioCyclesSinceLastQuery;
  141. UINT64 TotalCyclesSinceLastQuery;
  142. UINT32 MinimumCyclesPerQuantum;
  143. UINT32 MaximumCyclesPerQuantum;
  144. UINT32 MemoryUsageInBytes;
  145. UINT32 CurrentLatencyInSamples;
  146. UINT32 GlitchesSinceEngineStarted;
  147. UINT32 ActiveSourceVoiceCount;
  148. UINT32 TotalSourceVoiceCount;
  149. UINT32 ActiveSubmixVoiceCount;
  150. UINT32 ActiveResamplerCount;
  151. UINT32 ActiveMatrixMixCount;
  152. UINT32 ActiveXmaSourceVoices;
  153. UINT32 ActiveXmaStreams;
  154. } XAUDIO2_PERFORMANCE_DATA;
  155. typedef struct XAUDIO22_PERFORMANCE_DATA
  156. {
  157. UINT64 AudioCyclesSinceLastQuery;
  158. UINT64 TotalCyclesSinceLastQuery;
  159. UINT32 MinimumCyclesPerQuantum;
  160. UINT32 MaximumCyclesPerQuantum;
  161. UINT32 MemoryUsageInBytes;
  162. UINT32 CurrentLatencyInSamples;
  163. UINT32 GlitchesSinceEngineStarted;
  164. UINT32 ActiveSourceVoiceCount;
  165. UINT32 TotalSourceVoiceCount;
  166. UINT32 ActiveSubmixVoiceCount;
  167. UINT32 TotalSubmixVoiceCount;
  168. UINT32 ActiveXmaSourceVoices;
  169. UINT32 ActiveXmaStreams;
  170. } XAUDIO22_PERFORMANCE_DATA;
  171. typedef struct XAUDIO20_PERFORMANCE_DATA
  172. {
  173. UINT64 AudioCyclesSinceLastQuery;
  174. UINT64 TotalCyclesSinceLastQuery;
  175. UINT32 MinimumCyclesPerQuantum;
  176. UINT32 MaximumCyclesPerQuantum;
  177. UINT32 MemoryUsageInBytes;
  178. UINT32 CurrentLatencyInSamples;
  179. UINT32 GlitchesSinceLastQuery;
  180. UINT32 ActiveSourceVoiceCount;
  181. UINT32 TotalSourceVoiceCount;
  182. UINT32 ActiveSubmixVoiceCount;
  183. UINT32 TotalSubmixVoiceCount;
  184. UINT32 ActiveXmaSourceVoices;
  185. UINT32 ActiveXmaStreams;
  186. } XAUDIO20_PERFORMANCE_DATA;
  187. typedef enum XAUDIO2_DEVICE_ROLE
  188. {
  189. NotDefaultDevice = 0x0,
  190. DefaultConsoleDevice = 0x1,
  191. DefaultMultimediaDevice = 0x2,
  192. DefaultCommunicationsDevice = 0x4,
  193. DefaultGameDevice = 0x8,
  194. GlobalDefaultDevice = 0xf,
  195. InvalidDeviceRole = ~GlobalDefaultDevice
  196. } XAUDIO2_DEVICE_ROLE;
  197. typedef struct XAUDIO2_DEVICE_DETAILS
  198. {
  199. WCHAR DeviceID[256];
  200. WCHAR DisplayName[256];
  201. XAUDIO2_DEVICE_ROLE Role;
  202. WAVEFORMATEXTENSIBLE OutputFormat;
  203. } XAUDIO2_DEVICE_DETAILS;
  204. typedef struct XAUDIO27_VOICE_DETAILS
  205. {
  206. UINT32 CreationFlags;
  207. UINT32 InputChannels;
  208. UINT32 InputSampleRate;
  209. } XAUDIO27_VOICE_DETAILS;
  210. typedef struct XAUDIO2_VOICE_DETAILS
  211. {
  212. UINT32 CreationFlags;
  213. UINT32 ActiveFlags;
  214. UINT32 InputChannels;
  215. UINT32 InputSampleRate;
  216. } XAUDIO2_VOICE_DETAILS;
  217. typedef struct XAUDIO2_SEND_DESCRIPTOR
  218. {
  219. UINT32 Flags;
  220. IXAudio2Voice* pOutputVoice;
  221. } XAUDIO2_SEND_DESCRIPTOR;
  222. /* XAudio2 2.3's XAUDIO2_VOICE_SENDS struct */
  223. typedef struct XAUDIO23_VOICE_SENDS
  224. {
  225. UINT32 OutputCount;
  226. IXAudio2Voice **pOutputVoices;
  227. } XAUDIO23_VOICE_SENDS;
  228. typedef struct XAUDIO2_VOICE_SENDS
  229. {
  230. UINT32 SendCount;
  231. XAUDIO2_SEND_DESCRIPTOR* pSends;
  232. } XAUDIO2_VOICE_SENDS;
  233. typedef struct XAUDIO2_EFFECT_DESCRIPTOR
  234. {
  235. IUnknown* pEffect;
  236. BOOL InitialState;
  237. UINT32 OutputChannels;
  238. } XAUDIO2_EFFECT_DESCRIPTOR;
  239. typedef struct XAUDIO2_EFFECT_CHAIN
  240. {
  241. UINT32 EffectCount;
  242. XAUDIO2_EFFECT_DESCRIPTOR* pEffectDescriptors;
  243. } XAUDIO2_EFFECT_CHAIN;
  244. const UINT32 XAUDIO2_MAX_BUFFER_BYTES = 0x80000000;
  245. const UINT32 XAUDIO2_MAX_QUEUED_BUFFERS = 64;
  246. const UINT32 XAUDIO2_MAX_BUFFERS_SYSTEM = 2;
  247. const UINT32 XAUDIO2_MAX_AUDIO_CHANNELS = 64;
  248. const UINT32 XAUDIO2_MIN_SAMPLE_RATE = 1000;
  249. const UINT32 XAUDIO2_MAX_SAMPLE_RATE = 200000;
  250. const float XAUDIO2_MAX_VOLUME_LEVEL = 16777216.0;
  251. const float XAUDIO2_MIN_FREQ_RATIO = (1/1024.0);
  252. const float XAUDIO2_MAX_FREQ_RATIO = 1024.0;
  253. const float XAUDIO2_DEFAULT_FREQ_RATIO = 2.0;
  254. const float XAUDIO2_MAX_FILTER_ONEOVERQ = 1.5;
  255. const float XAUDIO2_MAX_FILTER_FREQUENCY = 1.0;
  256. const UINT32 XAUDIO2_MAX_LOOP_COUNT = 254;
  257. const UINT32 XAUDIO20_MAX_LOOP_COUNT = 0x100000; /* xaudio 2.0 */
  258. const UINT32 XAUDIO2_COMMIT_NOW = 0;
  259. const UINT32 XAUDIO2_COMMIT_ALL = 0;
  260. const UINT32 XAUDIO2_INVALID_OPSET = 0xffffffff;
  261. const UINT32 XAUDIO2_NO_LOOP_REGION = 0;
  262. const UINT32 XAUDIO2_LOOP_INFINITE = 255;
  263. const UINT32 XAUDIO20_LOOP_INFINITE = ((UINT)-1); /* xaudio 2.0 */
  264. const UINT32 XAUDIO2_DEFAULT_CHANNELS = 0;
  265. const UINT32 XAUDIO2_DEFAULT_SAMPLERATE = 0;
  266. [
  267. object,
  268. local
  269. ]
  270. interface IXAudio2EngineCallback
  271. {
  272. void OnProcessingPassStart();
  273. void OnProcessingPassEnd();
  274. void OnCriticalError([in] HRESULT Error);
  275. }
  276. typedef enum XAUDIO2_FILTER_TYPE
  277. {
  278. LowPassFilter,
  279. BandPassFilter,
  280. HighPassFilter,
  281. NotchFilter
  282. } XAUDIO2_FILTER_TYPE;
  283. typedef struct XAUDIO2_FILTER_PARAMETERS
  284. {
  285. XAUDIO2_FILTER_TYPE Type;
  286. float Frequency;
  287. float OneOverQ;
  288. } XAUDIO2_FILTER_PARAMETERS;
  289. /* XAudio 2.0's IXAudio2Voice */
  290. /* XAudio2 2.0's IXAudio2Voice interface. Actually called
  291. * IXAudio2Voice in the Mar 2008 DX SDK */
  292. [
  293. object,
  294. local
  295. ]
  296. interface IXAudio20Voice
  297. {
  298. void GetVoiceDetails([out] XAUDIO27_VOICE_DETAILS* pVoiceDetails);
  299. HRESULT SetOutputVoices([in] const XAUDIO23_VOICE_SENDS* pSendList);
  300. HRESULT SetEffectChain([in] const XAUDIO2_EFFECT_CHAIN* pEffectChain);
  301. HRESULT EnableEffect(
  302. [in] UINT32 EffectIndex,
  303. [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
  304. HRESULT DisableEffect(
  305. [in] UINT32 EffectIndex,
  306. [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
  307. void GetEffectState(
  308. [in] UINT32 EffectIndex,
  309. [out] BOOL* pEnabled);
  310. HRESULT SetEffectParameters(
  311. [in] UINT32 EffectIndex,
  312. [in] const void* pParameters,
  313. [in] UINT32 ParametersByteSize,
  314. [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
  315. HRESULT GetEffectParameters(
  316. [in] UINT32 EffectIndex,
  317. [out] void* pParameters,
  318. [in] UINT32 ParametersByteSize);
  319. HRESULT SetFilterParameters(
  320. [in] const XAUDIO2_FILTER_PARAMETERS* pParameters,
  321. [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
  322. void GetFilterParameters([out] XAUDIO2_FILTER_PARAMETERS* pParameters);
  323. HRESULT SetVolume(
  324. [in] float Volume,
  325. [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
  326. void GetVolume([out] float* pVolume);
  327. HRESULT SetChannelVolumes(
  328. [in] UINT32 Channels,
  329. [in, size_is(Channels)] const float* pVolumes,
  330. [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
  331. void GetChannelVolumes(
  332. [in] UINT32 Channels,
  333. [out, size_is(Channels)] float* pVolumes);
  334. HRESULT SetOutputMatrix(
  335. [in] IXAudio2Voice* pDestinationVoice,
  336. [in] UINT32 SourceChannels,
  337. [in] UINT32 DestinationChannels,
  338. [in, size_is(SourceChannels * DestinationChannels)] const float* pLevelMatrix,
  339. [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
  340. HRESULT GetOutputMatrix(
  341. [in] IXAudio2Voice* pDestinationVoice,
  342. [in] UINT32 SourceChannels,
  343. [in] UINT32 DestinationChannels,
  344. [out, size_is(SourceChannels * DestinationChannels)] float* pLevelMatrix);
  345. void DestroyVoice();
  346. }
  347. /* XAudio 2.3's IXAudio2Voice */
  348. /* XAudio2 2.3's IXAudio2Voice interface. Actually called
  349. * IXAudio2Voice in the Nov 2008 DX SDK */
  350. [
  351. object,
  352. local
  353. ]
  354. interface IXAudio23Voice
  355. {
  356. void GetVoiceDetails([out] XAUDIO27_VOICE_DETAILS* pVoiceDetails);
  357. HRESULT SetOutputVoices([in] const XAUDIO23_VOICE_SENDS* pSendList);
  358. HRESULT SetEffectChain([in] const XAUDIO2_EFFECT_CHAIN* pEffectChain);
  359. HRESULT EnableEffect(
  360. [in] UINT32 EffectIndex,
  361. [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
  362. HRESULT DisableEffect(
  363. [in] UINT32 EffectIndex,
  364. [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
  365. void GetEffectState(
  366. [in] UINT32 EffectIndex,
  367. [out] BOOL* pEnabled);
  368. HRESULT SetEffectParameters(
  369. [in] UINT32 EffectIndex,
  370. [in] const void* pParameters,
  371. [in] UINT32 ParametersByteSize,
  372. [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
  373. HRESULT GetEffectParameters(
  374. [in] UINT32 EffectIndex,
  375. [out] void* pParameters,
  376. [in] UINT32 ParametersByteSize);
  377. HRESULT SetFilterParameters(
  378. [in] const XAUDIO2_FILTER_PARAMETERS* pParameters,
  379. [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
  380. void GetFilterParameters([out] XAUDIO2_FILTER_PARAMETERS* pParameters);
  381. HRESULT SetVolume(
  382. [in] float Volume,
  383. [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
  384. void GetVolume([out] float* pVolume);
  385. HRESULT SetChannelVolumes(
  386. [in] UINT32 Channels,
  387. [in, size_is(Channels)] const float* pVolumes,
  388. [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
  389. void GetChannelVolumes(
  390. [in] UINT32 Channels,
  391. [out, size_is(Channels)] float* pVolumes);
  392. HRESULT SetOutputMatrix(
  393. [in] IXAudio2Voice* pDestinationVoice,
  394. [in] UINT32 SourceChannels,
  395. [in] UINT32 DestinationChannels,
  396. [in, size_is(SourceChannels * DestinationChannels)] const float* pLevelMatrix,
  397. [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
  398. void GetOutputMatrix(
  399. [in] IXAudio2Voice* pDestinationVoice,
  400. [in] UINT32 SourceChannels,
  401. [in] UINT32 DestinationChannels,
  402. [out, size_is(SourceChannels * DestinationChannels)] float* pLevelMatrix);
  403. void DestroyVoice();
  404. }
  405. /* XAudio 2.7's IXAudio2Voice */
  406. /* XAudio2 2.7's IXAudio2Voice interface. Actually called
  407. * IXAudio2Voice in the Jun 2010 DX SDK */
  408. [
  409. object,
  410. local
  411. ]
  412. interface IXAudio27Voice
  413. {
  414. void GetVoiceDetails([out] XAUDIO27_VOICE_DETAILS* pVoiceDetails);
  415. HRESULT SetOutputVoices([in] const XAUDIO2_VOICE_SENDS* pSendList);
  416. HRESULT SetEffectChain([in] const XAUDIO2_EFFECT_CHAIN* pEffectChain);
  417. HRESULT EnableEffect(
  418. [in] UINT32 EffectIndex,
  419. [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
  420. HRESULT DisableEffect(
  421. [in] UINT32 EffectIndex,
  422. [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
  423. void GetEffectState(
  424. [in] UINT32 EffectIndex,
  425. [out] BOOL* pEnabled);
  426. HRESULT SetEffectParameters(
  427. [in] UINT32 EffectIndex,
  428. [in] const void* pParameters,
  429. [in] UINT32 ParametersByteSize,
  430. [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
  431. HRESULT GetEffectParameters(
  432. [in] UINT32 EffectIndex,
  433. [out] void* pParameters,
  434. [in] UINT32 ParametersByteSize);
  435. HRESULT SetFilterParameters(
  436. [in] const XAUDIO2_FILTER_PARAMETERS* pParameters,
  437. [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
  438. void GetFilterParameters([out] XAUDIO2_FILTER_PARAMETERS* pParameters);
  439. HRESULT SetOutputFilterParameters(
  440. [in] IXAudio2Voice* pDestinationVoice,
  441. [in] const XAUDIO2_FILTER_PARAMETERS* pParameters,
  442. [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
  443. void GetOutputFilterParameters(
  444. [in] IXAudio2Voice* pDestinationVoice,
  445. [out] XAUDIO2_FILTER_PARAMETERS* pParameters);
  446. HRESULT SetVolume(
  447. [in] float Volume,
  448. [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
  449. void GetVolume([out] float* pVolume);
  450. HRESULT SetChannelVolumes(
  451. [in] UINT32 Channels,
  452. [in, size_is(Channels)] const float* pVolumes,
  453. [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
  454. void GetChannelVolumes(
  455. [in] UINT32 Channels,
  456. [out, size_is(Channels)] float* pVolumes);
  457. HRESULT SetOutputMatrix(
  458. [in] IXAudio2Voice* pDestinationVoice,
  459. [in] UINT32 SourceChannels,
  460. [in] UINT32 DestinationChannels,
  461. [in, size_is(SourceChannels * DestinationChannels)] const float* pLevelMatrix,
  462. [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
  463. void GetOutputMatrix(
  464. [in] IXAudio2Voice* pDestinationVoice,
  465. [in] UINT32 SourceChannels,
  466. [in] UINT32 DestinationChannels,
  467. [out, size_is(SourceChannels * DestinationChannels)] float* pLevelMatrix);
  468. void DestroyVoice();
  469. }
  470. [
  471. object,
  472. local
  473. ]
  474. interface IXAudio2Voice
  475. {
  476. void GetVoiceDetails([out] XAUDIO2_VOICE_DETAILS* pVoiceDetails);
  477. HRESULT SetOutputVoices([in] const XAUDIO2_VOICE_SENDS* pSendList);
  478. HRESULT SetEffectChain([in] const XAUDIO2_EFFECT_CHAIN* pEffectChain);
  479. HRESULT EnableEffect(
  480. [in] UINT32 EffectIndex,
  481. [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
  482. HRESULT DisableEffect(
  483. [in] UINT32 EffectIndex,
  484. [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
  485. void GetEffectState(
  486. [in] UINT32 EffectIndex,
  487. [out] BOOL* pEnabled);
  488. HRESULT SetEffectParameters(
  489. [in] UINT32 EffectIndex,
  490. [in] const void* pParameters,
  491. [in] UINT32 ParametersByteSize,
  492. [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
  493. HRESULT GetEffectParameters(
  494. [in] UINT32 EffectIndex,
  495. [out] void* pParameters,
  496. [in] UINT32 ParametersByteSize);
  497. HRESULT SetFilterParameters(
  498. [in] const XAUDIO2_FILTER_PARAMETERS* pParameters,
  499. [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
  500. void GetFilterParameters([out] XAUDIO2_FILTER_PARAMETERS* pParameters);
  501. HRESULT SetOutputFilterParameters(
  502. [in] IXAudio2Voice* pDestinationVoice,
  503. [in] const XAUDIO2_FILTER_PARAMETERS* pParameters,
  504. [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
  505. void GetOutputFilterParameters(
  506. [in] IXAudio2Voice* pDestinationVoice,
  507. [out] XAUDIO2_FILTER_PARAMETERS* pParameters);
  508. HRESULT SetVolume(
  509. [in] float Volume,
  510. [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
  511. void GetVolume([out] float* pVolume);
  512. HRESULT SetChannelVolumes(
  513. [in] UINT32 Channels,
  514. [in, size_is(Channels)] const float* pVolumes,
  515. [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
  516. void GetChannelVolumes(
  517. [in] UINT32 Channels,
  518. [out, size_is(Channels)] float* pVolumes);
  519. HRESULT SetOutputMatrix(
  520. [in] IXAudio2Voice* pDestinationVoice,
  521. [in] UINT32 SourceChannels,
  522. [in] UINT32 DestinationChannels,
  523. [in, size_is(SourceChannels * DestinationChannels)] const float* pLevelMatrix,
  524. [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
  525. void GetOutputMatrix(
  526. [in] IXAudio2Voice* pDestinationVoice,
  527. [in] UINT32 SourceChannels,
  528. [in] UINT32 DestinationChannels,
  529. [out, size_is(SourceChannels * DestinationChannels)] float* pLevelMatrix);
  530. void DestroyVoice();
  531. }
  532. typedef struct XAUDIO2_BUFFER
  533. {
  534. UINT32 Flags;
  535. UINT32 AudioBytes;
  536. const BYTE* pAudioData;
  537. UINT32 PlayBegin;
  538. UINT32 PlayLength;
  539. UINT32 LoopBegin;
  540. UINT32 LoopLength;
  541. UINT32 LoopCount;
  542. void* pContext;
  543. } XAUDIO2_BUFFER;
  544. typedef struct XAUDIO2_BUFFER_WMA
  545. {
  546. const UINT32* pDecodedPacketCumulativeBytes;
  547. UINT32 PacketCount;
  548. } XAUDIO2_BUFFER_WMA;
  549. typedef struct XAUDIO2_VOICE_STATE
  550. {
  551. void* pCurrentBufferContext;
  552. UINT32 BuffersQueued;
  553. UINT64 SamplesPlayed;
  554. } XAUDIO2_VOICE_STATE;
  555. [
  556. local
  557. ]
  558. /* XAudio2 2.0's IXAudio2SourceVoice interface. Actually called
  559. * IXAudio2SourceVoice in the Mar 2008 DX SDK */
  560. interface IXAudio20SourceVoice : IXAudio20Voice
  561. {
  562. HRESULT Start(
  563. [in, defaultvalue(0)] UINT32 Flags,
  564. [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
  565. HRESULT Stop(
  566. [in, defaultvalue(0)] UINT32 Flags,
  567. [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
  568. HRESULT SubmitSourceBuffer(
  569. [in] const XAUDIO2_BUFFER* pBuffer,
  570. [in, defaultvalue(NULL)] const XAUDIO2_BUFFER_WMA* pBufferWMA);
  571. HRESULT FlushSourceBuffers();
  572. HRESULT Discontinuity();
  573. HRESULT ExitLoop([in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
  574. void GetState([out] XAUDIO2_VOICE_STATE* pVoiceState);
  575. HRESULT SetFrequencyRatio(
  576. [in] float Ratio,
  577. [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
  578. void GetFrequencyRatio([out] float* pRatio);
  579. }
  580. [
  581. local
  582. ]
  583. /* XAudio2 2.3's IXAudio2SourceVoice interface. Actually called
  584. * IXAudio2SourceVoice in the Nov 2008 DX SDK */
  585. interface IXAudio23SourceVoice : IXAudio23Voice
  586. {
  587. HRESULT Start(
  588. [in, defaultvalue(0)] UINT32 Flags,
  589. [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
  590. HRESULT Stop(
  591. [in, defaultvalue(0)] UINT32 Flags,
  592. [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
  593. HRESULT SubmitSourceBuffer(
  594. [in] const XAUDIO2_BUFFER* pBuffer,
  595. [in, defaultvalue(NULL)] const XAUDIO2_BUFFER_WMA* pBufferWMA);
  596. HRESULT FlushSourceBuffers();
  597. HRESULT Discontinuity();
  598. HRESULT ExitLoop([in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
  599. void GetState([out] XAUDIO2_VOICE_STATE* pVoiceState);
  600. HRESULT SetFrequencyRatio(
  601. [in] float Ratio,
  602. [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
  603. void GetFrequencyRatio([out] float* pRatio);
  604. }
  605. [
  606. local
  607. ]
  608. /* XAudio2 2.7's IXAudio2SourceVoice interface. Actually called
  609. * IXAudio2SourceVoice in the Jun 2010 DX SDK */
  610. interface IXAudio27SourceVoice : IXAudio27Voice
  611. {
  612. HRESULT Start(
  613. [in, defaultvalue(0)] UINT32 Flags,
  614. [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
  615. HRESULT Stop(
  616. [in, defaultvalue(0)] UINT32 Flags,
  617. [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
  618. HRESULT SubmitSourceBuffer(
  619. [in] const XAUDIO2_BUFFER* pBuffer,
  620. [in, defaultvalue(NULL)] const XAUDIO2_BUFFER_WMA* pBufferWMA);
  621. HRESULT FlushSourceBuffers();
  622. HRESULT Discontinuity();
  623. HRESULT ExitLoop([in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
  624. void GetState([out] XAUDIO2_VOICE_STATE* pVoiceState);
  625. HRESULT SetFrequencyRatio(
  626. [in] float Ratio,
  627. [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
  628. void GetFrequencyRatio([out] float* pRatio);
  629. HRESULT SetSourceSampleRate([in] UINT32 NewSourceSampleRate);
  630. }
  631. [
  632. local
  633. ]
  634. /* XAudio2 2.8's IXAudio2SourceVoice interface. */
  635. interface IXAudio2SourceVoice : IXAudio2Voice
  636. {
  637. HRESULT Start(
  638. [in, defaultvalue(0)] UINT32 Flags,
  639. [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
  640. HRESULT Stop(
  641. [in, defaultvalue(0)] UINT32 Flags,
  642. [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
  643. HRESULT SubmitSourceBuffer(
  644. [in] const XAUDIO2_BUFFER* pBuffer,
  645. [in, defaultvalue(NULL)] const XAUDIO2_BUFFER_WMA* pBufferWMA);
  646. HRESULT FlushSourceBuffers();
  647. HRESULT Discontinuity();
  648. HRESULT ExitLoop([in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
  649. void GetState([out] XAUDIO2_VOICE_STATE* pVoiceState, [in, defaultvalue(0)] UINT32 Flags);
  650. HRESULT SetFrequencyRatio(
  651. [in] float Ratio,
  652. [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
  653. void GetFrequencyRatio([out] float* pRatio);
  654. HRESULT SetSourceSampleRate([in] UINT32 NewSourceSampleRate);
  655. }
  656. [
  657. local
  658. ]
  659. /* XAudio2 2.0's IXAudio2SubmixVoice interface. Actually called
  660. * IXAudio2SubmixVoice in the Mar 2008 DX SDK */
  661. interface IXAudio20SubmixVoice : IXAudio20Voice
  662. {
  663. }
  664. [
  665. local
  666. ]
  667. /* XAudio2 2.3's IXAudio2SubmixVoice interface. Actually called
  668. * IXAudio2SubmixVoice in the Nov 2008 DX SDK */
  669. interface IXAudio23SubmixVoice : IXAudio23Voice
  670. {
  671. }
  672. [
  673. local
  674. ]
  675. /* XAudio2 2.7's IXAudio2SubmixVoice interface. Actually called
  676. * IXAudio2SubmixVoice in the Jun 2010 DX SDK */
  677. interface IXAudio27SubmixVoice : IXAudio27Voice
  678. {
  679. }
  680. [
  681. local
  682. ]
  683. interface IXAudio2SubmixVoice : IXAudio2Voice
  684. {
  685. }
  686. [
  687. local
  688. ]
  689. /* XAudio2 2.0's IXAudio2MasteringVoice interface. Actually called
  690. * IXAudio2MasteringVoice in the Mar 2008 DX SDK */
  691. interface IXAudio20MasteringVoice : IXAudio20Voice
  692. {
  693. }
  694. [
  695. local
  696. ]
  697. /* XAudio2 2.3's IXAudio2MasteringVoice interface. Actually called
  698. * IXAudio2MasteringVoice in the Nov 2008 DX SDK */
  699. interface IXAudio23MasteringVoice : IXAudio23Voice
  700. {
  701. }
  702. [
  703. local
  704. ]
  705. /* XAudio2 2.7's IXAudio2MasteringVoice interface. Actually called
  706. * IXAudio2MasteringVoice in the Jun 2010 DX SDK */
  707. interface IXAudio27MasteringVoice : IXAudio27Voice
  708. {
  709. }
  710. [
  711. local
  712. ]
  713. interface IXAudio2MasteringVoice : IXAudio2Voice
  714. {
  715. /* not present in XAudio2 2.7 */
  716. void GetChannelMask([out] DWORD *pChannelMask);
  717. }
  718. [
  719. object,
  720. local
  721. ]
  722. interface IXAudio20VoiceCallback
  723. {
  724. void OnVoiceProcessingPassStart();
  725. void OnVoiceProcessingPassEnd();
  726. void OnStreamEnd();
  727. void OnBufferStart([in] void* pBufferContext);
  728. void OnBufferEnd([in] void* pBufferContext);
  729. void OnLoopEnd([in] void* pBufferContext);
  730. void OnVoiceError(
  731. [in] void* pBuffercontext,
  732. [in] HRESULT Error);
  733. }
  734. [
  735. object,
  736. local
  737. ]
  738. interface IXAudio2VoiceCallback
  739. {
  740. void OnVoiceProcessingPassStart([in] UINT32 BytesRequired);
  741. void OnVoiceProcessingPassEnd();
  742. void OnStreamEnd();
  743. void OnBufferStart([in] void* pBufferContext);
  744. void OnBufferEnd([in] void* pBufferContext);
  745. void OnLoopEnd([in] void* pBufferContext);
  746. void OnVoiceError(
  747. [in] void* pBuffercontext,
  748. [in] HRESULT Error);
  749. }
  750. typedef struct XAUDIO2_DEBUG_CONFIGURATION
  751. {
  752. UINT32 TraceMask;
  753. UINT32 BreakMask;
  754. BOOL LogThreadID;
  755. BOOL LogFileline;
  756. BOOL LogFunctionName;
  757. BOOL LogTiming;
  758. } XAUDIO2_DEBUG_CONFIGURATION;
  759. [
  760. object,
  761. uuid(8bcf1f58-9fe7-4583-8ac6-e2adc465c8bb), /* all versions before 28 share IID_IXAudio */
  762. ]
  763. /* XAudio2 2.0's IXAudio2 interface. Actually called IXAudio2 in the Mar 2008
  764. * DX SDK */
  765. interface IXAudio20 : IUnknown
  766. {
  767. HRESULT GetDeviceCount([out] UINT32* pCount);
  768. HRESULT GetDeviceDetails(
  769. [in] UINT32 Index,
  770. [out] XAUDIO2_DEVICE_DETAILS* pDeviceDetails);
  771. HRESULT Initialize(
  772. [in, defaultvalue(0)] UINT32 Flags,
  773. [in, defaultvalue(XAUDIO2_DEFAULT_PROCESSOR)] XAUDIO2_PROCESSOR XAudio2Processor);
  774. HRESULT RegisterForCallbacks([in] IXAudio2EngineCallback* pCallback);
  775. void UnregisterForCallbacks([in] IXAudio2EngineCallback* pCallback);
  776. HRESULT CreateSourceVoice(
  777. [out] IXAudio2SourceVoice** ppSourceVoice,
  778. [in] const WAVEFORMATEX* pSourceFormat,
  779. [in, defaultvalue(0)] UINT32 Flags,
  780. [in, defaultvalue(XAUDIO2_DEFAULT_FREQ_RATIO)] float MaxFrequencyRatio,
  781. [in, defaultvalue(NULL)] IXAudio2VoiceCallback* pCallback,
  782. [in, defaultvalue(NULL)] const XAUDIO23_VOICE_SENDS* pSendList,
  783. [in, defaultvalue(NULL)] const XAUDIO2_EFFECT_CHAIN* pEffectChain);
  784. HRESULT CreateSubmixVoice(
  785. [out] IXAudio2SubmixVoice** ppSubmixVoice,
  786. [in] UINT32 InputChannels,
  787. [in] UINT32 InputSampleRate,
  788. [in, defaultvalue(0)] UINT32 Flags,
  789. [in, defaultvalue(0)] UINT32 ProcessingStage,
  790. [in, defaultvalue(NULL)] const XAUDIO23_VOICE_SENDS* pSendList,
  791. [in, defaultvalue(NULL)] const XAUDIO2_EFFECT_CHAIN* pEffectChain);
  792. HRESULT CreateMasteringVoice(
  793. [out] IXAudio2MasteringVoice** ppMasteringVoice,
  794. [in, defaultvalue(XAUDIO2_DEFAULT_CHANNELS)] UINT32 InputChannels,
  795. [in, defaultvalue(XAUDIO2_DEFAULT_SAMPLERATE)] UINT32 InputSampleRate,
  796. [in, defaultvalue(0)] UINT32 Flags,
  797. [in, defaultvalue(0)] UINT32 DeviceIndex,
  798. [in, defaultvalue(NULL)] const XAUDIO2_EFFECT_CHAIN* pEffectChain);
  799. HRESULT StartEngine();
  800. void StopEngine();
  801. HRESULT CommitChanges([in] UINT32 OperationSet);
  802. void GetPerformanceData([out] XAUDIO20_PERFORMANCE_DATA* pPerfData);
  803. [local] void SetDebugConfiguration(
  804. [in] const XAUDIO2_DEBUG_CONFIGURATION* pDebugConfiguration,
  805. [in, defaultvalue(NULL)] void* pReserved);
  806. }
  807. [
  808. object,
  809. uuid(8bcf1f58-9fe7-4583-8ac6-e2adc465c8bb), /* all versions before 28 share IID_IXAudio */
  810. ]
  811. /* XAudio2 2.2's IXAudio2 interface. Actually called IXAudio2 in the Jun 2010
  812. * DX SDK */
  813. interface IXAudio22 : IUnknown
  814. {
  815. HRESULT GetDeviceCount([out] UINT32* pCount);
  816. HRESULT GetDeviceDetails(
  817. [in] UINT32 Index,
  818. [out] XAUDIO2_DEVICE_DETAILS* pDeviceDetails);
  819. HRESULT Initialize(
  820. [in, defaultvalue(0)] UINT32 Flags,
  821. [in, defaultvalue(XAUDIO2_DEFAULT_PROCESSOR)] XAUDIO2_PROCESSOR XAudio2Processor);
  822. HRESULT RegisterForCallbacks([in] IXAudio2EngineCallback* pCallback);
  823. void UnregisterForCallbacks([in] IXAudio2EngineCallback* pCallback);
  824. HRESULT CreateSourceVoice(
  825. [out] IXAudio2SourceVoice** ppSourceVoice,
  826. [in] const WAVEFORMATEX* pSourceFormat,
  827. [in, defaultvalue(0)] UINT32 Flags,
  828. [in, defaultvalue(XAUDIO2_DEFAULT_FREQ_RATIO)] float MaxFrequencyRatio,
  829. [in, defaultvalue(NULL)] IXAudio2VoiceCallback* pCallback,
  830. [in, defaultvalue(NULL)] const XAUDIO23_VOICE_SENDS* pSendList,
  831. [in, defaultvalue(NULL)] const XAUDIO2_EFFECT_CHAIN* pEffectChain);
  832. HRESULT CreateSubmixVoice(
  833. [out] IXAudio2SubmixVoice** ppSubmixVoice,
  834. [in] UINT32 InputChannels,
  835. [in] UINT32 InputSampleRate,
  836. [in, defaultvalue(0)] UINT32 Flags,
  837. [in, defaultvalue(0)] UINT32 ProcessingStage,
  838. [in, defaultvalue(NULL)] const XAUDIO23_VOICE_SENDS* pSendList,
  839. [in, defaultvalue(NULL)] const XAUDIO2_EFFECT_CHAIN* pEffectChain);
  840. HRESULT CreateMasteringVoice(
  841. [out] IXAudio2MasteringVoice** ppMasteringVoice,
  842. [in, defaultvalue(XAUDIO2_DEFAULT_CHANNELS)] UINT32 InputChannels,
  843. [in, defaultvalue(XAUDIO2_DEFAULT_SAMPLERATE)] UINT32 InputSampleRate,
  844. [in, defaultvalue(0)] UINT32 Flags,
  845. [in, defaultvalue(0)] UINT32 DeviceIndex,
  846. [in, defaultvalue(NULL)] const XAUDIO2_EFFECT_CHAIN* pEffectChain);
  847. HRESULT StartEngine();
  848. void StopEngine();
  849. HRESULT CommitChanges([in] UINT32 OperationSet);
  850. void GetPerformanceData([out] XAUDIO22_PERFORMANCE_DATA* pPerfData);
  851. [local] void SetDebugConfiguration(
  852. [in] const XAUDIO2_DEBUG_CONFIGURATION* pDebugConfiguration,
  853. [in, defaultvalue(NULL)] void* pReserved);
  854. }
  855. [
  856. object,
  857. uuid(8bcf1f58-9fe7-4583-8ac6-e2adc465c8bb), /* all versions before 28 share IID_IXAudio */
  858. ]
  859. /* XAudio2 2.3's IXAudio2 interface. Actually called IXAudio2 in the Nov 2008
  860. * DX SDK */
  861. interface IXAudio23 : IUnknown
  862. {
  863. HRESULT GetDeviceCount([out] UINT32* pCount);
  864. HRESULT GetDeviceDetails(
  865. [in] UINT32 Index,
  866. [out] XAUDIO2_DEVICE_DETAILS* pDeviceDetails);
  867. HRESULT Initialize(
  868. [in, defaultvalue(0)] UINT32 Flags,
  869. [in, defaultvalue(XAUDIO2_DEFAULT_PROCESSOR)] XAUDIO2_PROCESSOR XAudio2Processor);
  870. HRESULT RegisterForCallbacks([in] IXAudio2EngineCallback* pCallback);
  871. void UnregisterForCallbacks([in] IXAudio2EngineCallback* pCallback);
  872. HRESULT CreateSourceVoice(
  873. [out] IXAudio2SourceVoice** ppSourceVoice,
  874. [in] const WAVEFORMATEX* pSourceFormat,
  875. [in, defaultvalue(0)] UINT32 Flags,
  876. [in, defaultvalue(XAUDIO2_DEFAULT_FREQ_RATIO)] float MaxFrequencyRatio,
  877. [in, defaultvalue(NULL)] IXAudio2VoiceCallback* pCallback,
  878. [in, defaultvalue(NULL)] const XAUDIO23_VOICE_SENDS* pSendList,
  879. [in, defaultvalue(NULL)] const XAUDIO2_EFFECT_CHAIN* pEffectChain);
  880. HRESULT CreateSubmixVoice(
  881. [out] IXAudio2SubmixVoice** ppSubmixVoice,
  882. [in] UINT32 InputChannels,
  883. [in] UINT32 InputSampleRate,
  884. [in, defaultvalue(0)] UINT32 Flags,
  885. [in, defaultvalue(0)] UINT32 ProcessingStage,
  886. [in, defaultvalue(NULL)] const XAUDIO23_VOICE_SENDS* pSendList,
  887. [in, defaultvalue(NULL)] const XAUDIO2_EFFECT_CHAIN* pEffectChain);
  888. HRESULT CreateMasteringVoice(
  889. [out] IXAudio2MasteringVoice** ppMasteringVoice,
  890. [in, defaultvalue(XAUDIO2_DEFAULT_CHANNELS)] UINT32 InputChannels,
  891. [in, defaultvalue(XAUDIO2_DEFAULT_SAMPLERATE)] UINT32 InputSampleRate,
  892. [in, defaultvalue(0)] UINT32 Flags,
  893. [in, defaultvalue(0)] UINT32 DeviceIndex,
  894. [in, defaultvalue(NULL)] const XAUDIO2_EFFECT_CHAIN* pEffectChain);
  895. HRESULT StartEngine();
  896. void StopEngine();
  897. HRESULT CommitChanges([in] UINT32 OperationSet);
  898. void GetPerformanceData([out] XAUDIO2_PERFORMANCE_DATA* pPerfData);
  899. [local] void SetDebugConfiguration(
  900. [in] const XAUDIO2_DEBUG_CONFIGURATION* pDebugConfiguration,
  901. [in, defaultvalue(NULL)] void* pReserved);
  902. }
  903. [
  904. object,
  905. uuid(8bcf1f58-9fe7-4583-8ac6-e2adc465c8bb),
  906. ]
  907. /* XAudio2 2.7's IXAudio2 interface. Actually called IXAudio2 in the Jun 2010
  908. * DX SDK */
  909. interface IXAudio27 : IUnknown
  910. {
  911. HRESULT GetDeviceCount([out] UINT32* pCount);
  912. HRESULT GetDeviceDetails(
  913. [in] UINT32 Index,
  914. [out] XAUDIO2_DEVICE_DETAILS* pDeviceDetails);
  915. HRESULT Initialize(
  916. [in, defaultvalue(0)] UINT32 Flags,
  917. [in, defaultvalue(XAUDIO2_DEFAULT_PROCESSOR)] XAUDIO2_PROCESSOR XAudio2Processor);
  918. HRESULT RegisterForCallbacks([in] IXAudio2EngineCallback* pCallback);
  919. void UnregisterForCallbacks([in] IXAudio2EngineCallback* pCallback);
  920. HRESULT CreateSourceVoice(
  921. [out] IXAudio2SourceVoice** ppSourceVoice,
  922. [in] const WAVEFORMATEX* pSourceFormat,
  923. [in, defaultvalue(0)] UINT32 Flags,
  924. [in, defaultvalue(XAUDIO2_DEFAULT_FREQ_RATIO)] float MaxFrequencyRatio,
  925. [in, defaultvalue(NULL)] IXAudio2VoiceCallback* pCallback,
  926. [in, defaultvalue(NULL)] const XAUDIO2_VOICE_SENDS* pSendList,
  927. [in, defaultvalue(NULL)] const XAUDIO2_EFFECT_CHAIN* pEffectChain);
  928. HRESULT CreateSubmixVoice(
  929. [out] IXAudio2SubmixVoice** ppSubmixVoice,
  930. [in] UINT32 InputChannels,
  931. [in] UINT32 InputSampleRate,
  932. [in, defaultvalue(0)] UINT32 Flags,
  933. [in, defaultvalue(0)] UINT32 ProcessingStage,
  934. [in, defaultvalue(NULL)] const XAUDIO2_VOICE_SENDS* pSendList,
  935. [in, defaultvalue(NULL)] const XAUDIO2_EFFECT_CHAIN* pEffectChain);
  936. HRESULT CreateMasteringVoice(
  937. [out] IXAudio2MasteringVoice** ppMasteringVoice,
  938. [in, defaultvalue(XAUDIO2_DEFAULT_CHANNELS)] UINT32 InputChannels,
  939. [in, defaultvalue(XAUDIO2_DEFAULT_SAMPLERATE)] UINT32 InputSampleRate,
  940. [in, defaultvalue(0)] UINT32 Flags,
  941. [in, defaultvalue(0)] UINT32 DeviceIndex,
  942. [in, defaultvalue(NULL)] const XAUDIO2_EFFECT_CHAIN* pEffectChain);
  943. HRESULT StartEngine();
  944. void StopEngine();
  945. HRESULT CommitChanges([in] UINT32 OperationSet);
  946. void GetPerformanceData([out] XAUDIO2_PERFORMANCE_DATA* pPerfData);
  947. [local] void SetDebugConfiguration(
  948. [in] const XAUDIO2_DEBUG_CONFIGURATION* pDebugConfiguration,
  949. [in, defaultvalue(NULL)] void* pReserved);
  950. }
  951. /* XAudio2 2.8's IXAudio2 is identical to 2.9's */
  952. cpp_quote("DEFINE_GUID(IID_IXAudio28, 0x60d8dac8, 0x5aa1, 0x4e8e, 0xb5, 0x97, 0x2f, 0x5e, 0x28, 0x83, 0xd4, 0x84);")
  953. [
  954. object,
  955. uuid(2b02e3cf-2e0b-4ec3-be45-1b2a3fe7210d)
  956. ]
  957. /* XAudio2 2.9's IXAudio2 interface. */
  958. interface IXAudio2 : IUnknown
  959. {
  960. HRESULT RegisterForCallbacks([in] IXAudio2EngineCallback* pCallback);
  961. void UnregisterForCallbacks([in] IXAudio2EngineCallback* pCallback);
  962. HRESULT CreateSourceVoice(
  963. [out] IXAudio2SourceVoice** ppSourceVoice,
  964. [in] const WAVEFORMATEX* pSourceFormat,
  965. [in, defaultvalue(0)] UINT32 Flags,
  966. [in, defaultvalue(XAUDIO2_DEFAULT_FREQ_RATIO)] float MaxFrequencyRatio,
  967. [in, defaultvalue(NULL)] IXAudio2VoiceCallback* pCallback,
  968. [in, defaultvalue(NULL)] const XAUDIO2_VOICE_SENDS* pSendList,
  969. [in, defaultvalue(NULL)] const XAUDIO2_EFFECT_CHAIN* pEffectChain);
  970. HRESULT CreateSubmixVoice(
  971. [out] IXAudio2SubmixVoice** ppSubmixVoice,
  972. [in] UINT32 InputChannels,
  973. [in] UINT32 InputSampleRate,
  974. [in, defaultvalue(0)] UINT32 Flags,
  975. [in, defaultvalue(0)] UINT32 ProcessingStage,
  976. [in, defaultvalue(NULL)] const XAUDIO2_VOICE_SENDS* pSendList,
  977. [in, defaultvalue(NULL)] const XAUDIO2_EFFECT_CHAIN* pEffectChain);
  978. HRESULT CreateMasteringVoice(
  979. [out] IXAudio2MasteringVoice** ppMasteringVoice,
  980. [in, defaultvalue(XAUDIO2_DEFAULT_CHANNELS)] UINT32 InputChannels,
  981. [in, defaultvalue(XAUDIO2_DEFAULT_SAMPLERATE)] UINT32 InputSampleRate,
  982. [in, defaultvalue(0)] UINT32 Flags,
  983. [in, defaultvalue(NULL)] LPCWSTR DeviceId,
  984. [in, defaultvalue(NULL)] const XAUDIO2_EFFECT_CHAIN* pEffectChain,
  985. [in, defaultvalue(AudioCategory_GameEffects)] AUDIO_STREAM_CATEGORY StreamCategory);
  986. HRESULT StartEngine();
  987. void StopEngine();
  988. HRESULT CommitChanges([in] UINT32 OperationSet);
  989. void GetPerformanceData([out] XAUDIO2_PERFORMANCE_DATA* pPerfData);
  990. [local] void SetDebugConfiguration(
  991. [in] const XAUDIO2_DEBUG_CONFIGURATION* pDebugConfiguration,
  992. [in, defaultvalue(NULL)] void* pReserved);
  993. }
  994. const UINT32 XAUDIO2_DEBUG_ENGINE = 1;
  995. const UINT32 XAUDIO2_VOICE_NOPITCH = 2;
  996. const UINT32 XAUDIO2_VOICE_NOSRC = 4;
  997. const UINT32 XAUDIO2_VOICE_USEFILTER = 8;
  998. const UINT32 XAUDIO2_VOICE_MUSIC = 16;
  999. const UINT32 XAUDIO2_PLAY_TAILS = 32;
  1000. const UINT32 XAUDIO2_END_OF_STREAM = 64;
  1001. const UINT32 XAUDIO2_SEND_USEFILTER = 128;
  1002. const UINT32 XAUDIO2_VOICE_NOSAMPLESPLAYED = 256;
  1003. const XAUDIO2_FILTER_TYPE XAUDIO2_DEFAULT_FILTER_TYPE = LowPassFilter;
  1004. const float XAUDIO2_DEFAULT_FILTER_FREQUENCY = XAUDIO2_MAX_FILTER_FREQUENCY;
  1005. const float XAUDIO2_DEFAULT_FILTER_ONEOVERQ = 1.0;
  1006. const UINT32 XAUDIO2_QUANTUM_NUMERATOR = 1;
  1007. const UINT32 XAUDIO2_QUANTUM_DENOMINATOR = 100;
  1008. const float XAUDIO2_QUANTUM_MS = (1000.0 * XAUDIO2_QUANTUM_NUMERATOR / XAUDIO2_QUANTUM_DENOMINATOR);
  1009. /* use cpp_quote to retain the HRESULT type in header file */
  1010. cpp_quote("#define XAUDIO2_E_INVALID_CALL ((HRESULT)0x88960001)")
  1011. cpp_quote("#define XAUDIO2_E_XMA_DECODER_ERROR ((HRESULT)0x88960002)")
  1012. cpp_quote("#define XAUDIO2_E_XAPO_CREATION_FAILED ((HRESULT)0x88960003)")
  1013. cpp_quote("#define XAUDIO2_E_DEVICE_INVALIDATED ((HRESULT)0x88960004)")
  1014. /* xaudio 2.0 error codes */
  1015. cpp_quote("#define XAUDIO20_E_XMA_DECODER_ERROR ((HRESULT)0x88960001)")
  1016. cpp_quote("#define XAUDIO20_E_XAPO_CREATION_FAILED ((HRESULT)0x88960002)")
  1017. cpp_quote("#define XAUDIO20_E_DEVICE_INVALIDATED ((HRESULT)0x88960003)")
  1018. cpp_quote("#ifdef XAUDIO2_HELPER_FUNCTIONS")
  1019. cpp_quote("#define _USE_MATH_DEFINES")
  1020. cpp_quote("#include <math.h>")
  1021. cpp_quote("inline static float XAudio2DecibelsToAmplitudeRatio(float decibels) { return powf(10.0f, decibels/20.0f); }")
  1022. cpp_quote("inline static float XAudio2AmplitudeRatioToDecibels(float volume) { if (volume == 0) { return -3.402823466e+38f; } return 20.0f * log10f(volume); }")
  1023. cpp_quote("inline static float XAudio2SemitonesToFrequencyRatio(float semitones) { return powf(2.0f, semitones/12.0f); }")
  1024. cpp_quote("inline static float XAudio2FrequencyRatioToSemitones(float freqratio) { return 39.86313713864835f * log10f(freqratio); }")
  1025. cpp_quote("inline static float XAudio2CutoffFrequencyToRadians(float cutofffreq, UINT32 samplerate) { if ((UINT32)(cutofffreq * 6.0f) >= samplerate) { return XAUDIO2_MAX_FILTER_FREQUENCY; } return 2.0f * sinf((float)M_PI * cutofffreq / samplerate); }")
  1026. cpp_quote("inline static float XAudio2RadiansToCutoffFrequency(float radians, float samplerate) { return samplerate * asinf(radians/2.0f) / (float)M_PI; }")
  1027. cpp_quote("#endif")
  1028. cpp_quote("HRESULT WINAPI XAudio2Create(IXAudio2** pxaudio2, UINT32 flags, XAUDIO2_PROCESSOR processor);")
  1029. cpp_quote("#include <poppack.h>")