ppy / osu

rhythm is just a *click* away!
https://osu.ppy.sh
MIT License
15.52k stars 2.31k forks source link

Nightcore beats don't resume playing correctly after pausing #30293

Open bdach opened 1 month ago

bdach commented 1 month ago

Type

Game behaviour

Bug description

Reported in https://discord.com/channels/188630481301012481/1097318920991559880/1295680161580056600

With Nightcore mod active, pausing mid-play and unpausing results in nightcore beat samples not being played for some time. They seem to only resume when a "finish" sample is normally supposed to be played (every 16 beats / 4 bars). They also get disabled again for the same number of beats whenever a new timing point is encountered.

Screenshots or videos

https://github.com/user-attachments/assets/b7fcaa25-c8b4-46ca-9419-6892de717593

Version

current master

Logs

n/a

bdach commented 1 month ago

Well if I were to try fix this naively, it would be by essentially reverting https://github.com/ppy/osu/pull/7221/commits/c883c97bab8e81a3bd67db0ef5d4c7110b5d3161...

diff --git a/osu.Game/Rulesets/Mods/ModNightcore.cs b/osu.Game/Rulesets/Mods/ModNightcore.cs
index bb18940f8c..c55ac952ed 100644
--- a/osu.Game/Rulesets/Mods/ModNightcore.cs
+++ b/osu.Game/Rulesets/Mods/ModNightcore.cs
@@ -116,7 +116,7 @@ protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint,

                 if (!firstBeat.HasValue || beatIndex < firstBeat)
                     // decide on a good starting beat index if once has not yet been decided.
-                    firstBeat = beatIndex < 0 ? 0 : (beatIndex / segmentLength + 1) * segmentLength;
+                    firstBeat = beatIndex < 0 ? 0 : (beatIndex / segmentLength) * segmentLength;

                 if (beatIndex >= firstBeat)
                     playBeatFor(beatIndex % segmentLength, timingPoint.TimeSignature);

@peppy are you able to provide some insight into that commit? Dec 2019 is already within my range of activity but I don't believe I looked at that original change and there's seemingly not much talk about it on the PR.

peppy commented 1 month ago

From my recollection, without that commit the beat would start too early at the beginning of the beatmap. Maybe that has been fixed elsewhere if you're not seeing that?

I'll take a look.