Interface AudioFrameBuffer
-
- All Superinterfaces:
AudioFrameConsumer,AudioFrameProvider
- All Known Implementing Classes:
AbstractAudioFrameBuffer,AllocatingAudioFrameBuffer,NonAllocatingAudioFrameBuffer
public interface AudioFrameBuffer extends AudioFrameProvider, AudioFrameConsumer
A frame buffer. Stores the specified duration worth of frames in the internal buffer. Consumes frames in a blocking manner and provides frames in a non-blocking manner.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclear()Clear the buffer.intgetFullCapacity()java.lang.LonggetLastInputTimecode()intgetRemainingCapacity()booleanhasClearOnInsert()booleanhasReceivedFrames()voidlockBuffer()Lock the buffer so no more incoming frames are accepted.voidsetClearOnInsert()Signal that the next frame provided to the buffer will clear the frames before it.voidsetTerminateOnEmpty()Signal that no more input is expected and if the content frames have been consumed, emit a terminator frame.voidwaitForTermination()Wait until another thread has consumed a terminator frame from this buffer-
Methods inherited from interface com.sedmelluq.discord.lavaplayer.track.playback.AudioFrameConsumer
consume, rebuild
-
Methods inherited from interface com.sedmelluq.discord.lavaplayer.track.playback.AudioFrameProvider
provide, provide, provide, provide
-
-
-
-
Method Detail
-
getRemainingCapacity
int getRemainingCapacity()
- Returns:
- Number of frames that can be added to the buffer without blocking.
-
getFullCapacity
int getFullCapacity()
- Returns:
- Total number of frames that the buffer can hold.
-
waitForTermination
void waitForTermination() throws java.lang.InterruptedExceptionWait until another thread has consumed a terminator frame from this buffer- Throws:
java.lang.InterruptedException- When interrupted externally (or for seek/stop).
-
setTerminateOnEmpty
void setTerminateOnEmpty()
Signal that no more input is expected and if the content frames have been consumed, emit a terminator frame.
-
setClearOnInsert
void setClearOnInsert()
Signal that the next frame provided to the buffer will clear the frames before it. This is useful when the next data is not contiguous with the current frame buffer, but the remaining frames in the buffer should be used until the next data arrives to prevent a situation where the buffer cannot provide any frames for a while.
-
hasClearOnInsert
boolean hasClearOnInsert()
- Returns:
- Whether the next frame is set to clear the buffer.
-
clear
void clear()
Clear the buffer.
-
lockBuffer
void lockBuffer()
Lock the buffer so no more incoming frames are accepted.
-
hasReceivedFrames
boolean hasReceivedFrames()
- Returns:
- True if this buffer has received any input frames.
-
getLastInputTimecode
java.lang.Long getLastInputTimecode()
- Returns:
- The timecode of the last frame in the buffer, null if the buffer is empty or is marked to be cleared upon receiving the next frame.
-
-