Add setting for disabling background music

This commit is contained in:
drdev
2014-06-29 03:34:14 +00:00
parent 7c821455aa
commit 93bcca743c
3 changed files with 15 additions and 2 deletions

View File

@@ -63,6 +63,7 @@ public class ForgePreferences extends PreferencesStore<ForgePreferences.FPref> {
UI_PREFERRED_AVATARS_ONLY ("false"),
UI_TARGETING_OVERLAY ("false"),
UI_ENABLE_SOUNDS ("true"),
UI_ENABLE_MUSIC ("true"),
UI_ALT_SOUND_SYSTEM ("false"),
UI_CURRENT_AI_PROFILE (AiProfileUtil.AI_PROFILE_RANDOM_MATCH),
UI_CLONE_MODE_SOURCE ("false"), /** */

View File

@@ -168,14 +168,16 @@ public class SoundSystem {
changeBackgroundTrack();
}
private void changeBackgroundTrack() {
public void changeBackgroundTrack() {
//ensure old track stopped and disposed of if needed
if (currentTrack != null) {
currentTrack.dispose();
currentTrack = null;
}
if (currentPlaylist == null) { return; }
if (currentPlaylist == null || !FModel.getPreferences().getPrefBoolean(FPref.UI_ENABLE_MUSIC)) {
return;
}
String filename = currentPlaylist.getRandomFilename();
if (filename == null) { return; }