diff --git a/build.gradle b/build.gradle index 391fe96a..779f7980 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ plugins { id 'com.palantir.docker' version '0.22.1' } -def versionObj = new Version(major: 0, minor: 18, revision: 6) +def versionObj = new Version(major: 0, minor: 18, revision: 7) sourceCompatibility = 11 targetCompatibility = 11 @@ -20,10 +20,11 @@ ext { configVersion = '1.3.4' jdaNasVersion = '1.1.0' jsr305Version = '3.0.2' + koeVersion = '454cfec' lavaplayerVersion = '1.3.19' lavadspVersion = '0.5.2' logbackVersion = '1.2.3' - magmaVersion = '0.10.4' + magmaVersion = '0.10.0' nativeLoaderVersion = '0.3.0' prometheusVersion = '0.6.0' sentryVersion = '1.7.25' @@ -51,9 +52,12 @@ dependencies { //REST, WebSocket, etc compile "io.vertx:vertx-web:$vertxWebVersion" - //Raw audio -> udp packet + //Audio sending compile "club.minnced:magma:$magmaVersion" + //Audio sending + //compile "moe.kyokobot:koe:$koeVersion" + //Audio player compile "com.sedmelluq:lavaplayer:$lavaplayerVersion" diff --git a/src/main/java/andesite/node/player/NonAllocatingProvider.java b/src/main/java/andesite/node/player/NonAllocatingProvider.java index a8445507..54462b8f 100644 --- a/src/main/java/andesite/node/player/NonAllocatingProvider.java +++ b/src/main/java/andesite/node/player/NonAllocatingProvider.java @@ -7,33 +7,13 @@ import javax.annotation.CheckReturnValue; import javax.annotation.Nonnull; -import java.lang.reflect.Field; import java.nio.ByteBuffer; -import java.util.function.Function; class NonAllocatingProvider implements AudioProvider { - private static final Function INTERNAL_BUFFER_GETTER; - private final ByteBuffer buffer = ByteBuffer.allocate(StandardAudioDataFormats.DISCORD_OPUS.maximumChunkSize()); private final MutableAudioFrame frame = new MutableAudioFrame(); private final AudioPlayer player; - static { - try { - Field f = MutableAudioFrame.class.getDeclaredField("frameBuffer"); - f.setAccessible(true); - INTERNAL_BUFFER_GETTER = frame -> { - try { - return (ByteBuffer) f.get(frame); - } catch(Exception impossible) { - throw new AssertionError(impossible); - } - }; - } catch(Exception e) { - throw new ExceptionInInitializerError(e); - } - } - public NonAllocatingProvider(AudioPlayer player) { this.player = player; frame.setBuffer(buffer); @@ -50,14 +30,6 @@ public boolean canProvide() { @Nonnull @Override public ByteBuffer provide() { - if(INTERNAL_BUFFER_GETTER.apply(frame) != buffer) { - frame.getData(buffer.array(), frame.getDataLength()); - //hopefully this copy won't be needed for the next frame - //and data will be directly written to the provider's buffer. - //this call is pretty much free, and might help preventing - //more copies for future frames. - frame.setBuffer(buffer.limit(buffer.capacity())); - } return buffer.position(0).limit(frame.getDataLength()); }