aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/soundchan/AudioPlayerSendHandler.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/soundchan/AudioPlayerSendHandler.java')
-rw-r--r--src/main/java/soundchan/AudioPlayerSendHandler.java11
1 files changed, 5 insertions, 6 deletions
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