Skip to content

Commit 6b0fb8f

Browse files
committed
duplicate mode audio fix
- disable audio track on every screen except one in duplicate mode (mpv video player only.)
1 parent b603c60 commit 6b0fb8f

File tree

3 files changed

+25
-10
lines changed

3 files changed

+25
-10
lines changed

src/livelywpf/livelywpf/Core/Playback/Playback.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,9 @@ private void ForegroundAppMonitor()
241241
{
242242
if (!(fHandle.Equals(NativeMethods.GetDesktopWindow()) || fHandle.Equals(NativeMethods.GetShellWindow())))
243243
{
244-
if (!ScreenHelper.IsMultiScreen() || Program.SettingsVM.Settings.DisplayPauseSettings == DisplayPauseEnum.all)
244+
if (!ScreenHelper.IsMultiScreen() ||
245+
Program.SettingsVM.Settings.DisplayPauseSettings == DisplayPauseEnum.all)
246+
//Program.SettingsVM.Settings.WallpaperArrangement == WallpaperArrangement.duplicate)
245247
{
246248
if (IntPtr.Equals(fHandle, workerWOrig) || IntPtr.Equals(fHandle, progman))
247249
{

src/livelywpf/livelywpf/Core/SetupDesktop.cs

+21-8
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ private static async void SetupDesktop_WallpaperInitialized(object sender, Windo
424424

425425
if (reloadRequired)
426426
{
427-
wallpaper.SendMessage("lively:reload");
427+
wallpaper.SetPlaybackPos(0, PlaybackPosType.absolutePercent);
428428
}
429429

430430
if (wallpaper.GetProcess() != null)
@@ -561,11 +561,25 @@ private static void SetWallpaperDuplicateScreen(IWallpaper wallpaper)
561561
}
562562
else
563563
{
564-
Logger.Info("Attempting to synchronize wallpaper position (duplicate.)");
565-
Wallpapers.ForEach(wp =>
564+
Logger.Info("Synchronizing wallpaper (duplicate.)");
565+
var mpvFix = (wallpaper.GetWallpaperType() == WallpaperType.video || wallpaper.GetWallpaperType() == WallpaperType.videostream) &&
566+
Program.SettingsVM.Settings.VideoPlayer == LivelyMediaPlayer.mpv;
567+
Wallpapers.ForEach(x =>
566568
{
567-
wp.SetPlaybackPos(0, PlaybackPosType.absolutePercent);
569+
if (mpvFix)
570+
{
571+
//{mpv player}
572+
//todo: make a general IWallpaper interface method for track change.
573+
//disable audio track of everything except the latest `wallpaper` (not added to Wallpaper list yet..)
574+
Logger.Info("Disabling audio track on screen {0} (duplicate.)", x.GetScreen().DeviceName);
575+
x.SendMessage("{\"command\":[\"set_property\",\"aid\",\"no\"]}\n");
576+
}
577+
x.SetPlaybackPos(0, PlaybackPosType.absolutePercent);
568578
});
579+
if (mpvFix)
580+
{
581+
wallpaper.SetPlaybackPos(0, PlaybackPosType.absolutePercent);
582+
}
569583
}
570584
}
571585

@@ -1055,10 +1069,9 @@ private static void SetFocusMainApp()
10551069
//NativeMethods.SetFocus(progman);
10561070

10571071
if (App.AppWindow?.Visibility != Visibility.Hidden)
1058-
{
1059-
Logger.Debug("MainWindow visible => Setting focus.");
1060-
App.AppWindow?.Activate();
1061-
}
1072+
{
1073+
App.AppWindow?.Activate();
1074+
}
10621075
}));
10631076
}
10641077

src/livelywpf/livelywpf/livelywpf.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<StartupObject>livelywpf.Program</StartupObject>
1111
<ApplicationIcon>appicon.ico</ApplicationIcon>
1212
<Version>1.0.0</Version>
13-
<AssemblyVersion>1.3.1.0</AssemblyVersion>
13+
<AssemblyVersion>1.3.1.1</AssemblyVersion>
1414
</PropertyGroup>
1515

1616
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x86'">

0 commit comments

Comments
 (0)