|
|
|
@ -25,7 +25,7 @@ public class MusicHandler implements AudioSendHandler, Closeable |
|
|
|
|
// private final LinkedList<Song> songQueue = new LinkedList<>();
|
|
|
|
|
// private final Queue<byte[]> queue = new ConcurrentLinkedQueue<>();
|
|
|
|
|
private final CircularByteBuffer audioBuffer = new CircularByteBuffer(3840 * 1024); |
|
|
|
|
private boolean playing = true; |
|
|
|
|
private boolean shouldPlay = true; |
|
|
|
|
private int byteCount; |
|
|
|
|
|
|
|
|
|
private boolean arrayErr = false; |
|
|
|
@ -121,14 +121,19 @@ public class MusicHandler implements AudioSendHandler, Closeable |
|
|
|
|
|
|
|
|
|
public boolean isPlaying() |
|
|
|
|
{ |
|
|
|
|
return playing; |
|
|
|
|
return player != null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void setPlaying(boolean playing) |
|
|
|
|
public boolean isShouldPlay() |
|
|
|
|
{ |
|
|
|
|
if (!this.playing && playing) |
|
|
|
|
return shouldPlay; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void setShouldPlay(boolean shouldPlay) |
|
|
|
|
{ |
|
|
|
|
if (!this.shouldPlay && shouldPlay) |
|
|
|
|
nextSong(); |
|
|
|
|
this.playing = playing; |
|
|
|
|
this.shouldPlay = shouldPlay; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@ -136,7 +141,7 @@ public class MusicHandler implements AudioSendHandler, Closeable |
|
|
|
|
{ |
|
|
|
|
return player != null && player.has(1); |
|
|
|
|
// If we have something in our buffer we can provide it to the send system
|
|
|
|
|
// return audioBuffer.getCurrentNumberOfBytes() > byteCount && playing;
|
|
|
|
|
// return audioBuffer.getCurrentNumberOfBytes() > byteCount && shouldPlay;
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|