Class ImmutableAudioFrame

  • All Implemented Interfaces:
    AudioFrame

    public class ImmutableAudioFrame
    extends java.lang.Object
    implements AudioFrame
    A single audio frame.
    • 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:
        getTimecode in interface AudioFrame
        Returns:
        Absolute timecode of the frame in milliseconds.
      • getVolume

        public int getVolume()
        Specified by:
        getVolume in interface AudioFrame
        Returns:
        Volume of the current frame.
      • getDataLength

        public int getDataLength()
        Specified by:
        getDataLength in interface AudioFrame
        Returns:
        Length of the data of this frame.
      • getData

        public byte[] getData()
        Specified by:
        getData in interface AudioFrame
        Returns:
        Byte array with the frame data.
      • getData

        public void getData​(byte[] buffer,
                            int offset)
        Description copied from interface: AudioFrame
        Before calling this method, the caller should verify that the data fits in the buffer using AudioFrame.getDataLength().
        Specified by:
        getData in interface AudioFrame
        Parameters:
        buffer - Buffer to write the frame data to.
        offset - Offset in the buffer to start writing at.
      • isTerminator

        public boolean isTerminator()
        Specified by:
        isTerminator in interface AudioFrame
        Returns:
        Whether this frame is a terminator. This is an internal concept of the player and should never be true in any frames received by the user.