[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
This commit is contained in:
Andrey Nekrasov
2022-03-21 12:48:11 +03:00
committed by GitHub
parent 2e3a2b3f96
commit 176f2c2870
13 changed files with 224 additions and 33 deletions

View File

@@ -10,7 +10,6 @@
#include <wil/resource.h>
#include <wil/com.h>
#include <string_view>
#include <optional>
@@ -47,7 +46,8 @@ private:
constexpr static inline std::wstring_view FALLBACK_ID = L"UNKNOWN_ID";
public:
MicrophoneDevice(MicrophoneDevice&&) noexcept = default;
MicrophoneDevice(MicrophoneDevice&&) noexcept = delete;
MicrophoneDevice(const MicrophoneDevice&) noexcept = delete;
MicrophoneDevice(wil::com_ptr_nothrow<IMMDevice> device, wil::com_ptr_nothrow<IAudioEndpointVolume> endpoint);
~MicrophoneDevice();
@@ -60,6 +60,6 @@ public:
std::wstring_view name() const noexcept;
void set_mute_changed_callback(mute_changed_cb_t callback) noexcept;
static std::optional<MicrophoneDevice> getDefault();
static std::vector<MicrophoneDevice> getAllActive();
static std::unique_ptr<MicrophoneDevice> getDefault();
static std::vector<std::unique_ptr<MicrophoneDevice>> getAllActive();
};