audioclient.idl 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. /*
  2. * Core Audio audioclient definitions
  3. *
  4. * (c) 2013 Corrected, and extended by mingw-w64 team
  5. * base on version Copyright 2009 Maarten Lankhorst
  6. *
  7. * This library is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Lesser General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2.1 of the License, or (at your option) any later version.
  11. *
  12. * This library is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with this library; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  20. *
  21. */
  22. cpp_quote("#include <winapifamily.h>")
  23. cpp_quote("")
  24. import "wtypes.idl";
  25. import "unknwn.idl";
  26. cpp_quote("")
  27. cpp_quote("#if 0")
  28. typedef [restricted, hidden] struct WAVEFORMATEX {
  29. WORD wFormatTag;
  30. WORD nChannels;
  31. DWORD nSamplesPerSec;
  32. DWORD nAvgBytesPerSec;
  33. WORD nBlockAlign;
  34. WORD wBitsPerSample;
  35. WORD cbSize;
  36. } WAVEFORMATEX;
  37. cpp_quote("")
  38. typedef [restricted, hidden] LONGLONG REFERENCE_TIME;
  39. cpp_quote("#else")
  40. cpp_quote("#define _IKsControl_")
  41. cpp_quote("")
  42. cpp_quote("#include <mmreg.h>")
  43. cpp_quote("#include <ks.h>")
  44. cpp_quote("#include <ksmedia.h>")
  45. cpp_quote("#endif")
  46. cpp_quote("")
  47. import "audiosessiontypes.h";
  48. cpp_quote("")
  49. cpp_quote("#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)")
  50. enum _AUDCLNT_BUFFERFLAGS {
  51. AUDCLNT_BUFFERFLAGS_DATA_DISCONTINUITY = 0x1,
  52. AUDCLNT_BUFFERFLAGS_SILENT = 0x2,
  53. AUDCLNT_BUFFERFLAGS_TIMESTAMP_ERROR = 0x4
  54. };
  55. typedef [v1_enum] enum AUDCLNT_STREAMOPTIONS {
  56. AUDCLNT_STREAMOPTIONS_NONE = 0x0,
  57. AUDCLNT_STREAMOPTIONS_RAW = 0x1,
  58. AUDCLNT_STREAMOPTIONS_MATCH_FORMAT = 0x2,
  59. AUDCLNT_STREAMOPTIONS_AMBISONICS = 0x4
  60. } AUDCLNT_STREAMOPTIONS;
  61. cpp_quote("DEFINE_ENUM_FLAG_OPERATORS(AUDCLNT_STREAMOPTIONS);")
  62. typedef enum AMBISONICS_TYPE {
  63. AMBISONICS_TYPE_FULL3D = 0x0
  64. } AMBISONICS_TYPE;
  65. typedef enum AMBISONICS_CHANNEL_ORDERING {
  66. AMBISONICS_CHANNEL_ORDERING_ACN = 0x0
  67. } AMBISONICS_CHANNEL_ORDERING;
  68. typedef enum AMBISONICS_NORMALIZATION {
  69. AMBISONICS_NORMALIZATION_SN3D = 0x0,
  70. AMBISONICS_NORMALIZATION_N3D = 0x1
  71. } AMBISONICS_NORMALIZATION;
  72. cpp_quote("")
  73. typedef struct AudioClientProperties {
  74. UINT32 cbSize;
  75. WINBOOL bIsOffload;
  76. AUDIO_STREAM_CATEGORY eCategory;
  77. AUDCLNT_STREAMOPTIONS Options;
  78. } AudioClientProperties;
  79. typedef struct AudioClient3ActivationParams {
  80. GUID tracingContextId;
  81. } AudioClient3ActivationParams;
  82. typedef struct AMBISONICS_PARAMS {
  83. UINT32 u32Size;
  84. UINT32 u32Version;
  85. AMBISONICS_TYPE u32Type;
  86. AMBISONICS_CHANNEL_ORDERING u32ChannelOrdering;
  87. AMBISONICS_NORMALIZATION u32Normalization;
  88. UINT32 u32Order;
  89. UINT32 u32NumChannels;
  90. UINT32 *pu32ChannelMap;
  91. } AMBISONICS_PARAMS;
  92. cpp_quote("")
  93. [object, local, uuid (1cb9ad4c-DBFA-4c32-B178-C2F568A703B2), pointer_default (unique)]
  94. interface IAudioClient : IUnknown {
  95. HRESULT Initialize ([in] AUDCLNT_SHAREMODE ShareMode,[in] DWORD StreamFlags,[in] REFERENCE_TIME hnsBufferDuration,[in] REFERENCE_TIME hnsPeriodicity,[in] const WAVEFORMATEX *pFormat,[in] LPCGUID AudioSessionGuid);
  96. HRESULT GetBufferSize ([out] UINT32 *pNumBufferFrames);
  97. HRESULT GetStreamLatency ([out] REFERENCE_TIME *phnsLatency);
  98. HRESULT GetCurrentPadding ([out] UINT32 *pNumPaddingFrames);
  99. HRESULT IsFormatSupported ([in] AUDCLNT_SHAREMODE ShareMode,[in] const WAVEFORMATEX *pFormat,[out, unique] WAVEFORMATEX **ppClosestMatch);
  100. HRESULT GetMixFormat ([out] WAVEFORMATEX **ppDeviceFormat);
  101. HRESULT GetDevicePeriod ([out] REFERENCE_TIME *phnsDefaultDevicePeriod,[out] REFERENCE_TIME *phnsMinimumDevicePeriod);
  102. HRESULT Start ();
  103. HRESULT Stop ();
  104. HRESULT Reset ();
  105. HRESULT SetEventHandle ([in] HANDLE eventHandle);
  106. HRESULT GetService ([in] REFIID riid,[out, iid_is (riid)] void **ppv);
  107. }
  108. cpp_quote("")
  109. [object, local, uuid (726778cd-F60A-4eda-82de-E47610CD78AA), pointer_default (unique)]
  110. interface IAudioClient2 : IAudioClient {
  111. HRESULT IsOffloadCapable ([in] AUDIO_STREAM_CATEGORY Category,[in] WINBOOL *pbOffloadCapable);
  112. HRESULT SetClientProperties ([in] const AudioClientProperties *pProperties);
  113. HRESULT GetBufferSizeLimits ([in] const WAVEFORMATEX *pFormat,[in] WINBOOL bEventDriven,[in] REFERENCE_TIME *phnsMinBufferDuration,[in] REFERENCE_TIME *phnsMaxBufferDuration);
  114. }
  115. [object, local, uuid (7ed4ee07-8e67-4cd4-8c1a-2b7a5987ad42), pointer_default (unique)]
  116. interface IAudioClient3 : IAudioClient2 {
  117. HRESULT GetSharedModeEnginePeriod ([in] const WAVEFORMATEX *pFormat, [out] UINT32 *pDefaultPeriodInFrames, [out] UINT32 *pFundamentalPeriodInFrames, [out] UINT32 *pMinPeriodInFrames, [out] UINT32 *pMaxPeriodInFrames);
  118. HRESULT GetCurrentSharedModeEnginePeriod ([out, unique] WAVEFORMATEX **ppFormat, [out] UINT32 *pCurrentPeriodInFrames);
  119. HRESULT InitializeSharedAudioStream ([in] DWORD StreamFlags, [in] UINT32 PeriodInFrames, [in] const WAVEFORMATEX *pFormat, [in] LPCGUID AudioSessionGuid);
  120. }
  121. cpp_quote("")
  122. [object, local, uuid (F294ACFC-3146-4483-A7BF-ADDCA7C260E2), helpstring ("IAudioRenderClient Interface"), pointer_default (unique)]
  123. interface IAudioRenderClient : IUnknown {
  124. HRESULT GetBuffer ([in] UINT32 NumFramesRequested,[out] BYTE **ppData);
  125. HRESULT ReleaseBuffer ([in] UINT32 NumFramesWritten,[in] DWORD dwFlags);
  126. }
  127. cpp_quote("")
  128. [object, local, uuid (C8ADBD64-E71E-48a0-A4DE-185c395cd317), helpstring ("IAudioCaptureClient Interface"), pointer_default (unique)]
  129. interface IAudioCaptureClient : IUnknown {
  130. HRESULT GetBuffer ([out] BYTE **ppData,[out] UINT32 *pNumFramesToRead,[out] DWORD *pdwFlags,[out, unique] UINT64 *pu64DevicePosition,[out, unique] UINT64 *pu64QPCPosition);
  131. HRESULT ReleaseBuffer ([in] UINT32 NumFramesRead);
  132. HRESULT GetNextPacketSize ([out] UINT32 *pNumFramesInNextPacket);
  133. }
  134. cpp_quote("")
  135. cpp_quote("#define AUDIOCLOCK_CHARACTERISTIC_FIXED_FREQ 0x1")
  136. cpp_quote("")
  137. [object, local, uuid (CD63314F-3fba-4a1b-812c-EF96358728E7), pointer_default (unique)]
  138. interface IAudioClock : IUnknown {
  139. HRESULT GetFrequency ([out] UINT64 *pu64Frequency);
  140. HRESULT GetPosition ([out] UINT64 *pu64Position,[out, unique] UINT64 *pu64QPCPosition);
  141. HRESULT GetCharacteristics ([out] DWORD *pdwCharacteristics);
  142. };
  143. cpp_quote("#endif")
  144. cpp_quote("")
  145. cpp_quote("#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)")
  146. [object, local, uuid (6f49ff73-6727-49ac-a008-d98cf5e70048), pointer_default (unique)]
  147. interface IAudioClock2 : IUnknown {
  148. HRESULT GetDevicePosition ([out] UINT64 *DevicePosition,[out, unique] UINT64 *QPCPosition);
  149. };
  150. cpp_quote("")
  151. [local, uuid (f6e4c0a0-46d9-4fb8-be21-57a3ef2b626c), pointer_default (unique)]
  152. interface IAudioClockAdjustment : IUnknown {
  153. HRESULT SetSampleRate ([in] float flSampleRate);
  154. };
  155. cpp_quote("#endif")
  156. cpp_quote("")
  157. cpp_quote("#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)")
  158. [object, local, uuid (87ce5498-68d6-44e5-9215-6da47ef883d8), pointer_default (unique)]
  159. interface ISimpleAudioVolume : IUnknown {
  160. HRESULT SetMasterVolume ([in] float fLevel,[in, unique] LPCGUID EventContext);
  161. HRESULT GetMasterVolume ([out] float *pfLevel);
  162. HRESULT SetMute ([in] const WINBOOL bMute,[in, unique] LPCGUID EventContext);
  163. HRESULT GetMute ([out] WINBOOL *pbMute);
  164. }
  165. cpp_quote("#endif")
  166. cpp_quote("")
  167. cpp_quote("#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)")
  168. [object, local, uuid (93014887-242d-4068-8a15-CF5E93B90FE3), pointer_default (unique)]
  169. interface IAudioStreamVolume : IUnknown {
  170. HRESULT GetChannelCount ([out] UINT32 *pdwCount);
  171. HRESULT SetChannelVolume ([in] UINT32 dwIndex,[in] const float fLevel);
  172. HRESULT GetChannelVolume ([in] UINT32 dwIndex,[out] float *pfLevel);
  173. HRESULT SetAllVolumes ([in] UINT32 dwCount,[in, size_is (dwCount)] const float *pfVolumes);
  174. HRESULT GetAllVolumes ([in] UINT32 dwCount,[out, size_is (dwCount),] float *pfVolumes);
  175. }
  176. [object, local, uuid (28724c91-df35-4856-9f76-d6a26413f3df), pointer_default (unique)]
  177. interface IAudioAmbisonicsControl : IUnknown {
  178. HRESULT SetData([in] const AMBISONICS_PARAMS *pAmbisonicsParams, [in] UINT32 cbAmbisonicsParams);
  179. HRESULT SetHeadTracking([in] WINBOOL bEnableHeadTracking);
  180. HRESULT GetHeadTracking([out] WINBOOL *pbEnableHeadTracking);
  181. HRESULT SetRotation([in] float X, [in] float Y, [in] float Z, [in] float W);
  182. }
  183. cpp_quote("")
  184. [object, local, uuid (1c158861-B533-4b30-B1CF-E853E51C59B8), pointer_default (unique)]
  185. interface IChannelAudioVolume : IUnknown {
  186. HRESULT GetChannelCount ([out] UINT32 *pdwCount);
  187. HRESULT SetChannelVolume ([in] UINT32 dwIndex,[in] const float fLevel,[in, unique] LPCGUID EventContext);
  188. HRESULT GetChannelVolume ([in] UINT32 dwIndex,[out] float *pfLevel);
  189. HRESULT SetAllVolumes ([in] UINT32 dwCount,[in, size_is (dwCount)] const float *pfVolumes,[in, unique] LPCGUID EventContext);
  190. HRESULT GetAllVolumes ([in] UINT32 dwCount,[out, size_is (dwCount),] float *pfVolumes);
  191. }
  192. cpp_quote("#endif")
  193. cpp_quote("")
  194. cpp_quote("#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)")
  195. cpp_quote("#define AUDCLNT_ERR(n) MAKE_HRESULT(SEVERITY_ERROR, FACILITY_AUDCLNT, n)")
  196. cpp_quote("#define AUDCLNT_SUCCESS(n) MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_AUDCLNT, n)")
  197. cpp_quote("")
  198. cpp_quote("#define AUDCLNT_E_NOT_INITIALIZED AUDCLNT_ERR(0x1)")
  199. cpp_quote("#define AUDCLNT_E_ALREADY_INITIALIZED AUDCLNT_ERR(0x2)")
  200. cpp_quote("#define AUDCLNT_E_WRONG_ENDPOINT_TYPE AUDCLNT_ERR(0x3)")
  201. cpp_quote("#define AUDCLNT_E_DEVICE_INVALIDATED AUDCLNT_ERR(0x4)")
  202. cpp_quote("#define AUDCLNT_E_NOT_STOPPED AUDCLNT_ERR(0x5)")
  203. cpp_quote("#define AUDCLNT_E_BUFFER_TOO_LARGE AUDCLNT_ERR(0x6)")
  204. cpp_quote("#define AUDCLNT_E_OUT_OF_ORDER AUDCLNT_ERR(0x7)")
  205. cpp_quote("#define AUDCLNT_E_UNSUPPORTED_FORMAT AUDCLNT_ERR(0x8)")
  206. cpp_quote("#define AUDCLNT_E_INVALID_SIZE AUDCLNT_ERR(0x9)")
  207. cpp_quote("#define AUDCLNT_E_DEVICE_IN_USE AUDCLNT_ERR(0xa)")
  208. cpp_quote("#define AUDCLNT_E_BUFFER_OPERATION_PENDING AUDCLNT_ERR(0xb)")
  209. cpp_quote("#define AUDCLNT_E_THREAD_NOT_REGISTERED AUDCLNT_ERR(0xc)")
  210. cpp_quote("#define AUDCLNT_E_EXCLUSIVE_MODE_NOT_ALLOWED AUDCLNT_ERR(0xe)")
  211. cpp_quote("#define AUDCLNT_E_ENDPOINT_CREATE_FAILED AUDCLNT_ERR(0xf)")
  212. cpp_quote("#define AUDCLNT_E_SERVICE_NOT_RUNNING AUDCLNT_ERR(0x10)")
  213. cpp_quote("#define AUDCLNT_E_EVENTHANDLE_NOT_EXPECTED AUDCLNT_ERR(0x11)")
  214. cpp_quote("#define AUDCLNT_E_EXCLUSIVE_MODE_ONLY AUDCLNT_ERR(0x12)")
  215. cpp_quote("#define AUDCLNT_E_BUFDURATION_PERIOD_NOT_EQUAL AUDCLNT_ERR(0x13)")
  216. cpp_quote("#define AUDCLNT_E_EVENTHANDLE_NOT_SET AUDCLNT_ERR(0x14)")
  217. cpp_quote("#define AUDCLNT_E_INCORRECT_BUFFER_SIZE AUDCLNT_ERR(0x15)")
  218. cpp_quote("#define AUDCLNT_E_BUFFER_SIZE_ERROR AUDCLNT_ERR(0x16)")
  219. cpp_quote("#define AUDCLNT_E_CPUUSAGE_EXCEEDED AUDCLNT_ERR(0x17)")
  220. cpp_quote("#define AUDCLNT_E_BUFFER_ERROR AUDCLNT_ERR(0x18)")
  221. cpp_quote("#define AUDCLNT_E_BUFFER_SIZE_NOT_ALIGNED AUDCLNT_ERR(0x19)")
  222. cpp_quote("#define AUDCLNT_E_INVALID_DEVICE_PERIOD AUDCLNT_ERR(0x20)")
  223. cpp_quote("#define AUDCLNT_E_INVALID_STREAM_FLAG AUDCLNT_ERR(0x21)")
  224. cpp_quote("#define AUDCLNT_E_ENDPOINT_OFFLOAD_NOT_CAPABLE AUDCLNT_ERR(0x22)")
  225. cpp_quote("#define AUDCLNT_E_OUT_OF_OFFLOAD_RESOURCES AUDCLNT_ERR(0x23)")
  226. cpp_quote("#define AUDCLNT_E_OFFLOAD_MODE_ONLY AUDCLNT_ERR(0x24)")
  227. cpp_quote("#define AUDCLNT_E_NONOFFLOAD_MODE_ONLY AUDCLNT_ERR(0x25)")
  228. cpp_quote("#define AUDCLNT_E_RESOURCES_INVALIDATED AUDCLNT_ERR(0x26)")
  229. cpp_quote("#define AUDCLNT_E_RAW_MODE_UNSUPPORTED AUDCLNT_ERR(0x027)")
  230. cpp_quote("#define AUDCLNT_E_ENGINE_PERIODICITY_LOCKED AUDCLNT_ERR(0x028)")
  231. cpp_quote("#define AUDCLNT_E_ENGINE_FORMAT_LOCKED AUDCLNT_ERR(0x029)")
  232. cpp_quote("#define AUDCLNT_E_HEADTRACKING_ENABLED AUDCLNT_ERR(0x030)")
  233. cpp_quote("#define AUDCLNT_E_HEADTRACKING_UNSUPPORTED AUDCLNT_ERR(0x040)")
  234. cpp_quote("#define AUDCLNT_S_BUFFER_EMPTY AUDCLNT_SUCCESS(0x1)")
  235. cpp_quote("#define AUDCLNT_S_THREAD_ALREADY_REGISTERED AUDCLNT_SUCCESS(0x2)")
  236. cpp_quote("#define AUDCLNT_S_POSITION_STALLED AUDCLNT_SUCCESS(0x3)")
  237. cpp_quote("#endif")