From 08d9f4165a34d3c88066533c34c07c29d3b9edaa Mon Sep 17 00:00:00 2001 From: yugecin Date: Fri, 30 Sep 2016 20:46:38 +0200 Subject: [PATCH] option to ignore beatmap sample volume --- src/itdelatrisu/opsu/Options.java | 7 +++++++ src/itdelatrisu/opsu/audio/SoundController.java | 4 ++++ src/itdelatrisu/opsu/states/OptionsMenu.java | 1 + 3 files changed, 12 insertions(+) diff --git a/src/itdelatrisu/opsu/Options.java b/src/itdelatrisu/opsu/Options.java index 335a706e..66b50f03 100644 --- a/src/itdelatrisu/opsu/Options.java +++ b/src/itdelatrisu/opsu/Options.java @@ -433,6 +433,7 @@ public class Options { container.setMusicVolume(getMasterVolume() * getMusicVolume()); } }, + IGNORE_SAMPLE_VOLUME ("Ignore sample volume", "IgnoreBMSample", "Ignore hitsound volume set by beatmap", true), EFFECT_VOLUME ("Effect Volume", "VolumeEffect", "Volume of menu and game sounds.", 70, 0, 100), HITSOUND_VOLUME ("Hit Sound Volume", "VolumeHitSound", "Volume of hit sounds.", 30, 0, 100), MUSIC_OFFSET ("Music Offset", "Offset", "Adjust this value if hit objects are out of sync.", -75, -500, 500) { @@ -1164,6 +1165,12 @@ public class Options { */ public static float getHitSoundVolume() { return GameOption.HITSOUND_VOLUME.getIntegerValue() / 100f; } + /** + * Returns the default hit sound volume. + * @return the hit sound volume [0, 1] + */ + public static boolean ignoreBeatmapSampleVolume() { return GameOption.IGNORE_SAMPLE_VOLUME.bool; } + /** * Returns the music offset time. * @return the offset (in milliseconds) diff --git a/src/itdelatrisu/opsu/audio/SoundController.java b/src/itdelatrisu/opsu/audio/SoundController.java index 7f42f144..7d354d81 100644 --- a/src/itdelatrisu/opsu/audio/SoundController.java +++ b/src/itdelatrisu/opsu/audio/SoundController.java @@ -291,6 +291,10 @@ public class SoundController { if (hitSound < 0) return; + if (Options.ignoreBeatmapSampleVolume()) { + sampleVolumeMultiplier = 1f; + } + float volume = Options.getHitSoundVolume() * sampleVolumeMultiplier * Options.getMasterVolume(); if (volume == 0f) return; diff --git a/src/itdelatrisu/opsu/states/OptionsMenu.java b/src/itdelatrisu/opsu/states/OptionsMenu.java index 8e9818fd..c8333a52 100644 --- a/src/itdelatrisu/opsu/states/OptionsMenu.java +++ b/src/itdelatrisu/opsu/states/OptionsMenu.java @@ -70,6 +70,7 @@ public class OptionsMenu extends BasicGameState { GameOption.MUSIC_VOLUME, GameOption.EFFECT_VOLUME, GameOption.HITSOUND_VOLUME, + GameOption.IGNORE_SAMPLE_VOLUME, GameOption.MUSIC_OFFSET, GameOption.DISABLE_SOUNDS, GameOption.ENABLE_THEME_SONG