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

index ba55e3246a6571db7614a710ff9dbe151057e874..eb014cf9f90ada678a53ed97252198fe9dcc1c9e 100644 (file)
@@ -109,7 +109,7 @@ void MuteControl::SetNotifications(bool enable)
    notificationsEnabled_ = enable;
 }
 
-void MuteControl::RestoreVolume()
+void MuteControl::RestoreVolume(bool withDelay)
 {
    WMLog& log = WMLog::GetInstance();
    if (!restoreVolume_) {
@@ -129,6 +129,9 @@ void MuteControl::RestoreVolume()
       ShowNotification(
          _T("Volume restored"),
          _T("All endpoints have been restored to their previous configuration"));
+      if (withDelay) {
+         Sleep(2000);
+      }
       winAudio_->RestoreMuteStatus();
    }
 }
@@ -213,7 +216,7 @@ bool MuteControl::GetMuteOnShutdown()
    return muteConfig_[MuteTypeShutdown].shouldMute;
 }
 
-void MuteControl::NotifyRestoreCondition(int type, bool active)
+void MuteControl::NotifyRestoreCondition(int type, bool active, bool withDelay)
 {
    if (active) {
       SaveMuteStatus();
@@ -229,7 +232,7 @@ void MuteControl::NotifyRestoreCondition(int type, bool active)
       if (muteConfig_[type].active) {
          muteConfig_[type].active = false;
          if (muteConfig_[type].shouldMute) {
-            RestoreVolume();
+            RestoreVolume(withDelay);
          }
       }
    }
index fd5648826381d17c33ac1f31dc47ea77a1c0f5f7..01f4b471c77e13a9014a83b3c364dbcc54246c71 100644 (file)
@@ -95,8 +95,8 @@ private:
 
    const TrayIcon* trayIcon_;
 
-   void NotifyRestoreCondition(int type, bool active);
+   void NotifyRestoreCondition(int type, bool active, bool withDelay);
    void SaveMuteStatus();
-   void RestoreVolume();
+   void RestoreVolume(bool withDelay = false);
    void ShowNotification(const tstring& title, const tstring& text);
 };