From 78717b0eb59dda3ff314ed96fcb984b5ea746239 Mon Sep 17 00:00:00 2001 From: EliteAsian <29520859+EliteAsian123@users.noreply.github.com> Date: Tue, 23 Jul 2024 17:04:59 -0400 Subject: [PATCH] Added setting to enable/disable the overstrum/overhit sound effect --- Assets/Script/Gameplay/Player/DrumsPlayer.cs | 2 +- .../Script/Gameplay/Player/FiveFretPlayer.cs | 19 +++++++++++-------- Assets/Script/Gameplay/Player/TrackPlayer.cs | 2 +- .../Settings/SettingsManager.Settings.cs | 2 ++ Assets/Script/Settings/SettingsManager.cs | 1 + Assets/StreamingAssets/lang/en-US.json | 4 ++++ 6 files changed, 20 insertions(+), 10 deletions(-) diff --git a/Assets/Script/Gameplay/Player/DrumsPlayer.cs b/Assets/Script/Gameplay/Player/DrumsPlayer.cs index dc516420b..bd31c0dff 100644 --- a/Assets/Script/Gameplay/Player/DrumsPlayer.cs +++ b/Assets/Script/Gameplay/Player/DrumsPlayer.cs @@ -78,7 +78,7 @@ protected override DrumsEngine CreateEngine() engine.OnNoteHit += OnNoteHit; engine.OnNoteMissed += OnNoteMissed; - engine.OnOverhit += OnOverstrum; + engine.OnOverhit += OnOverhit; engine.OnSoloStart += OnSoloStart; engine.OnSoloEnd += OnSoloEnd; diff --git a/Assets/Script/Gameplay/Player/FiveFretPlayer.cs b/Assets/Script/Gameplay/Player/FiveFretPlayer.cs index d39919a91..02bf01ba1 100644 --- a/Assets/Script/Gameplay/Player/FiveFretPlayer.cs +++ b/Assets/Script/Gameplay/Player/FiveFretPlayer.cs @@ -10,6 +10,7 @@ using YARG.Gameplay.HUD; using YARG.Gameplay.Visuals; using YARG.Player; +using YARG.Settings; namespace YARG.Gameplay.Player { @@ -88,7 +89,7 @@ protected override GuitarEngine CreateEngine() engine.OnNoteHit += OnNoteHit; engine.OnNoteMissed += OnNoteMissed; - engine.OnOverstrum += OnOverstrum; + engine.OnOverstrum += OnOverhit; engine.OnSustainStart += OnSustainStart; engine.OnSustainEnd += OnSustainEnd; @@ -190,16 +191,18 @@ protected override void OnNoteMissed(int index, GuitarNote chordParent) } } - protected override void OnOverstrum() + protected override void OnOverhit() { - base.OnOverstrum(); + base.OnOverhit(); - const int min = (int) SfxSample.Overstrum1; - const int max = (int) SfxSample.Overstrum4; - - var randomOverstrum = (SfxSample) Random.Range(min, max + 1); + if (SettingsManager.Settings.OverstrumAndOverhitSoundEffects.Value) + { + const int MIN = (int) SfxSample.Overstrum1; + const int MAX = (int) SfxSample.Overstrum4; - GlobalAudioHandler.PlaySoundEffect(randomOverstrum); + var randomOverstrum = (SfxSample) Random.Range(MIN, MAX + 1); + GlobalAudioHandler.PlaySoundEffect(randomOverstrum); + } } private void OnSustainStart(GuitarNote parent) diff --git a/Assets/Script/Gameplay/Player/TrackPlayer.cs b/Assets/Script/Gameplay/Player/TrackPlayer.cs index 44e743dcd..e6f03ee6a 100644 --- a/Assets/Script/Gameplay/Player/TrackPlayer.cs +++ b/Assets/Script/Gameplay/Player/TrackPlayer.cs @@ -443,7 +443,7 @@ protected virtual void OnNoteMissed(int index, TNote note) } } - protected virtual void OnOverstrum() + protected virtual void OnOverhit() { if (IsFc) { diff --git a/Assets/Script/Settings/SettingsManager.Settings.cs b/Assets/Script/Settings/SettingsManager.Settings.cs index 843106ef0..d159f583a 100644 --- a/Assets/Script/Settings/SettingsManager.Settings.cs +++ b/Assets/Script/Settings/SettingsManager.Settings.cs @@ -157,6 +157,8 @@ public void OpenVenueFolder() public ToggleSetting ClapsInStarpower { get; } = new(true); + public ToggleSetting OverstrumAndOverhitSoundEffects { get; } = new(true); + // public ToggleSetting UseWhammyFx { get; } = new(true, UseWhammyFxChange); // public SliderSetting WhammyPitchShiftAmount { get; } = new(1, 1, 12, WhammyPitchShiftAmountChange); // public IntSetting WhammyOversampleFactor { get; } = new(8, 4, 32, WhammyOversampleFactorChange); diff --git a/Assets/Script/Settings/SettingsManager.cs b/Assets/Script/Settings/SettingsManager.cs index 4557b8d25..1a136e73b 100644 --- a/Assets/Script/Settings/SettingsManager.cs +++ b/Assets/Script/Settings/SettingsManager.cs @@ -87,6 +87,7 @@ public static partial class SettingsManager // nameof(Settings.WhammyPitchShiftAmount), // nameof(Settings.WhammyOversampleFactor), nameof(Settings.ClapsInStarpower), + nameof(Settings.OverstrumAndOverhitSoundEffects), // nameof(Settings.ReverbInStarpower), nameof(Settings.UseChipmunkSpeed), nameof(Settings.ApplyVolumesInMusicLibrary), diff --git a/Assets/StreamingAssets/lang/en-US.json b/Assets/StreamingAssets/lang/en-US.json index aaa1d0a26..3971ae6de 100644 --- a/Assets/StreamingAssets/lang/en-US.json +++ b/Assets/StreamingAssets/lang/en-US.json @@ -439,6 +439,10 @@ "Name": "Star Power Claps", "Description": "Enables claps to the beat while Star Power is active." }, + "OverstrumAndOverhitSoundEffects": { + "Name": "Overstrum/Overhit Sound Effects", + "Description": "Enables the overstrum/overhit sound effect." + }, "CrowdVolume": { "Name": "Crowd Volume", "Description": "Adjusts the song's crowd track volume. Only does something if the song is multi-track."