Skip to content

Commit

Permalink
Add Setting To Always Allow Drum SFX (#889)
Browse files Browse the repository at this point in the history
  • Loading branch information
nameonascreen authored Oct 17, 2024
1 parent 55d366b commit d1acf92
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
16 changes: 13 additions & 3 deletions Assets/Script/Gameplay/Player/DrumsPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
using YARG.Gameplay.Visuals;
using YARG.Helpers.Extensions;
using YARG.Player;
using YARG.Settings;

namespace YARG.Gameplay.Player
{
Expand Down Expand Up @@ -101,7 +102,15 @@ protected override DrumsEngine CreateEngine()
engine.OnPadHit += (action, wasNoteHit, velocity) =>
{
// Skip if a note was hit, because we have different logic for that below
if (wasNoteHit) return;
if (wasNoteHit)
{
// If AODSFX is turned on and a note was hit, Play the drum sfx. Without this, drum sfx will only play on misses.
if (SettingsManager.Settings.AlwaysOnDrumSFX.Value)
{
PlayDrumSoundEffect(action, velocity);
}
return;
}

// Choose the correct fret
int fret;
Expand Down Expand Up @@ -133,7 +142,8 @@ protected override DrumsEngine CreateEngine()

bool isDrumFreestyle = IsDrumFreestyle();

if (isDrumFreestyle)
// Figure out wether its a drum freestyle or if AODSFX is enabled
if (SettingsManager.Settings.AlwaysOnDrumSFX.Value || isDrumFreestyle)
{
// Play drum sound effect
PlayDrumSoundEffect(action, velocity);
Expand Down Expand Up @@ -342,4 +352,4 @@ public override (ReplayFrame Frame, ReplayStats Stats) ConstructReplayData()
return (frame, Engine.EngineStats.ConstructReplayStats(Player.Profile.Name));
}
}
}
}
2 changes: 2 additions & 0 deletions Assets/Script/Settings/SettingsManager.Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ public void OpenVenueFolder()

public ToggleSetting OverstrumAndOverhitSoundEffects { get; } = new(true);

public ToggleSetting AlwaysOnDrumSFX { get; } = new(false);

public ToggleSetting UseWhammyFx { get; } = new(false, v => GlobalAudioHandler.UseWhammyFx = v);

public SliderSetting WhammyPitchShiftAmount { get; } = new(1, 1, 5, v => GlobalAudioHandler.WhammyPitchShiftAmount = v);
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 @@ -105,6 +105,7 @@ public static partial class SettingsManager
// nameof(Settings.WhammyOversampleFactor),
nameof(Settings.ClapsInStarpower),
nameof(Settings.OverstrumAndOverhitSoundEffects),
nameof(Settings.AlwaysOnDrumSFX),
// 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 @@ -530,6 +530,10 @@
"Name": "Overstrum/Overhit Sound Effects",
"Description": "Enables the overstrum/overhit sound effect."
},
"AlwaysOnDrumSFX": {
"Name": "Always-On Drum SFX",
"Description": "Enables Drum SFX at all times."
},
"CrowdVolume": {
"Name": "Crowd Volume",
"PauseName": "Crowd",
Expand Down

0 comments on commit d1acf92

Please sign in to comment.