Package com.jme3.audio.plugins
Class NativeVorbisFile
java.lang.Object
com.jme3.audio.plugins.NativeVorbisFile
Represents the android implementation for the native vorbis file decoder.
This decoder initializes an OggVorbis_File from an already opened file designated by the
fd
.-
Field Summary
Modifier and TypeFieldDescriptionint
int
float
int
int
boolean
int
-
Constructor Summary
ConstructorDescriptionNativeVorbisFile
(int fd, long offset, long length) Initializes an ogg vorbis native file from a file descriptor [fd] of an already opened file. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Clears the native resources and destroys the bufferovf
reference.int
readIntoArray
(byte[] buffer, int offset, int length) Reads the vorbis file into a primitive byte buffer [buf] with an [offset] indicating the start byte and a [length] indicating the end byte on the output buffer.void
readIntoBuffer
(ByteBuffer out) Reads the vorbis file into a directByteBuffer
, starting from offset [0] till the buffer end on the output buffer.void
seekTime
(double time) Seeks to a playback time relative to the decompressed pcm (Pulse-code modulation) stream.
-
Field Details
-
fd
public int fd -
ovf
-
seekable
public boolean seekable -
channels
public int channels -
sampleRate
public int sampleRate -
bitRate
public int bitRate -
totalBytes
public int totalBytes -
duration
public float duration
-
-
Constructor Details
-
NativeVorbisFile
Initializes an ogg vorbis native file from a file descriptor [fd] of an already opened file.- Parameters:
fd
- an integer representing the file descriptoroffset
- an integer indicating the start of the bufferlength
- an integer indicating the end of the buffer- Throws:
IOException
- in cases of a failure to initialize the vorbis file
-
-
Method Details
-
seekTime
Seeks to a playback time relative to the decompressed pcm (Pulse-code modulation) stream.- Parameters:
time
- the playback seek time- Throws:
IOException
- if the seek is not successful
-
readIntoArray
Reads the vorbis file into a primitive byte buffer [buf] with an [offset] indicating the start byte and a [length] indicating the end byte on the output buffer.- Parameters:
buffer
- a primitive byte buffer to read the data into itoffset
- an integer representing the offset or the start byte on the output bufferlength
- an integer representing the end byte on the output buffer- Returns:
- the number of the read bytes, (-1) if the reading has failed indicating an EOF, returns (0) if the reading has failed or the primitive [buffer] passed is null
- Throws:
IOException
- if the library has failed to read the file into the [out] buffer or if the java primitive byte array [buffer] is inaccessible
-
readIntoBuffer
Reads the vorbis file into a directByteBuffer
, starting from offset [0] till the buffer end on the output buffer.- Parameters:
out
- a reference to the output direct buffer- Throws:
IOException
- if a premature EOF is encountered before reaching the end of the buffer or if the library has failed to read the file into the [out] buffer
-
clearResources
public void clearResources()Clears the native resources and destroys the bufferovf
reference.
-