Merge pull request #25179 from bdach/insufficient-sample-point-query-leniency

Fix insufficient leniency when querying sample points
This commit is contained in:
Dean Herbert 2023-10-20 20:07:32 +09:00 committed by GitHub
commit a26e0bda35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 2 deletions

View File

@ -1080,5 +1080,18 @@ namespace osu.Game.Tests.Beatmaps.Formats
Assert.That(controlPoints.DifficultyPointAt(3000).GenerateTicks, Is.True);
}
}
[Test]
public void TestSamplePointLeniency()
{
var decoder = new LegacyBeatmapDecoder { ApplyOffsets = false };
using (var resStream = TestResources.OpenResource("sample-point-leniency.osu"))
using (var stream = new LineBufferedReader(resStream))
{
var hitObject = decoder.Decode(stream).HitObjects.Single();
Assert.That(hitObject.Samples.Select(s => s.Volume), Has.All.EqualTo(70));
}
}
}
}

View File

@ -0,0 +1,10 @@
osu file format v14
# extracted from https://osu.ppy.sh/beatmapsets/1859679#osu/3823636
[TimingPoints]
39166,-117.647058823529,4,2,1,5,0,0
39262,-117.647058823529,4,2,1,70,0,0
[HitObjects]
440,70,39260,1,10,0:2:0:0:

View File

@ -28,9 +28,12 @@ namespace osu.Game.Beatmaps.Formats
public const int EARLY_VERSION_TIMING_OFFSET = 24;
/// <summary>
/// A small adjustment to the start time of control points to account for rounding/precision errors.
/// A small adjustment to the start time of sample control points to account for rounding/precision errors.
/// </summary>
private const double control_point_leniency = 1;
/// <remarks>
/// Compare: https://github.com/peppy/osu-stable-reference/blob/master/osu!/GameplayElements/HitObjects/HitObject.cs#L319
/// </remarks>
private const double control_point_leniency = 5;
internal static RulesetStore? RulesetStore;