From d00a0cb70a2e8ebc2e5de45c735b3b5fb3ba0e79 Mon Sep 17 00:00:00 2001 From: Duncan Sterken Date: Fri, 14 Jun 2019 08:49:21 +0200 Subject: [PATCH 01/68] Implement sending friendly ex on error --- .../main/java/lavalink/server/player/EventEmitter.java | 5 +++++ .../src/main/java/lavalink/server/util/Util.java | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/LavalinkServer/src/main/java/lavalink/server/player/EventEmitter.java b/LavalinkServer/src/main/java/lavalink/server/player/EventEmitter.java index cc500dc55..d74ee8b46 100644 --- a/LavalinkServer/src/main/java/lavalink/server/player/EventEmitter.java +++ b/LavalinkServer/src/main/java/lavalink/server/player/EventEmitter.java @@ -78,6 +78,11 @@ public void onTrackException(AudioPlayer player, AudioTrack track, FriendlyExcep } out.put("error", exception.getMessage()); + JSONObject exceptionJson = new JSONObject(); + exceptionJson.put("message", exception.getMessage()); + exceptionJson.put("severity", exception.severity.toString()); + exceptionJson.put("cause", Util.getRootCause(exception).toString()); + out.put("exception", exceptionJson); linkPlayer.getSocket().send(out); } diff --git a/LavalinkServer/src/main/java/lavalink/server/util/Util.java b/LavalinkServer/src/main/java/lavalink/server/util/Util.java index 67ff7eb63..4e5e60007 100644 --- a/LavalinkServer/src/main/java/lavalink/server/util/Util.java +++ b/LavalinkServer/src/main/java/lavalink/server/util/Util.java @@ -50,4 +50,12 @@ public static String toMessage(AudioPlayerManager audioPlayerManager, AudioTrack return Base64.encodeBase64String(baos.toByteArray()); } + public static Throwable getRootCause(Throwable throwable) { + Throwable rootCause = throwable; + while (rootCause.getCause() != null) { + rootCause = rootCause.getCause(); + } + return rootCause; + } + } From 77481c8ee7db1217cbadc87426565fa1f411ba09 Mon Sep 17 00:00:00 2001 From: Duncan Sterken Date: Fri, 14 Jun 2019 08:54:21 +0200 Subject: [PATCH 02/68] Update implementation --- IMPLEMENTATION.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/IMPLEMENTATION.md b/IMPLEMENTATION.md index 51586e1a8..830902ec7 100644 --- a/IMPLEMENTATION.md +++ b/IMPLEMENTATION.md @@ -219,9 +219,14 @@ private void handleEvent(JSONObject json) throws IOException { ); break; case "TrackExceptionEvent": + JSONObject jsonEx = json.getJSONObject("exception"); event = new TrackExceptionEvent(player, LavalinkUtil.toAudioTrack(json.getString("track")), - new RemoteTrackException(json.getString("error")) + new FriendlyException( + jsonEx.getString("message"), + FriendlyException.Severity.valueOf(jsonEx.getString("severity")), + new Exception(jsonEx.getString("cause")) + ) ); break; case "TrackStuckEvent": From 1ba4a4b5b4a30d4cc8869429d56ba750ae49ddff Mon Sep 17 00:00:00 2001 From: Duncan Sterken Date: Sun, 16 Jun 2019 09:21:57 +0200 Subject: [PATCH 03/68] Document breaking change --- IMPLEMENTATION.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/IMPLEMENTATION.md b/IMPLEMENTATION.md index 830902ec7..9915c0e0f 100644 --- a/IMPLEMENTATION.md +++ b/IMPLEMENTATION.md @@ -12,6 +12,10 @@ The Java client has support for JDA, but can also be adapted to work with other * Hixie 76 * Hixie 75 +## Significant changes v3.0 -> v3.1 +The `error` string on the `TrackExceptionEvent` has been deprecated and replaced by +the `exception` object following the same structure as the `LOAD_FAILED` error on [`/loadtracks`](#rest-api) + ## Significant changes v2.0 -> v3.0 * The response of `/loadtracks` has been completely changed (again since the initial v3.0 pre-release). * Lavalink v3.0 now reports its version as a handshake response header. @@ -225,7 +229,7 @@ private void handleEvent(JSONObject json) throws IOException { new FriendlyException( jsonEx.getString("message"), FriendlyException.Severity.valueOf(jsonEx.getString("severity")), - new Exception(jsonEx.getString("cause")) + new RuntimeException(jsonEx.getString("cause")) ) ); break; From 5d57afa0f5fa152f779f311fff4ae72eb3af7c26 Mon Sep 17 00:00:00 2001 From: Duncan Sterken Date: Sun, 16 Jun 2019 11:38:02 +0200 Subject: [PATCH 04/68] Bump API version Co-Authored-By: Frederik Ar. Mikkelsen --- IMPLEMENTATION.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IMPLEMENTATION.md b/IMPLEMENTATION.md index 9915c0e0f..5efc912d3 100644 --- a/IMPLEMENTATION.md +++ b/IMPLEMENTATION.md @@ -12,7 +12,7 @@ The Java client has support for JDA, but can also be adapted to work with other * Hixie 76 * Hixie 75 -## Significant changes v3.0 -> v3.1 +## Significant changes v3.0 -> v4.0 The `error` string on the `TrackExceptionEvent` has been deprecated and replaced by the `exception` object following the same structure as the `LOAD_FAILED` error on [`/loadtracks`](#rest-api) From 4ee708fc5d34828338c8f5765d26530446df967b Mon Sep 17 00:00:00 2001 From: "Frederik Ar. Mikkelsen" Date: Sat, 6 Jul 2019 13:57:24 +0200 Subject: [PATCH 05/68] Add lavaDsp --- LavalinkServer/build.gradle | 1 + build.gradle | 1 + 2 files changed, 2 insertions(+) diff --git a/LavalinkServer/build.gradle b/LavalinkServer/build.gradle index b3ff46f7a..ad900a96a 100644 --- a/LavalinkServer/build.gradle +++ b/LavalinkServer/build.gradle @@ -37,6 +37,7 @@ dependencies { compile group: 'club.minnced', name: 'magma', version: magmaVersion compile group: 'com.sedmelluq', name: 'lavaplayer', version: lavaplayerVersion compile group: 'com.sedmelluq', name: 'jda-nas', version: jdaNasVersion + compile group: 'com.github.natanbc', name: 'lavadsp', version: lavaDspVersion compile group: 'org.jetbrains.kotlin', name: 'kotlin-reflect', version: kotlinVersion compile group: 'com.github.shredder121', name: 'jda-async-packetprovider', version: jappVersion diff --git a/build.gradle b/build.gradle index 16b5cb12d..55ca0f678 100644 --- a/build.gradle +++ b/build.gradle @@ -55,6 +55,7 @@ subprojects { magmaVersion = '0.9.0' jdaNasVersion = '1.0.6' jappVersion = '1.3' + lavaDspVersion = '0.5.2' springBootVersion = "${springBootVersion}" springWebSocketVersion = '5.0.8.RELEASE' From 42cb5f7c58e98d1911e87bffb35aee0a235b85f8 Mon Sep 17 00:00:00 2001 From: "Frederik Ar. Mikkelsen" Date: Sat, 6 Jul 2019 14:01:02 +0200 Subject: [PATCH 06/68] Initial filter config --- .../java/lavalink/server/player/filters.kt | 85 +++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 LavalinkServer/src/main/java/lavalink/server/player/filters.kt diff --git a/LavalinkServer/src/main/java/lavalink/server/player/filters.kt b/LavalinkServer/src/main/java/lavalink/server/player/filters.kt new file mode 100644 index 000000000..9ce714f89 --- /dev/null +++ b/LavalinkServer/src/main/java/lavalink/server/player/filters.kt @@ -0,0 +1,85 @@ +package lavalink.server.player + +import com.sedmelluq.discord.lavaplayer.filter.* +import com.sedmelluq.discord.lavaplayer.format.AudioDataFormat +import com.sedmelluq.discord.lavaplayer.track.AudioTrack +import org.json.JSONObject + +class FilterChain( + var equalizer: EqualizerConfig? = null, + var karaoke: KaraokeConfig? = null, + var timescale: TimescaleConfig? = null, + var tremolo: TremoloConfig? = null, + var vibrato: VibratoConfig? = null, + var volume: VolumeConfig? = null +) : PcmFilterFactory { + + fun parse(json: JSONObject) { + // TODO + } + + override fun buildChain(track: AudioTrack, format: AudioDataFormat, output: UniversalPcmAudioFilter): MutableList { + val list = listOfNotNull(equalizer, karaoke, timescale, tremolo, vibrato, volume) + val builder = FilterChainBuilder() + builder.addFirst(output) + list.filter { it.isEnabled } + .map { it.build(format, builder.makeFirstFloat(format.channelCount)) } + .forEach { builder.addFirst(it) } + + return builder.build(null, format.channelCount) + .filters.apply { dropLast(1) } + } +} + +class EqualizerConfig(json: JSONObject) : FilterConfig(json) { + override fun build(format: AudioDataFormat, output: FloatPcmAudioFilter): AudioFilter { + TODO("not implemented") + } + + override val isEnabled: Boolean get() = false +} + +class KaraokeConfig(json: JSONObject) : FilterConfig(json) { + override fun build(format: AudioDataFormat, output: FloatPcmAudioFilter): AudioFilter { + TODO("not implemented") + } + + override val isEnabled: Boolean get() = false +} + +class TimescaleConfig(json: JSONObject) : FilterConfig(json) { + override fun build(format: AudioDataFormat, output: FloatPcmAudioFilter): AudioFilter { + TODO("not implemented") + } + + override val isEnabled: Boolean get() = false +} + +class TremoloConfig(json: JSONObject) : FilterConfig(json) { + override fun build(format: AudioDataFormat, output: FloatPcmAudioFilter): AudioFilter { + TODO("not implemented") + } + + override val isEnabled: Boolean get() = false +} + +class VibratoConfig(json: JSONObject) : FilterConfig(json) { + override fun build(format: AudioDataFormat, output: FloatPcmAudioFilter): AudioFilter { + TODO("not implemented") + } + + override val isEnabled: Boolean get() = false +} + +class VolumeConfig(json: JSONObject) : FilterConfig(json) { + override fun build(format: AudioDataFormat, output: FloatPcmAudioFilter): AudioFilter { + TODO("not implemented") + } + + override val isEnabled: Boolean get() = false +} + +abstract class FilterConfig(json: JSONObject) { + abstract fun build(format: AudioDataFormat, output: FloatPcmAudioFilter) : AudioFilter + abstract val isEnabled: Boolean +} \ No newline at end of file From 17f6884434c2d70d1704b2322a951d9f07af8865 Mon Sep 17 00:00:00 2001 From: "Frederik Ar. Mikkelsen" Date: Sat, 6 Jul 2019 14:55:59 +0200 Subject: [PATCH 07/68] Configure volume filter --- .../lavalink/server/io/WebSocketHandlers.kt | 41 ++++++++++++++----- .../java/lavalink/server/player/Player.java | 10 +++++ .../java/lavalink/server/player/filters.kt | 38 +++++++++-------- 3 files changed, 61 insertions(+), 28 deletions(-) diff --git a/LavalinkServer/src/main/java/lavalink/server/io/WebSocketHandlers.kt b/LavalinkServer/src/main/java/lavalink/server/io/WebSocketHandlers.kt index d90a8792d..9587d0bd9 100644 --- a/LavalinkServer/src/main/java/lavalink/server/io/WebSocketHandlers.kt +++ b/LavalinkServer/src/main/java/lavalink/server/io/WebSocketHandlers.kt @@ -1,5 +1,7 @@ package lavalink.server.io +import lavalink.server.player.FilterChain +import lavalink.server.player.VolumeConfig import lavalink.server.util.Util import org.json.JSONObject import org.slf4j.Logger @@ -14,6 +16,8 @@ class WebSocketHandlers(private val contextMap: Map) { private val log: Logger = LoggerFactory.getLogger(WebSocketHandlers::class.java) } + private var loggedVolumeDeprecationWarning = false + fun voiceUpdate(session: WebSocketSession, json: JSONObject) { val sessionId = json.getString("sessionId") val guildId = json.getString("guildId") @@ -27,7 +31,7 @@ class WebSocketHandlers(private val contextMap: Map) { return } - val sktContext = contextMap[session.id]!! + val sktContext = session.context val member = MagmaMember.builder() .userId(sktContext.userId) .guildId(guildId) @@ -41,7 +45,7 @@ class WebSocketHandlers(private val contextMap: Map) { } fun play(session: WebSocketSession, json: JSONObject) { - val ctx = contextMap[session.id]!! + val ctx = session.context val player = ctx.getPlayer(json.getString("guildId")) val noReplace = json.optBoolean("noReplace", false) @@ -58,12 +62,18 @@ class WebSocketHandlers(private val contextMap: Map) { player.setPause(json.optBoolean("pause", false)) if (json.has("volume")) { - player.setVolume(json.getInt("volume")) + if(!loggedVolumeDeprecationWarning) log.warn("The volume property in the play operation has been deprecated" + + "and will be removed in v4. Please configure a filter instead. Note that the new filter takes a " + + "float value 0.0-1.0") + loggedVolumeDeprecationWarning = true + val filters = player.filters ?: FilterChain() + filters.volume = VolumeConfig(json.getFloat("volume") / 100) + player.filters = filters } player.play(track) - val context = contextMap[session.id]!! + val context = session.context val m = MagmaMember.builder() .userId(context.userId) @@ -75,31 +85,31 @@ class WebSocketHandlers(private val contextMap: Map) { } fun stop(session: WebSocketSession, json: JSONObject) { - val player = contextMap[session.id]!!.getPlayer(json.getString("guildId")) + val player = session.context.getPlayer(json.getString("guildId")) player.stop() } fun pause(session: WebSocketSession, json: JSONObject) { - val context = contextMap[session.id]!! + val context = session.context val player = context.getPlayer(json.getString("guildId")) player.setPause(json.getBoolean("pause")) SocketServer.sendPlayerUpdate(context, player) } fun seek(session: WebSocketSession, json: JSONObject) { - val context = contextMap[session.id]!! + val context = session.context val player = context.getPlayer(json.getString("guildId")) player.seekTo(json.getLong("position")) SocketServer.sendPlayerUpdate(context, player) } fun volume(session: WebSocketSession, json: JSONObject) { - val player = contextMap[session.id]!!.getPlayer(json.getString("guildId")) + val player = session.context.getPlayer(json.getString("guildId")) player.setVolume(json.getInt("volume")) } fun equalizer(session: WebSocketSession, json: JSONObject) { - val player = contextMap[session.id]!!.getPlayer(json.getString("guildId")) + val player = session.context.getPlayer(json.getString("guildId")) val bands = json.getJSONArray("bands") for (i in 0 until bands.length()) { @@ -109,7 +119,7 @@ class WebSocketHandlers(private val contextMap: Map) { } fun destroy(session: WebSocketSession, json: JSONObject) { - val socketContext = contextMap[session.id]!! + val socketContext = session.context val player = socketContext.players.remove(json.getString("guildId")) player?.stop() val mem = MagmaMember.builder() @@ -121,8 +131,17 @@ class WebSocketHandlers(private val contextMap: Map) { } fun configureResuming(session: WebSocketSession, json: JSONObject) { - val socketContext = contextMap[session.id]!! + val socketContext = session.context socketContext.resumeKey = json.optString("key", null) if (json.has("timeout")) socketContext.resumeTimeout = json.getLong("timeout") } + + fun configureFilters(session: WebSocketSession, json: JSONObject) { + val player = session.context.getPlayer(json.getString("guildId")) + val filters = player.filters ?: FilterChain() + filters.parse(json) + player.filters = filters + } + + private val WebSocketSession.context get() = contextMap[this.id] ?: error("Unknown context for WS session") } \ No newline at end of file diff --git a/LavalinkServer/src/main/java/lavalink/server/player/Player.java b/LavalinkServer/src/main/java/lavalink/server/player/Player.java index b61c55120..b37335e49 100644 --- a/LavalinkServer/src/main/java/lavalink/server/player/Player.java +++ b/LavalinkServer/src/main/java/lavalink/server/player/Player.java @@ -53,6 +53,7 @@ public class Player extends AudioEventAdapter implements AudioSendHandler { private ScheduledFuture myFuture = null; private EqualizerFactory equalizerFactory = new EqualizerFactory(); private boolean isEqualizerApplied = false; + private FilterChain filters; public Player(SocketContext socketContext, String guildId, AudioPlayerManager audioPlayerManager) { this.socketContext = socketContext; @@ -188,4 +189,13 @@ public void onTrackStart(AudioPlayer player, AudioTrack track) { } } + @Nullable + public FilterChain getFilters() { + return filters; + } + + public void setFilters(FilterChain filters) { + this.filters = filters; + player.setFilterFactory(filters); + } } diff --git a/LavalinkServer/src/main/java/lavalink/server/player/filters.kt b/LavalinkServer/src/main/java/lavalink/server/player/filters.kt index 9ce714f89..f90766aa2 100644 --- a/LavalinkServer/src/main/java/lavalink/server/player/filters.kt +++ b/LavalinkServer/src/main/java/lavalink/server/player/filters.kt @@ -1,18 +1,19 @@ package lavalink.server.player +import com.github.natanbc.lavadsp.volume.VolumePcmAudioFilter import com.sedmelluq.discord.lavaplayer.filter.* import com.sedmelluq.discord.lavaplayer.format.AudioDataFormat import com.sedmelluq.discord.lavaplayer.track.AudioTrack import org.json.JSONObject -class FilterChain( - var equalizer: EqualizerConfig? = null, - var karaoke: KaraokeConfig? = null, - var timescale: TimescaleConfig? = null, - var tremolo: TremoloConfig? = null, - var vibrato: VibratoConfig? = null, - var volume: VolumeConfig? = null -) : PcmFilterFactory { +class FilterChain : PcmFilterFactory { + + private var equalizer: EqualizerConfig? = null + private var karaoke: KaraokeConfig? = null + private var timescale: TimescaleConfig? = null + private var tremolo: TremoloConfig? = null + private var vibrato: VibratoConfig? = null + var volume: VolumeConfig? = null fun parse(json: JSONObject) { // TODO @@ -31,7 +32,7 @@ class FilterChain( } } -class EqualizerConfig(json: JSONObject) : FilterConfig(json) { +class EqualizerConfig(json: JSONObject) : FilterConfig() { override fun build(format: AudioDataFormat, output: FloatPcmAudioFilter): AudioFilter { TODO("not implemented") } @@ -39,7 +40,7 @@ class EqualizerConfig(json: JSONObject) : FilterConfig(json) { override val isEnabled: Boolean get() = false } -class KaraokeConfig(json: JSONObject) : FilterConfig(json) { +class KaraokeConfig(json: JSONObject) : FilterConfig() { override fun build(format: AudioDataFormat, output: FloatPcmAudioFilter): AudioFilter { TODO("not implemented") } @@ -47,7 +48,7 @@ class KaraokeConfig(json: JSONObject) : FilterConfig(json) { override val isEnabled: Boolean get() = false } -class TimescaleConfig(json: JSONObject) : FilterConfig(json) { +class TimescaleConfig(json: JSONObject) : FilterConfig() { override fun build(format: AudioDataFormat, output: FloatPcmAudioFilter): AudioFilter { TODO("not implemented") } @@ -55,7 +56,7 @@ class TimescaleConfig(json: JSONObject) : FilterConfig(json) { override val isEnabled: Boolean get() = false } -class TremoloConfig(json: JSONObject) : FilterConfig(json) { +class TremoloConfig(json: JSONObject) : FilterConfig() { override fun build(format: AudioDataFormat, output: FloatPcmAudioFilter): AudioFilter { TODO("not implemented") } @@ -63,7 +64,7 @@ class TremoloConfig(json: JSONObject) : FilterConfig(json) { override val isEnabled: Boolean get() = false } -class VibratoConfig(json: JSONObject) : FilterConfig(json) { +class VibratoConfig(json: JSONObject) : FilterConfig() { override fun build(format: AudioDataFormat, output: FloatPcmAudioFilter): AudioFilter { TODO("not implemented") } @@ -71,15 +72,18 @@ class VibratoConfig(json: JSONObject) : FilterConfig(json) { override val isEnabled: Boolean get() = false } -class VolumeConfig(json: JSONObject) : FilterConfig(json) { +class VolumeConfig(var volume: Float = 1.0f) : FilterConfig() { + override fun build(format: AudioDataFormat, output: FloatPcmAudioFilter): AudioFilter { - TODO("not implemented") + return VolumePcmAudioFilter(output, format.channelCount).also { + it.volume = volume + } } - override val isEnabled: Boolean get() = false + override val isEnabled: Boolean get() = volume != 1.0f } -abstract class FilterConfig(json: JSONObject) { +abstract class FilterConfig { abstract fun build(format: AudioDataFormat, output: FloatPcmAudioFilter) : AudioFilter abstract val isEnabled: Boolean } \ No newline at end of file From 9510e9004ce5a9e3ef416c59e1db79261bb3a559 Mon Sep 17 00:00:00 2001 From: "Frederik Ar. Mikkelsen" Date: Sat, 6 Jul 2019 19:16:44 +0200 Subject: [PATCH 08/68] Add gson --- LavalinkServer/build.gradle | 1 + .../main/java/lavalink/server/io/HandshakeInterceptorImpl.kt | 2 -- build.gradle | 1 + 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/LavalinkServer/build.gradle b/LavalinkServer/build.gradle index ad900a96a..5508b2bfe 100644 --- a/LavalinkServer/build.gradle +++ b/LavalinkServer/build.gradle @@ -48,6 +48,7 @@ dependencies { compile group: 'io.sentry', name: 'sentry-logback', version: sentryLogbackVersion compile group: 'com.github.oshi', name: 'oshi-core', version: oshiVersion compile group: 'org.json', name: 'json', version: jsonOrgVersion + compile group: 'com.google.code.gson', name: 'gson', version: gsonVersion compile(group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: springBootVersion) { exclude group: 'org.springframework.boot', module: 'spring-boot-starter-tomcat' } diff --git a/LavalinkServer/src/main/java/lavalink/server/io/HandshakeInterceptorImpl.kt b/LavalinkServer/src/main/java/lavalink/server/io/HandshakeInterceptorImpl.kt index 723757291..beb67c139 100644 --- a/LavalinkServer/src/main/java/lavalink/server/io/HandshakeInterceptorImpl.kt +++ b/LavalinkServer/src/main/java/lavalink/server/io/HandshakeInterceptorImpl.kt @@ -1,7 +1,6 @@ package lavalink.server.io import lavalink.server.config.ServerConfig -import org.slf4j.Logger import org.slf4j.LoggerFactory import org.springframework.beans.factory.annotation.Autowired import org.springframework.http.server.ServerHttpRequest @@ -9,7 +8,6 @@ import org.springframework.http.server.ServerHttpResponse import org.springframework.stereotype.Controller import org.springframework.web.socket.WebSocketHandler import org.springframework.web.socket.server.HandshakeInterceptor -import java.util.Objects @Controller class HandshakeInterceptorImpl @Autowired diff --git a/build.gradle b/build.gradle index 55ca0f678..c01e02dea 100644 --- a/build.gradle +++ b/build.gradle @@ -66,6 +66,7 @@ subprojects { spotbugsAnnotationsVersion = '3.1.6' prometheusVersion = '0.5.0' commonsLangVersion = '3.8' + gsonVersion = '2.8.5' //@formatter:on } From c2e018d5ffef54b2d17244b3d213e31723a084d6 Mon Sep 17 00:00:00 2001 From: "Frederik Ar. Mikkelsen" Date: Sat, 6 Jul 2019 21:51:41 +0200 Subject: [PATCH 09/68] Add filters to the API spec --- IMPLEMENTATION.md | 62 ++++++++++++++----- .../lavalink/server/io/WebSocketHandlers.kt | 2 +- 2 files changed, 47 insertions(+), 17 deletions(-) diff --git a/IMPLEMENTATION.md b/IMPLEMENTATION.md index 5efc912d3..a35090e14 100644 --- a/IMPLEMENTATION.md +++ b/IMPLEMENTATION.md @@ -2,6 +2,8 @@ How to write your own client. The Java [Lavalink-Client](https://github.com/FredBoat/Lavalink-Client) will serve as an example implementation. The Java client has support for JDA, but can also be adapted to work with other JVM libraries. +JSON comments are for illustration purposes only, and will not be accepted by the server. + ## Requirements * You must be able to send messages via a shard's mainWS connection. * You must be able to intercept voice server updates from mainWS on your shard connection. @@ -107,32 +109,60 @@ Make the player seek to a position of the track. Position is in millis } ``` -Set player volume. Volume may range from 0 to 1000. 100 is default. -```json -{ - "op": "volume", - "guildId": "...", - "volume": 125 -} -``` +The `filters` op sets the filters. All the filters are optional, and leaving them out of this message will disable them. + +Adding a filter can have adverse effects on performance. These filters force Lavaplayer to decode all audio to PCM, +even if the input was already in the Opus format that Discord uses. This means decoding and encoding audio that would +normally require very little processing. This is often the case with YouTube videos. -Using the player equalizer ```json { - "op": "equalizer", + "op": "filters", "guildId": "...", - "bands": [ + + // Float value where 1.0 is 100%. Values >1.0 may cause clipping + "volume": 1.0, + + // 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. + "equalizer": [ { "band": 0, "gain": 0.2 } - ] + ], + + // Uses equalization to eliminate part of a band, usually targeting vocals. + karaoke: { + "level": 1.0, + "monoLevel": 1.0, + "filterBand": 220.0, + "filterWidth": 100.0 + }, + + // Changes the speed, pitch, and rate. All default to 1. + timescale: { + "speed": 1.0, + "pitch": 1.0, + "rate": 1.0 + }, + + // Uses amplification to create a shuddering effect, where the volume quickly oscillates. + // Example: https://en.wikipedia.org/wiki/File:Fuse_Electronics_Tremolo_MK-III_Quick_Demo.ogv + tremolo: { + frequency: 2.0, // 0 < x + depth: 0.5 // 0 < x ≤ 1 + }, + + // Similar to tremolo. While tremolo oscillates the volume, vibrato oscillates the pitch. + vibrato: { + frequency: 2.0, // 0 < x ≤ 14 + depth: 0.5 // 0 < x ≤ 1 + } } ``` -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. Tell the server to potentially disconnect from the voice server and potentially remove the player with all its data. This is useful if you want to move to a new node for a voice connection. Calling this op does not affect voice state, diff --git a/LavalinkServer/src/main/java/lavalink/server/io/WebSocketHandlers.kt b/LavalinkServer/src/main/java/lavalink/server/io/WebSocketHandlers.kt index 9587d0bd9..83aab2744 100644 --- a/LavalinkServer/src/main/java/lavalink/server/io/WebSocketHandlers.kt +++ b/LavalinkServer/src/main/java/lavalink/server/io/WebSocketHandlers.kt @@ -64,7 +64,7 @@ class WebSocketHandlers(private val contextMap: Map) { if (json.has("volume")) { if(!loggedVolumeDeprecationWarning) log.warn("The volume property in the play operation has been deprecated" + "and will be removed in v4. Please configure a filter instead. Note that the new filter takes a " + - "float value 0.0-1.0") + "float value with 1.0 being 100%") loggedVolumeDeprecationWarning = true val filters = player.filters ?: FilterChain() filters.volume = VolumeConfig(json.getFloat("volume") / 100) From d4db194cac7a839a3899857f1f6d7b910369309d Mon Sep 17 00:00:00 2001 From: "Frederik Ar. Mikkelsen" Date: Sat, 6 Jul 2019 21:56:07 +0200 Subject: [PATCH 10/68] Fix JSON comments on GitHub marked in red --- IMPLEMENTATION.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/IMPLEMENTATION.md b/IMPLEMENTATION.md index a35090e14..d44d683dd 100644 --- a/IMPLEMENTATION.md +++ b/IMPLEMENTATION.md @@ -2,8 +2,6 @@ How to write your own client. The Java [Lavalink-Client](https://github.com/FredBoat/Lavalink-Client) will serve as an example implementation. The Java client has support for JDA, but can also be adapted to work with other JVM libraries. -JSON comments are for illustration purposes only, and will not be accepted by the server. - ## Requirements * You must be able to send messages via a shard's mainWS connection. * You must be able to intercept voice server updates from mainWS on your shard connection. @@ -115,7 +113,9 @@ Adding a filter can have adverse effects on performance. These filters force Lav even if the input was already in the Opus format that Discord uses. This means decoding and encoding audio that would normally require very little processing. This is often the case with YouTube videos. -```json +JSON comments are for illustration purposes only, and will not be accepted by the server. + +```yaml { "op": "filters", "guildId": "...", From aa9e8e24cf27231e15ec365ace980693dcf565ae Mon Sep 17 00:00:00 2001 From: "Frederik Ar. Mikkelsen" Date: Wed, 10 Jul 2019 00:39:50 +0200 Subject: [PATCH 11/68] First pass on filters --- .../server/config/SentryConfiguration.java | 1 + .../java/lavalink/server/io/SocketServer.kt | 5 +- .../lavalink/server/io/WebSocketHandlers.kt | 30 +++--- .../java/lavalink/server/player/Player.java | 1 + .../java/lavalink/server/player/filters.kt | 89 --------------- .../server/player/filters/FilterChain.kt | 43 ++++++++ .../server/player/filters/filterConfigs.kt | 101 ++++++++++++++++++ 7 files changed, 166 insertions(+), 104 deletions(-) delete mode 100644 LavalinkServer/src/main/java/lavalink/server/player/filters.kt create mode 100644 LavalinkServer/src/main/java/lavalink/server/player/filters/FilterChain.kt create mode 100644 LavalinkServer/src/main/java/lavalink/server/player/filters/filterConfigs.kt diff --git a/LavalinkServer/src/main/java/lavalink/server/config/SentryConfiguration.java b/LavalinkServer/src/main/java/lavalink/server/config/SentryConfiguration.java index f0fa9b34d..42f504a5e 100644 --- a/LavalinkServer/src/main/java/lavalink/server/config/SentryConfiguration.java +++ b/LavalinkServer/src/main/java/lavalink/server/config/SentryConfiguration.java @@ -31,6 +31,7 @@ public SentryConfiguration(ServerConfig serverConfig, SentryConfigProperties sen boolean warnDeprecatedDsnConfig = false; if (dsn == null || dsn.isEmpty()) { //try deprecated config location + //noinspection deprecation dsn = serverConfig.getSentryDsn(); warnDeprecatedDsnConfig = true; } diff --git a/LavalinkServer/src/main/java/lavalink/server/io/SocketServer.kt b/LavalinkServer/src/main/java/lavalink/server/io/SocketServer.kt index cbf424220..5903440dc 100644 --- a/LavalinkServer/src/main/java/lavalink/server/io/SocketServer.kt +++ b/LavalinkServer/src/main/java/lavalink/server/io/SocketServer.kt @@ -25,11 +25,9 @@ package lavalink.server.io import com.github.shredder121.asyncaudio.jda.AsyncPacketProviderFactory import com.sedmelluq.discord.lavaplayer.jdaudp.NativeAudioSendFactory import com.sedmelluq.discord.lavaplayer.player.AudioPlayerManager -import com.sedmelluq.discord.lavaplayer.track.TrackMarker import lavalink.server.config.AudioSendFactoryConfiguration import lavalink.server.config.ServerConfig import lavalink.server.player.Player -import lavalink.server.player.TrackEndMarkerHandler import lavalink.server.util.Util import net.dv8tion.jda.core.audio.factory.IAudioSendFactory import org.json.JSONObject @@ -40,7 +38,7 @@ import org.springframework.web.socket.TextMessage import org.springframework.web.socket.WebSocketSession import org.springframework.web.socket.handler.TextWebSocketHandler import space.npstr.magma.Member -import java.util.HashMap +import java.util.* import java.util.concurrent.ConcurrentHashMap import java.util.function.Supplier @@ -154,6 +152,7 @@ class SocketServer( "destroy" -> handlers.destroy(session, json) "configureResuming" -> handlers.configureResuming(session, json) "equalizer" -> handlers.equalizer(session, json) + "filters" -> handlers.filters(session, json.getString("guildId"), message.payload) else -> log.warn("Unexpected operation: " + json.getString("op")) // @formatter:on } diff --git a/LavalinkServer/src/main/java/lavalink/server/io/WebSocketHandlers.kt b/LavalinkServer/src/main/java/lavalink/server/io/WebSocketHandlers.kt index 83aab2744..8df93efe8 100644 --- a/LavalinkServer/src/main/java/lavalink/server/io/WebSocketHandlers.kt +++ b/LavalinkServer/src/main/java/lavalink/server/io/WebSocketHandlers.kt @@ -1,7 +1,7 @@ package lavalink.server.io -import lavalink.server.player.FilterChain -import lavalink.server.player.VolumeConfig +import lavalink.server.player.filters.Band +import lavalink.server.player.filters.FilterChain import lavalink.server.util.Util import org.json.JSONObject import org.slf4j.Logger @@ -17,6 +17,7 @@ class WebSocketHandlers(private val contextMap: Map) { } private var loggedVolumeDeprecationWarning = false + private var loggedEqualizerDeprecationWarning = false fun voiceUpdate(session: WebSocketSession, json: JSONObject) { val sessionId = json.getString("sessionId") @@ -67,7 +68,7 @@ class WebSocketHandlers(private val contextMap: Map) { "float value with 1.0 being 100%") loggedVolumeDeprecationWarning = true val filters = player.filters ?: FilterChain() - filters.volume = VolumeConfig(json.getFloat("volume") / 100) + filters.volume = json.getFloat("volume") / 100 player.filters = filters } @@ -109,13 +110,20 @@ class WebSocketHandlers(private val contextMap: Map) { } fun equalizer(session: WebSocketSession, json: JSONObject) { + if (!loggedEqualizerDeprecationWarning) log.warn("The 'equalizer' op has been deprecated in favour of the " + + "'filters' op. Please switch to use that one, as this op will get removed in v4.") + loggedEqualizerDeprecationWarning = true + val player = session.context.getPlayer(json.getString("guildId")) - val bands = json.getJSONArray("bands") - for (i in 0 until bands.length()) { - val band = bands.getJSONObject(i) - player.setBandGain(band.getInt("band"), band.getFloat("gain")) + val list = mutableListOf() + json.getJSONArray("bands").forEach { b -> + val band = b as JSONObject + list.add(Band(band.getInt("band"), band.getFloat("gain"))) } + val filters = player.filters ?: FilterChain() + filters.equalizer = list + player.filters = filters } fun destroy(session: WebSocketSession, json: JSONObject) { @@ -136,11 +144,9 @@ class WebSocketHandlers(private val contextMap: Map) { if (json.has("timeout")) socketContext.resumeTimeout = json.getLong("timeout") } - fun configureFilters(session: WebSocketSession, json: JSONObject) { - val player = session.context.getPlayer(json.getString("guildId")) - val filters = player.filters ?: FilterChain() - filters.parse(json) - player.filters = filters + fun filters(session: WebSocketSession, guildId: String, json: String) { + val player = session.context.getPlayer(guildId) + player.filters = FilterChain.parse(json) } private val WebSocketSession.context get() = contextMap[this.id] ?: error("Unknown context for WS session") diff --git a/LavalinkServer/src/main/java/lavalink/server/player/Player.java b/LavalinkServer/src/main/java/lavalink/server/player/Player.java index b37335e49..30b9c469c 100644 --- a/LavalinkServer/src/main/java/lavalink/server/player/Player.java +++ b/LavalinkServer/src/main/java/lavalink/server/player/Player.java @@ -32,6 +32,7 @@ import com.sedmelluq.discord.lavaplayer.track.playback.AudioFrame; import lavalink.server.io.SocketContext; import lavalink.server.io.SocketServer; +import lavalink.server.player.filters.FilterChain; import net.dv8tion.jda.core.audio.AudioSendHandler; import org.json.JSONObject; import org.slf4j.Logger; diff --git a/LavalinkServer/src/main/java/lavalink/server/player/filters.kt b/LavalinkServer/src/main/java/lavalink/server/player/filters.kt deleted file mode 100644 index f90766aa2..000000000 --- a/LavalinkServer/src/main/java/lavalink/server/player/filters.kt +++ /dev/null @@ -1,89 +0,0 @@ -package lavalink.server.player - -import com.github.natanbc.lavadsp.volume.VolumePcmAudioFilter -import com.sedmelluq.discord.lavaplayer.filter.* -import com.sedmelluq.discord.lavaplayer.format.AudioDataFormat -import com.sedmelluq.discord.lavaplayer.track.AudioTrack -import org.json.JSONObject - -class FilterChain : PcmFilterFactory { - - private var equalizer: EqualizerConfig? = null - private var karaoke: KaraokeConfig? = null - private var timescale: TimescaleConfig? = null - private var tremolo: TremoloConfig? = null - private var vibrato: VibratoConfig? = null - var volume: VolumeConfig? = null - - fun parse(json: JSONObject) { - // TODO - } - - override fun buildChain(track: AudioTrack, format: AudioDataFormat, output: UniversalPcmAudioFilter): MutableList { - val list = listOfNotNull(equalizer, karaoke, timescale, tremolo, vibrato, volume) - val builder = FilterChainBuilder() - builder.addFirst(output) - list.filter { it.isEnabled } - .map { it.build(format, builder.makeFirstFloat(format.channelCount)) } - .forEach { builder.addFirst(it) } - - return builder.build(null, format.channelCount) - .filters.apply { dropLast(1) } - } -} - -class EqualizerConfig(json: JSONObject) : FilterConfig() { - override fun build(format: AudioDataFormat, output: FloatPcmAudioFilter): AudioFilter { - TODO("not implemented") - } - - override val isEnabled: Boolean get() = false -} - -class KaraokeConfig(json: JSONObject) : FilterConfig() { - override fun build(format: AudioDataFormat, output: FloatPcmAudioFilter): AudioFilter { - TODO("not implemented") - } - - override val isEnabled: Boolean get() = false -} - -class TimescaleConfig(json: JSONObject) : FilterConfig() { - override fun build(format: AudioDataFormat, output: FloatPcmAudioFilter): AudioFilter { - TODO("not implemented") - } - - override val isEnabled: Boolean get() = false -} - -class TremoloConfig(json: JSONObject) : FilterConfig() { - override fun build(format: AudioDataFormat, output: FloatPcmAudioFilter): AudioFilter { - TODO("not implemented") - } - - override val isEnabled: Boolean get() = false -} - -class VibratoConfig(json: JSONObject) : FilterConfig() { - override fun build(format: AudioDataFormat, output: FloatPcmAudioFilter): AudioFilter { - TODO("not implemented") - } - - override val isEnabled: Boolean get() = false -} - -class VolumeConfig(var volume: Float = 1.0f) : FilterConfig() { - - override fun build(format: AudioDataFormat, output: FloatPcmAudioFilter): AudioFilter { - return VolumePcmAudioFilter(output, format.channelCount).also { - it.volume = volume - } - } - - override val isEnabled: Boolean get() = volume != 1.0f -} - -abstract class FilterConfig { - abstract fun build(format: AudioDataFormat, output: FloatPcmAudioFilter) : AudioFilter - abstract val isEnabled: Boolean -} \ No newline at end of file diff --git a/LavalinkServer/src/main/java/lavalink/server/player/filters/FilterChain.kt b/LavalinkServer/src/main/java/lavalink/server/player/filters/FilterChain.kt new file mode 100644 index 000000000..35874f45c --- /dev/null +++ b/LavalinkServer/src/main/java/lavalink/server/player/filters/FilterChain.kt @@ -0,0 +1,43 @@ +package lavalink.server.player.filters + +import com.google.gson.Gson +import com.sedmelluq.discord.lavaplayer.filter.AudioFilter +import com.sedmelluq.discord.lavaplayer.filter.FilterChainBuilder +import com.sedmelluq.discord.lavaplayer.filter.PcmFilterFactory +import com.sedmelluq.discord.lavaplayer.filter.UniversalPcmAudioFilter +import com.sedmelluq.discord.lavaplayer.format.AudioDataFormat +import com.sedmelluq.discord.lavaplayer.track.AudioTrack + +class FilterChain : PcmFilterFactory { + + companion object { + private val gson = Gson() + fun parse(json: String) = gson.fromJson(json, FilterChain::class.java)!! + } + + var volume: Float? = null + var equalizer: List? = null + private val karaoke: KaraokeConfig? = null + private val timescale: TimescaleConfig? = null + private val tremolo: TremoloConfig? = null + private val vibrato: VibratoConfig? = null + + override fun buildChain(track: AudioTrack, format: AudioDataFormat, output: UniversalPcmAudioFilter): MutableList { + val list = listOfNotNull( + volume?.let { VolumeConfig(it) }, + equalizer?.let { EqualizerConfig(it) }, + karaoke, + timescale, + tremolo, + vibrato + ) + val builder = FilterChainBuilder() + builder.addFirst(output) + list.filter { it.isEnabled } + .map { it.build(format, builder.makeFirstFloat(format.channelCount)) } + .forEach { builder.addFirst(it) } + + return builder.build(null, format.channelCount) + .filters.apply { dropLast(1) } + } +} \ No newline at end of file diff --git a/LavalinkServer/src/main/java/lavalink/server/player/filters/filterConfigs.kt b/LavalinkServer/src/main/java/lavalink/server/player/filters/filterConfigs.kt new file mode 100644 index 000000000..80c44d160 --- /dev/null +++ b/LavalinkServer/src/main/java/lavalink/server/player/filters/filterConfigs.kt @@ -0,0 +1,101 @@ +package lavalink.server.player.filters + +import com.github.natanbc.lavadsp.karaoke.KaraokePcmAudioFilter +import com.github.natanbc.lavadsp.timescale.TimescalePcmAudioFilter +import com.github.natanbc.lavadsp.tremolo.TremoloPcmAudioFilter +import com.github.natanbc.lavadsp.vibrato.VibratoPcmAudioFilter +import com.github.natanbc.lavadsp.volume.VolumePcmAudioFilter +import com.sedmelluq.discord.lavaplayer.filter.AudioFilter +import com.sedmelluq.discord.lavaplayer.filter.FloatPcmAudioFilter +import com.sedmelluq.discord.lavaplayer.filter.equalizer.Equalizer +import com.sedmelluq.discord.lavaplayer.format.AudioDataFormat + +class VolumeConfig(private var volume: Float) : FilterConfig() { + override fun build(format: AudioDataFormat, output: FloatPcmAudioFilter): AudioFilter { + return VolumePcmAudioFilter(output, format.channelCount).also { + it.volume = volume + } + } + + override val isEnabled: Boolean get() = volume != 1.0f +} + +class EqualizerConfig(bands: List) : FilterConfig() { + private val array = FloatArray(Equalizer.BAND_COUNT) { 0.0f } + + init { + bands.forEach { array[it.band] = it.gain } + } + + override fun build(format: AudioDataFormat, output: FloatPcmAudioFilter): AudioFilter = + Equalizer(format.channelCount, output, array) + + override val isEnabled: Boolean get() = array.any { it != 0.0f } +} + +data class Band(val band: Int, val gain: Float) + +class KaraokeConfig( + private val level: Float = 1.0f, + private val monoLevel: Float = 1.0f, + private val filterBand: Float = 220.0f, + private val filterWidth: Float = 100.0f +) : FilterConfig() { + override fun build(format: AudioDataFormat, output: FloatPcmAudioFilter): AudioFilter { + return KaraokePcmAudioFilter(output, format.channelCount, format.sampleRate) + .setLevel(level) + .setMonoLevel(monoLevel) + .setFilterBand(filterBand) + .setFilterWidth(filterWidth) + } + override val isEnabled: Boolean get() = true +} + +class TimescaleConfig( + private val speed: Double = 1.0, + private val pitch: Double = 1.0, + private val rate: Double = 1.0 +) : FilterConfig() { + + override fun build(format: AudioDataFormat, output: FloatPcmAudioFilter): AudioFilter { + return TimescalePcmAudioFilter(output, format.channelCount, format.sampleRate) + .setSpeed(speed) + .setPitch(pitch) + .setRate(rate) + } + override val isEnabled: Boolean get() = speed != 1.0 || pitch != 1.0 || rate != 1.0 + +} + +class TremoloConfig( + private val frequency: Float = 2.0f, + private val depth: Float = 0.5f +) : FilterConfig() { + override fun build(format: AudioDataFormat, output: FloatPcmAudioFilter): AudioFilter { + return TremoloPcmAudioFilter(output, format.channelCount, format.sampleRate) + .setFrequency(frequency) + .setDepth(depth) + } + + override val isEnabled: Boolean get() = depth != 0.0f +} + +class VibratoConfig( + private val frequency: Float = 2.0f, + private val depth: Float = 0.5f +) : FilterConfig() { + + override fun build(format: AudioDataFormat, output: FloatPcmAudioFilter): AudioFilter { + return VibratoPcmAudioFilter(output, format.channelCount, format.sampleRate) + .setFrequency(frequency) + .setDepth(depth) + } + + override val isEnabled: Boolean get() = depth != 0.0f + +} + +abstract class FilterConfig { + abstract fun build(format: AudioDataFormat, output: FloatPcmAudioFilter): AudioFilter + abstract val isEnabled: Boolean +} \ No newline at end of file From 44c272ee549a8e5ec9b8408b718103c63c25062a Mon Sep 17 00:00:00 2001 From: "Frederik Ar. Mikkelsen" Date: Wed, 31 Jul 2019 10:48:14 +0200 Subject: [PATCH 12/68] Only build filters we need --- .../server/player/filters/FilterChain.kt | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/LavalinkServer/src/main/java/lavalink/server/player/filters/FilterChain.kt b/LavalinkServer/src/main/java/lavalink/server/player/filters/FilterChain.kt index 35874f45c..43d943c52 100644 --- a/LavalinkServer/src/main/java/lavalink/server/player/filters/FilterChain.kt +++ b/LavalinkServer/src/main/java/lavalink/server/player/filters/FilterChain.kt @@ -7,10 +7,13 @@ import com.sedmelluq.discord.lavaplayer.filter.PcmFilterFactory import com.sedmelluq.discord.lavaplayer.filter.UniversalPcmAudioFilter import com.sedmelluq.discord.lavaplayer.format.AudioDataFormat import com.sedmelluq.discord.lavaplayer.track.AudioTrack +import org.slf4j.Logger +import org.slf4j.LoggerFactory class FilterChain : PcmFilterFactory { companion object { + private val log: Logger = LoggerFactory.getLogger(FilterChain::class.java) private val gson = Gson() fun parse(json: String) = gson.fromJson(json, FilterChain::class.java)!! } @@ -22,7 +25,18 @@ class FilterChain : PcmFilterFactory { private val tremolo: TremoloConfig? = null private val vibrato: VibratoConfig? = null - override fun buildChain(track: AudioTrack, format: AudioDataFormat, output: UniversalPcmAudioFilter): MutableList { + private fun buildList() = listOfNotNull( + volume?.let { VolumeConfig(it) }, + equalizer?.let { EqualizerConfig(it) }, + karaoke, + timescale, + tremolo, + vibrato + ) + + val isEnabled get() = buildList().any { it.isEnabled } + + override fun buildChain(track: AudioTrack?, format: AudioDataFormat, output: UniversalPcmAudioFilter): MutableList { val list = listOfNotNull( volume?.let { VolumeConfig(it) }, equalizer?.let { EqualizerConfig(it) }, @@ -38,6 +52,10 @@ class FilterChain : PcmFilterFactory { .forEach { builder.addFirst(it) } return builder.build(null, format.channelCount) - .filters.apply { dropLast(1) } + .filters//.apply { dropLast(1) } + .apply { + log.info(this.map { it.javaClass.simpleName }.toString()) + } } + } \ No newline at end of file From 386c2f3bee435821041c8f81a22bfd511807ae13 Mon Sep 17 00:00:00 2001 From: Devoxin Date: Mon, 30 Mar 2020 18:48:59 +0100 Subject: [PATCH 13/68] Working filter stuff --- .../java/lavalink/server/player/Player.java | 61 ++++++++++--------- .../server/player/filters/FilterChain.kt | 35 ++++------- .../server/player/filters/filterConfigs.kt | 15 ++--- 3 files changed, 52 insertions(+), 59 deletions(-) diff --git a/LavalinkServer/src/main/java/lavalink/server/player/Player.java b/LavalinkServer/src/main/java/lavalink/server/player/Player.java index 30b9c469c..19aba5922 100644 --- a/LavalinkServer/src/main/java/lavalink/server/player/Player.java +++ b/LavalinkServer/src/main/java/lavalink/server/player/Player.java @@ -52,8 +52,6 @@ public class Player extends AudioEventAdapter implements AudioSendHandler { private AudioLossCounter audioLossCounter = new AudioLossCounter(); private AudioFrame lastFrame = null; private ScheduledFuture myFuture = null; - private EqualizerFactory equalizerFactory = new EqualizerFactory(); - private boolean isEqualizerApplied = false; private FilterChain filters; public Player(SocketContext socketContext, String guildId, AudioPlayerManager audioPlayerManager) { @@ -93,32 +91,32 @@ public void setVolume(int volume) { player.setVolume(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) { - if (!isEqualizerApplied) { - return; - } - - boolean shouldDisable = true; - - for (int i = 0; i < Equalizer.BAND_COUNT; i++) { - if (equalizerFactory.getGain(i) != 0.0f) { - shouldDisable = false; - } - } - - if (shouldDisable) { - this.player.setFilterFactory(null); - this.isEqualizerApplied = false; - } - } else if (!this.isEqualizerApplied) { - this.player.setFilterFactory(equalizerFactory); - this.isEqualizerApplied = true; - } - } +// public void setBandGain(int band, float gain) { +// log.debug("Setting band {}'s gain to {}", band, gain); +// equalizerFactory.setGain(band, gain); +// +// if (gain == 0.0f) { +// if (!isEqualizerApplied) { +// return; +// } +// +// boolean shouldDisable = true; +// +// for (int i = 0; i < Equalizer.BAND_COUNT; i++) { +// if (equalizerFactory.getGain(i) != 0.0f) { +// shouldDisable = false; +// } +// } +// +// if (shouldDisable) { +// this.player.setFilterFactory(null); +// this.isEqualizerApplied = false; +// } +// } else if (!this.isEqualizerApplied) { +// this.player.setFilterFactory(equalizerFactory); +// this.isEqualizerApplied = true; +// } +// } public JSONObject getState() { JSONObject json = new JSONObject(); @@ -197,6 +195,11 @@ public FilterChain getFilters() { public void setFilters(FilterChain filters) { this.filters = filters; - player.setFilterFactory(filters); + + if (filters.isEnabled()) { + player.setFilterFactory(filters); + } else { + player.setFilterFactory(null); + } } } diff --git a/LavalinkServer/src/main/java/lavalink/server/player/filters/FilterChain.kt b/LavalinkServer/src/main/java/lavalink/server/player/filters/FilterChain.kt index 43d943c52..362766a7b 100644 --- a/LavalinkServer/src/main/java/lavalink/server/player/filters/FilterChain.kt +++ b/LavalinkServer/src/main/java/lavalink/server/player/filters/FilterChain.kt @@ -1,10 +1,7 @@ package lavalink.server.player.filters import com.google.gson.Gson -import com.sedmelluq.discord.lavaplayer.filter.AudioFilter -import com.sedmelluq.discord.lavaplayer.filter.FilterChainBuilder -import com.sedmelluq.discord.lavaplayer.filter.PcmFilterFactory -import com.sedmelluq.discord.lavaplayer.filter.UniversalPcmAudioFilter +import com.sedmelluq.discord.lavaplayer.filter.* import com.sedmelluq.discord.lavaplayer.format.AudioDataFormat import com.sedmelluq.discord.lavaplayer.track.AudioTrack import org.slf4j.Logger @@ -37,25 +34,17 @@ class FilterChain : PcmFilterFactory { val isEnabled get() = buildList().any { it.isEnabled } override fun buildChain(track: AudioTrack?, format: AudioDataFormat, output: UniversalPcmAudioFilter): MutableList { - val list = listOfNotNull( - volume?.let { VolumeConfig(it) }, - equalizer?.let { EqualizerConfig(it) }, - karaoke, - timescale, - tremolo, - vibrato - ) - val builder = FilterChainBuilder() - builder.addFirst(output) - list.filter { it.isEnabled } - .map { it.build(format, builder.makeFirstFloat(format.channelCount)) } - .forEach { builder.addFirst(it) } - - return builder.build(null, format.channelCount) - .filters//.apply { dropLast(1) } - .apply { - log.info(this.map { it.javaClass.simpleName }.toString()) - } + val enabledFilters = buildList().takeIf { it.isNotEmpty() } + ?: return mutableListOf() + + val pipeline = mutableListOf() + + for (filter in enabledFilters) { + val outputTo = pipeline.lastOrNull() ?: output + pipeline.add(filter.build(format, outputTo)) + } + + return pipeline.reversed().toMutableList() // Output last } } \ No newline at end of file diff --git a/LavalinkServer/src/main/java/lavalink/server/player/filters/filterConfigs.kt b/LavalinkServer/src/main/java/lavalink/server/player/filters/filterConfigs.kt index 80c44d160..4f7238a9b 100644 --- a/LavalinkServer/src/main/java/lavalink/server/player/filters/filterConfigs.kt +++ b/LavalinkServer/src/main/java/lavalink/server/player/filters/filterConfigs.kt @@ -7,11 +7,12 @@ import com.github.natanbc.lavadsp.vibrato.VibratoPcmAudioFilter import com.github.natanbc.lavadsp.volume.VolumePcmAudioFilter import com.sedmelluq.discord.lavaplayer.filter.AudioFilter import com.sedmelluq.discord.lavaplayer.filter.FloatPcmAudioFilter +import com.sedmelluq.discord.lavaplayer.filter.UniversalPcmAudioFilter import com.sedmelluq.discord.lavaplayer.filter.equalizer.Equalizer import com.sedmelluq.discord.lavaplayer.format.AudioDataFormat class VolumeConfig(private var volume: Float) : FilterConfig() { - override fun build(format: AudioDataFormat, output: FloatPcmAudioFilter): AudioFilter { + override fun build(format: AudioDataFormat, output: FloatPcmAudioFilter): FloatPcmAudioFilter { return VolumePcmAudioFilter(output, format.channelCount).also { it.volume = volume } @@ -27,7 +28,7 @@ class EqualizerConfig(bands: List) : FilterConfig() { bands.forEach { array[it.band] = it.gain } } - override fun build(format: AudioDataFormat, output: FloatPcmAudioFilter): AudioFilter = + override fun build(format: AudioDataFormat, output: FloatPcmAudioFilter): FloatPcmAudioFilter = Equalizer(format.channelCount, output, array) override val isEnabled: Boolean get() = array.any { it != 0.0f } @@ -41,7 +42,7 @@ class KaraokeConfig( private val filterBand: Float = 220.0f, private val filterWidth: Float = 100.0f ) : FilterConfig() { - override fun build(format: AudioDataFormat, output: FloatPcmAudioFilter): AudioFilter { + override fun build(format: AudioDataFormat, output: FloatPcmAudioFilter): FloatPcmAudioFilter { return KaraokePcmAudioFilter(output, format.channelCount, format.sampleRate) .setLevel(level) .setMonoLevel(monoLevel) @@ -57,7 +58,7 @@ class TimescaleConfig( private val rate: Double = 1.0 ) : FilterConfig() { - override fun build(format: AudioDataFormat, output: FloatPcmAudioFilter): AudioFilter { + override fun build(format: AudioDataFormat, output: FloatPcmAudioFilter): FloatPcmAudioFilter { return TimescalePcmAudioFilter(output, format.channelCount, format.sampleRate) .setSpeed(speed) .setPitch(pitch) @@ -71,7 +72,7 @@ class TremoloConfig( private val frequency: Float = 2.0f, private val depth: Float = 0.5f ) : FilterConfig() { - override fun build(format: AudioDataFormat, output: FloatPcmAudioFilter): AudioFilter { + override fun build(format: AudioDataFormat, output: FloatPcmAudioFilter): FloatPcmAudioFilter { return TremoloPcmAudioFilter(output, format.channelCount, format.sampleRate) .setFrequency(frequency) .setDepth(depth) @@ -85,7 +86,7 @@ class VibratoConfig( private val depth: Float = 0.5f ) : FilterConfig() { - override fun build(format: AudioDataFormat, output: FloatPcmAudioFilter): AudioFilter { + override fun build(format: AudioDataFormat, output: FloatPcmAudioFilter): FloatPcmAudioFilter { return VibratoPcmAudioFilter(output, format.channelCount, format.sampleRate) .setFrequency(frequency) .setDepth(depth) @@ -96,6 +97,6 @@ class VibratoConfig( } abstract class FilterConfig { - abstract fun build(format: AudioDataFormat, output: FloatPcmAudioFilter): AudioFilter + abstract fun build(format: AudioDataFormat, output: FloatPcmAudioFilter): FloatPcmAudioFilter abstract val isEnabled: Boolean } \ No newline at end of file From 15e39ddf01f3973d72ea6f53e27f5c16413fe33e Mon Sep 17 00:00:00 2001 From: Devoxin Date: Mon, 30 Mar 2020 19:56:11 +0100 Subject: [PATCH 14/68] Remove redundant code --- .../java/lavalink/server/player/Player.java | 27 ------------------- 1 file changed, 27 deletions(-) diff --git a/LavalinkServer/src/main/java/lavalink/server/player/Player.java b/LavalinkServer/src/main/java/lavalink/server/player/Player.java index 19aba5922..98816a785 100644 --- a/LavalinkServer/src/main/java/lavalink/server/player/Player.java +++ b/LavalinkServer/src/main/java/lavalink/server/player/Player.java @@ -91,33 +91,6 @@ public void setVolume(int volume) { player.setVolume(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) { -// if (!isEqualizerApplied) { -// return; -// } -// -// boolean shouldDisable = true; -// -// for (int i = 0; i < Equalizer.BAND_COUNT; i++) { -// if (equalizerFactory.getGain(i) != 0.0f) { -// shouldDisable = false; -// } -// } -// -// if (shouldDisable) { -// this.player.setFilterFactory(null); -// this.isEqualizerApplied = false; -// } -// } else if (!this.isEqualizerApplied) { -// this.player.setFilterFactory(equalizerFactory); -// this.isEqualizerApplied = true; -// } -// } - public JSONObject getState() { JSONObject json = new JSONObject(); From 3c580171357b343dbd3433ffd131053f8a79fd3d Mon Sep 17 00:00:00 2001 From: "Frederik Ar. Mikkelsen" Date: Sat, 28 Nov 2020 12:45:40 +0100 Subject: [PATCH 15/68] Undocument vibrato --- IMPLEMENTATION.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/IMPLEMENTATION.md b/IMPLEMENTATION.md index 05c864003..5e50136e6 100644 --- a/IMPLEMENTATION.md +++ b/IMPLEMENTATION.md @@ -169,12 +169,6 @@ JSON comments are for illustration purposes only, and will not be accepted by th tremolo: { frequency: 2.0, // 0 < x depth: 0.5 // 0 < x ≤ 1 - }, - - // Similar to tremolo. While tremolo oscillates the volume, vibrato oscillates the pitch. - vibrato: { - frequency: 2.0, // 0 < x ≤ 14 - depth: 0.5 // 0 < x ≤ 1 } } ``` From 91bb1b186429cb81abe253b81004c9ba5b5096f4 Mon Sep 17 00:00:00 2001 From: "Frederik Ar. Mikkelsen" Date: Sat, 28 Nov 2020 12:52:24 +0100 Subject: [PATCH 16/68] Update section about significant changes --- IMPLEMENTATION.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/IMPLEMENTATION.md b/IMPLEMENTATION.md index 5e50136e6..d228f7904 100644 --- a/IMPLEMENTATION.md +++ b/IMPLEMENTATION.md @@ -6,8 +6,9 @@ The Java client has support for JDA, but can also be adapted to work with other * You must be able to send messages via a shard's mainWS connection. * You must be able to intercept voice server updates from mainWS on your shard connection. -## Significant changes v3.0 -> v4.0 -The `error` string on the `TrackExceptionEvent` has been deprecated and replaced by +## Significant changes v3.3 -> v3.4 +* Added filters +* The `error` string on the `TrackExceptionEvent` has been deprecated and replaced by the `exception` object following the same structure as the `LOAD_FAILED` error on [`/loadtracks`](#rest-api) ## Significant changes v2.0 -> v3.0 From 1e376c7e2737b62cac1154c0318fd4bdde349cbd Mon Sep 17 00:00:00 2001 From: DaliborTrampota <31895316+DaliborTrampota@users.noreply.github.com> Date: Sat, 28 Nov 2020 13:01:18 +0100 Subject: [PATCH 17/68] lavaDsp 0.5.2 -> 0.7.4 fixes vibrato --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 1f35b16f5..ca5452ef7 100644 --- a/build.gradle +++ b/build.gradle @@ -59,7 +59,7 @@ subprojects { jdaNasVersion = '1.1.0' jappVersion = '1.3.2-MINN' koeVersion = '1.0.1' - lavaDspVersion = '0.5.2' + lavaDspVersion = '0.7.4' springBootVersion = "${springBootVersion}" springWebSocketVersion = '5.1.9.RELEASE' From 534834b4383383f8cd4a262430ee756b5613fa60 Mon Sep 17 00:00:00 2001 From: "Frederik Ar. Mikkelsen" Date: Sat, 28 Nov 2020 13:03:37 +0100 Subject: [PATCH 18/68] Revert "Undocument vibrato" This reverts commit 3c580171357b343dbd3433ffd131053f8a79fd3d. --- IMPLEMENTATION.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/IMPLEMENTATION.md b/IMPLEMENTATION.md index d228f7904..b562c6fc9 100644 --- a/IMPLEMENTATION.md +++ b/IMPLEMENTATION.md @@ -170,6 +170,12 @@ JSON comments are for illustration purposes only, and will not be accepted by th tremolo: { frequency: 2.0, // 0 < x depth: 0.5 // 0 < x ≤ 1 + }, + + // Similar to tremolo. While tremolo oscillates the volume, vibrato oscillates the pitch. + vibrato: { + frequency: 2.0, // 0 < x ≤ 14 + depth: 0.5 // 0 < x ≤ 1 } } ``` From 090a5d811e98cf5b06b4c26a8e75e7090d15673d Mon Sep 17 00:00:00 2001 From: "Frederik Ar. Mikkelsen" Date: Sat, 28 Nov 2020 22:05:18 +0100 Subject: [PATCH 19/68] Remove unused Num-Shards header --- IMPLEMENTATION.md | 1 - .../src/main/java/lavalink/server/io/SocketServer.kt | 6 ------ 2 files changed, 7 deletions(-) diff --git a/IMPLEMENTATION.md b/IMPLEMENTATION.md index b562c6fc9..1abc9e98f 100644 --- a/IMPLEMENTATION.md +++ b/IMPLEMENTATION.md @@ -46,7 +46,6 @@ the JDA client takes advantage of JDA's websocket write thread to send OP 4s for When opening a websocket connection, you must supply 3 required headers: ``` Authorization: Password matching the server config -Num-Shards: Total number of shards your bot is operating on User-Id: The user id of the bot you are playing music with ``` diff --git a/LavalinkServer/src/main/java/lavalink/server/io/SocketServer.kt b/LavalinkServer/src/main/java/lavalink/server/io/SocketServer.kt index 67e3b0ec8..98eb8127f 100644 --- a/LavalinkServer/src/main/java/lavalink/server/io/SocketServer.kt +++ b/LavalinkServer/src/main/java/lavalink/server/io/SocketServer.kt @@ -44,7 +44,6 @@ class SocketServer( ) : TextWebSocketHandler() { // userId <-> shardCount - private val shardCounts = ConcurrentHashMap() val contextMap = ConcurrentHashMap() @Suppress("LeakingThis") private val handlers = WebSocketHandlers(contextMap) @@ -68,12 +67,9 @@ class SocketServer( get() = contextMap.values override fun afterConnectionEstablished(session: WebSocketSession) { - val shardCount = Integer.parseInt(session.handshakeHeaders.getFirst("Num-Shards")!!) val userId = session.handshakeHeaders.getFirst("User-Id")!! val resumeKey = session.handshakeHeaders.getFirst("Resume-Key") - shardCounts[userId] = shardCount - var resumable: SocketContext? = null if (resumeKey != null) resumable = resumableSessions.remove(resumeKey) @@ -84,8 +80,6 @@ class SocketServer( return } - shardCounts[userId] = shardCount - contextMap[session.id] = SocketContext( audioPlayerManager, serverConfig, From b4dbfd694caf0205660bf86d8e2d8616ececcf33 Mon Sep 17 00:00:00 2001 From: "Frederik Ar. Mikkelsen" Date: Sat, 28 Nov 2020 22:11:17 +0100 Subject: [PATCH 20/68] Request and log client name --- IMPLEMENTATION.md | 3 ++- .../src/main/java/lavalink/server/io/SocketServer.kt | 10 +++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/IMPLEMENTATION.md b/IMPLEMENTATION.md index 1abc9e98f..c0fa2ed64 100644 --- a/IMPLEMENTATION.md +++ b/IMPLEMENTATION.md @@ -47,6 +47,7 @@ When opening a websocket connection, you must supply 3 required headers: ``` Authorization: Password matching the server config User-Id: The user id of the bot you are playing music with +Client-Name: The name of your client ``` ### Outgoing messages @@ -85,7 +86,7 @@ If `pause` is set to true, the playback will be paused. This is an optional fiel "endTime": "120000", "volume": "100", "noReplace": false, - "pause": false, + "pause": false } ``` diff --git a/LavalinkServer/src/main/java/lavalink/server/io/SocketServer.kt b/LavalinkServer/src/main/java/lavalink/server/io/SocketServer.kt index 98eb8127f..7e41fab40 100644 --- a/LavalinkServer/src/main/java/lavalink/server/io/SocketServer.kt +++ b/LavalinkServer/src/main/java/lavalink/server/io/SocketServer.kt @@ -69,6 +69,8 @@ class SocketServer( override fun afterConnectionEstablished(session: WebSocketSession) { val userId = session.handshakeHeaders.getFirst("User-Id")!! val resumeKey = session.handshakeHeaders.getFirst("Resume-Key") + val clientName = session.handshakeHeaders.getFirst("Client-Name") + val userAgent = session.handshakeHeaders.getFirst("User-Agent") var resumable: SocketContext? = null if (resumeKey != null) resumable = resumableSessions.remove(resumeKey) @@ -88,7 +90,13 @@ class SocketServer( userId, koe.newClient(userId.toLong()) ) - log.info("Connection successfully established from " + session.remoteAddress!!) + + if (clientName != null) { + log.info("Connection successfully established from $clientName") + } else { + log.info("Connection successfully established") + log.warn("Library developers: Please specify a 'Client-Name' header. User agent: $userAgent") + } } override fun afterConnectionClosed(session: WebSocketSession?, status: CloseStatus?) { From 45257b5928d827765cacc1af2b6462b507ac5e29 Mon Sep 17 00:00:00 2001 From: caneleex Date: Tue, 1 Dec 2020 21:01:28 +0100 Subject: [PATCH 21/68] bump lp (#407) * bump lavaplayer (#405) * bump lp Co-authored-by: Frederik Ar. Mikkelsen --- build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index ca5452ef7..de938a828 100644 --- a/build.gradle +++ b/build.gradle @@ -53,8 +53,8 @@ subprojects { ext { //@formatter:off - - lavaplayerVersion = '1.3.61' + + lavaplayerVersion = '1.3.63' lavaplayerIpRotatorVersion = '0.2.3' jdaNasVersion = '1.1.0' jappVersion = '1.3.2-MINN' From 23d8a3917da8324abf15f42952e7edaabddf2c2c Mon Sep 17 00:00:00 2001 From: "Frederik Ar. Mikkelsen" Date: Wed, 2 Dec 2020 19:38:28 +0100 Subject: [PATCH 22/68] Update IMPLEMENTATION.md --- IMPLEMENTATION.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IMPLEMENTATION.md b/IMPLEMENTATION.md index c0fa2ed64..afa3d3938 100644 --- a/IMPLEMENTATION.md +++ b/IMPLEMENTATION.md @@ -47,7 +47,7 @@ When opening a websocket connection, you must supply 3 required headers: ``` Authorization: Password matching the server config User-Id: The user id of the bot you are playing music with -Client-Name: The name of your client +Client-Name: The name of your client. Optionally in the format NAME/VERSION ``` ### Outgoing messages From 4c3fd7f2fe75f528358857ef745a1465e66fa8d1 Mon Sep 17 00:00:00 2001 From: "Frederik Ar. Mikkelsen" Date: Wed, 2 Dec 2020 19:45:11 +0100 Subject: [PATCH 23/68] Don't print User-Agent as null --- .../src/main/java/lavalink/server/io/SocketServer.kt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/LavalinkServer/src/main/java/lavalink/server/io/SocketServer.kt b/LavalinkServer/src/main/java/lavalink/server/io/SocketServer.kt index 7e41fab40..e95a86806 100644 --- a/LavalinkServer/src/main/java/lavalink/server/io/SocketServer.kt +++ b/LavalinkServer/src/main/java/lavalink/server/io/SocketServer.kt @@ -93,9 +93,14 @@ class SocketServer( if (clientName != null) { log.info("Connection successfully established from $clientName") - } else { - log.info("Connection successfully established") + return + } + + log.info("Connection successfully established") + if (userAgent != null) { log.warn("Library developers: Please specify a 'Client-Name' header. User agent: $userAgent") + } else { + log.warn("Library developers: Please specify a 'Client-Name' header.") } } From 65995a4c2e55794719cb92f164fca07b39209406 Mon Sep 17 00:00:00 2001 From: "Frederik Ar. Mikkelsen" Date: Thu, 17 Dec 2020 22:00:57 +0100 Subject: [PATCH 24/68] Update lavaplayer --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index de938a828..07b28be94 100644 --- a/build.gradle +++ b/build.gradle @@ -54,7 +54,7 @@ subprojects { ext { //@formatter:off - lavaplayerVersion = '1.3.63' + lavaplayerVersion = '1.3.64' lavaplayerIpRotatorVersion = '0.2.3' jdaNasVersion = '1.1.0' jappVersion = '1.3.2-MINN' From e88fb6ce155a29c3ba1c6b651a734bed5c4da177 Mon Sep 17 00:00:00 2001 From: "Frederik Ar. Mikkelsen" Date: Wed, 23 Dec 2020 13:48:17 +0100 Subject: [PATCH 25/68] Update lavaplayer --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 07b28be94..ef17071cd 100644 --- a/build.gradle +++ b/build.gradle @@ -54,7 +54,7 @@ subprojects { ext { //@formatter:off - lavaplayerVersion = '1.3.64' + lavaplayerVersion = '1.3.65' lavaplayerIpRotatorVersion = '0.2.3' jdaNasVersion = '1.1.0' jappVersion = '1.3.2-MINN' From 6be992c9e5f56ad653d1300edcb883e19dd11cbe Mon Sep 17 00:00:00 2001 From: "Frederik Ar. Mikkelsen" Date: Thu, 31 Dec 2020 12:13:06 +0100 Subject: [PATCH 26/68] Update lavaplayer --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index ef17071cd..6045c628c 100644 --- a/build.gradle +++ b/build.gradle @@ -54,7 +54,7 @@ subprojects { ext { //@formatter:off - lavaplayerVersion = '1.3.65' + lavaplayerVersion = '1.3.66' lavaplayerIpRotatorVersion = '0.2.3' jdaNasVersion = '1.1.0' jappVersion = '1.3.2-MINN' From e6c2db2d85f830d3c840b98fdc8732e0f40ab31a Mon Sep 17 00:00:00 2001 From: Devoxin <15076404+Devoxin@users.noreply.github.com> Date: Fri, 8 Jan 2021 22:46:41 +0000 Subject: [PATCH 27/68] Add configurable frame buffer duration (#424) * Add configurable frame buffer duration * Small fixes --- LavalinkServer/application.yml.example | 3 ++- .../server/config/AudioPlayerConfiguration.kt | 11 +++++++++++ .../main/java/lavalink/server/config/ServerConfig.kt | 1 + 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/LavalinkServer/application.yml.example b/LavalinkServer/application.yml.example index 868d1e836..cc4a56a1a 100644 --- a/LavalinkServer/application.yml.example +++ b/LavalinkServer/application.yml.example @@ -13,7 +13,8 @@ lavalink: mixer: true http: true local: false - bufferDurationMs: 400 + bufferDurationMs: 400 # The duration of the NAS buffer. Higher values fare better against longer GC pauses + frameBufferDurationMs: 5000 # How many milliseconds of audio to keep buffered youtubePlaylistLoadLimit: 6 # Number of pages at 100 each playerUpdateInterval: 5 # How frequently to send player updates to clients, in seconds youtubeSearchEnabled: true diff --git a/LavalinkServer/src/main/java/lavalink/server/config/AudioPlayerConfiguration.kt b/LavalinkServer/src/main/java/lavalink/server/config/AudioPlayerConfiguration.kt index 953fb1a2b..eac422fcf 100644 --- a/LavalinkServer/src/main/java/lavalink/server/config/AudioPlayerConfiguration.kt +++ b/LavalinkServer/src/main/java/lavalink/server/config/AudioPlayerConfiguration.kt @@ -45,6 +45,17 @@ class AudioPlayerConfiguration { audioPlayerManager.enableGcMonitoring() } + val defaultFrameBufferDuration = audioPlayerManager.frameBufferDuration + serverConfig.frameBufferDurationMs?.let { + if (it < 200) { // At the time of writing, LP enforces a minimum of 200ms. + log.warn("Buffer size of {}ms is illegal. Defaulting to {}", it, defaultFrameBufferDuration) + } + + val bufferDuration = it.takeIf { it >= 200 } ?: defaultFrameBufferDuration + log.debug("Setting frame buffer duration to {}", bufferDuration) + audioPlayerManager.frameBufferDuration = bufferDuration + } + if (sources.isYoutube) { val youtube = YoutubeAudioSourceManager(serverConfig.isYoutubeSearchEnabled) if (routePlanner != null) { diff --git a/LavalinkServer/src/main/java/lavalink/server/config/ServerConfig.kt b/LavalinkServer/src/main/java/lavalink/server/config/ServerConfig.kt index 28f27ffe9..fcc518abf 100644 --- a/LavalinkServer/src/main/java/lavalink/server/config/ServerConfig.kt +++ b/LavalinkServer/src/main/java/lavalink/server/config/ServerConfig.kt @@ -32,6 +32,7 @@ class ServerConfig { @get:Deprecated("use {@link SentryConfigProperties} instead.") var sentryDsn = "" var bufferDurationMs: Int? = null + var frameBufferDurationMs: Int? = null var youtubePlaylistLoadLimit: Int? = null var playerUpdateInterval: Int? = 5 var isGcWarnings = true From cf9c605948133f027af24e3c863254cba561293b Mon Sep 17 00:00:00 2001 From: Allvaa <52526068+Allvaa@users.noreply.github.com> Date: Fri, 5 Feb 2021 16:18:08 +0700 Subject: [PATCH 28/68] update lavaplayer (#431) added support for searching on yt music --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 6045c628c..6a41e6894 100644 --- a/build.gradle +++ b/build.gradle @@ -54,7 +54,7 @@ subprojects { ext { //@formatter:off - lavaplayerVersion = '1.3.66' + lavaplayerVersion = '1.3.67' lavaplayerIpRotatorVersion = '0.2.3' jdaNasVersion = '1.1.0' jappVersion = '1.3.2-MINN' From 7ef3f3890951655ad143d1739b2c29122b486b2b Mon Sep 17 00:00:00 2001 From: "Frederik Ar. Mikkelsen" Date: Sun, 7 Feb 2021 15:41:17 +0100 Subject: [PATCH 29/68] Added connected field to player updates --- IMPLEMENTATION.md | 9 +++++++-- .../src/main/java/lavalink/server/io/SocketContext.kt | 9 +++++++++ .../src/main/java/lavalink/server/io/SocketServer.kt | 6 +++++- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/IMPLEMENTATION.md b/IMPLEMENTATION.md index afa3d3938..4aa226e46 100644 --- a/IMPLEMENTATION.md +++ b/IMPLEMENTATION.md @@ -10,6 +10,7 @@ The Java client has support for JDA, but can also be adapted to work with other * Added filters * The `error` string on the `TrackExceptionEvent` has been deprecated and replaced by the `exception` object following the same structure as the `LOAD_FAILED` error on [`/loadtracks`](#rest-api) +* Added the `connected` boolean to player updates. ## Significant changes v2.0 -> v3.0 * The response of `/loadtracks` has been completely changed (again since the initial v3.0 pre-release). @@ -197,14 +198,18 @@ and you can send the same VOICE_SERVER_UPDATE to a new node. See [LavalinkSocket.java](https://github.com/FredBoat/Lavalink-Client/blob/master/src/main/java/lavalink/client/io/LavalinkSocket.java) for client implementation -Position information about a player. Includes unix timestamp. +This event includes: +* Unix timestamp in milliseconds. +* Track position in milliseconds. Omitted if not playing anything. +* `connected` is true when connected to the voice gateway. ```json { "op": "playerUpdate", "guildId": "...", "state": { "time": 1500467109, - "position": 60000 + "position": 60000, + "connected": true } } ``` diff --git a/LavalinkServer/src/main/java/lavalink/server/io/SocketContext.kt b/LavalinkServer/src/main/java/lavalink/server/io/SocketContext.kt index 749ac526d..ee3ba114e 100644 --- a/LavalinkServer/src/main/java/lavalink/server/io/SocketContext.kt +++ b/LavalinkServer/src/main/java/lavalink/server/io/SocketContext.kt @@ -37,6 +37,7 @@ import org.json.JSONObject import org.slf4j.LoggerFactory import org.springframework.web.socket.WebSocketSession import org.springframework.web.socket.adapter.standard.StandardWebSocketSession +import java.net.InetSocketAddress import java.util.* import java.util.concurrent.ConcurrentHashMap import java.util.concurrent.ConcurrentLinkedQueue @@ -91,6 +92,8 @@ class SocketContext internal constructor( } } + internal fun getPlayer(guildId: Long) = getPlayer(guildId.toString()) + internal fun getPlayer(guildId: String) = players.computeIfAbsent(guildId) { Player(this, guildId, audioPlayerManager, serverConfig) } @@ -189,6 +192,12 @@ class SocketContext internal constructor( out.put("byRemote", byRemote) send(out) + + SocketServer.sendPlayerUpdate(this@SocketContext, this@SocketContext.getPlayer(guildId)) + } + + override fun gatewayReady(target: InetSocketAddress?, ssrc: Int) { + SocketServer.sendPlayerUpdate(this@SocketContext, this@SocketContext.getPlayer(guildId)) } } } diff --git a/LavalinkServer/src/main/java/lavalink/server/io/SocketServer.kt b/LavalinkServer/src/main/java/lavalink/server/io/SocketServer.kt index e95a86806..c4a7548c8 100644 --- a/LavalinkServer/src/main/java/lavalink/server/io/SocketServer.kt +++ b/LavalinkServer/src/main/java/lavalink/server/io/SocketServer.kt @@ -55,10 +55,14 @@ class SocketServer( fun sendPlayerUpdate(socketContext: SocketContext, player: Player) { val json = JSONObject() + + val state = player.state + val connected = socketContext.getVoiceConnection(player.guildId.toLong()).gatewayConnection?.isOpen == true + state.put("connected", connected) + json.put("op", "playerUpdate") json.put("guildId", player.guildId) json.put("state", player.state) - socketContext.send(json) } } From 5591fd75071b654bb01345c3a0494ce3489b7137 Mon Sep 17 00:00:00 2001 From: Mandruyd <30357211+Mandruyd@users.noreply.github.com> Date: Mon, 8 Feb 2021 18:35:22 +0200 Subject: [PATCH 30/68] Add rotation and distortsion filters (#417) * Add rotation and distortsion filters * Proper LavaDSP version with natives * Update IMPLEMENTATION.md Co-authored-by: Mandruyd Co-authored-by: Frederik Ar. Mikkelsen --- IMPLEMENTATION.md | 18 +++++++++ .../server/player/filters/FilterChain.kt | 6 ++- .../server/player/filters/filterConfigs.kt | 40 +++++++++++++++++++ build.gradle | 2 +- 4 files changed, 64 insertions(+), 2 deletions(-) diff --git a/IMPLEMENTATION.md b/IMPLEMENTATION.md index 4aa226e46..5095ef4e6 100644 --- a/IMPLEMENTATION.md +++ b/IMPLEMENTATION.md @@ -177,7 +177,25 @@ JSON comments are for illustration purposes only, and will not be accepted by th vibrato: { frequency: 2.0, // 0 < x ≤ 14 depth: 0.5 // 0 < x ≤ 1 + }, + // Rotates the sound around the stereo channels/user headphones aka Audio Panning. It can produce an effect similar to: https://youtu.be/QB9EB8mTKcc (without the reverb) + rotation: { + rotationHz: 0 // The frequency of the audio rotating around the listener in Hz. 0.2 is similar to the example video above. + }, + //Distortion effect. It can generate some pretty unique audio effects. + distortion: { + sinOffset: 0, + sinScale: 1, + cosOffset: 0, + cosScale: 1, + tanOffset: 0, + tanScale: 1, + offset: 0, + scale: 1 + } } + + } ``` diff --git a/LavalinkServer/src/main/java/lavalink/server/player/filters/FilterChain.kt b/LavalinkServer/src/main/java/lavalink/server/player/filters/FilterChain.kt index 362766a7b..e7ee2ecd8 100644 --- a/LavalinkServer/src/main/java/lavalink/server/player/filters/FilterChain.kt +++ b/LavalinkServer/src/main/java/lavalink/server/player/filters/FilterChain.kt @@ -21,6 +21,8 @@ class FilterChain : PcmFilterFactory { private val timescale: TimescaleConfig? = null private val tremolo: TremoloConfig? = null private val vibrato: VibratoConfig? = null + private val distorsion: DistortionConfig? = null + private val rotation: RotationConfig? = null private fun buildList() = listOfNotNull( volume?.let { VolumeConfig(it) }, @@ -28,7 +30,9 @@ class FilterChain : PcmFilterFactory { karaoke, timescale, tremolo, - vibrato + vibrato, + distorsion, + rotation ) val isEnabled get() = buildList().any { it.isEnabled } diff --git a/LavalinkServer/src/main/java/lavalink/server/player/filters/filterConfigs.kt b/LavalinkServer/src/main/java/lavalink/server/player/filters/filterConfigs.kt index 4f7238a9b..789dd1219 100644 --- a/LavalinkServer/src/main/java/lavalink/server/player/filters/filterConfigs.kt +++ b/LavalinkServer/src/main/java/lavalink/server/player/filters/filterConfigs.kt @@ -4,6 +4,8 @@ import com.github.natanbc.lavadsp.karaoke.KaraokePcmAudioFilter import com.github.natanbc.lavadsp.timescale.TimescalePcmAudioFilter import com.github.natanbc.lavadsp.tremolo.TremoloPcmAudioFilter import com.github.natanbc.lavadsp.vibrato.VibratoPcmAudioFilter +import com.github.natanbc.lavadsp.distortion.DistortionPcmAudioFilter +import com.github.natanbc.lavadsp.rotation.RotationPcmAudioFilter import com.github.natanbc.lavadsp.volume.VolumePcmAudioFilter import com.sedmelluq.discord.lavaplayer.filter.AudioFilter import com.sedmelluq.discord.lavaplayer.filter.FloatPcmAudioFilter @@ -96,6 +98,44 @@ class VibratoConfig( } +class DistortionConfig( + private val sinOffset: Float = 0.0f, + private val sinScale: Float = 1.0f, + private val cosOffset: Float = 0.0f, + private val cosScale: Float = 1.0f, + private val tanOffset: Float = 0.0f, + private val tanScale: Float = 1.0f, + private val offset: Float = 0.0f, + private val scale: Float = 1.0f +) : FilterConfig() { + + override fun build(format: AudioDataFormat, output: FloatPcmAudioFilter): FloatPcmAudioFilter { + return DistortionPcmAudioFilter(output, format.channelCount) + .setSinOffset(sinOffset) + .setSinScale(sinScale) + .setCosOffset(cosOffset) + .setCosScale(cosScale) + .setTanOffset(tanOffset) + .setTanScale(tanScale) + .setOffset(offset) + .setScale(scale) + } + + override val isEnabled: Boolean get() = sinOffset != 0.0f || sinScale != 1.0f || cosOffset != 0.0f || cosScale != 1.0f || tanOffset != 0.0f || tanScale != 1.0f || offset != 0.0f || scale != 1.0f + +} + +class RotationConfig( + private val rotationHz: Double = 0.0 +) : FilterConfig() { + override fun build(format: AudioDataFormat, output: FloatPcmAudioFilter): FloatPcmAudioFilter { + return RotationPcmAudioFilter(output, format.sampleRate) + .setRotationSpeed(rotationHz) + } + + override val isEnabled: Boolean get() = rotationHz != 0.0 +} + abstract class FilterConfig { abstract fun build(format: AudioDataFormat, output: FloatPcmAudioFilter): FloatPcmAudioFilter abstract val isEnabled: Boolean diff --git a/build.gradle b/build.gradle index 6a41e6894..2108f3afe 100644 --- a/build.gradle +++ b/build.gradle @@ -59,7 +59,7 @@ subprojects { jdaNasVersion = '1.1.0' jappVersion = '1.3.2-MINN' koeVersion = '1.0.1' - lavaDspVersion = '0.7.4' + lavaDspVersion = '0.7.6' springBootVersion = "${springBootVersion}" springWebSocketVersion = '5.1.9.RELEASE' From dafa4e80eb470f12cfe1622cd84097d595640814 Mon Sep 17 00:00:00 2001 From: Alex <46286597+Alex-R-31@users.noreply.github.com> Date: Tue, 9 Feb 2021 15:31:28 +0000 Subject: [PATCH 31/68] Fix JSON syntax --- IMPLEMENTATION.md | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/IMPLEMENTATION.md b/IMPLEMENTATION.md index 5095ef4e6..5f2e54767 100644 --- a/IMPLEMENTATION.md +++ b/IMPLEMENTATION.md @@ -152,7 +152,7 @@ JSON comments are for illustration purposes only, and will not be accepted by th ], // Uses equalization to eliminate part of a band, usually targeting vocals. - karaoke: { + "karaoke": { "level": 1.0, "monoLevel": 1.0, "filterBand": 220.0, @@ -160,7 +160,7 @@ JSON comments are for illustration purposes only, and will not be accepted by th }, // Changes the speed, pitch, and rate. All default to 1. - timescale: { + "timescale": { "speed": 1.0, "pitch": 1.0, "rate": 1.0 @@ -168,30 +168,30 @@ JSON comments are for illustration purposes only, and will not be accepted by th // Uses amplification to create a shuddering effect, where the volume quickly oscillates. // Example: https://en.wikipedia.org/wiki/File:Fuse_Electronics_Tremolo_MK-III_Quick_Demo.ogv - tremolo: { - frequency: 2.0, // 0 < x - depth: 0.5 // 0 < x ≤ 1 + "tremolo": { + "frequency": 2.0, // 0 < x + "depth": 0.5 // 0 < x ≤ 1 }, // Similar to tremolo. While tremolo oscillates the volume, vibrato oscillates the pitch. - vibrato: { - frequency: 2.0, // 0 < x ≤ 14 - depth: 0.5 // 0 < x ≤ 1 + "vibrato": { + "frequency": 2.0, // 0 < x ≤ 14 + "depth": 0.5 // 0 < x ≤ 1 }, // Rotates the sound around the stereo channels/user headphones aka Audio Panning. It can produce an effect similar to: https://youtu.be/QB9EB8mTKcc (without the reverb) - rotation: { - rotationHz: 0 // The frequency of the audio rotating around the listener in Hz. 0.2 is similar to the example video above. + "rotation": { + "rotationHz": 0 // The frequency of the audio rotating around the listener in Hz. 0.2 is similar to the example video above. }, //Distortion effect. It can generate some pretty unique audio effects. - distortion: { - sinOffset: 0, - sinScale: 1, - cosOffset: 0, - cosScale: 1, - tanOffset: 0, - tanScale: 1, - offset: 0, - scale: 1 + "distortion": { + "sinOffset": 0, + "sinScale": 1, + "cosOffset": 0, + "cosScale": 1, + "tanOffset": 0, + "tanScale": 1, + "offset": 0, + "scale": 1 } } From 530fdf1315cd10f816cc6909493d67a562d99e7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?To=CF=80Senpai?= <15636011+TopiSenpai@users.noreply.github.com> Date: Sun, 14 Feb 2021 02:28:12 +0100 Subject: [PATCH 32/68] bump lavaplayer (#434) * bump lavaplayer * Update build.gradle --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 2108f3afe..231cc9910 100644 --- a/build.gradle +++ b/build.gradle @@ -54,7 +54,7 @@ subprojects { ext { //@formatter:off - lavaplayerVersion = '1.3.67' + lavaplayerVersion = '1.3.69' lavaplayerIpRotatorVersion = '0.2.3' jdaNasVersion = '1.1.0' jappVersion = '1.3.2-MINN' From 41e358200ceb9469c46fee637e4d9929a3888cc3 Mon Sep 17 00:00:00 2001 From: ToxicMushroom <32853531+ToxicMushroom@users.noreply.github.com> Date: Mon, 15 Feb 2021 12:14:15 +0100 Subject: [PATCH 33/68] Bump lavaplayer to 1.3.71 (#436) * Bump lavaplayer to 1.3.70 * Bump lavaplayer to 1.3.71 --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 231cc9910..3d58a0b9b 100644 --- a/build.gradle +++ b/build.gradle @@ -54,7 +54,7 @@ subprojects { ext { //@formatter:off - lavaplayerVersion = '1.3.69' + lavaplayerVersion = '1.3.71' lavaplayerIpRotatorVersion = '0.2.3' jdaNasVersion = '1.1.0' jappVersion = '1.3.2-MINN' From 46960aaa4e7e23a6be491c2be89e46b40b7d16c8 Mon Sep 17 00:00:00 2001 From: Allvaa <52526068+Allvaa@users.noreply.github.com> Date: Wed, 17 Feb 2021 03:53:58 +0700 Subject: [PATCH 34/68] fix: connected field on playerUpdate is missing (#438) --- LavalinkServer/src/main/java/lavalink/server/io/SocketServer.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LavalinkServer/src/main/java/lavalink/server/io/SocketServer.kt b/LavalinkServer/src/main/java/lavalink/server/io/SocketServer.kt index c4a7548c8..6add0da18 100644 --- a/LavalinkServer/src/main/java/lavalink/server/io/SocketServer.kt +++ b/LavalinkServer/src/main/java/lavalink/server/io/SocketServer.kt @@ -62,7 +62,7 @@ class SocketServer( json.put("op", "playerUpdate") json.put("guildId", player.guildId) - json.put("state", player.state) + json.put("state", state) socketContext.send(json) } } From b10012e3faf444ca2bf726cb2e12834d45de0318 Mon Sep 17 00:00:00 2001 From: "Frederik Ar. Mikkelsen" Date: Mon, 22 Feb 2021 20:29:58 +0100 Subject: [PATCH 35/68] Re-document volume op --- IMPLEMENTATION.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/IMPLEMENTATION.md b/IMPLEMENTATION.md index 5f2e54767..b3a897f85 100644 --- a/IMPLEMENTATION.md +++ b/IMPLEMENTATION.md @@ -122,6 +122,18 @@ The position is in milliseconds. } ``` +#### Set player volume + +Volume may range from 0 to 1000. 100 is default. + +```json +{ + "op": "volume", + "guildId": "...", + "volume": 125 +} +``` + #### Using filters The `filters` op sets the filters. All the filters are optional, and leaving them out of this message will disable them. @@ -132,6 +144,8 @@ normally require very little processing. This is often the case with YouTube vid JSON comments are for illustration purposes only, and will not be accepted by the server. +Note that filters may take a moment to apply. + ```yaml { "op": "filters", From 524bf91abba1804ded85cf14af810a0964b2b769 Mon Sep 17 00:00:00 2001 From: Allvaa <52526068+Allvaa@users.noreply.github.com> Date: Wed, 24 Feb 2021 03:13:46 +0700 Subject: [PATCH 36/68] fix: players are not deleted even using destroy op (#442) --- .../java/lavalink/server/io/SocketContext.kt | 17 +++++++++-------- .../java/lavalink/server/io/SocketServer.kt | 2 +- .../lavalink/server/io/WebSocketHandlers.kt | 4 ++-- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/LavalinkServer/src/main/java/lavalink/server/io/SocketContext.kt b/LavalinkServer/src/main/java/lavalink/server/io/SocketContext.kt index ee3ba114e..0fb92767e 100644 --- a/LavalinkServer/src/main/java/lavalink/server/io/SocketContext.kt +++ b/LavalinkServer/src/main/java/lavalink/server/io/SocketContext.kt @@ -105,11 +105,12 @@ class SocketContext internal constructor( /** * Gets or creates a voice connection */ - fun getVoiceConnection(guild: Long): VoiceConnection { - var conn = koe.getConnection(guild) + fun getVoiceConnection(player: Player): VoiceConnection { + val guildId = player.guildId.toLong() + var conn = koe.getConnection(guildId) if (conn == null) { - conn = koe.createConnection(guild) - conn.registerListener(EventHandler(guild.toString())) + conn = koe.createConnection(guildId) + conn.registerListener(EventHandler(player)) } return conn } @@ -181,23 +182,23 @@ class SocketContext internal constructor( koe.close() } - private inner class EventHandler(private val guildId: String) : KoeEventAdapter() { + private inner class EventHandler(private val player: Player) : KoeEventAdapter() { override fun gatewayClosed(code: Int, reason: String?, byRemote: Boolean) { val out = JSONObject() out.put("op", "event") out.put("type", "WebSocketClosedEvent") - out.put("guildId", guildId) + out.put("guildId", player.guildId) out.put("reason", reason ?: "") out.put("code", code) out.put("byRemote", byRemote) send(out) - SocketServer.sendPlayerUpdate(this@SocketContext, this@SocketContext.getPlayer(guildId)) + SocketServer.sendPlayerUpdate(this@SocketContext, player) } override fun gatewayReady(target: InetSocketAddress?, ssrc: Int) { - SocketServer.sendPlayerUpdate(this@SocketContext, this@SocketContext.getPlayer(guildId)) + SocketServer.sendPlayerUpdate(this@SocketContext, player) } } } diff --git a/LavalinkServer/src/main/java/lavalink/server/io/SocketServer.kt b/LavalinkServer/src/main/java/lavalink/server/io/SocketServer.kt index 6add0da18..42f8e75b1 100644 --- a/LavalinkServer/src/main/java/lavalink/server/io/SocketServer.kt +++ b/LavalinkServer/src/main/java/lavalink/server/io/SocketServer.kt @@ -57,7 +57,7 @@ class SocketServer( val json = JSONObject() val state = player.state - val connected = socketContext.getVoiceConnection(player.guildId.toLong()).gatewayConnection?.isOpen == true + val connected = socketContext.getVoiceConnection(player).gatewayConnection?.isOpen == true state.put("connected", connected) json.put("op", "playerUpdate") diff --git a/LavalinkServer/src/main/java/lavalink/server/io/WebSocketHandlers.kt b/LavalinkServer/src/main/java/lavalink/server/io/WebSocketHandlers.kt index b173b5779..aa2e45448 100644 --- a/LavalinkServer/src/main/java/lavalink/server/io/WebSocketHandlers.kt +++ b/LavalinkServer/src/main/java/lavalink/server/io/WebSocketHandlers.kt @@ -30,7 +30,7 @@ class WebSocketHandlers(private val contextMap: Map) { //discord sometimes send a partial server update missing the endpoint, which can be ignored. endpoint ?: return - context.getVoiceConnection(guildId).connect(VoiceServerInfo(sessionId, endpoint, token)) + context.getVoiceConnection(context.getPlayer(guildId)).connect(VoiceServerInfo(sessionId, endpoint, token)) } fun play(context: SocketContext, json: JSONObject) { @@ -70,7 +70,7 @@ class WebSocketHandlers(private val contextMap: Map) { player.play(track) - val conn = context.getVoiceConnection(player.guildId.toLong()) + val conn = context.getVoiceConnection(player) context.getPlayer(json.getString("guildId")).provideTo(conn) } From 601c7e2cec98182d3fd7a45f4e3e8710b89ed5c5 Mon Sep 17 00:00:00 2001 From: TopiSenpai Date: Fri, 26 Feb 2021 17:59:28 +0100 Subject: [PATCH 37/68] lavalink now plays when moved to a different voicechannel --- .../src/main/java/lavalink/server/io/WebSocketHandlers.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/LavalinkServer/src/main/java/lavalink/server/io/WebSocketHandlers.kt b/LavalinkServer/src/main/java/lavalink/server/io/WebSocketHandlers.kt index aa2e45448..099250d64 100644 --- a/LavalinkServer/src/main/java/lavalink/server/io/WebSocketHandlers.kt +++ b/LavalinkServer/src/main/java/lavalink/server/io/WebSocketHandlers.kt @@ -30,7 +30,9 @@ class WebSocketHandlers(private val contextMap: Map) { //discord sometimes send a partial server update missing the endpoint, which can be ignored. endpoint ?: return - context.getVoiceConnection(context.getPlayer(guildId)).connect(VoiceServerInfo(sessionId, endpoint, token)) + val player = context.getPlayer(guildId) + val conn = context.getVoiceConnection(player) + conn.connect(VoiceServerInfo(sessionId, endpoint, token)).apply { player.provideTo(conn) } } fun play(context: SocketContext, json: JSONObject) { From 3b174226a692a358c6887f93a09f5723e74716b0 Mon Sep 17 00:00:00 2001 From: "Frederik Ar. Mikkelsen" Date: Sat, 27 Feb 2021 11:42:29 +0100 Subject: [PATCH 38/68] Remove unnecessary apply function --- .../src/main/java/lavalink/server/io/WebSocketHandlers.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/LavalinkServer/src/main/java/lavalink/server/io/WebSocketHandlers.kt b/LavalinkServer/src/main/java/lavalink/server/io/WebSocketHandlers.kt index 099250d64..070eead2b 100644 --- a/LavalinkServer/src/main/java/lavalink/server/io/WebSocketHandlers.kt +++ b/LavalinkServer/src/main/java/lavalink/server/io/WebSocketHandlers.kt @@ -32,7 +32,8 @@ class WebSocketHandlers(private val contextMap: Map) { val player = context.getPlayer(guildId) val conn = context.getVoiceConnection(player) - conn.connect(VoiceServerInfo(sessionId, endpoint, token)).apply { player.provideTo(conn) } + conn.connect(VoiceServerInfo(sessionId, endpoint, token)) + player.provideTo(conn) } fun play(context: SocketContext, json: JSONObject) { From 9ce5d1fdbfb9d582ea983d741c00247d40dbe720 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?To=CF=80Senpai?= <15636011+TopiSenpai@users.noreply.github.com> Date: Wed, 3 Mar 2021 16:17:21 +0100 Subject: [PATCH 39/68] lp bump (#446) --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 3d58a0b9b..53cb5d71f 100644 --- a/build.gradle +++ b/build.gradle @@ -54,7 +54,7 @@ subprojects { ext { //@formatter:off - lavaplayerVersion = '1.3.71' + lavaplayerVersion = '1.3.72' lavaplayerIpRotatorVersion = '0.2.3' jdaNasVersion = '1.1.0' jappVersion = '1.3.2-MINN' From 29fb37958c3514386c58fc62b6099d5c5f59a5ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?To=CF=80Senpai?= <15636011+TopiSenpai@users.noreply.github.com> Date: Sun, 7 Mar 2021 16:28:32 +0100 Subject: [PATCH 40/68] lavaplayer 1.3.73 dump (#448) --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 53cb5d71f..aa588b531 100644 --- a/build.gradle +++ b/build.gradle @@ -54,7 +54,7 @@ subprojects { ext { //@formatter:off - lavaplayerVersion = '1.3.72' + lavaplayerVersion = '1.3.73' lavaplayerIpRotatorVersion = '0.2.3' jdaNasVersion = '1.1.0' jappVersion = '1.3.2-MINN' From 289f6654ed4dc791bf28a25a3de284d63ab601a9 Mon Sep 17 00:00:00 2001 From: Mandruyd <30357211+Mandruyd@users.noreply.github.com> Date: Thu, 1 Apr 2021 20:17:58 +0300 Subject: [PATCH 41/68] Update Lavaplayer (#464) --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index aa588b531..c48ff7f51 100644 --- a/build.gradle +++ b/build.gradle @@ -54,7 +54,7 @@ subprojects { ext { //@formatter:off - lavaplayerVersion = '1.3.73' + lavaplayerVersion = '1.3.74' lavaplayerIpRotatorVersion = '0.2.3' jdaNasVersion = '1.1.0' jappVersion = '1.3.2-MINN' From de2c9f0276e2f34ed200182ed0246c2a5e27f51f Mon Sep 17 00:00:00 2001 From: fuzzysearch404 <44381551+fuzzysearch404@users.noreply.github.com> Date: Fri, 2 Apr 2021 18:42:58 +0300 Subject: [PATCH 42/68] Update Lavaplayer to 1.3.75 (#465) --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index c48ff7f51..5f23dffe3 100644 --- a/build.gradle +++ b/build.gradle @@ -54,7 +54,7 @@ subprojects { ext { //@formatter:off - lavaplayerVersion = '1.3.74' + lavaplayerVersion = '1.3.75' lavaplayerIpRotatorVersion = '0.2.3' jdaNasVersion = '1.1.0' jappVersion = '1.3.2-MINN' From f6a58245ad7fc3c5f14935317874011fbbf34b72 Mon Sep 17 00:00:00 2001 From: PredaaA <46051820+PredaaA@users.noreply.github.com> Date: Fri, 2 Apr 2021 17:46:29 +0200 Subject: [PATCH 43/68] Fix distortion filter typo (#460) --- .../main/java/lavalink/server/player/filters/FilterChain.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/LavalinkServer/src/main/java/lavalink/server/player/filters/FilterChain.kt b/LavalinkServer/src/main/java/lavalink/server/player/filters/FilterChain.kt index e7ee2ecd8..8fcf75acf 100644 --- a/LavalinkServer/src/main/java/lavalink/server/player/filters/FilterChain.kt +++ b/LavalinkServer/src/main/java/lavalink/server/player/filters/FilterChain.kt @@ -21,7 +21,7 @@ class FilterChain : PcmFilterFactory { private val timescale: TimescaleConfig? = null private val tremolo: TremoloConfig? = null private val vibrato: VibratoConfig? = null - private val distorsion: DistortionConfig? = null + private val distortion: DistortionConfig? = null private val rotation: RotationConfig? = null private fun buildList() = listOfNotNull( @@ -31,7 +31,7 @@ class FilterChain : PcmFilterFactory { timescale, tremolo, vibrato, - distorsion, + distortion, rotation ) @@ -51,4 +51,4 @@ class FilterChain : PcmFilterFactory { return pipeline.reversed().toMutableList() // Output last } -} \ No newline at end of file +} From 82fe7290e949875600af23cc056346b9e1286409 Mon Sep 17 00:00:00 2001 From: Kodehawa Date: Sun, 11 Apr 2021 14:17:42 -0400 Subject: [PATCH 44/68] update lavaplayer to 1.3.76 (#472) --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 5f23dffe3..2197bf95d 100644 --- a/build.gradle +++ b/build.gradle @@ -54,7 +54,7 @@ subprojects { ext { //@formatter:off - lavaplayerVersion = '1.3.75' + lavaplayerVersion = '1.3.76' lavaplayerIpRotatorVersion = '0.2.3' jdaNasVersion = '1.1.0' jappVersion = '1.3.2-MINN' From 2b89c6ff3aca5a71e23844799df533b0daa8462b Mon Sep 17 00:00:00 2001 From: Muhimur <52611945+muhimur9049@users.noreply.github.com> Date: Sun, 18 Apr 2021 02:44:47 -0400 Subject: [PATCH 45/68] Fix more references to old username (#474) * Update README.md * Update README.md * Update README.md * Update Launcher.kt * Update CHANGELOG.md * Update CHANGELOG.md * Update CHANGELOG.md * Update CHANGELOG.md --- CHANGELOG.md | 54 +++++++++---------- .../src/main/java/lavalink/server/Launcher.kt | 2 +- README.md | 6 +-- 3 files changed, 31 insertions(+), 31 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 25cc2ba6c..6088ad786 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,7 +21,7 @@ The most noteworthy of these, as well as any features and breaking changes, are * Added a Testbot for development. Contributors: -[@Frederikam](https://github.com/Frederikam), +[@freyacodes](https://github.com/freyacodes), [@Thewsomeguy](https://github.com/Thewsomeguy), [@Neuheit](https://github.com/Neuheit), [@Sangoon_Is_Noob](https://github.com/Sangoon_Is_Noob), @@ -41,7 +41,7 @@ Contributors: ## v3.3.1.1 * Updated Lavaplayer to `1.3.50`. This notably fixes YouTube search. -Search patch contributed by [@Frederikam](https://github.com/Frederikam) +Search patch contributed by [@freyacodes](https://github.com/freyacodes) ## v3.3.1 * Update Magma and Lavaplayer. @@ -51,7 +51,7 @@ Search patch contributed by [@Frederikam](https://github.com/Frederikam) * Docker images now use Zulu JDK 13 to mitigate TLS 1.3 problems. Contributors: -[@Frederikam](https://github.com/Frederikam), +[@freyacodes](https://github.com/freyacodes), [@duncte123](https://github.com/duncte123), [@ByteAlex](https://github.com/ByteAlex), and [@Xavinlol](https://github.com/Xavinlol) @@ -66,7 +66,7 @@ Officially limit Lavalink to JRE 11 and up. Magma has long been having issues wi * Docker container now uses a non-root user. Contributors: -[@Frederikam](https://github.com/Frederikam), +[@freyacodes](https://github.com/freyacodes), [@ByteAlex](https://github.com/ByteAlex), [@duncte123](https://github.com/duncte123), and [@james7132](https://github.com/james7132) @@ -77,7 +77,7 @@ https://github.com/sedmelluq/lavaplayer/pull/199 * Made the WebSocket handshake return code 401 instead of 200 on bad auth. #208 Contributors: -[@Frederikam](https://github.com/Frederikam) and +[@freyacodes](https://github.com/freyacodes) and [@Devoxin](https://github.com/Devoxin) @@ -90,7 +90,7 @@ Contributors: Contributors: [@Devoxin](https://github.com/Devoxin), [@duncte123](https://github.com/duncte123), -[@Frederikam](https://github.com/Frederikam), and +[@freyacodes](https://github.com/freyacodes), and [@napstr](https://github.com/napstr) ## v3.2.0.3 @@ -103,12 +103,12 @@ Contributor: * Patched magma Contributor: -[@Frederikam](https://github.com/Frederikam/) +[@freyacodes](https://github.com/freyacodes/) ## v3.2.0.1 * Bumped to Java 11. Treating this as a patch version, as v3.2 still requires Java 11 due to a Magma update. -[@Frederikam](https://github.com/Frederikam) +[@freyacodes](https://github.com/freyacodes) ## v3.2 * Added support for resuming @@ -116,7 +116,7 @@ Contributor: * Sending the same voice server update will not cause an existing connection to reconnect Contributor: -[@Frederikam](https://github.com/Frederikam) +[@freyacodes](https://github.com/freyacodes) ## v3.1.2 * Add API version header to all responses @@ -132,7 +132,7 @@ Contributor: Contributors: [@Devoxin](https://github.com/Devoxin), -[@Frederikam](https://github.com/Frederikam/), +[@freyacodes](https://github.com/freyacodes/), [@calebj](https://github.com/calebj) ## v3.1 @@ -146,49 +146,49 @@ server and port. Port is specified by `server.port`. **Please note**: Java 10 will be obsolete as of [September 2018 with the release of Java 11](http://www.java-countdown.xyz/). Expect a Lavalink major version release that will be targetting Java 11 by that time. -* **Breaking:** Changes to the output of the /loadtracks endpoint. [\#91](https://github.com/Frederikam/Lavalink/pull/91), [\#114](https://github.com/Frederikam/Lavalink/pull/114), [\#116](https://github.com/Frederikam/Lavalink/pull/116) +* **Breaking:** Changes to the output of the /loadtracks endpoint. [\#91](https://github.com/freyacodes/Lavalink/pull/91), [\#114](https://github.com/Frederikam/Lavalink/pull/114), [\#116](https://github.com/freyacodes/Lavalink/pull/116) * **Breaking:** The Java client has been moved to a [new repository](https://github.com/FredBoat/Lavalink-Client). * **Breaking:** The Java client has been made generic. This is a breaking change so please read the [migration guide](https://github.com/FredBoat/Lavalink-Client#migrating-from-v2-to-v3). -* Better configurable logging. [\#97](https://github.com/Frederikam/Lavalink/pull/97) -* Add custom sentry tags, change sentry dsn configuration location. [\#103](https://github.com/Frederikam/Lavalink/pull/103) -* Add Lavalink version header to websocket handshake. [\#111](https://github.com/Frederikam/Lavalink/pull/111) -* Use git tags for easier version visibility. [\#129](https://github.com/Frederikam/Lavalink/pull/129) +* Better configurable logging. [\#97](https://github.com/freyacodes/Lavalink/pull/97) +* Add custom sentry tags, change sentry dsn configuration location. [\#103](https://github.com/freyacodes/Lavalink/pull/103) +* Add Lavalink version header to websocket handshake. [\#111](https://github.com/freyacodes/Lavalink/pull/111) +* Use git tags for easier version visibility. [\#129](https://github.com/freyacodes/Lavalink/pull/129) Contributors: [@Devoxin](https://github.com/Devoxin), -[@Frederikam](https://github.com/Frederikam/), +[@freyacodes](https://github.com/freyacodes/), [@napstr](https://github.com/napstr), [@SamOphis](https://github.com/SamOphis) ## v2.2 -* Lavaplayer updated to 1.3.x [\#115](https://github.com/Frederikam/Lavalink/pull/115) -* Version command line flag [\#121](https://github.com/Frederikam/Lavalink/pull/121) -* Fix race condition in `/loadtracks` endpoint leading to some requests never completing [\#125](https://github.com/Frederikam/Lavalink/pull/125) +* Lavaplayer updated to 1.3.x [\#115](https://github.com/freyacodes/Lavalink/pull/115) +* Version command line flag [\#121](https://github.com/freyacodes/Lavalink/pull/121) +* Fix race condition in `/loadtracks` endpoint leading to some requests never completing [\#125](https://github.com/freyacodes/Lavalink/pull/125) Contributors: [@Devoxin](https://github.com/Devoxin), -[@Frederikam](https://github.com/Frederikam/), +[@freyacodes](https://github.com/freyacodes/), [@napstr](https://github.com/napstr) ## v2.1 -* Add prometheus metrics [\#105](https://github.com/Frederikam/Lavalink/pull/105), [\#106](https://github.com/Frederikam/Lavalink/pull/106) +* Add prometheus metrics [\#105](https://github.com/freyacodes/Lavalink/pull/105), [\#106](https://github.com/freyacodes/Lavalink/pull/106) Contributors: -[@Frederikam](https://github.com/Frederikam/), +[@freyacodes](https://github.com/freyacodes/), [@napstr](https://github.com/napstr), [@Repulser](https://github.com/Repulser/) ## v2.0.1 -* Configurable playlist load limit [\#60](https://github.com/Frederikam/Lavalink/pull/60) -* [Docker Releases](https://hub.docker.com/r/fredboat/lavalink/), [\#74](https://github.com/Frederikam/Lavalink/pull/74) +* Configurable playlist load limit [\#60](https://github.com/freyacodes/Lavalink/pull/60) +* [Docker Releases](https://hub.docker.com/r/fredboat/lavalink/), [\#74](https://github.com/freyacodes/Lavalink/pull/74) Contributors: [@Devoxin](https://github.com/Devoxin), -[@Frederikam](https://github.com/Frederikam/), +[@freyacodes](https://github.com/freyacodes/), [@itslukej](https://github.com/itslukej/), [@napstr](https://github.com/napstr), [@Repulser](https://github.com/Repulser/) ## v2.0 -Please see [here](https://github.com/Frederikam/Lavalink/commit/b8dd3c8a7e186755c1ab343d19a552baecf138e7) -and [here](https://github.com/Frederikam/Lavalink/commit/08a34c99a47a18ade7bd14e6c55ab92348caaa88) +Please see [here](https://github.com/freyacodes/Lavalink/commit/b8dd3c8a7e186755c1ab343d19a552baecf138e7) +and [here](https://github.com/freyacodes/Lavalink/commit/08a34c99a47a18ade7bd14e6c55ab92348caaa88) diff --git a/LavalinkServer/src/main/java/lavalink/server/Launcher.kt b/LavalinkServer/src/main/java/lavalink/server/Launcher.kt index b1a83d26e..491c61fb9 100644 --- a/LavalinkServer/src/main/java/lavalink/server/Launcher.kt +++ b/LavalinkServer/src/main/java/lavalink/server/Launcher.kt @@ -125,6 +125,6 @@ object Launcher { } ) sa.run(*args) - log.info("You can safely ignore the big red warning about illegal reflection. See https://github.com/Frederikam/Lavalink/issues/295") + log.info("You can safely ignore the big red warning about illegal reflection. See https://github.com/freyacodes/Lavalink/issues/295") } } diff --git a/README.md b/README.md index 8ad2240d2..ae561c832 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ Support for Darwin (Mac), Windows AMD64, and Linux ARM (Raspberry Pi) is provide Support for other JVMs is also best-effort. Periodic CPU utilization stats are prone to not work everywhere. -**\*Java 11 appears to have some issues with Discord's TLS 1.3. Java 14 has other undiagnosed HTTPS problems. Use Java 13. Docker images have been updated.** See [#258](https://github.com/Frederikam/Lavalink/issues/258), [#260](https://github.com/Frederikam/Lavalink/issues/260) +**\*Java 11 appears to have some issues with Discord's TLS 1.3. Java 14 has other undiagnosed HTTPS problems. Use Java 13. Docker images have been updated.** See [#258](https://github.com/freyacodes/Lavalink/issues/258), [#260](https://github.com/freyacodes/Lavalink/issues/260) ## Changelog @@ -96,9 +96,9 @@ users about the compatibility of their clients to the Lavalink server. * Or [create your own](https://github.com/Frederikam/Lavalink/blob/master/IMPLEMENTATION.md) ## Server configuration -Download binaries from [the CI server](https://ci.fredboat.com/viewLog.html?buildId=lastSuccessful&buildTypeId=Lavalink_Build&tab=artifacts&guest=1) or [the GitHub releases](https://github.com/Frederikam/Lavalink/releases). +Download binaries from [the CI server](https://ci.fredboat.com/viewLog.html?buildId=lastSuccessful&buildTypeId=Lavalink_Build&tab=artifacts&guest=1) or [the GitHub releases](https://github.com/freyacodes/Lavalink/releases). -Put an `application.yml` file in your working directory. [Example](https://github.com/Frederikam/Lavalink/blob/master/LavalinkServer/application.yml.example) +Put an `application.yml` file in your working directory. [Example](https://github.com/freyacodes/Lavalink/blob/master/LavalinkServer/application.yml.example) Run with `java -jar Lavalink.jar` From 8a0ea130bec6a5a2495bf460b1b8c724d6bdccaa Mon Sep 17 00:00:00 2001 From: Freya Arbjerg Date: Sun, 18 Apr 2021 09:21:01 +0200 Subject: [PATCH 46/68] Replace old names --- CHANGELOG.md | 6 +++--- IMPLEMENTATION.md | 4 ++-- LICENSE | 2 +- LavalinkServer/src/main/java/lavalink/server/Launcher.kt | 2 +- .../src/main/java/lavalink/server/config/ServerConfig.kt | 2 +- .../src/main/java/lavalink/server/io/SocketContext.kt | 2 +- .../src/main/java/lavalink/server/io/SocketServer.kt | 2 +- .../src/main/java/lavalink/server/io/StatsTask.java | 2 +- .../src/main/java/lavalink/server/io/WSCodes.java | 2 +- .../src/main/java/lavalink/server/player/AudioLoader.java | 2 +- .../java/lavalink/server/player/AudioLoaderRestHandler.java | 2 +- .../main/java/lavalink/server/player/AudioLossCounter.java | 2 +- .../src/main/java/lavalink/server/player/EventEmitter.java | 2 +- .../src/main/java/lavalink/server/player/Player.java | 2 +- .../java/lavalink/server/player/TrackEndMarkerHandler.java | 2 +- .../java/lavalink/server/util/ResetableCountDownLatch.java | 2 +- LavalinkServer/src/main/java/lavalink/server/util/Util.java | 2 +- README.md | 4 ++-- Testbot/readme.md | 2 +- 19 files changed, 23 insertions(+), 23 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6088ad786..30955cc6c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -146,9 +146,9 @@ server and port. Port is specified by `server.port`. **Please note**: Java 10 will be obsolete as of [September 2018 with the release of Java 11](http://www.java-countdown.xyz/). Expect a Lavalink major version release that will be targetting Java 11 by that time. -* **Breaking:** Changes to the output of the /loadtracks endpoint. [\#91](https://github.com/freyacodes/Lavalink/pull/91), [\#114](https://github.com/Frederikam/Lavalink/pull/114), [\#116](https://github.com/freyacodes/Lavalink/pull/116) -* **Breaking:** The Java client has been moved to a [new repository](https://github.com/FredBoat/Lavalink-Client). -* **Breaking:** The Java client has been made generic. This is a breaking change so please read the [migration guide](https://github.com/FredBoat/Lavalink-Client#migrating-from-v2-to-v3). +* **Breaking:** Changes to the output of the /loadtracks endpoint. [\#91](https://github.com/freyacodes/Lavalink/pull/91), [\#114](https://github.com/freyacodes/Lavalink/pull/114), [\#116](https://github.com/freyacodes/Lavalink/pull/116) +* **Breaking:** The Java client has been moved to a [new repository](https://github.com/freyacodes/Lavalink-Client). +* **Breaking:** The Java client has been made generic. This is a breaking change so please read the [migration guide](https://github.com/freyacodes/Lavalink-Client#migrating-from-v2-to-v3). * Better configurable logging. [\#97](https://github.com/freyacodes/Lavalink/pull/97) * Add custom sentry tags, change sentry dsn configuration location. [\#103](https://github.com/freyacodes/Lavalink/pull/103) * Add Lavalink version header to websocket handshake. [\#111](https://github.com/freyacodes/Lavalink/pull/111) diff --git a/IMPLEMENTATION.md b/IMPLEMENTATION.md index b3a897f85..b9701c665 100644 --- a/IMPLEMENTATION.md +++ b/IMPLEMENTATION.md @@ -1,5 +1,5 @@ # Implementation guidelines -How to write your own client. The Java [Lavalink-Client](https://github.com/FredBoat/Lavalink-Client) will serve as an example implementation. +How to write your own client. The Java [Lavalink-Client](https://github.com/freyacodes/lavalink-client) will serve as an example implementation. The Java client has support for JDA, but can also be adapted to work with other JVM libraries. ## Requirements @@ -228,7 +228,7 @@ and you can send the same VOICE_SERVER_UPDATE to a new node. ### Incoming messages -See [LavalinkSocket.java](https://github.com/FredBoat/Lavalink-Client/blob/master/src/main/java/lavalink/client/io/LavalinkSocket.java) for client implementation +See [LavalinkSocket.java](https://github.com/freyacodes/lavalink-client/blob/master/src/main/java/lavalink/client/io/LavalinkSocket.java) for client implementation This event includes: * Unix timestamp in milliseconds. diff --git a/LICENSE b/LICENSE index 45c84dd28..1faac87d0 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2017 Frederik Ar. Mikkelsen +Copyright (c) 2017 Freya Arbjerg and contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/LavalinkServer/src/main/java/lavalink/server/Launcher.kt b/LavalinkServer/src/main/java/lavalink/server/Launcher.kt index 491c61fb9..dc6e6f3e7 100644 --- a/LavalinkServer/src/main/java/lavalink/server/Launcher.kt +++ b/LavalinkServer/src/main/java/lavalink/server/Launcher.kt @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Frederik Ar. Mikkelsen & NoobLance + * Copyright (c) 2021 Freya Arbjerg and contributors * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/LavalinkServer/src/main/java/lavalink/server/config/ServerConfig.kt b/LavalinkServer/src/main/java/lavalink/server/config/ServerConfig.kt index fcc518abf..d883490e6 100644 --- a/LavalinkServer/src/main/java/lavalink/server/config/ServerConfig.kt +++ b/LavalinkServer/src/main/java/lavalink/server/config/ServerConfig.kt @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Frederik Ar. Mikkelsen & NoobLance + * Copyright (c) 2021 Freya Arbjerg and contributors * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/LavalinkServer/src/main/java/lavalink/server/io/SocketContext.kt b/LavalinkServer/src/main/java/lavalink/server/io/SocketContext.kt index 0fb92767e..c20e94b74 100644 --- a/LavalinkServer/src/main/java/lavalink/server/io/SocketContext.kt +++ b/LavalinkServer/src/main/java/lavalink/server/io/SocketContext.kt @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Frederik Ar. Mikkelsen & NoobLance + * Copyright (c) 2021 Freya Arbjerg and contributors * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/LavalinkServer/src/main/java/lavalink/server/io/SocketServer.kt b/LavalinkServer/src/main/java/lavalink/server/io/SocketServer.kt index 42f8e75b1..14285c979 100644 --- a/LavalinkServer/src/main/java/lavalink/server/io/SocketServer.kt +++ b/LavalinkServer/src/main/java/lavalink/server/io/SocketServer.kt @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Frederik Ar. Mikkelsen & NoobLance + * Copyright (c) 2021 Freya Arbjerg and contributors * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/LavalinkServer/src/main/java/lavalink/server/io/StatsTask.java b/LavalinkServer/src/main/java/lavalink/server/io/StatsTask.java index 77ac0715b..30c199d2b 100644 --- a/LavalinkServer/src/main/java/lavalink/server/io/StatsTask.java +++ b/LavalinkServer/src/main/java/lavalink/server/io/StatsTask.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Frederik Ar. Mikkelsen & NoobLance + * Copyright (c) 2021 Freya Arbjerg and contributors * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/LavalinkServer/src/main/java/lavalink/server/io/WSCodes.java b/LavalinkServer/src/main/java/lavalink/server/io/WSCodes.java index 65ae51d2a..a7cf5e18c 100644 --- a/LavalinkServer/src/main/java/lavalink/server/io/WSCodes.java +++ b/LavalinkServer/src/main/java/lavalink/server/io/WSCodes.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Frederik Ar. Mikkelsen & NoobLance + * Copyright (c) 2021 Freya Arbjerg and contributors * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/LavalinkServer/src/main/java/lavalink/server/player/AudioLoader.java b/LavalinkServer/src/main/java/lavalink/server/player/AudioLoader.java index 8e17307ef..a32276633 100644 --- a/LavalinkServer/src/main/java/lavalink/server/player/AudioLoader.java +++ b/LavalinkServer/src/main/java/lavalink/server/player/AudioLoader.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Frederik Ar. Mikkelsen & NoobLance + * Copyright (c) 2021 Freya Arbjerg and contributors * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/LavalinkServer/src/main/java/lavalink/server/player/AudioLoaderRestHandler.java b/LavalinkServer/src/main/java/lavalink/server/player/AudioLoaderRestHandler.java index de120f96c..f58d0f5e4 100644 --- a/LavalinkServer/src/main/java/lavalink/server/player/AudioLoaderRestHandler.java +++ b/LavalinkServer/src/main/java/lavalink/server/player/AudioLoaderRestHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Frederik Ar. Mikkelsen & NoobLance + * Copyright (c) 2021 Freya Arbjerg and contributors * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/LavalinkServer/src/main/java/lavalink/server/player/AudioLossCounter.java b/LavalinkServer/src/main/java/lavalink/server/player/AudioLossCounter.java index 70c5d9944..a2904e9d1 100644 --- a/LavalinkServer/src/main/java/lavalink/server/player/AudioLossCounter.java +++ b/LavalinkServer/src/main/java/lavalink/server/player/AudioLossCounter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Frederik Ar. Mikkelsen & NoobLance + * Copyright (c) 2021 Freya Arbjerg and contributors * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/LavalinkServer/src/main/java/lavalink/server/player/EventEmitter.java b/LavalinkServer/src/main/java/lavalink/server/player/EventEmitter.java index 941f875f6..b27871540 100644 --- a/LavalinkServer/src/main/java/lavalink/server/player/EventEmitter.java +++ b/LavalinkServer/src/main/java/lavalink/server/player/EventEmitter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Frederik Ar. Mikkelsen & NoobLance + * Copyright (c) 2021 Freya Arbjerg and contributors * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/LavalinkServer/src/main/java/lavalink/server/player/Player.java b/LavalinkServer/src/main/java/lavalink/server/player/Player.java index 98686b10a..8bbae55af 100644 --- a/LavalinkServer/src/main/java/lavalink/server/player/Player.java +++ b/LavalinkServer/src/main/java/lavalink/server/player/Player.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Frederik Ar. Mikkelsen & NoobLance + * Copyright (c) 2021 Freya Arbjerg and contributors * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/LavalinkServer/src/main/java/lavalink/server/player/TrackEndMarkerHandler.java b/LavalinkServer/src/main/java/lavalink/server/player/TrackEndMarkerHandler.java index d738a4346..0c6525138 100644 --- a/LavalinkServer/src/main/java/lavalink/server/player/TrackEndMarkerHandler.java +++ b/LavalinkServer/src/main/java/lavalink/server/player/TrackEndMarkerHandler.java @@ -1,6 +1,6 @@ package lavalink.server.player; /* - * Copyright (c) 2017 Frederik Ar. Mikkelsen & NoobLance + * Copyright (c) 2021 Freya Arbjerg and contributors * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/LavalinkServer/src/main/java/lavalink/server/util/ResetableCountDownLatch.java b/LavalinkServer/src/main/java/lavalink/server/util/ResetableCountDownLatch.java index ee24aeaa4..3fa3ae2b5 100644 --- a/LavalinkServer/src/main/java/lavalink/server/util/ResetableCountDownLatch.java +++ b/LavalinkServer/src/main/java/lavalink/server/util/ResetableCountDownLatch.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Frederik Ar. Mikkelsen & NoobLance + * Copyright (c) 2021 Freya Arbjerg and contributors * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/LavalinkServer/src/main/java/lavalink/server/util/Util.java b/LavalinkServer/src/main/java/lavalink/server/util/Util.java index 4e5e60007..c0b2b9b2c 100644 --- a/LavalinkServer/src/main/java/lavalink/server/util/Util.java +++ b/LavalinkServer/src/main/java/lavalink/server/util/Util.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Frederik Ar. Mikkelsen & NoobLance + * Copyright (c) 2021 Freya Arbjerg and contributors * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index ae561c832..7bd34df24 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,7 @@ users about the compatibility of their clients to the Lavalink server. ## Client libraries: -* [Lavalink-Client](https://github.com/FredBoat/Lavalink-Client) (JDA or generic, Java) +* [Lavalink-Client](https://github.com/freyacodes/lavalink-client) (JDA or generic, Java) * [LavaClient](https://github.com/SamOphis/LavaClient) (Java) * [Lavalink.py](https://github.com/Devoxin/Lavalink.py) (discord.py, Python) * [pylava](https://github.com/Pandentia/pylava) (discord.py, Python) @@ -93,7 +93,7 @@ users about the compatibility of their clients to the Lavalink server. * [lavapotion](https://github.com/SamOphis/lavapotion) (Elixir) * [WaveLink](https://github.com/EvieePy/Wavelink) (discord.py, Python) * [Lavalink-rs](https://gitlab.com/nitsuga5124/lavalink-rs/) (Async Libraries, Rust) -* Or [create your own](https://github.com/Frederikam/Lavalink/blob/master/IMPLEMENTATION.md) +* Or [create your own](https://github.com/freyacodes/Lavalink/blob/master/IMPLEMENTATION.md) ## Server configuration Download binaries from [the CI server](https://ci.fredboat.com/viewLog.html?buildId=lastSuccessful&buildTypeId=Lavalink_Build&tab=artifacts&guest=1) or [the GitHub releases](https://github.com/freyacodes/Lavalink/releases). diff --git a/Testbot/readme.md b/Testbot/readme.md index 96212c143..ad87488b5 100644 --- a/Testbot/readme.md +++ b/Testbot/readme.md @@ -1,7 +1,7 @@ # Lavalink Testbot This is a minimalistic example of a bot using Lavalink. This example is based upon Lavalink-Client for Java. -https://github.com/FredBoat/Lavalink-Client +https://github.com/freyacodes/lavalink-client This uses Lavaplayer to load tracks rather than initially loading tracks via Lavalink. Non-JVM (Java) bots will need to query the `/loadtracks` endpoint. From 8155ac232bc86b1f20aed902d262270369ab3afd Mon Sep 17 00:00:00 2001 From: Freya Arbjerg Date: Sun, 18 Apr 2021 09:22:11 +0200 Subject: [PATCH 47/68] Update year --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index 1faac87d0..506d8d130 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2017 Freya Arbjerg and contributors +Copyright (c) 2021 Freya Arbjerg and contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From 626c2186641d249e472a1070bdc61a99c077e6ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?To=CF=80Senpai?= <15636011+TopiSenpai@users.noreply.github.com> Date: Sun, 18 Apr 2021 17:21:14 +0200 Subject: [PATCH 48/68] added source name to trackToJSON --- .../java/lavalink/server/player/AudioLoaderRestHandler.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/LavalinkServer/src/main/java/lavalink/server/player/AudioLoaderRestHandler.java b/LavalinkServer/src/main/java/lavalink/server/player/AudioLoaderRestHandler.java index f58d0f5e4..14aa32500 100644 --- a/LavalinkServer/src/main/java/lavalink/server/player/AudioLoaderRestHandler.java +++ b/LavalinkServer/src/main/java/lavalink/server/player/AudioLoaderRestHandler.java @@ -72,7 +72,8 @@ private JSONObject trackToJSON(AudioTrack audioTrack) { .put("uri", trackInfo.uri) .put("isStream", trackInfo.isStream) .put("isSeekable", audioTrack.isSeekable()) - .put("position", audioTrack.getPosition()); + .put("position", audioTrack.getPosition()) + .put("sourceName", audioTrack.getSourceManager() == null ? null : audioTrack.getSourceManager().getSourceName()); } private JSONObject encodeLoadResult(LoadResult result) { From fddac16ff1988ec7e96c8a2773d3f1954dac849f Mon Sep 17 00:00:00 2001 From: TopiSenpai Date: Sun, 18 Apr 2021 18:44:58 +0200 Subject: [PATCH 49/68] added sourceName to docu --- IMPLEMENTATION.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/IMPLEMENTATION.md b/IMPLEMENTATION.md index b9701c665..25b3c739a 100644 --- a/IMPLEMENTATION.md +++ b/IMPLEMENTATION.md @@ -382,7 +382,8 @@ Response: "isStream": false, "position": 0, "title": "Rick Astley - Never Gonna Give You Up", - "uri": "https://www.youtube.com/watch?v=dQw4w9WgXcQ" + "uri": "https://www.youtube.com/watch?v=dQw4w9WgXcQ", + "sourceName": "youtube" } } ] From 418c12055405bc230d07a05638ce69c6c7ad6dc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?To=CF=80Senpai?= <15636011+TopiSenpai@users.noreply.github.com> Date: Sun, 18 Apr 2021 18:35:42 +0200 Subject: [PATCH 50/68] Docu for /decodetrack & /decodetracks (#477) * added /decodetrack & /decodetracks * Update IMPLEMENTATION.md * fixed code blocks * fixed http method Co-authored-by: Freya Arbjerg * fixed wording Co-authored-by: Freya Arbjerg Co-authored-by: Freya Arbjerg --- IMPLEMENTATION.md | 60 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/IMPLEMENTATION.md b/IMPLEMENTATION.md index 25b3c739a..a046683ce 100644 --- a/IMPLEMENTATION.md +++ b/IMPLEMENTATION.md @@ -427,6 +427,66 @@ A severity level of `COMMON` indicates that the error is non-fatal and that the } ``` +### Track Decoding API + +Decode a single track into its info +``` +GET /decodetrack?track=QAAAjQIAJVJpY2sgQXN0bGV5IC0gTmV2ZXIgR29ubmEgR2l2ZSBZb3UgVXAADlJpY2tBc3RsZXlWRVZPAAAAAAADPCAAC2RRdzR3OVdnWGNRAAEAK2h0dHBzOi8vd3d3LnlvdXR1YmUuY29tL3dhdGNoP3Y9ZFF3NHc5V2dYY1EAB3lvdXR1YmUAAAAAAAAAAA== HTTP/1.1 +Host: localhost:8080 +Authorization: youshallnotpass +``` + +Response: +```json +{ + "track": "QAAAjQIAJVJpY2sgQXN0bGV5IC0gTmV2ZXIgR29ubmEgR2l2ZSBZb3UgVXAADlJpY2tBc3RsZXlWRVZPAAAAAAADPCAAC2RRdzR3OVdnWGNRAAEAK2h0dHBzOi8vd3d3LnlvdXR1YmUuY29tL3dhdGNoP3Y9ZFF3NHc5V2dYY1EAB3lvdXR1YmUAAAAAAAAAAA==", + "info": { + "identifier": "dQw4w9WgXcQ", + "isSeekable": true, + "author": "RickAstleyVEVO", + "length": 212000, + "isStream": false, + "position": 0, + "title": "Rick Astley - Never Gonna Give You Up", + "uri": "https://www.youtube.com/watch?v=dQw4w9WgXcQ" + } +} +``` + +Decode multiple tracks into info their info +``` +POST /decodetracks HTTP/1.1 +Host: localhost:8080 +Authorization: youshallnotpass +``` + +Request: +```json +[ + "QAAAjQIAJVJpY2sgQXN0bGV5IC0gTmV2ZXIgR29ubmEgR2l2ZSBZb3UgVXAADlJpY2tBc3RsZXlWRVZPAAAAAAADPCAAC2RRdzR3OVdnWGNRAAEAK2h0dHBzOi8vd3d3LnlvdXR1YmUuY29tL3dhdGNoP3Y9ZFF3NHc5V2dYY1EAB3lvdXR1YmUAAAAAAAAAAA==", + ... +] +``` + +Response: +```json +[ + { + "track": "QAAAjQIAJVJpY2sgQXN0bGV5IC0gTmV2ZXIgR29ubmEgR2l2ZSBZb3UgVXAADlJpY2tBc3RsZXlWRVZPAAAAAAADPCAAC2RRdzR3OVdnWGNRAAEAK2h0dHBzOi8vd3d3LnlvdXR1YmUuY29tL3dhdGNoP3Y9ZFF3NHc5V2dYY1EAB3lvdXR1YmUAAAAAAAAAAA==", + "info": { + "identifier": "dQw4w9WgXcQ", + "isSeekable": true, + "author": "RickAstleyVEVO", + "length": 212000, + "isStream": false, + "position": 0, + "title": "Rick Astley - Never Gonna Give You Up", + "uri": "https://www.youtube.com/watch?v=dQw4w9WgXcQ" + } + }, + ... +] +``` --- ### RoutePlanner API From 6ea9ea84dfe2ab0de6028b310c894ed833ba3e3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?To=CF=80Senpai?= <15636011+TopiSenpai@users.noreply.github.com> Date: Tue, 20 Apr 2021 00:01:58 +0200 Subject: [PATCH 51/68] Update IMPLEMENTATION.md --- IMPLEMENTATION.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/IMPLEMENTATION.md b/IMPLEMENTATION.md index a046683ce..e5c0fb6e3 100644 --- a/IMPLEMENTATION.md +++ b/IMPLEMENTATION.md @@ -448,7 +448,8 @@ Response: "isStream": false, "position": 0, "title": "Rick Astley - Never Gonna Give You Up", - "uri": "https://www.youtube.com/watch?v=dQw4w9WgXcQ" + "uri": "https://www.youtube.com/watch?v=dQw4w9WgXcQ", + "sourceName": "youtube" } } ``` @@ -481,7 +482,8 @@ Response: "isStream": false, "position": 0, "title": "Rick Astley - Never Gonna Give You Up", - "uri": "https://www.youtube.com/watch?v=dQw4w9WgXcQ" + "uri": "https://www.youtube.com/watch?v=dQw4w9WgXcQ", + "sourceName": "youtube" } }, ... From 73c4c4d423693c74cd489bc3c8b45520ebfbe3de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?To=CF=80Senpai?= <15636011+TopiSenpai@users.noreply.github.com> Date: Tue, 20 Apr 2021 09:02:46 +0200 Subject: [PATCH 52/68] fix for decodetrack response in docu (#480) # Conflicts: # IMPLEMENTATION.md --- IMPLEMENTATION.md | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/IMPLEMENTATION.md b/IMPLEMENTATION.md index e5c0fb6e3..916e440a1 100644 --- a/IMPLEMENTATION.md +++ b/IMPLEMENTATION.md @@ -439,18 +439,15 @@ Authorization: youshallnotpass Response: ```json { - "track": "QAAAjQIAJVJpY2sgQXN0bGV5IC0gTmV2ZXIgR29ubmEgR2l2ZSBZb3UgVXAADlJpY2tBc3RsZXlWRVZPAAAAAAADPCAAC2RRdzR3OVdnWGNRAAEAK2h0dHBzOi8vd3d3LnlvdXR1YmUuY29tL3dhdGNoP3Y9ZFF3NHc5V2dYY1EAB3lvdXR1YmUAAAAAAAAAAA==", - "info": { - "identifier": "dQw4w9WgXcQ", - "isSeekable": true, - "author": "RickAstleyVEVO", - "length": 212000, - "isStream": false, - "position": 0, - "title": "Rick Astley - Never Gonna Give You Up", - "uri": "https://www.youtube.com/watch?v=dQw4w9WgXcQ", - "sourceName": "youtube" - } + "identifier": "dQw4w9WgXcQ", + "isSeekable": true, + "author": "RickAstleyVEVO", + "length": 212000, + "isStream": false, + "position": 0, + "title": "Rick Astley - Never Gonna Give You Up", + "uri": "https://www.youtube.com/watch?v=dQw4w9WgXcQ", + "sourceName": "youtube" } ``` From 38a456b5a29b1c640a4ab70a4b995d8c504ea066 Mon Sep 17 00:00:00 2001 From: TopiSenpai Date: Wed, 12 May 2021 13:18:49 +0200 Subject: [PATCH 53/68] add channelmix filter --- .../server/player/filters/FilterChain.kt | 4 +++- .../server/player/filters/filterConfigs.kt | 19 +++++++++++++++++++ build.gradle | 5 ++++- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/LavalinkServer/src/main/java/lavalink/server/player/filters/FilterChain.kt b/LavalinkServer/src/main/java/lavalink/server/player/filters/FilterChain.kt index 8fcf75acf..d026f17ed 100644 --- a/LavalinkServer/src/main/java/lavalink/server/player/filters/FilterChain.kt +++ b/LavalinkServer/src/main/java/lavalink/server/player/filters/FilterChain.kt @@ -23,6 +23,7 @@ class FilterChain : PcmFilterFactory { private val vibrato: VibratoConfig? = null private val distortion: DistortionConfig? = null private val rotation: RotationConfig? = null + private val channelMix: ChannelMixConfig? = null private fun buildList() = listOfNotNull( volume?.let { VolumeConfig(it) }, @@ -32,7 +33,8 @@ class FilterChain : PcmFilterFactory { tremolo, vibrato, distortion, - rotation + rotation, + channelMix ) val isEnabled get() = buildList().any { it.isEnabled } diff --git a/LavalinkServer/src/main/java/lavalink/server/player/filters/filterConfigs.kt b/LavalinkServer/src/main/java/lavalink/server/player/filters/filterConfigs.kt index 789dd1219..f52714e90 100644 --- a/LavalinkServer/src/main/java/lavalink/server/player/filters/filterConfigs.kt +++ b/LavalinkServer/src/main/java/lavalink/server/player/filters/filterConfigs.kt @@ -1,5 +1,6 @@ package lavalink.server.player.filters +import com.github.natanbc.lavadsp.channelmix.ChannelMixPcmAudioFilter import com.github.natanbc.lavadsp.karaoke.KaraokePcmAudioFilter import com.github.natanbc.lavadsp.timescale.TimescalePcmAudioFilter import com.github.natanbc.lavadsp.tremolo.TremoloPcmAudioFilter @@ -136,6 +137,24 @@ class RotationConfig( override val isEnabled: Boolean get() = rotationHz != 0.0 } +class ChannelMixConfig( + private val leftToLeft: Float = 1f, + private val leftToRight: Float = 0f, + private val rightToLeft: Float = 0f, + private val rightToRight: Float = 1f + +) : FilterConfig() { + override fun build(format: AudioDataFormat, output: FloatPcmAudioFilter): FloatPcmAudioFilter { + return ChannelMixPcmAudioFilter(output) + .setLeftToLeft(leftToLeft) + .setLeftToRight(leftToRight) + .setRightToLeft(rightToLeft) + .setRightToRight(rightToRight) + } + + override val isEnabled: Boolean get() = leftToLeft != 1f || leftToRight != 0f || rightToLeft != 0f || rightToRight != 1f +} + abstract class FilterConfig { abstract fun build(format: AudioDataFormat, output: FloatPcmAudioFilter): FloatPcmAudioFilter abstract val isEnabled: Boolean diff --git a/build.gradle b/build.gradle index 2197bf95d..cc387bfbb 100644 --- a/build.gradle +++ b/build.gradle @@ -25,11 +25,14 @@ buildscript { allprojects { repositories { + maven { + name 'm2-dv8tion' + url 'https://m2.dv8tion.net/releases' + } mavenCentral() // main maven repo jcenter() // JDA and some other stuff mavenLocal() // useful for developing maven { url "https://jitpack.io" } // build projects directly from github - maven { url 'https://dl.bintray.com/sedmelluq/com.sedmelluq' } } group = 'lavalink' From edd838f9e7870849ac35357064f05d458458f19b Mon Sep 17 00:00:00 2001 From: TopiSenpai Date: Wed, 12 May 2021 20:04:16 +0200 Subject: [PATCH 54/68] add LowPass filter and documentation --- IMPLEMENTATION.md | 18 ++++++++++++++++-- .../server/player/filters/FilterChain.kt | 4 +++- .../server/player/filters/filterConfigs.kt | 12 ++++++++++++ 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/IMPLEMENTATION.md b/IMPLEMENTATION.md index 916e440a1..5d8384546 100644 --- a/IMPLEMENTATION.md +++ b/IMPLEMENTATION.md @@ -192,11 +192,13 @@ Note that filters may take a moment to apply. "frequency": 2.0, // 0 < x ≤ 14 "depth": 0.5 // 0 < x ≤ 1 }, + // Rotates the sound around the stereo channels/user headphones aka Audio Panning. It can produce an effect similar to: https://youtu.be/QB9EB8mTKcc (without the reverb) "rotation": { "rotationHz": 0 // The frequency of the audio rotating around the listener in Hz. 0.2 is similar to the example video above. }, - //Distortion effect. It can generate some pretty unique audio effects. + + // Distortion effect. It can generate some pretty unique audio effects. "distortion": { "sinOffset": 0, "sinScale": 1, @@ -207,9 +209,21 @@ Note that filters may take a moment to apply. "offset": 0, "scale": 1 } + + // Mixes both channels (left and right), with a configurable factor on how much each channel affects the other. + // With the defaults, both channels are kept independent from each other. + // Setting all factors to 0.5 means both channels get the same audio. + "channelMix": { + "leftToLeft": 1.0, + "leftToRight": 0.0, + "rightToLeft": 0.0, + "rightToRight": 1.0, } - + // Higher frequencies get suppressed, while lower frequencies pass through this filter, thus the name low pass. + "lowPass": { + "smoothing": 20.0 + } } ``` diff --git a/LavalinkServer/src/main/java/lavalink/server/player/filters/FilterChain.kt b/LavalinkServer/src/main/java/lavalink/server/player/filters/FilterChain.kt index d026f17ed..7609236fb 100644 --- a/LavalinkServer/src/main/java/lavalink/server/player/filters/FilterChain.kt +++ b/LavalinkServer/src/main/java/lavalink/server/player/filters/FilterChain.kt @@ -24,6 +24,7 @@ class FilterChain : PcmFilterFactory { private val distortion: DistortionConfig? = null private val rotation: RotationConfig? = null private val channelMix: ChannelMixConfig? = null + private val lowPass: LowPassConfig? = null private fun buildList() = listOfNotNull( volume?.let { VolumeConfig(it) }, @@ -34,7 +35,8 @@ class FilterChain : PcmFilterFactory { vibrato, distortion, rotation, - channelMix + channelMix, + lowPass ) val isEnabled get() = buildList().any { it.isEnabled } diff --git a/LavalinkServer/src/main/java/lavalink/server/player/filters/filterConfigs.kt b/LavalinkServer/src/main/java/lavalink/server/player/filters/filterConfigs.kt index f52714e90..3269039dd 100644 --- a/LavalinkServer/src/main/java/lavalink/server/player/filters/filterConfigs.kt +++ b/LavalinkServer/src/main/java/lavalink/server/player/filters/filterConfigs.kt @@ -6,6 +6,7 @@ import com.github.natanbc.lavadsp.timescale.TimescalePcmAudioFilter import com.github.natanbc.lavadsp.tremolo.TremoloPcmAudioFilter import com.github.natanbc.lavadsp.vibrato.VibratoPcmAudioFilter import com.github.natanbc.lavadsp.distortion.DistortionPcmAudioFilter +import com.github.natanbc.lavadsp.lowpass.LowPassPcmAudioFilter import com.github.natanbc.lavadsp.rotation.RotationPcmAudioFilter import com.github.natanbc.lavadsp.volume.VolumePcmAudioFilter import com.sedmelluq.discord.lavaplayer.filter.AudioFilter @@ -155,6 +156,17 @@ class ChannelMixConfig( override val isEnabled: Boolean get() = leftToLeft != 1f || leftToRight != 0f || rightToLeft != 0f || rightToRight != 1f } +class LowPassConfig( + private val smoothing: Float = 20.0f +) : FilterConfig() { + override fun build(format: AudioDataFormat, output: FloatPcmAudioFilter): FloatPcmAudioFilter { + return LowPassPcmAudioFilter(output, format.sampleRate) + .setSmoothing(smoothing) + } + + override val isEnabled: Boolean get() = smoothing != 20.0f +} + abstract class FilterConfig { abstract fun build(format: AudioDataFormat, output: FloatPcmAudioFilter): FloatPcmAudioFilter abstract val isEnabled: Boolean From 744a003d2136fdafd74b204df757837b241a41c0 Mon Sep 17 00:00:00 2001 From: TopiSenpai Date: Wed, 12 May 2021 20:07:11 +0200 Subject: [PATCH 55/68] short syntax for repo --- build.gradle | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index cc387bfbb..5a3028b37 100644 --- a/build.gradle +++ b/build.gradle @@ -25,10 +25,7 @@ buildscript { allprojects { repositories { - maven { - name 'm2-dv8tion' - url 'https://m2.dv8tion.net/releases' - } + maven { url 'https://m2.dv8tion.net/releases' } mavenCentral() // main maven repo jcenter() // JDA and some other stuff mavenLocal() // useful for developing From 25be085a044599097c555c90ad7e9be95e833b81 Mon Sep 17 00:00:00 2001 From: Muhimur <52611945+muhimur9049@users.noreply.github.com> Date: Wed, 26 May 2021 08:28:50 -0400 Subject: [PATCH 56/68] lavaDsp bump (#484) --- build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 2197bf95d..c87d1acb0 100644 --- a/build.gradle +++ b/build.gradle @@ -29,7 +29,7 @@ allprojects { jcenter() // JDA and some other stuff mavenLocal() // useful for developing maven { url "https://jitpack.io" } // build projects directly from github - maven { url 'https://dl.bintray.com/sedmelluq/com.sedmelluq' } + maven { url 'https://m2.dv8tion.net/releases' } } group = 'lavalink' @@ -59,7 +59,7 @@ subprojects { jdaNasVersion = '1.1.0' jappVersion = '1.3.2-MINN' koeVersion = '1.0.1' - lavaDspVersion = '0.7.6' + lavaDspVersion = '0.7.7' springBootVersion = "${springBootVersion}" springWebSocketVersion = '5.1.9.RELEASE' From 8125918d30a26e2739cefe8a7ce4b88ccb656d1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?To=CF=80Senpai?= <15636011+TopiSenpai@users.noreply.github.com> Date: Wed, 26 May 2021 14:29:08 +0200 Subject: [PATCH 57/68] bump lp (#487) --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index c87d1acb0..70f5035fd 100644 --- a/build.gradle +++ b/build.gradle @@ -54,7 +54,7 @@ subprojects { ext { //@formatter:off - lavaplayerVersion = '1.3.76' + lavaplayerVersion = '1.3.77' lavaplayerIpRotatorVersion = '0.2.3' jdaNasVersion = '1.1.0' jappVersion = '1.3.2-MINN' From e20aebf656c625c0f09c48f08d6952be440aae71 Mon Sep 17 00:00:00 2001 From: Stonedestroyer <1307729+Stonedestroyer@users.noreply.github.com> Date: Mon, 31 May 2021 23:05:29 +0200 Subject: [PATCH 58/68] OSHI bump (#492) * Do some stuff * Fix logic * Rename * Comments * Update LavalinkServer/src/main/java/lavalink/server/io/StatsTask.java Co-authored-by: Freya Arbjerg Co-authored-by: Freya Arbjerg --- .../main/java/lavalink/server/io/StatsTask.java | 15 +++++++++++---- build.gradle | 2 +- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/LavalinkServer/src/main/java/lavalink/server/io/StatsTask.java b/LavalinkServer/src/main/java/lavalink/server/io/StatsTask.java index 30c199d2b..8ea419f87 100644 --- a/LavalinkServer/src/main/java/lavalink/server/io/StatsTask.java +++ b/LavalinkServer/src/main/java/lavalink/server/io/StatsTask.java @@ -41,6 +41,9 @@ public class StatsTask implements Runnable { private final SocketServer socketServer; private final SystemInfo si = new SystemInfo(); + private final HardwareAbstractionLayer hal = si.getHardware(); + /** CPU ticks used for calculations in CPU load. */ + private long[] prevTicks; StatsTask(SocketContext context, SocketServer socketServer) { this.context = context; @@ -82,13 +85,17 @@ private void sendStats() { mem.put("reservable", Runtime.getRuntime().maxMemory()); out.put("memory", mem); - HardwareAbstractionLayer hal = si.getHardware(); - - JSONObject cpu = new JSONObject(); cpu.put("cores", Runtime.getRuntime().availableProcessors()); - cpu.put("systemLoad", hal.getProcessor().getSystemCpuLoad()); + // prevTicks will be null so set it to a value. + if(prevTicks == null) { + prevTicks = hal.getProcessor().getSystemCpuLoadTicks(); + } + // Compare current CPU ticks with previous to establish a CPU load and return double. + cpu.put("systemLoad", hal.getProcessor().getSystemCpuLoadBetweenTicks(prevTicks)); + // Set new prevTicks to current value for more accurate baseline, and checks in next schedule. + prevTicks = hal.getProcessor().getSystemCpuLoadTicks(); double load = getProcessRecentCpuUsage(); if (!Double.isFinite(load)) load = 0; cpu.put("lavalinkLoad", load); diff --git a/build.gradle b/build.gradle index 70f5035fd..acce0c913 100644 --- a/build.gradle +++ b/build.gradle @@ -65,7 +65,7 @@ subprojects { springWebSocketVersion = '5.1.9.RELEASE' logbackVersion = '1.2.3' sentryLogbackVersion = '1.7.7' - oshiVersion = '3.13.3' + oshiVersion = '5.7.4' jsonOrgVersion = '20180813' spotbugsAnnotationsVersion = '3.1.6' prometheusVersion = '0.5.0' From 7ab68938bb85e09e38cbccc0d5e133276969686e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?To=CF=80Senpai?= <15636011+TopiSenpai@users.noreply.github.com> Date: Mon, 5 Jul 2021 19:36:41 +0200 Subject: [PATCH 59/68] bump lavaplayer (#499) --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index acce0c913..6db7bd7ba 100644 --- a/build.gradle +++ b/build.gradle @@ -54,7 +54,7 @@ subprojects { ext { //@formatter:off - lavaplayerVersion = '1.3.77' + lavaplayerVersion = '1.3.78' lavaplayerIpRotatorVersion = '0.2.3' jdaNasVersion = '1.1.0' jappVersion = '1.3.2-MINN' From 53765f00f1d7b594a8afa0173a02afc89b3ded17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?To=CF=80Senpai?= <15636011+TopiSenpai@users.noreply.github.com> Date: Thu, 9 Sep 2021 14:37:19 +0200 Subject: [PATCH 60/68] bump lavaplayer latest version of walkyst fork (#513) --- LavalinkServer/build.gradle | 7 +++++-- .../lavalink/server/config/AudioPlayerConfiguration.kt | 8 ++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/LavalinkServer/build.gradle b/LavalinkServer/build.gradle index 750dadf60..edaa15720 100644 --- a/LavalinkServer/build.gradle +++ b/LavalinkServer/build.gradle @@ -39,8 +39,11 @@ dependencies { exclude group: "org.slf4j", module: "slf4j-api" } compile group: 'moe.kyokobot.koe', name: 'ext-udpqueue', version: koeVersion - compile group: 'com.sedmelluq', name: 'lavaplayer', version: lavaplayerVersion - compile group: 'com.sedmelluq', name: 'lavaplayer-ext-youtube-rotator', version: lavaplayerIpRotatorVersion + compile group: 'com.github.Walkyst', name: 'lavaplayer-fork', version: '9ed7db57f4' + //compile group: 'com.sedmelluq', name: 'lavaplayer', version: lavaplayerVersion + compile(group: 'com.sedmelluq', name: 'lavaplayer-ext-youtube-rotator', version: lavaplayerIpRotatorVersion) { + exclude group: 'com.sedmelluq', module: 'lavaplayer' + } compile group: 'com.github.natanbc', name: 'lavadsp', version: lavaDspVersion compile group: 'org.jetbrains.kotlin', name: 'kotlin-reflect', version: kotlinVersion diff --git a/LavalinkServer/src/main/java/lavalink/server/config/AudioPlayerConfiguration.kt b/LavalinkServer/src/main/java/lavalink/server/config/AudioPlayerConfiguration.kt index eac422fcf..c5a59b639 100644 --- a/LavalinkServer/src/main/java/lavalink/server/config/AudioPlayerConfiguration.kt +++ b/LavalinkServer/src/main/java/lavalink/server/config/AudioPlayerConfiguration.kt @@ -8,7 +8,7 @@ import com.sedmelluq.discord.lavaplayer.source.http.HttpAudioSourceManager import com.sedmelluq.discord.lavaplayer.source.local.LocalAudioSourceManager import com.sedmelluq.discord.lavaplayer.source.soundcloud.DefaultSoundCloudDataReader import com.sedmelluq.discord.lavaplayer.source.soundcloud.DefaultSoundCloudFormatHandler -import com.sedmelluq.discord.lavaplayer.source.soundcloud.DefaultSoundCloudHtmlDataLoader +import com.sedmelluq.discord.lavaplayer.source.soundcloud.DefaultSoundCloudDataLoader import com.sedmelluq.discord.lavaplayer.source.soundcloud.DefaultSoundCloudPlaylistLoader import com.sedmelluq.discord.lavaplayer.source.soundcloud.SoundCloudAudioSourceManager import com.sedmelluq.discord.lavaplayer.source.twitch.TwitchStreamAudioSourceManager @@ -73,15 +73,15 @@ class AudioPlayerConfiguration { } if (sources.isSoundcloud) { val dataReader = DefaultSoundCloudDataReader(); - val htmlDataLoader = DefaultSoundCloudHtmlDataLoader(); + val dataLoader = DefaultSoundCloudDataLoader(); val formatHandler = DefaultSoundCloudFormatHandler(); audioPlayerManager.registerSourceManager(SoundCloudAudioSourceManager( serverConfig.isSoundcloudSearchEnabled, dataReader, - htmlDataLoader, + dataLoader, formatHandler, - DefaultSoundCloudPlaylistLoader(htmlDataLoader, dataReader, formatHandler) + DefaultSoundCloudPlaylistLoader(dataLoader, dataReader, formatHandler) )); } if (sources.isBandcamp) audioPlayerManager.registerSourceManager(BandcampAudioSourceManager()) From 6e925523293b81708ea1a577b16ff9f9c4167a49 Mon Sep 17 00:00:00 2001 From: Walkyst <41806921+Walkyst@users.noreply.github.com> Date: Thu, 9 Sep 2021 22:46:54 +0300 Subject: [PATCH 61/68] bump lavaplayer (#515) --- LavalinkServer/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LavalinkServer/build.gradle b/LavalinkServer/build.gradle index edaa15720..0864b0523 100644 --- a/LavalinkServer/build.gradle +++ b/LavalinkServer/build.gradle @@ -39,7 +39,7 @@ dependencies { exclude group: "org.slf4j", module: "slf4j-api" } compile group: 'moe.kyokobot.koe', name: 'ext-udpqueue', version: koeVersion - compile group: 'com.github.Walkyst', name: 'lavaplayer-fork', version: '9ed7db57f4' + compile group: 'com.github.Walkyst', name: 'lavaplayer-fork', version: '3a54cbd43b' //compile group: 'com.sedmelluq', name: 'lavaplayer', version: lavaplayerVersion compile(group: 'com.sedmelluq', name: 'lavaplayer-ext-youtube-rotator', version: lavaplayerIpRotatorVersion) { exclude group: 'com.sedmelluq', module: 'lavaplayer' From 8759d12f31f8e6b31f4c42eb7a379da68a7d3187 Mon Sep 17 00:00:00 2001 From: eniraa Date: Sun, 19 Sep 2021 06:17:16 -0400 Subject: [PATCH 62/68] Fix typo (#518) Corrected `Admidtedly` to `Admittedly`. --- IMPLEMENTATION.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IMPLEMENTATION.md b/IMPLEMENTATION.md index 5d8384546..0f9be7a60 100644 --- a/IMPLEMENTATION.md +++ b/IMPLEMENTATION.md @@ -649,7 +649,7 @@ queue is then emptied and the events are then replayed. ``` # Common pitfalls -Admidtedly Lavalink isn't inherently the most intuitive thing ever, and people tend to run into the same mistakes over again. Please double check the following if you run into problems developing your client and you can't connect to a voice channel or play audio: +Admittedly Lavalink isn't inherently the most intuitive thing ever, and people tend to run into the same mistakes over again. Please double check the following if you run into problems developing your client and you can't connect to a voice channel or play audio: 1. Check that you are forwarding sendWS events to **Discord**. 2. Check that you are intercepting **VOICE_SERVER_UPDATE**s to **Lavalink**. Do not edit the event object from Discord. From 8bcb043d2a9c6ac73ce7f0bbcd09ce955edc4193 Mon Sep 17 00:00:00 2001 From: iwa <19956672+iwa@users.noreply.github.com> Date: Sat, 25 Sep 2021 17:19:28 +0200 Subject: [PATCH 63/68] add missing erelajs in readme (#523) That's because the branches have not been merged with each other yet. Regardless, I'll include this as it doesn't conflict --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 7bd34df24..199055e7a 100644 --- a/README.md +++ b/README.md @@ -80,6 +80,7 @@ users about the compatibility of their clients to the Lavalink server. * [eris-lavalink](https://github.com/briantanner/eris-lavalink) ([eris](https://github.com/abalabahaha/eris), JavaScript) * [LavaClient](https://github.com/lavaclient/lavaclient) (JavaScript) * [Shoukaku](https://github.com/Deivu/Shoukaku) ([discord.js](https://github.com/discordjs/discord.js), JavaScript) +* [erela.js](https://github.com/MenuDocs/erela.js) (JavaScript) * [Lavacord](https://github.com/lavacord/lavacord) (JavaScript) * [LavaJS](https://github.com/Overleap/LavaJS) ([discord.js](https://github.com/discordjs/discord.js), JavaScript/TypeScript) * [EvoLava](https://github.com/EvolveJS/EvoLava) ([EvolveJS](https://github.com/EvolveJS/EvolveJS), Javascript/Typescript) From db6ae208c4616ae7659392751f83eebcdfd50668 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?To=CF=80Senpai?= <15636011+TopiSenpai@users.noreply.github.com> Date: Mon, 18 Oct 2021 09:59:10 +0200 Subject: [PATCH 64/68] bump lavaplayer version (#542) --- LavalinkServer/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LavalinkServer/build.gradle b/LavalinkServer/build.gradle index 0864b0523..74bcb7323 100644 --- a/LavalinkServer/build.gradle +++ b/LavalinkServer/build.gradle @@ -39,7 +39,7 @@ dependencies { exclude group: "org.slf4j", module: "slf4j-api" } compile group: 'moe.kyokobot.koe', name: 'ext-udpqueue', version: koeVersion - compile group: 'com.github.Walkyst', name: 'lavaplayer-fork', version: '3a54cbd43b' + compile group: 'com.github.Walkyst', name: 'lavaplayer-fork', version: '07f96f1' //compile group: 'com.sedmelluq', name: 'lavaplayer', version: lavaplayerVersion compile(group: 'com.sedmelluq', name: 'lavaplayer-ext-youtube-rotator', version: lavaplayerIpRotatorVersion) { exclude group: 'com.sedmelluq', module: 'lavaplayer' From 87dfa32092d97e2129725720aff2b6ff70dd2ea1 Mon Sep 17 00:00:00 2001 From: Rajat Mishra <85543339+hydrox19@users.noreply.github.com> Date: Mon, 18 Oct 2021 14:00:07 +0530 Subject: [PATCH 65/68] Update README.md (#540) Shouka isn't limited to discord.js anymore --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 199055e7a..fe313a74e 100644 --- a/README.md +++ b/README.md @@ -79,7 +79,7 @@ users about the compatibility of their clients to the Lavalink server. * [Gorilink](https://github.com/Gorillas-Team/Gorilink) (JavaScript) * [eris-lavalink](https://github.com/briantanner/eris-lavalink) ([eris](https://github.com/abalabahaha/eris), JavaScript) * [LavaClient](https://github.com/lavaclient/lavaclient) (JavaScript) -* [Shoukaku](https://github.com/Deivu/Shoukaku) ([discord.js](https://github.com/discordjs/discord.js), JavaScript) +* [Shoukaku](https://github.com/Deivu/Shoukaku) (JavaScript) * [erela.js](https://github.com/MenuDocs/erela.js) (JavaScript) * [Lavacord](https://github.com/lavacord/lavacord) (JavaScript) * [LavaJS](https://github.com/Overleap/LavaJS) ([discord.js](https://github.com/discordjs/discord.js), JavaScript/TypeScript) From 31d3c66ad2bf7be8a720750353d379d011804e28 Mon Sep 17 00:00:00 2001 From: Walkyst <41806921+Walkyst@users.noreply.github.com> Date: Sat, 23 Oct 2021 11:56:06 +0300 Subject: [PATCH 66/68] bump lavaplayer (#545) --- LavalinkServer/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LavalinkServer/build.gradle b/LavalinkServer/build.gradle index 74bcb7323..e30fba931 100644 --- a/LavalinkServer/build.gradle +++ b/LavalinkServer/build.gradle @@ -39,7 +39,7 @@ dependencies { exclude group: "org.slf4j", module: "slf4j-api" } compile group: 'moe.kyokobot.koe', name: 'ext-udpqueue', version: koeVersion - compile group: 'com.github.Walkyst', name: 'lavaplayer-fork', version: '07f96f1' + compile group: 'com.github.walkyst', name: 'lavaplayer-fork', version: '1.3.96' //compile group: 'com.sedmelluq', name: 'lavaplayer', version: lavaplayerVersion compile(group: 'com.sedmelluq', name: 'lavaplayer-ext-youtube-rotator', version: lavaplayerIpRotatorVersion) { exclude group: 'com.sedmelluq', module: 'lavaplayer' From 77d2ac03382f83944518896cd586078ec8a78a44 Mon Sep 17 00:00:00 2001 From: Freya Arbjerg Date: Tue, 26 Oct 2021 16:05:47 +0200 Subject: [PATCH 67/68] Remove merge conflict markings --- IMPLEMENTATION.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/IMPLEMENTATION.md b/IMPLEMENTATION.md index d9f62ae55..516ce3740 100644 --- a/IMPLEMENTATION.md +++ b/IMPLEMENTATION.md @@ -460,12 +460,8 @@ Response: "isStream": false, "position": 0, "title": "Rick Astley - Never Gonna Give You Up", -<<<<<<< HEAD "uri": "https://www.youtube.com/watch?v=dQw4w9WgXcQ", "sourceName": "youtube" -======= - "uri": "https://www.youtube.com/watch?v=dQw4w9WgXcQ" ->>>>>>> master } ``` From c46cd7256b5894ae8ecff90c1d3306679363eeb6 Mon Sep 17 00:00:00 2001 From: Freya Arbjerg Date: Tue, 26 Oct 2021 16:11:57 +0200 Subject: [PATCH 68/68] Add v3.4 changelog --- CHANGELOG.md | 16 ++++++++++++++++ IMPLEMENTATION.md | 2 ++ 2 files changed, 18 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bc0aa64ce..94acaf81f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,22 @@ Each release usually includes various fixes and improvements. The most noteworthy of these, as well as any features and breaking changes, are listed here. +## 3.4 +* New filters system +* Deprecation of `TrackExceptionEvent.error`, replaced by `TrackExceptionEvent.exception` +* Added the `connected` boolean to player updates. +* Updated lavaplayer, fixes Soundcloud +* Added source name to REST api track objects +* Clients are now requested to make their name known during handshake + +Contributors: +[@freyacodes](https://github.com/freyacodes), +[@duncte123](https://github.com/duncte123), +[@DaliborTrampota](https://github.com/DaliborTrampota), +[@Mandruyd](https://github.com/Mandruyd), +[@Allvaa](https://github.com/@Allvaa), and +[@TopiSenpai](https://github.com/TopiSenpai) + ## 3.3.2.5 * Update Lavaplayer to 1.3.76 diff --git a/IMPLEMENTATION.md b/IMPLEMENTATION.md index 516ce3740..57a9a5eab 100644 --- a/IMPLEMENTATION.md +++ b/IMPLEMENTATION.md @@ -11,6 +11,8 @@ The Java client has support for JDA, but can also be adapted to work with other * The `error` string on the `TrackExceptionEvent` has been deprecated and replaced by the `exception` object following the same structure as the `LOAD_FAILED` error on [`/loadtracks`](#rest-api) * Added the `connected` boolean to player updates. +* Added source name to REST api track objects +* Clients are now requested to make their name known during handshake ## Significant changes v2.0 -> v3.0 * The response of `/loadtracks` has been completely changed (again since the initial v3.0 pre-release).