Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update framework and adjust internal offsets for enhanced WASAPI support #26154

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion osu.Android.props
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ppy.osu.Framework.Android" Version="2023.1219.0" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2023.1227.0" />
</ItemGroup>
<PropertyGroup>
<!-- Fody does not handle Android build well, and warns when unchanged.
Expand Down
22 changes: 21 additions & 1 deletion osu.Game/Beatmaps/FramedBeatmapClock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Diagnostics;
using osu.Framework;
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Timing;
Expand Down Expand Up @@ -44,6 +45,8 @@ public partial class FramedBeatmapClock : Component, IFrameBasedClock, IAdjustab

private readonly DecouplingFramedClock decoupledTrack;

private IBindable<bool>? usingGlobalMixer;

[Resolved]
private OsuConfigManager config { get; set; } = null!;

Expand All @@ -69,7 +72,7 @@ public FramedBeatmapClock(bool applyOffsets, bool requireDecoupling, IClock? sou
{
// Audio timings in general with newer BASS versions don't match stable.
// This only seems to be required on windows. We need to eventually figure out why, with a bit of luck.
platformOffsetClock = new OffsetCorrectionClock(interpolatedTrack, ExternalPauseFrequencyAdjust) { Offset = RuntimeInfo.OS == RuntimeInfo.Platform.Windows ? 15 : 0 };
platformOffsetClock = new OffsetCorrectionClock(interpolatedTrack, ExternalPauseFrequencyAdjust);

// User global offset (set in settings) should also be applied.
userGlobalOffsetClock = new OffsetCorrectionClock(platformOffsetClock, ExternalPauseFrequencyAdjust);
Expand All @@ -83,6 +86,23 @@ public FramedBeatmapClock(bool applyOffsets, bool requireDecoupling, IClock? sou
}
}

[BackgroundDependencyLoader]
private void load(AudioManager audioManager)
{
if (platformOffsetClock != null)
{
if (RuntimeInfo.OS == RuntimeInfo.Platform.Windows)
{
usingGlobalMixer = audioManager.UsingGlobalMixer.GetBoundCopy();
usingGlobalMixer.BindValueChanged(usingMixer =>
{
// known "good" values, aka defaults which work for the majority of users.
platformOffsetClock.Offset = usingMixer.NewValue ? -45 : 15;
});
}
}
}

protected override void LoadComplete()
{
base.LoadComplete();
Expand Down
2 changes: 1 addition & 1 deletion osu.Game/osu.Game.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Realm" Version="11.5.0" />
<PackageReference Include="ppy.osu.Framework" Version="2023.1219.0" />
<PackageReference Include="ppy.osu.Framework" Version="2023.1227.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2023.1225.0" />
<PackageReference Include="Sentry" Version="3.40.0" />
<!-- Held back due to 0.34.0 failing AOT compilation on ZstdSharp.dll dependency. -->
Expand Down
2 changes: 1 addition & 1 deletion osu.iOS.props
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@
<RuntimeIdentifier>iossimulator-x64</RuntimeIdentifier>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ppy.osu.Framework.iOS" Version="2023.1219.0" />
<PackageReference Include="ppy.osu.Framework.iOS" Version="2023.1227.0" />
</ItemGroup>
</Project>
Loading