]> repos.lx-s.de Git - winmute.git/commitdiff
Added unmute delay when BT device reconnects
authorlx-s <lx-s@users.noreply.github.com>
Wed, 3 Aug 2022 08:27:10 +0000 (10:27 +0200)
committerlx-s <lx-s@users.noreply.github.com>
Wed, 3 Aug 2022 08:27:10 +0000 (10:27 +0200)
WinMute/MuteControl.cpp
WinMute/MuteControl.h

index 540ad89357240c6086e45bca850e8ced9afbd12a..a00ccd311c53d6d1922dab2ccb018db2acb9fb28 100644 (file)
@@ -33,6 +33,8 @@ POSSIBILITY OF SUCH DAMAGE.
 
 #include "common.h"
 
+const int BLUETOOTH_RECONNECT_UNMUTE_DELAY = 5000; // Milliseconds
+
 enum MuteType {
    // With restore
    MuteTypeWorkstationLock = 0,
@@ -131,7 +133,7 @@ void MuteControl::RestoreVolume(bool withDelay)
          L"Volume restored",
          L"All endpoints have been restored to their previous configuration");
       if (withDelay) {
-         Sleep(2000);
+         Sleep(BLUETOOTH_RECONNECT_UNMUTE_DELAY);
       }
       winAudio_->RestoreMuteStatus();
    }
@@ -285,7 +287,7 @@ void MuteControl::NotifyBluetoothConnected(bool connected)
    WMLog::GetInstance().Write(
       L"Mute Event: Bluetooth audio device %s",
       connected ? L"connected" : L"disconnected");
-   NotifyRestoreCondition(MuteTypeBluetoothDisconnect, !connected);
+   NotifyRestoreCondition(MuteTypeBluetoothDisconnect, !connected, true);
 }
 
 void MuteControl::NotifyLogout()
index 0db0640f9af8d953d3d640a2d89b223ab7abab10..9f0c370048efa93848502ab0b0201e8d862935cf 100644 (file)
@@ -98,7 +98,7 @@ private:
 
    const TrayIcon* trayIcon_;
 
-   void NotifyRestoreCondition(int type, bool active, bool withDelay);
+   void NotifyRestoreCondition(int type, bool active, bool withDelay = false);
    void SaveMuteStatus();
    void RestoreVolume(bool withDelay = false);
    void ShowNotification(const std::wstring& title, const std::wstring& text);