From 5987a431501d7142b2c7eeb289144f04b980d167 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Tue, 19 May 2020 19:55:08 -0400 Subject: [PATCH] v0.8.1: adjusted volume sliders to use an exponential scale --- .../com/shatteredpixel/shatteredpixeldungeon/SPDSettings.java | 4 ++-- .../shatteredpixeldungeon/ShatteredPixelDungeon.java | 4 ++-- .../shatteredpixeldungeon/windows/WndSettings.java | 2 ++ 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/SPDSettings.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/SPDSettings.java index dfbd5d3b4..f1caa85dd 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/SPDSettings.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/SPDSettings.java @@ -201,7 +201,7 @@ public class SPDSettings extends GameSettings { } public static void musicVol( int value ){ - Music.INSTANCE.volume(value/10f); + Music.INSTANCE.volume(value*value/100f); put( KEY_MUSIC_VOL, value ); } @@ -219,7 +219,7 @@ public class SPDSettings extends GameSettings { } public static void SFXVol( int value ) { - Sample.INSTANCE.volume(value/10f); + Sample.INSTANCE.volume(value*value/100f); put( KEY_SFX_VOL, value ); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ShatteredPixelDungeon.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ShatteredPixelDungeon.java index 8164d3cb6..bfeaa6f4d 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ShatteredPixelDungeon.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ShatteredPixelDungeon.java @@ -149,9 +149,9 @@ public class ShatteredPixelDungeon extends Game { SPDAction.loadBindings(); Music.INSTANCE.enable( SPDSettings.music() ); - Music.INSTANCE.volume( SPDSettings.musicVol()/10f ); + Music.INSTANCE.volume( SPDSettings.musicVol()*SPDSettings.musicVol()/100f ); Sample.INSTANCE.enable( SPDSettings.soundFx() ); - Sample.INSTANCE.volume( SPDSettings.SFXVol()/10f ); + Sample.INSTANCE.volume( SPDSettings.SFXVol()*SPDSettings.SFXVol()/100f ); Sample.INSTANCE.load( Assets.Sounds.all ); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndSettings.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndSettings.java index 18535027e..633bd63dc 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndSettings.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndSettings.java @@ -36,6 +36,7 @@ import com.watabou.noosa.Game; import com.watabou.noosa.Group; import com.watabou.noosa.audio.Sample; import com.watabou.utils.DeviceCompat; +import com.watabou.utils.Random; //TODO seeing as a fair bit of this is platform-dependant, might be better to have a per-platform wndsettings public class WndSettings extends WndTabbed { @@ -351,6 +352,7 @@ public class WndSettings extends WndTabbed { @Override protected void onChange() { SPDSettings.SFXVol(getSelectedValue()); + Sample.INSTANCE.play(Random.element(Assets.Sounds.all)); } }; SFXVol.setSelectedValue(SPDSettings.SFXVol());