From: lx-s Date: Wed, 3 Aug 2022 08:21:50 +0000 (+0200) Subject: Added delay to mutecontrol X-Git-Tag: 2.1.1.0~4^2 X-Git-Url: https://repos.lx-s.de/gitweb/?a=commitdiff_plain;h=cb7ba0e7506507f3552e49283e71930a909b2437;p=winmute.git Added delay to mutecontrol --- diff --git a/WinMute/MuteControl.cpp b/WinMute/MuteControl.cpp index ba55e32..eb014cf 100644 --- a/WinMute/MuteControl.cpp +++ b/WinMute/MuteControl.cpp @@ -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); } } } diff --git a/WinMute/MuteControl.h b/WinMute/MuteControl.h index fd56488..01f4b47 100644 --- a/WinMute/MuteControl.h +++ b/WinMute/MuteControl.h @@ -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); };