use of com.sedmelluq.discord.lavaplayer.track.playback.MutableAudioFrame in project lavaplayer by sedmelluq.
the class PlayerManagerTestTools method consumeTrack.
public static long consumeTrack(AudioPlayer player) throws Exception {
ByteBuffer buffer = ByteBuffer.allocate(960 * 2 * 2);
MutableAudioFrame frame = new MutableAudioFrame();
frame.setBuffer(buffer);
CRC32 crc = new CRC32();
int count = 0;
while (player.getPlayingTrack() != null && player.provide(frame, 10, TimeUnit.SECONDS)) {
buffer.flip();
crc.update(buffer.array(), buffer.position(), buffer.remaining());
count++;
}
System.out.println("Consumed " + count + " samples");
return crc.getValue();
}
Aggregations