vrubleg / soundkeeper

Prevents SPDIF/HDMI digital audio playback devices from sleeping.
https://veg.by/projects/soundkeeper/
MIT License
213 stars 9 forks source link

Windows 11 powercfg Requestsoverride not working to allow sleep #4

Closed flowerdealer closed 1 year ago

flowerdealer commented 1 year ago

Hi, after installing SoundKeeper my sound issues are gone, but my PC won't go to sleep. I've run powercg -requestsoverride and made sure that I have the correct driver listed, but it still prevents sleep no matter what (even after doing the override the driver keeps appearing in the powercg -requests command. Any other ideas for workarounds?

flowerdealer commented 1 year ago

Device is: NVIDIA High Definition Audio (HDAUDIO\FUNC_01&VEN_10DE&DEV_00A3&SUBSYS_145840BF&REV_1001\5&2ce84b24&0&0001)

Overrides read as following (I've tried a few variations):

NVIDIA High Definition Audio Device SYSTEM HDAUDIO\FUNC_01&VEN_10DE&DEV_00A3&SUBSYS_145840BF&REV_1001\5&2ce84b24&0&0001 SYSTEM High Definition Audio Device SYSTEM NVIDIA High Definition Audio Device (HDAUDIO\FUNC_01&VEN_10DE&DEV_00A3&SUBSYS_145840BF&REV_1001\5&2ce84b24&0&0001) SYSTEM NVIDIA High Definition Audio SYSTEM NVIDIA High Definition Audio (HDAUDIO\FUNC_01&VEN_10DE&DEV_00A3&SUBSYS_145840BF&REV_1001\5&2ce84b24&0&0001) SYSTEM

vrubleg commented 1 year ago

Unfortunately, I don't have Windows 11 for testing this. I would just recommend to make a keystroke for putting your PC into sleep mode.

flowerdealer commented 1 year ago

As an idea (which I might try), would it be possible to stop SoundKeeper, when the display goes to sleep or when a screensaver starts? A quick search shows that it might be possible via task scheduler (which I might try), but maybe there some low level stuff SoundKeeper could do. It might not work for people that use it for music, but for my usage, whenever I'm not using my PC I want the display to sleep or go to a screensaver, and under those conditions I wouldn't expect for an audio feed to keep running, and I would also want for my system to eventually go to sleep during that period of inactivity. Like I said, I will try this for my usage case via task scheduler but just putting this idea as a potential workaround, since the overrides aren't working.

On Sun, Feb 19, 2023, 9:01 AM Evgeny Vrublevsky @.***> wrote:

Unfortunately, I don't have Windows 11 for testing this. I would just recommend to make a keystroke for putting your PC into sleep mode.

— Reply to this email directly, view it on GitHub https://github.com/vrubleg/soundkeeper/issues/4#issuecomment-1436038832, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGF6BG5IT5YCDZQGTMYQWTWYJGXHANCNFSM6AAAAAAVBB5HZA . You are receiving this because you authored the thread.Message ID: @.***>

vrubleg commented 1 year ago

I consider adding such feature as an option in the future, it is in by backlog. But there are no exact plans when it will be implemented though. One day in the future =)

You can run soundkeeper kill from the Task Scheduler to stop current Sound Keeper instance gracefully. Also, you can conveniently pass all required settings (like stream type) in command line if you start it from the Task Scheduler, so executable could be named just soundkeeper.exe. So you can try to imitate required behavior using Task Scheduler.

vrubleg commented 1 year ago

There is a hidden setting "Allow System Required Policy" in the advanced power settings:

image

Run this command to make this setting visible and configurable:

powercfg -attributes SUB_SLEEP SYSTEMREQUIRED -ATTRIB_HIDE

It allows you to prevent programs from going into sleep mode (if you set it to "No").

To hide this setting back, run:

powercfg -attributes SUB_SLEEP SYSTEMREQUIRED +ATTRIB_HIDE

As another way to do the same, you can disable the "Allow applications to prevent automatic sleep" policy in Group Policy Editor > Computer Configuration > Administrative Templates > System > Power Management > Sleep Settings.

Keep in mind that with this setting, Windows will go into sleep mode even if you just watch a movie right now, so set idle timeout for 2-3 hours to avoid unexpected interruption.

flowerdealer commented 1 year ago

Would this force or to go to sleep even when gaming? That doesn't sound good.

On Sat, Feb 25, 2023, 1:10 AM Evgeny Vrublevsky @.***> wrote:

As an option, you can disable the "Allow applications to prevent automatic sleep" policy in Group Policy Editor > Computer Configuration > Administrative Templates > System > Power Management > Sleep Settings. In this case, Windows will go into sleep mode even if you just watch a movie right now, so set idle timeout for 2-3 hours to avoid unexpected interruption.

— Reply to this email directly, view it on GitHub https://github.com/vrubleg/soundkeeper/issues/4#issuecomment-1445036822, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGF6BDLGXM2OS6F24OM7WLWZHD6HANCNFSM6AAAAAAVBB5HZA . You are receiving this because you authored the thread.Message ID: @.***>

vrubleg commented 1 year ago

No, only when you don't touch input devices.

flowerdealer commented 1 year ago

Your suggestions worked and it's great for my use case, thanks!

On Sat, Feb 25, 2023 at 8:33 AM Evgeny Vrublevsky @.***> wrote:

No, only when you don't touch input devices.

— Reply to this email directly, view it on GitHub https://github.com/vrubleg/soundkeeper/issues/4#issuecomment-1445154025, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGF6BEKNP5WSSVHSQUYK73WZIX5ZANCNFSM6AAAAAAVBB5HZA . You are receiving this because you authored the thread.Message ID: @.***>

-- Jose Fernandez de Castro