rocksdanister / lively

Free and open-source software that allows users to set animated desktop wallpapers and screensavers powered by WinUI 3.
https://rocksdanister.com/lively
GNU General Public License v3.0
14.38k stars 1.03k forks source link

WASAPI exclusive mode breaks wallpapers that have an audio element. #2217

Open Jammrock opened 2 months ago

Jammrock commented 2 months ago

Describe the bug

Wallpapers with an audio element, such as "Living Room" and "Music TV", will cause Lively to fail when an audio player uses WSAPI exclusive mode for playback. Once in state, Lively will fail to switch to any other wallpaper. I need to close Lively completely, via the notification icon, stop music playback, start Lively, switch to a wallpaper without an audio element, then start music playback again.

In my case, I use the Qobuz app with a USB DAC as my audio device. I can reproduce the issue with foobar200 in WASAPI exclusive mode, too.

To Reproduce Steps to reproduce the behavior:

  1. Get an audio app that supports WASAPI exclusive mode (Qobuz, foobar2000 with the WASAPI Output component.
  2. Put the app into exclusive mode.
  3. Play music while in exclusive mode.
  4. Launch Lively Wallpaper.
  5. Select a wallpaper that has an audio component like "Living Room" or "Music TV".
  6. The Lively wallpaper will disappear from the desktop.
  7. Try to load another wallpaper.
  8. You should see an error in the Lively app.
  9. Stop playback.
  10. Restart Lively.
  11. Wallpapers should work again.

Expected behavior Lively should be able to handle conditions where audio is not available because an application has the device under exclusive control.

Screenshots/Video

Qobuz menu showing exclusive mode.

image

foobar2000 File > Preferences > Components > WASAPI output support (visible and enabled)

image

foobar2000 File > Preferences > Playback > Output > Devices > select the exclusive profile.

image

foobar2000 File > Preferences > Playback > Output > Select the device

image

Error in Lively once in state and trying to switch wallpapers:

image

Desktop (please complete the following information):

Additional context My guess here is that Lively is using WASAPI to get playback information for spectrograph work in the wallpaper. No other app can access the device/media stream when an app puts a device into exclusive mode. It appears that Lively doesn't know how to handle being unable to access the device/stream caused by exclusive mode.

https://learn.microsoft.com/en-us/windows/win32/coreaudio/exclusive-mode-streams

Log file (Important) Share the diagnostic files by:

lively_log_20240430_160246.zip