mirror of
https://github.com/osukey/osukey.git
synced 2025-08-08 09:03:50 +09:00
Add pitch randomisation to HoverSounds on-hover sample playback
This commit is contained in:
@ -11,6 +11,7 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
|
using osu.Framework.Utils;
|
||||||
|
|
||||||
namespace osu.Game.Graphics.UserInterface
|
namespace osu.Game.Graphics.UserInterface
|
||||||
{
|
{
|
||||||
@ -49,9 +50,11 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
{
|
{
|
||||||
bool enoughTimePassedSinceLastPlayback = !lastPlaybackTime.Value.HasValue || Time.Current - lastPlaybackTime.Value >= HoverDebounceTime;
|
bool enoughTimePassedSinceLastPlayback = !lastPlaybackTime.Value.HasValue || Time.Current - lastPlaybackTime.Value >= HoverDebounceTime;
|
||||||
|
|
||||||
if (enoughTimePassedSinceLastPlayback)
|
if (enoughTimePassedSinceLastPlayback && sampleHover != null)
|
||||||
{
|
{
|
||||||
sampleHover?.Play();
|
sampleHover.Frequency.Value = 0.96 + RNG.NextDouble(0.08);
|
||||||
|
sampleHover.Play();
|
||||||
|
|
||||||
lastPlaybackTime.Value = Time.Current;
|
lastPlaybackTime.Value = Time.Current;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user