Class ImmutableAudioFrame
- java.lang.Object
-
- com.sedmelluq.discord.lavaplayer.track.playback.ImmutableAudioFrame
-
- All Implemented Interfaces:
AudioFrame
public class ImmutableAudioFrame extends java.lang.Object implements AudioFrame
A single audio frame.
-
-
Field Summary
Fields Modifier and Type Field Description byte[]dataBuffer for this frame, in the format specified in the format field.AudioDataFormatformatSpecifies the format of audio in the data buffer.longtimecodeTimecode of this frame in milliseconds.intvolumeVolume level of the audio in this frame.
-
Constructor Summary
Constructors Constructor Description ImmutableAudioFrame(long timecode, byte[] data, int volume, AudioDataFormat format)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]getData()voidgetData(byte[] buffer, int offset)Before calling this method, the caller should verify that the data fits in the buffer usingAudioFrame.getDataLength().intgetDataLength()AudioDataFormatgetFormat()longgetTimecode()intgetVolume()booleanisTerminator()
-
-
-
Field Detail
-
timecode
public final long timecode
Timecode of this frame in milliseconds.
-
data
public final byte[] data
Buffer for this frame, in the format specified in the format field.
-
volume
public final int volume
Volume level of the audio in this frame. Internally when this value is 0, the data may actually contain a non-silent frame. This is to allow frames with 0 volume to be modified later. These frames should still be handled as silent frames.
-
format
public final AudioDataFormat format
Specifies the format of audio in the data buffer.
-
-
Constructor Detail
-
ImmutableAudioFrame
public ImmutableAudioFrame(long timecode, byte[] data, int volume, AudioDataFormat format)- Parameters:
timecode- Timecode of this frame in milliseconds.data- Buffer for this frame, in the format specified in the format field.volume- Volume level of the audio in this frame.format- Specifies the format of audio in the data buffer.
-
-
Method Detail
-
getTimecode
public long getTimecode()
- Specified by:
getTimecodein interfaceAudioFrame- Returns:
- Absolute timecode of the frame in milliseconds.
-
getVolume
public int getVolume()
- Specified by:
getVolumein interfaceAudioFrame- Returns:
- Volume of the current frame.
-
getDataLength
public int getDataLength()
- Specified by:
getDataLengthin interfaceAudioFrame- Returns:
- Length of the data of this frame.
-
getData
public byte[] getData()
- Specified by:
getDatain interfaceAudioFrame- Returns:
- Byte array with the frame data.
-
getData
public void getData(byte[] buffer, int offset)Description copied from interface:AudioFrameBefore calling this method, the caller should verify that the data fits in the buffer usingAudioFrame.getDataLength().- Specified by:
getDatain interfaceAudioFrame- Parameters:
buffer- Buffer to write the frame data to.offset- Offset in the buffer to start writing at.
-
getFormat
public AudioDataFormat getFormat()
- Specified by:
getFormatin interfaceAudioFrame- Returns:
- The data format of this buffer.
-
isTerminator
public boolean isTerminator()
- Specified by:
isTerminatorin interfaceAudioFrame- Returns:
- Whether this frame is a terminator. This is an internal concept of the player and should never be
truein any frames received by the user.
-
-