diff options
author | Matt Kohls <mattkohls13@gmail.com> | 2019-10-27 00:38:52 -0400 |
---|---|---|
committer | Matt Kohls <mattkohls13@gmail.com> | 2019-10-27 00:38:52 -0400 |
commit | c50216132981a993fb827315c7c4d6fb3d5857a1 (patch) | |
tree | 2e10a70799009c3a6fe9f245e644b7c9f4a68de8 /src/main/java/soundchan/AudioPlayerSendHandler.java | |
parent | d2bb59cf2c21c5ba3000d1523bb62bb969eb38d4 (diff) | |
download | SoundChan-c50216132981a993fb827315c7c4d6fb3d5857a1.tar.gz SoundChan-c50216132981a993fb827315c7c4d6fb3d5857a1.tar.bz2 SoundChan-c50216132981a993fb827315c7c4d6fb3d5857a1.zip |
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
Diffstat (limited to 'src/main/java/soundchan/AudioPlayerSendHandler.java')
-rw-r--r-- | src/main/java/soundchan/AudioPlayerSendHandler.java | 11 |
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 |