Advertisement
Kitomas

_kit_w32_audioCOM.cpp (scrapped)

Jul 14th, 2023
764
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 8.41 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. #include <_kit_w32_audioCOM.h>
  11.  
  12.  
  13.  
  14. //IMMDeviceEnumerator
  15.  
  16. HRESULT _kit_audioCOM_IMMDeviceEnumerator_EnumAudioEndpoints(IMMDeviceEnumerator* enumerator,
  17.   EDataFlow dataFlow_i, DWORD stateMask_i, IMMDeviceCollection** devices_o)
  18. { return enumerator->EnumAudioEndpoints(dataFlow_i, stateMask_i, devices_o); }
  19.  
  20.  
  21. HRESULT _kit_audioCOM_IMMDeviceEnumerator_GetDefaultAudioEndpoint(IMMDeviceEnumerator* enumerator,
  22.   EDataFlow dataFlow_i, ERole role_i, IMMDevice** endpoint_o)
  23. { return enumerator->GetDefaultAudioEndpoint(dataFlow_i, role_i, endpoint_o); }
  24.  
  25.  
  26. HRESULT _kit_audioCOM_IMMDeviceEnumerator_GetDevice(IMMDeviceEnumerator* enumerator,
  27.   LPCWSTR strID_i, IMMDevice** device_o)
  28. { return enumerator->GetDevice(strID_i, device_o); }
  29.  
  30.  
  31. HRESULT _kit_audioCOM_IMMDeviceEnumerator_RegisterEndpointNotificationCallback(IMMDeviceEnumerator* enumerator,
  32.   IMMNotificationClient* client_i)
  33. { return enumerator->RegisterEndpointNotificationCallback(client_i); }
  34.  
  35.  
  36. HRESULT _kit_audioCOM_IMMDeviceEnumerator_UnregisterEndpointNotificationCallback(IMMDeviceEnumerator* enumerator,
  37.   IMMNotificationClient* client_i)
  38. { return enumerator->UnregisterEndpointNotificationCallback(client_i); }
  39.  
  40. //
  41. HRESULT _kit_audioCOM_IMMDeviceEnumerator_QueryInterface(IMMDeviceEnumerator* enumerator,
  42.   IMMDeviceEnumerator** enumerator_o)
  43. { return enumerator->QueryInterface(enumerator_o); }
  44.  
  45.  
  46. ULONG _kit_audioCOM_IMMDeviceEnumerator_AddRef(IMMDeviceEnumerator* enumerator)
  47. { return enumerator->AddRef(); }
  48.  
  49.  
  50. ULONG _kit_audioCOM_IMMDeviceEnumerator_Release(IMMDeviceEnumerator* enumerator)
  51. { return enumerator->Release(); }
  52.  
  53.  
  54.  
  55. //IMMDeviceCollection
  56.  
  57. HRESULT _kit_audioCOM_IMMDeviceCollection_GetCount(IMMDeviceCollection* deviceCollection,
  58.   UINT* devices_o)
  59. { return deviceCollection->GetCount(devices_o); }
  60.  
  61.  
  62. HRESULT _kit_audioCOM_IMMDeviceCollection_Item(IMMDeviceCollection* deviceCollection,
  63.   UINT deviceNum_i, IMMDevice** device_o)
  64. { return deviceCollection->Item(deviceNum_i, device_o); }
  65.  
  66. //
  67. HRESULT _kit_audioCOM_IMMDeviceCollection_QueryInterface(IMMDeviceCollection* deviceCollection,
  68.   IMMDeviceCollection** deviceCollection_o)
  69. { return deviceCollection->QueryInterface(deviceCollection_o); }
  70.  
  71.  
  72. ULONG _kit_audioCOM_IMMDeviceCollection_AddRef(IMMDeviceCollection* deviceCollection)
  73. { return deviceCollection->AddRef(); }
  74.  
  75.  
  76. ULONG _kit_audioCOM_IMMDeviceCollection_Release(IMMDeviceCollection* deviceCollection)
  77. { return deviceCollection->Release(); }
  78.  
  79.  
  80.  
  81. //IMMDevice
  82.  
  83. HRESULT _kit_audioCOM_IMMDevice_Activate(IMMDevice* device,
  84.   REFIID iid_i, DWORD clsCtx_i, PROPVARIANT* activationParams_i, void** interface_o)
  85. { return device->Activate(iid_i, clsCtx_i, activationParams_i, interface_o); }
  86.  
  87.  
  88. HRESULT _kit_audioCOM_IMMDevice_GetId(IMMDevice* device,
  89.   LPWSTR* strID_o)
  90. { return device->GetId(strID_o); }
  91.  
  92.  
  93. HRESULT _kit_audioCOM_IMMDevice_GetState(IMMDevice* device,
  94.   DWORD* state_o)
  95. { return device->GetState(state_o); }
  96.  
  97.  
  98. HRESULT _kit_audioCOM_IMMDevice_OpenPropertyStore(IMMDevice* device,
  99.   DWORD access_i, IPropertyStore** properties_o)
  100. { return device->OpenPropertyStore(access_i, properties_o); }
  101.  
  102.  
  103. HRESULT _kit_audioCOM_IMMDevice_QueryInterface(IMMDevice* device,
  104.   IMMDevice** device_o)
  105. { return device->QueryInterface(device_o); }
  106.  
  107.  
  108. ULONG _kit_audioCOM_IMMDevice_AddRef(IMMDevice* device)
  109. { return device->AddRef(); }
  110.  
  111.  
  112. ULONG _kit_audioCOM_IMMDevice_Release(IMMDevice* device)
  113. { return device->Release(); }
  114.  
  115.  
  116.  
  117. //IAudioClient
  118.  
  119. HRESULT _kit_audioCOM_IAudioClient_GetBufferSize(IAudioClient* audioClient,
  120.   UINT32* numBufferFrames_o)
  121. { return audioClient->GetBufferSize(numBufferFrames_o); }
  122.  
  123.  
  124. HRESULT _kit_audioCOM_IAudioClient_GetCurrentPadding(IAudioClient* audioClient,
  125.   UINT32* numPaddingFrames_o)
  126. { return audioClient->GetCurrentPadding(numPaddingFrames_o); }
  127.  
  128.  
  129. HRESULT _kit_audioCOM_IAudioClient_GetDevicePeriod(IAudioClient* audioClient,
  130.   REFERENCE_TIME* defaultDevicePeriod_o, REFERENCE_TIME* minimumDevicePeriod_o)
  131. { return audioClient->GetDevicePeriod(defaultDevicePeriod_o, minimumDevicePeriod_o); }
  132.  
  133.  
  134. HRESULT _kit_audioCOM_IAudioClient_GetMixFormat(IAudioClient* audioClient,
  135.   WAVEFORMATEX** deviceFormat_o)
  136. { return audioClient->GetMixFormat(deviceFormat_o); }
  137.  
  138.  
  139. HRESULT _kit_audioCOM_IAudioClient_GetService(IAudioClient* audioClient,
  140.   REFIID riid_i, void** ppv_o)
  141. { return audioClient->GetService(riid_i, ppv_o); }
  142.  
  143.  
  144. HRESULT _kit_audioCOM_IAudioClient_GetStreamLatency(IAudioClient* audioClient,
  145.   REFERENCE_TIME* latency_o)
  146. { return audioClient->GetStreamLatency(latency_o); }
  147.  
  148.  
  149. HRESULT _kit_audioCOM_IAudioClient_Initialize(IAudioClient* audioClient,
  150.   AUDCLNT_SHAREMODE shareMode_i, DWORD streamFlags_i, REFERENCE_TIME bufferDuration_i,
  151.   REFERENCE_TIME periodicity_i, const WAVEFORMATEX* format_i, LPCGUID audioSessionGUID_i)
  152. { return audioClient->Initialize(shareMode_i, streamFlags_i, bufferDuration_i, periodicity_i, format_i, audioSessionGUID_i); }
  153.  
  154.  
  155. HRESULT _kit_audioCOM_IAudioClient_IsFormatSupported(IAudioClient* audioClient,
  156.   AUDCLNT_SHAREMODE shareMode_i, const WAVEFORMATEX* format_i, WAVEFORMATEX** closestMatch_o)
  157. { return audioClient->IsFormatSupported(shareMode_i, format_i, closestMatch_o); }
  158.  
  159.  
  160. HRESULT _kit_audioCOM_IAudioClient_Reset(IAudioClient* audioClient)
  161. { return audioClient->Reset(); }
  162.  
  163.  
  164. HRESULT _kit_audioCOM_IAudioClient_SetEventHandle(IAudioClient* audioClient,
  165.   HANDLE eventHandle_i)
  166. { return audioClient->SetEventHandle(eventHandle_i); }
  167.  
  168.  
  169. HRESULT _kit_audioCOM_IAudioClient_Start(IAudioClient* audioClient)
  170. { return audioClient->Start(); }
  171.  
  172.  
  173. HRESULT _kit_audioCOM_IAudioClient_Stop(IAudioClient* audioClient)
  174. { return audioClient->Stop(); }
  175.  
  176.  
  177. HRESULT _kit_audioCOM_IAudioClient_QueryInterface(IAudioClient* audioClient,
  178.   IAudioClient** audioClient_o)
  179. { return audioClient->QueryInterface(audioClient_o); }
  180.  
  181.  
  182. ULONG _kit_audioCOM_IAudioClient_AddRef(IAudioClient* audioClient)
  183. { return audioClient->AddRef(); }
  184.  
  185.  
  186. ULONG _kit_audioCOM_IAudioClient_Release(IAudioClient* audioClient)
  187. { return audioClient->Release(); }
  188.  
  189.  
  190.  
  191. //IAudioRenderClient
  192.  
  193. HRESULT _kit_audioCOM_IAudioRenderClient_GetBuffer(IAudioRenderClient* audioRenderClient,
  194.   UINT32 numFramesRequested_i, BYTE** data)
  195. { return audioRenderClient->GetBuffer(numFramesRequested_i, data); }
  196.  
  197.  
  198. HRESULT _kit_audioCOM_IAudioRenderClient_ReleaseBuffer(IAudioRenderClient* audioRenderClient,
  199.   UINT32 numFramesWritten_i, DWORD flags_i)
  200. { return audioRenderClient->ReleaseBuffer(numFramesWritten_i, flags_i); }
  201.  
  202.  
  203. HRESULT _kit_audioCOM_IAudioRenderClient_QueryInterface(IAudioRenderClient* audioRenderClient,
  204.   IAudioRenderClient** audioRenderClient_o)
  205. { return audioRenderClient->QueryInterface(audioRenderClient_o); }
  206.  
  207.  
  208. ULONG _kit_audioCOM_IAudioRenderClient_AddRef(IAudioRenderClient* audioRenderClient)
  209. { return audioRenderClient->AddRef(); }
  210.  
  211.  
  212. ULONG _kit_audioCOM_IAudioRenderClient_Release(IAudioRenderClient* audioRenderClient)
  213. { return audioRenderClient->Release(); }
  214.  
  215.  
  216.  
  217. //IPropertyStore
  218.  
  219. HRESULT _kit_audioCOM_IPropertyStore_Commit(IPropertyStore* properties)
  220. { return properties->Commit(); }
  221.  
  222.  
  223. HRESULT _kit_audioCOM_IPropertyStore_GetAt(IPropertyStore* properties,
  224.   DWORD propertyKeyIndex_i, PROPERTYKEY* propertyKey_o)
  225. { return properties->GetAt(propertyKeyIndex_i, propertyKey_o); }
  226.  
  227.  
  228. HRESULT _kit_audioCOM_IPropertyStore_GetCount(IPropertyStore* properties,
  229.   DWORD* numProperties_o)
  230. { return properties->GetCount(numProperties_o); }
  231.  
  232.  
  233. HRESULT _kit_audioCOM_IPropertyStore_GetValue(IPropertyStore* properties,
  234.   REFPROPERTYKEY key_i, PROPVARIANT* propertyVariant_o)
  235. { return properties->GetValue(key_i, propertyVariant_o); }
  236.  
  237.  
  238. HRESULT _kit_audioCOM_IPropertyStore_SetValue(IPropertyStore* properties,
  239.   REFPROPERTYKEY key_i, REFPROPVARIANT propertyVariant_i)
  240. { return properties->SetValue(key_i, propertyVariant_i); }
  241.  
  242.  
  243. HRESULT _kit_audioCOM_IPropertyStore_QueryInterface(IPropertyStore* properties,
  244.   IPropertyStore** properties_o)
  245. { return properties->QueryInterface(properties_o); }
  246.  
  247.  
  248. ULONG _kit_audioCOM_IPropertyStore_AddRef(IPropertyStore* properties)
  249. { return properties->AddRef(); }
  250.  
  251.  
  252. ULONG _kit_audioCOM_IPropertyStore_Release(IPropertyStore* properties)
  253. { return properties->Release(); }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement