Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //used internally by kit_w32_audio to wrap c++ com interfaces for use in c
- //(i'm making the api intentionally verbose here)
- //interfaces implemented:
- //IMMDeviceEnumerator
- //IMMDeviceCollection
- //IMMDevice
- //IAudioClient
- //IAudioRenderClient
- //IPropertyStore
- #ifndef _KIT_W32_AUDIOCOM_H
- #define _KIT_W32_AUDIOCOM_H
- #ifndef COM_NO_WINDOWS_H
- # define COM_NO_WINDOWS_H
- # include <windef.h>
- # include <winnt.h>
- //# include <initguid.h>
- # include <audioclient.h>
- # include <mmdeviceapi.h>
- # undef COM_NO_WINDOWS_H
- #else
- # include <windef.h>
- # include <winnt.h>
- //# include <initguid.h>
- # include <audioclient.h>
- # include <mmdeviceapi.h>
- #endif
- #ifdef __cplusplus
- extern "C" {
- #endif
- //IMMDeviceEnumerator
- extern HRESULT _kit_audioCOM_IMMDeviceEnumerator_EnumAudioEndpoints(IMMDeviceEnumerator* enumerator,
- EDataFlow dataFlow_i, DWORD stateMask_i, IMMDeviceCollection** devices_o);
- extern HRESULT _kit_audioCOM_IMMDeviceEnumerator_GetDefaultAudioEndpoint(IMMDeviceEnumerator* enumerator,
- EDataFlow dataFlow_i, ERole role_i, IMMDevice** endpoint_o);
- extern HRESULT _kit_audioCOM_IMMDeviceEnumerator_GetDevice(IMMDeviceEnumerator* enumerator,
- LPCWSTR strID_i, IMMDevice** device_o);
- extern HRESULT _kit_audioCOM_IMMDeviceEnumerator_RegisterEndpointNotificationCallback(IMMDeviceEnumerator* enumerator,
- IMMNotificationClient* client_i);
- extern HRESULT _kit_audioCOM_IMMDeviceEnumerator_UnregisterEndpointNotificationCallback(IMMDeviceEnumerator* enumerator,
- IMMNotificationClient* client_i);
- extern HRESULT _kit_audioCOM_IMMDeviceEnumerator_QueryInterface(IMMDeviceEnumerator* enumerator,
- IMMDeviceEnumerator** enumerator_o);
- extern ULONG _kit_audioCOM_IMMDeviceEnumerator_AddRef(IMMDeviceEnumerator* enumerator);
- extern ULONG _kit_audioCOM_IMMDeviceEnumerator_Release(IMMDeviceEnumerator* enumerator);
- //IMMDeviceCollection
- extern HRESULT _kit_audioCOM_IMMDeviceCollection_GetCount(IMMDeviceCollection* deviceCollection,
- UINT* devices_o);
- extern HRESULT _kit_audioCOM_IMMDeviceCollection_Item(IMMDeviceCollection* deviceCollection,
- UINT deviceNum_i, IMMDevice** device_o);
- extern HRESULT _kit_audioCOM_IMMDeviceCollection_QueryInterface(IMMDeviceCollection* deviceCollection,
- IMMDeviceCollection** deviceCollection_o);
- extern ULONG _kit_audioCOM_IMMDeviceCollection_AddRef(IMMDeviceCollection* deviceCollection);
- extern ULONG _kit_audioCOM_IMMDeviceCollection_Release(IMMDeviceCollection* deviceCollection);
- //IMMDevice
- extern HRESULT _kit_audioCOM_IMMDevice_Activate(IMMDevice* device,
- REFIID iid_i, DWORD clsCtx_i, PROPVARIANT* activationParams_i, void** interface_o);
- extern HRESULT _kit_audioCOM_IMMDevice_GetId(IMMDevice* device,
- LPWSTR* strID_o);
- extern HRESULT _kit_audioCOM_IMMDevice_GetState(IMMDevice* device,
- DWORD* state_o);
- extern HRESULT _kit_audioCOM_IMMDevice_OpenPropertyStore(IMMDevice* device,
- DWORD access_i, IPropertyStore** properties_o);
- extern HRESULT _kit_audioCOM_IMMDevice_QueryInterface(IMMDevice* device,
- IMMDevice** device_o);
- extern ULONG _kit_audioCOM_IMMDevice_AddRef(IMMDevice* device);
- extern ULONG _kit_audioCOM_IMMDevice_Release(IMMDevice* device);
- //IAudioClient
- extern HRESULT _kit_audioCOM_IAudioClient_GetBufferSize(IAudioClient* audioClient,
- UINT32* numBufferFrames_o);
- extern HRESULT _kit_audioCOM_IAudioClient_GetCurrentPadding(IAudioClient* audioClient,
- UINT32* numPaddingFrames_o);
- extern HRESULT _kit_audioCOM_IAudioClient_GetDevicePeriod(IAudioClient* audioClient,
- REFERENCE_TIME* defaultDevicePeriod_o, REFERENCE_TIME* minimumDevicePeriod_o);
- extern HRESULT _kit_audioCOM_IAudioClient_GetMixFormat(IAudioClient* audioClient,
- WAVEFORMATEX** deviceFormat_o);
- extern HRESULT _kit_audioCOM_IAudioClient_GetService(IAudioClient* audioClient,
- REFIID riid_i, void** ppv_o);
- extern HRESULT _kit_audioCOM_IAudioClient_GetStreamLatency(IAudioClient* audioClient,
- REFERENCE_TIME* latency_o);
- extern HRESULT _kit_audioCOM_IAudioClient_Initialize(IAudioClient* audioClient,
- AUDCLNT_SHAREMODE shareMode_i, DWORD streamFlags_i, REFERENCE_TIME bufferDuration_i,
- REFERENCE_TIME periodicity_i, const WAVEFORMATEX* format_i, LPCGUID audioSessionGUID_i);
- extern HRESULT _kit_audioCOM_IAudioClient_IsFormatSupported(IAudioClient* audioClient,
- AUDCLNT_SHAREMODE shareMode_i, const WAVEFORMATEX* format_i, WAVEFORMATEX** closestMatch_o);
- extern HRESULT _kit_audioCOM_IAudioClient_Reset(IAudioClient* audioClient);
- extern HRESULT _kit_audioCOM_IAudioClient_SetEventHandle(IAudioClient* audioClient,
- HANDLE eventHandle_i);
- extern HRESULT _kit_audioCOM_IAudioClient_Start(IAudioClient* audioClient);
- extern HRESULT _kit_audioCOM_IAudioClient_Stop(IAudioClient* audioClient);
- extern HRESULT _kit_audioCOM_IAudioClient_QueryInterface(IAudioClient* audioClient,
- IAudioClient** audioClient_o);
- extern ULONG _kit_audioCOM_IAudioClient_AddRef(IAudioClient* audioClient);
- extern ULONG _kit_audioCOM_IAudioClient_Release(IAudioClient* audioClient);
- //IAudioRenderClient
- extern HRESULT _kit_audioCOM_IAudioRenderClient_GetBuffer(IAudioRenderClient* audioRenderClient,
- UINT32 numFramesRequested_i, BYTE** data);
- extern HRESULT _kit_audioCOM_IAudioRenderClient_ReleaseBuffer(IAudioRenderClient* audioRenderClient,
- UINT32 numFramesWritten_i, DWORD flags_i);
- extern HRESULT _kit_audioCOM_IAudioRenderClient_QueryInterface(IAudioRenderClient* audioRenderClient,
- IAudioRenderClient** audioRenderClient_o);
- extern ULONG _kit_audioCOM_IAudioRenderClient_AddRef(IAudioRenderClient* audioRenderClient);
- extern ULONG _kit_audioCOM_IAudioRenderClient_Release(IAudioRenderClient* audioRenderClient);
- //IPropertyStore
- extern HRESULT _kit_audioCOM_IPropertyStore_Commit(IPropertyStore* properties);
- extern HRESULT _kit_audioCOM_IPropertyStore_GetAt(IPropertyStore* properties,
- DWORD propertyKeyIndex_i, PROPERTYKEY* propertyKey_o);
- extern HRESULT _kit_audioCOM_IPropertyStore_GetCount(IPropertyStore* properties,
- DWORD* numProperties_o);
- extern HRESULT _kit_audioCOM_IPropertyStore_GetValue(IPropertyStore* properties,
- REFPROPERTYKEY key_i, PROPVARIANT* propertyVariant_o);
- extern HRESULT _kit_audioCOM_IPropertyStore_SetValue(IPropertyStore* properties,
- REFPROPERTYKEY key_i, REFPROPVARIANT propertyVariant_i);
- extern HRESULT _kit_audioCOM_IPropertyStore_QueryInterface(IPropertyStore* properties,
- IPropertyStore** properties_o);
- extern ULONG _kit_audioCOM_IPropertyStore_AddRef(IPropertyStore* properties);
- extern ULONG _kit_audioCOM_IPropertyStore_Release(IPropertyStore* properties);
- #ifdef __cplusplus
- }
- #endif
- #endif //_KIT_W32_AUDIOCOM_H
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement