Skip to content

Commit

Permalink
Added setting to enable/disable the overstrum/overhit sound effect
Browse files Browse the repository at this point in the history
  • Loading branch information
EliteAsian123 committed Jul 23, 2024
1 parent 55da553 commit 78717b0
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Assets/Script/Gameplay/Player/DrumsPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
19 changes: 11 additions & 8 deletions Assets/Script/Gameplay/Player/FiveFretPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using YARG.Gameplay.HUD;
using YARG.Gameplay.Visuals;
using YARG.Player;
using YARG.Settings;

namespace YARG.Gameplay.Player
{
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion Assets/Script/Gameplay/Player/TrackPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ protected virtual void OnNoteMissed(int index, TNote note)
}
}

protected virtual void OnOverstrum()
protected virtual void OnOverhit()
{
if (IsFc)
{
Expand Down
2 changes: 2 additions & 0 deletions Assets/Script/Settings/SettingsManager.Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions Assets/Script/Settings/SettingsManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
4 changes: 4 additions & 0 deletions Assets/StreamingAssets/lang/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down

0 comments on commit 78717b0

Please sign in to comment.