lx-s / WinMute

WinMute lets you automatically mute your PC volume on certain events (e. g. Screensaver, Workstation Lock, Shutdown, etc.).
BSD 3-Clause "New" or "Revised" License
168 stars 6 forks source link

Umuting external monitor #30

Closed Eelstone closed 10 months ago

Eelstone commented 10 months ago

I am using your excellent code with great pleasure, however in my setup I am using the built-in speakers in my external Samsung CF791 monitor connected to the computer via a DVI/USB-C cable. The monitor speakers are indeed muted via WinMute when locking the computer, however the unmute part for the monitor does not work. I guess this should be a small bug to correct?

lx-s commented 10 months ago

Thank you for your compliments :)

That muting works but unmuting doesn’t is strange, since WinMute uses the windows api which abstracts the actual hardware away.

can you:

  1. enable logging within winmutes settings
  2. Restart WinMute
  3. lock your pc
  4. unlock it
  5. attach the log file here

Thanks for your help!

Eelstone commented 10 months ago

Hi and thanks for your respons,

I managed to catch this via the log file but noticed some unexpected behavior. If I lock the computer and more or less immediately unlock it, WinMute will unmute the monitor (and the built-in sound card) which also is reflected in the log file. However, if I lock the computer and wait some time (in this case approx 10 minutes), when unlocking only the sound card get unmuted and not the monitor. This is also reflected in the log file attached. I should maybe also mention that WinMute runs on a corporate computer where my user is not administrator and with policies restricting some settings but I cant really see that this fact should affect WinMute.

Thanks and regards! :)

WinMute.log

lx-s commented 10 months ago

What seems to be happening here, is that your monitor goes into standby and windows deregisters its audio endpoint.

WinMute gets this notification and re-reads all audio endpoints that are registered within the system: [2023-10-31 19:52:49] Found audio endpoint "Speakers (Realtek High Definition Audio(SST))"

Apparently the monitor takes a while to get registered again within windows. I'll see what I can do about this, but this seems to be a tricky one (hardware timing problems always are :( )

lx-s commented 10 months ago

Here is an early beta version where i started to implement the i18n stuff: winmute_beta.zip I added a few more log points. If you want you can try this one out and paste me the log file. Maybe I can refine the "reinitialize endpoints" code.

Eelstone commented 10 months ago

Thanks! I have now executed this beta. For your info - I noticed in this beta release that the language setting keeps returning to German even though I change to English (but just a minor comment).

Please find the log file from your beta attached. The same behavior and I can confirm your assumption that the difference between the two scenarios is indeed that the monitor goes into sleep mode (probably to save energy and I can't really find any local monitor setting to disable that and in the best case scenario I wouldn't want to do that either ;)

WinMute_2.log

lx-s commented 10 months ago

Ah, I see the problem now. Could you try this version winmute_beta.zip ?

Thanks!

P.S.: Ignore all the language stuff - I'm currently working on the plumbing that loads strings and everything. The UI stuff does not work at all yet :)

Eelstone commented 10 months ago

Wow, your magic seems to work! :-) Now the monitor unmuted even after going into sleep mode. I will do some further testing of course and let you know any issues. Please find the latest log file attached that reflects the new behavior.

WinMute_3.log

lx-s commented 10 months ago

Awesome - the log file looks just as I wanted it to be. I'll closethe issue for now and merge the fixes into the next version. You can just keep using the beta :)

If there are any issues regarding this bug, just comment on this issue again or open a new one!