fixed toggleMusic in BackgroundMusic.java

changed the Preference save form volume to the boolean musicenable
This commit is contained in:
Hanno Fleischer hanno.fleischer@unibw.de
2024-10-03 17:56:12 +02:00
parent d471f524d0
commit 6e0a93b74d

View File

@@ -30,7 +30,7 @@ public BackgroundMusic(Application app, String musicFilePath) {
backgroundMusic = new AudioNode(app.getAssetManager(), musicFilePath, DataType.Stream); backgroundMusic = new AudioNode(app.getAssetManager(), musicFilePath, DataType.Stream);
backgroundMusic.setLooping(true); backgroundMusic.setLooping(true);
backgroundMusic.setPositional(false); backgroundMusic.setPositional(false);
backgroundMusic.setVolume(1.0f); backgroundMusic.setVolume(volume);
if(musicEnabled) { if(musicEnabled) {
play(); play();
@@ -66,7 +66,7 @@ public void toogleMusic() {
stop(); stop();
} }
prefs.putFloat(VOLUME_PREF, volume); prefs.putBoolean(VOLUME_PREF, musicEnabled);
} }
/** /**