Advertisement
Kitomas

_kit_w32_audioCOM.h (scrapped)

Jul 14th, 2023
744
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 6.71 KB | Source Code | 0 0
  1. //used internally by kit_w32_audio to wrap c++ com interfaces for use in c
  2. //(i'm making the api intentionally verbose here)
  3. //interfaces implemented:
  4. //IMMDeviceEnumerator
  5. //IMMDeviceCollection
  6. //IMMDevice
  7. //IAudioClient
  8. //IAudioRenderClient
  9. //IPropertyStore
  10. #ifndef _KIT_W32_AUDIOCOM_H
  11. #define _KIT_W32_AUDIOCOM_H
  12.  
  13.  
  14.  
  15. #ifndef COM_NO_WINDOWS_H
  16. # define COM_NO_WINDOWS_H
  17. #  include <windef.h>
  18. #  include <winnt.h>
  19. //#  include <initguid.h>
  20. #  include <audioclient.h>
  21. #  include <mmdeviceapi.h>
  22. # undef COM_NO_WINDOWS_H
  23. #else
  24. #  include <windef.h>
  25. #  include <winnt.h>
  26. //#  include <initguid.h>
  27. #  include <audioclient.h>
  28. #  include <mmdeviceapi.h>
  29. #endif
  30.  
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif
  34.  
  35.  
  36.  
  37. //IMMDeviceEnumerator
  38.  
  39. extern HRESULT _kit_audioCOM_IMMDeviceEnumerator_EnumAudioEndpoints(IMMDeviceEnumerator* enumerator,
  40.   EDataFlow dataFlow_i, DWORD stateMask_i, IMMDeviceCollection** devices_o);
  41.  
  42.  
  43. extern HRESULT _kit_audioCOM_IMMDeviceEnumerator_GetDefaultAudioEndpoint(IMMDeviceEnumerator* enumerator,
  44.   EDataFlow dataFlow_i, ERole role_i, IMMDevice** endpoint_o);
  45.  
  46.  
  47. extern HRESULT _kit_audioCOM_IMMDeviceEnumerator_GetDevice(IMMDeviceEnumerator* enumerator,
  48.   LPCWSTR strID_i, IMMDevice** device_o);
  49.  
  50.  
  51. extern HRESULT _kit_audioCOM_IMMDeviceEnumerator_RegisterEndpointNotificationCallback(IMMDeviceEnumerator* enumerator,
  52.   IMMNotificationClient* client_i);
  53.  
  54.  
  55. extern HRESULT _kit_audioCOM_IMMDeviceEnumerator_UnregisterEndpointNotificationCallback(IMMDeviceEnumerator* enumerator,
  56.   IMMNotificationClient* client_i);
  57.  
  58.  
  59. extern HRESULT _kit_audioCOM_IMMDeviceEnumerator_QueryInterface(IMMDeviceEnumerator* enumerator,
  60.   IMMDeviceEnumerator** enumerator_o);
  61.  
  62.  
  63. extern ULONG _kit_audioCOM_IMMDeviceEnumerator_AddRef(IMMDeviceEnumerator* enumerator);
  64.  
  65.  
  66. extern ULONG _kit_audioCOM_IMMDeviceEnumerator_Release(IMMDeviceEnumerator* enumerator);
  67.  
  68.  
  69.  
  70. //IMMDeviceCollection
  71.  
  72. extern HRESULT _kit_audioCOM_IMMDeviceCollection_GetCount(IMMDeviceCollection* deviceCollection,
  73.   UINT* devices_o);
  74.  
  75.  
  76. extern HRESULT _kit_audioCOM_IMMDeviceCollection_Item(IMMDeviceCollection* deviceCollection,
  77.   UINT deviceNum_i, IMMDevice** device_o);
  78.  
  79.  
  80. extern HRESULT _kit_audioCOM_IMMDeviceCollection_QueryInterface(IMMDeviceCollection* deviceCollection,
  81.   IMMDeviceCollection** deviceCollection_o);
  82.  
  83.  
  84. extern ULONG _kit_audioCOM_IMMDeviceCollection_AddRef(IMMDeviceCollection* deviceCollection);
  85.  
  86.  
  87. extern ULONG _kit_audioCOM_IMMDeviceCollection_Release(IMMDeviceCollection* deviceCollection);
  88.  
  89.  
  90.  
  91. //IMMDevice
  92.  
  93. extern HRESULT _kit_audioCOM_IMMDevice_Activate(IMMDevice* device,
  94.   REFIID iid_i, DWORD clsCtx_i, PROPVARIANT* activationParams_i, void** interface_o);
  95.  
  96.  
  97. extern HRESULT _kit_audioCOM_IMMDevice_GetId(IMMDevice* device,
  98.   LPWSTR* strID_o);
  99.  
  100.  
  101. extern HRESULT _kit_audioCOM_IMMDevice_GetState(IMMDevice* device,
  102.   DWORD* state_o);
  103.  
  104.  
  105. extern HRESULT _kit_audioCOM_IMMDevice_OpenPropertyStore(IMMDevice* device,
  106.   DWORD access_i, IPropertyStore** properties_o);
  107.  
  108.  
  109. extern HRESULT _kit_audioCOM_IMMDevice_QueryInterface(IMMDevice* device,
  110.   IMMDevice** device_o);
  111.  
  112.  
  113. extern ULONG _kit_audioCOM_IMMDevice_AddRef(IMMDevice* device);
  114.  
  115.  
  116. extern ULONG _kit_audioCOM_IMMDevice_Release(IMMDevice* device);
  117.  
  118.  
  119.  
  120. //IAudioClient
  121.  
  122. extern HRESULT _kit_audioCOM_IAudioClient_GetBufferSize(IAudioClient* audioClient,
  123.   UINT32* numBufferFrames_o);
  124.  
  125.  
  126. extern HRESULT _kit_audioCOM_IAudioClient_GetCurrentPadding(IAudioClient* audioClient,
  127.   UINT32* numPaddingFrames_o);
  128.  
  129.  
  130. extern HRESULT _kit_audioCOM_IAudioClient_GetDevicePeriod(IAudioClient* audioClient,
  131.   REFERENCE_TIME* defaultDevicePeriod_o, REFERENCE_TIME* minimumDevicePeriod_o);
  132.  
  133.  
  134. extern HRESULT _kit_audioCOM_IAudioClient_GetMixFormat(IAudioClient* audioClient,
  135.   WAVEFORMATEX** deviceFormat_o);
  136.  
  137.  
  138. extern HRESULT _kit_audioCOM_IAudioClient_GetService(IAudioClient* audioClient,
  139.   REFIID riid_i, void** ppv_o);
  140.  
  141.  
  142. extern HRESULT _kit_audioCOM_IAudioClient_GetStreamLatency(IAudioClient* audioClient,
  143.   REFERENCE_TIME* latency_o);
  144.  
  145.  
  146. extern HRESULT _kit_audioCOM_IAudioClient_Initialize(IAudioClient* audioClient,
  147.   AUDCLNT_SHAREMODE shareMode_i, DWORD streamFlags_i, REFERENCE_TIME bufferDuration_i,
  148.   REFERENCE_TIME periodicity_i, const WAVEFORMATEX* format_i, LPCGUID audioSessionGUID_i);
  149.  
  150.  
  151. extern HRESULT _kit_audioCOM_IAudioClient_IsFormatSupported(IAudioClient* audioClient,
  152.   AUDCLNT_SHAREMODE shareMode_i, const WAVEFORMATEX* format_i, WAVEFORMATEX** closestMatch_o);
  153.  
  154.  
  155. extern HRESULT _kit_audioCOM_IAudioClient_Reset(IAudioClient* audioClient);
  156.  
  157.  
  158. extern HRESULT _kit_audioCOM_IAudioClient_SetEventHandle(IAudioClient* audioClient,
  159.   HANDLE eventHandle_i);
  160.  
  161.  
  162. extern HRESULT _kit_audioCOM_IAudioClient_Start(IAudioClient* audioClient);
  163.  
  164.  
  165. extern HRESULT _kit_audioCOM_IAudioClient_Stop(IAudioClient* audioClient);
  166.  
  167.  
  168. extern HRESULT _kit_audioCOM_IAudioClient_QueryInterface(IAudioClient* audioClient,
  169.   IAudioClient** audioClient_o);
  170.  
  171.  
  172. extern ULONG _kit_audioCOM_IAudioClient_AddRef(IAudioClient* audioClient);
  173.  
  174.  
  175. extern ULONG _kit_audioCOM_IAudioClient_Release(IAudioClient* audioClient);
  176.  
  177.  
  178.  
  179. //IAudioRenderClient
  180.  
  181. extern HRESULT _kit_audioCOM_IAudioRenderClient_GetBuffer(IAudioRenderClient* audioRenderClient,
  182.   UINT32 numFramesRequested_i, BYTE** data);
  183.  
  184.  
  185. extern HRESULT _kit_audioCOM_IAudioRenderClient_ReleaseBuffer(IAudioRenderClient* audioRenderClient,
  186.   UINT32 numFramesWritten_i, DWORD flags_i);
  187.  
  188.  
  189. extern HRESULT _kit_audioCOM_IAudioRenderClient_QueryInterface(IAudioRenderClient* audioRenderClient,
  190.   IAudioRenderClient** audioRenderClient_o);
  191.  
  192.  
  193. extern ULONG _kit_audioCOM_IAudioRenderClient_AddRef(IAudioRenderClient* audioRenderClient);
  194.  
  195.  
  196. extern ULONG _kit_audioCOM_IAudioRenderClient_Release(IAudioRenderClient* audioRenderClient);
  197.  
  198.  
  199.  
  200. //IPropertyStore
  201.  
  202. extern HRESULT _kit_audioCOM_IPropertyStore_Commit(IPropertyStore* properties);
  203.  
  204.  
  205. extern HRESULT _kit_audioCOM_IPropertyStore_GetAt(IPropertyStore* properties,
  206.   DWORD propertyKeyIndex_i, PROPERTYKEY* propertyKey_o);
  207.  
  208.  
  209. extern HRESULT _kit_audioCOM_IPropertyStore_GetCount(IPropertyStore* properties,
  210.   DWORD* numProperties_o);
  211.  
  212.  
  213. extern HRESULT _kit_audioCOM_IPropertyStore_GetValue(IPropertyStore* properties,
  214.   REFPROPERTYKEY key_i, PROPVARIANT* propertyVariant_o);
  215.  
  216.  
  217. extern HRESULT _kit_audioCOM_IPropertyStore_SetValue(IPropertyStore* properties,
  218.   REFPROPERTYKEY key_i, REFPROPVARIANT propertyVariant_i);
  219.  
  220.  
  221. extern HRESULT _kit_audioCOM_IPropertyStore_QueryInterface(IPropertyStore* properties,
  222.   IPropertyStore** properties_o);
  223.  
  224.  
  225. extern ULONG _kit_audioCOM_IPropertyStore_AddRef(IPropertyStore* properties);
  226.  
  227.  
  228. extern ULONG _kit_audioCOM_IPropertyStore_Release(IPropertyStore* properties);
  229.  
  230.  
  231.  
  232. #ifdef __cplusplus
  233. }
  234. #endif
  235.  
  236.  
  237.  
  238. #endif //_KIT_W32_AUDIOCOM_H
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement