mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38:00 +00:00
Add setting for disabling background music
This commit is contained in:
@@ -179,6 +179,16 @@ public class SettingsPage extends TabPage<SettingsScreen> {
|
||||
"Enable Sounds",
|
||||
"Enable sound effects during the game."),
|
||||
7);
|
||||
lstSettings.addItem(new BooleanSetting(FPref.UI_ENABLE_MUSIC,
|
||||
"Enable Music",
|
||||
"Enable background music during the game.") {
|
||||
@Override
|
||||
public void select() {
|
||||
super.select();
|
||||
//update background music when this setting changes
|
||||
Forge.getSoundSystem().changeBackgroundTrack();
|
||||
}
|
||||
}, 7);
|
||||
/*lstSettings.addItem(new BooleanSetting(FPref.UI_ALT_SOUND_SYSTEM,
|
||||
"Use Alternate Sound System",
|
||||
"Use the alternate sound system (only use if you have issues with sound not playing or disappearing)."),
|
||||
|
||||
@@ -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"), /** */
|
||||
|
||||
@@ -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; }
|
||||
|
||||
Reference in New Issue
Block a user