From 1e5a8d4ec402b8305dea59391fd692e9c970cbe4 Mon Sep 17 00:00:00 2001 From: lx-s Date: Wed, 3 Aug 2022 10:17:14 +0200 Subject: [PATCH] Redetect Audio Endpoints when BT device connects. --- WinMute/MMNotificationClient.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/WinMute/MMNotificationClient.cpp b/WinMute/MMNotificationClient.cpp index 1c9075c..e1874cf 100644 --- a/WinMute/MMNotificationClient.cpp +++ b/WinMute/MMNotificationClient.cpp @@ -101,8 +101,15 @@ HRESULT STDMETHODCALLTYPE MMNotificationClient::OnDeviceRemoved(LPCWSTR) } HRESULT STDMETHODCALLTYPE MMNotificationClient::OnDeviceStateChanged( - LPCWSTR, DWORD) + LPCWSTR pwstrDeviceId, DWORD dwNewState) { + UNREFERENCED_PARAMETER(pwstrDeviceId); + if (dwNewState == DEVICE_STATE_UNPLUGGED || + dwNewState == DEVICE_STATE_ACTIVE) { + if (notifyParent_) { + notifyParent_->ShouldReInit(); + } + } return S_OK; } -- 2.43.0