From c50216132981a993fb827315c7c4d6fb3d5857a1 Mon Sep 17 00:00:00 2001 From: Matt Kohls Date: Sun, 27 Oct 2019 00:38:52 -0400 Subject: Starting work to update libraries JDA v4 has many breaking changes that will need to be checked Lavaplayer shouldn't have any major changes, but needs version bump to continue working with various sites --- src/main/java/soundchan/AudioPlayerSendHandler.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/main/java/soundchan/AudioPlayerSendHandler.java') diff --git a/src/main/java/soundchan/AudioPlayerSendHandler.java b/src/main/java/soundchan/AudioPlayerSendHandler.java index 5e174ca..fdd9774 100644 --- a/src/main/java/soundchan/AudioPlayerSendHandler.java +++ b/src/main/java/soundchan/AudioPlayerSendHandler.java @@ -2,7 +2,9 @@ package soundchan; import com.sedmelluq.discord.lavaplayer.player.AudioPlayer; import com.sedmelluq.discord.lavaplayer.track.playback.AudioFrame; -import net.dv8tion.jda.core.audio.AudioSendHandler; +import net.dv8tion.jda.api.audio.AudioSendHandler; + +import java.nio.ByteBuffer; /** * This is a wrapper around AudioPlayer which makes it behave as an AudioSendHandler for JDA. As JDA calls canProvide @@ -30,15 +32,12 @@ public class AudioPlayerSendHandler implements AudioSendHandler { } @Override - public byte[] provide20MsAudio() { + public ByteBuffer provide20MsAudio() { if (lastFrame == null) { lastFrame = audioPlayer.provide(); } - byte[] data = lastFrame != null ? lastFrame.getData() : null; - lastFrame = null; - - return data; + return ByteBuffer.wrap(lastFrame.getData()); } @Override -- cgit v1.2.3