Files
PowerToys/src/modules/videoconference/VideoConferenceModule/AudioDeviceNotificationClient.h
Andrey Nekrasov 176f2c2870 [VCM] Track newly added microphones (#16199)
* [VCM] Track newly added microphones when [All] is selected in the settings

* [VCM] handle case when no mics are left

* fixup: fix crashes onNotify

* fixup: fix build
2022-03-21 09:48:11 +00:00

31 lines
885 B
C++

#pragma once
#include <MMDeviceAPI.h>
struct AudioDeviceNotificationClient : IMMNotificationClient
{
AudioDeviceNotificationClient();
~AudioDeviceNotificationClient();
bool PullPendingNotifications()
{
const bool result = _deviceConfigurationChanged;
_deviceConfigurationChanged = false;
return result;
}
private:
ULONG AddRef() override;
ULONG Release() override;
HRESULT QueryInterface(REFIID, void**) override;
HRESULT OnPropertyValueChanged(LPCWSTR, const PROPERTYKEY) override;
HRESULT OnDeviceAdded(LPCWSTR) override;
HRESULT OnDeviceRemoved(LPCWSTR) override;
HRESULT OnDeviceStateChanged(LPCWSTR, DWORD) override;
HRESULT OnDefaultDeviceChanged(EDataFlow flow, ERole role, LPCWSTR) override;
IMMDeviceEnumerator* _deviceEnumerator = nullptr;
bool _deviceConfigurationChanged = false;
};