From 555e1a50b498af5acd6c40f8e3324f070dfda4c8 Mon Sep 17 00:00:00 2001 From: Devoxin Date: Mon, 29 Oct 2018 13:23:36 +0000 Subject: [PATCH] Enable filter hotswap, extra debug line, small doc fix --- IMPLEMENTATION.md | 2 +- .../java/lavalink/server/config/AudioPlayerConfiguration.java | 2 ++ .../src/main/java/lavalink/server/player/Player.java | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/IMPLEMENTATION.md b/IMPLEMENTATION.md index 88b3bf2ef..dfaa5f52c 100644 --- a/IMPLEMENTATION.md +++ b/IMPLEMENTATION.md @@ -123,7 +123,7 @@ Using the player equalizer ] } ``` -There are 16 bands (0-15) that can be changed. +There are 15 bands (0-14) that can be changed. `gain` is the multiplier for the given band. The default value is 0. Valid values range from -0.25 to 1.0, where -0.25 means the given band is completely muted, and 0.25 means it is doubled. Modifying the gain could also change the volume of the output. diff --git a/LavalinkServer/src/main/java/lavalink/server/config/AudioPlayerConfiguration.java b/LavalinkServer/src/main/java/lavalink/server/config/AudioPlayerConfiguration.java index 3ea5eb4af..dd1082b20 100644 --- a/LavalinkServer/src/main/java/lavalink/server/config/AudioPlayerConfiguration.java +++ b/LavalinkServer/src/main/java/lavalink/server/config/AudioPlayerConfiguration.java @@ -45,6 +45,8 @@ public Supplier audioPlayerManagerSupplier(AudioSourcesConfi if (sources.isHttp()) audioPlayerManager.registerSourceManager(new HttpAudioSourceManager()); if (sources.isLocal()) audioPlayerManager.registerSourceManager(new LocalAudioSourceManager()); + audioPlayerManager.getConfiguration().setFilterHotSwapEnabled(true); + return audioPlayerManager; }; } diff --git a/LavalinkServer/src/main/java/lavalink/server/player/Player.java b/LavalinkServer/src/main/java/lavalink/server/player/Player.java index ac8ad1822..d4e026669 100644 --- a/LavalinkServer/src/main/java/lavalink/server/player/Player.java +++ b/LavalinkServer/src/main/java/lavalink/server/player/Player.java @@ -91,6 +91,7 @@ public void setVolume(int volume) { } public void setBandGain(int band, float gain) { + log.debug("Setting band {}'s gain to {}", band, gain); equalizerFactory.setGain(band, gain); if (gain == 0.0f) { @@ -110,7 +111,7 @@ public void setBandGain(int band, float gain) { this.player.setFilterFactory(null); this.isEqualizerApplied = false; } - } else { + } else if (!this.isEqualizerApplied) { this.player.setFilterFactory(equalizerFactory); this.isEqualizerApplied = true; }