mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 11:07:52 +08:00
Merge pull request #9036 from peppy/fix-audio-offsets-rate-adjust
Fix applied platform/user offsets being incorrect when rate adjust mods are active
This commit is contained in:
commit
43c42cdf31
@ -78,10 +78,10 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
// Lazer's audio timings in general doesn't match stable. This is the result of user testing, albeit limited.
|
// Lazer's audio timings in general doesn't match stable. This is the result of user testing, albeit limited.
|
||||||
// This only seems to be required on windows. We need to eventually figure out why, with a bit of luck.
|
// This only seems to be required on windows. We need to eventually figure out why, with a bit of luck.
|
||||||
platformOffsetClock = new FramedOffsetClock(adjustableClock) { Offset = RuntimeInfo.OS == RuntimeInfo.Platform.Windows ? 15 : 0 };
|
platformOffsetClock = new HardwareCorrectionOffsetClock(adjustableClock) { Offset = RuntimeInfo.OS == RuntimeInfo.Platform.Windows ? 15 : 0 };
|
||||||
|
|
||||||
// the final usable gameplay clock with user-set offsets applied.
|
// the final usable gameplay clock with user-set offsets applied.
|
||||||
userOffsetClock = new FramedOffsetClock(platformOffsetClock);
|
userOffsetClock = new HardwareCorrectionOffsetClock(platformOffsetClock);
|
||||||
|
|
||||||
// the clock to be exposed via DI to children.
|
// the clock to be exposed via DI to children.
|
||||||
GameplayClock = new GameplayClock(userOffsetClock);
|
GameplayClock = new GameplayClock(userOffsetClock);
|
||||||
@ -248,5 +248,16 @@ namespace osu.Game.Screens.Play
|
|||||||
speedAdjustmentsApplied = false;
|
speedAdjustmentsApplied = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class HardwareCorrectionOffsetClock : FramedOffsetClock
|
||||||
|
{
|
||||||
|
// we always want to apply the same real-time offset, so it should be adjusted by the playback rate to achieve this.
|
||||||
|
public override double CurrentTime => SourceTime + Offset * Rate;
|
||||||
|
|
||||||
|
public HardwareCorrectionOffsetClock(IClock source, bool processSource = true)
|
||||||
|
: base(source, processSource)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user