music: add option to mute ambient sound effects
This commit is contained in:
@@ -28,10 +28,12 @@ import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
|
||||
@ConfigGroup("music")
|
||||
@ConfigGroup(MusicConfig.GROUP)
|
||||
public interface MusicConfig extends Config
|
||||
{
|
||||
String GROUP = "music";
|
||||
String GRANULAR_SLIDERS = "granularSliders";
|
||||
String MUTE_AMBIENT_SOUNDS = "muteAmbientSounds";
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "muteOwnAreaSounds",
|
||||
@@ -77,11 +79,22 @@ public interface MusicConfig extends Config
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = MUTE_AMBIENT_SOUNDS,
|
||||
name = "Mute ambient sounds",
|
||||
description = "Mute background noise such as magic trees and furnaces",
|
||||
position = 4
|
||||
)
|
||||
default boolean muteAmbientSounds()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "mutePrayerSounds",
|
||||
name = "Mute prayer sounds",
|
||||
description = "Mute prayer activation and deactivation sounds",
|
||||
position = 4
|
||||
position = 5
|
||||
)
|
||||
default boolean mutePrayerSounds()
|
||||
{
|
||||
@@ -92,7 +105,7 @@ public interface MusicConfig extends Config
|
||||
keyName = GRANULAR_SLIDERS,
|
||||
name = "Granular volume sliders",
|
||||
description = "Make the volume sliders allow better control of volume",
|
||||
position = 5
|
||||
position = 6
|
||||
)
|
||||
default boolean granularSliders()
|
||||
{
|
||||
|
||||
@@ -221,12 +221,21 @@ public class MusicPlugin extends Plugin
|
||||
@Subscribe
|
||||
public void onGameStateChanged(GameStateChanged gameStateChanged)
|
||||
{
|
||||
if (gameStateChanged.getGameState() == GameState.LOGIN_SCREEN)
|
||||
GameState gameState = gameStateChanged.getGameState();
|
||||
if (gameState == GameState.LOGIN_SCREEN)
|
||||
{
|
||||
// Reset music filter on logout
|
||||
currentMusicFilter = MusicState.ALL;
|
||||
tracks = null;
|
||||
}
|
||||
else if (gameState == GameState.LOGGED_IN)
|
||||
{
|
||||
if (musicConfig.muteAmbientSounds())
|
||||
{
|
||||
client.getAmbientSoundEffects()
|
||||
.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
@@ -308,7 +317,7 @@ public class MusicPlugin extends Plugin
|
||||
@Subscribe
|
||||
public void onConfigChanged(ConfigChanged configChanged)
|
||||
{
|
||||
if ("music".equals(configChanged.getGroup()))
|
||||
if (configChanged.getGroup().equals(MusicConfig.GROUP))
|
||||
{
|
||||
clientThread.invoke(() ->
|
||||
{
|
||||
@@ -324,6 +333,14 @@ public class MusicPlugin extends Plugin
|
||||
teardownMusicOptions();
|
||||
}
|
||||
}
|
||||
else if (MusicConfig.MUTE_AMBIENT_SOUNDS.equals(configChanged.getKey()))
|
||||
{
|
||||
// Reload the scene to reapply ambient sounds
|
||||
if (client.getGameState() == GameState.LOGGED_IN)
|
||||
{
|
||||
client.setGameState(GameState.LOADING);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
updateMusicOptions();
|
||||
|
||||
Reference in New Issue
Block a user