public class AudioStream extends AudioData implements java.io.Closeable
AudioStream
is an implementation of AudioData that acquires the
audio from an InputStream. Audio can be streamed from network, hard drive
etc. It is assumed the data coming from the input stream is uncompressed.AudioData.DataType
Modifier and Type | Field and Description |
---|---|
protected float |
duration |
protected boolean |
eof |
protected int[] |
ids |
protected java.io.InputStream |
in |
protected boolean |
open |
protected int |
unqueuedBuffersBytes |
bitsPerSample, channels, sampleRate
handleRef, id, INVALID_ID, objectManager, OBJTYPE_AUDIOBUFFER, OBJTYPE_AUDIOSTREAM, OBJTYPE_BO, OBJTYPE_FILTER, OBJTYPE_FRAMEBUFFER, OBJTYPE_SHADER, OBJTYPE_SHADERSOURCE, OBJTYPE_TEXTURE, OBJTYPE_VERTEXBUFFER, updateNeeded
Modifier | Constructor and Description |
---|---|
|
AudioStream() |
protected |
AudioStream(int[] ids) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the stream, releasing all data relating to it.
|
NativeObject |
createDestructableClone()
Creates a shallow clone of this GL Object.
|
void |
deleteObject(java.lang.Object rendererObject)
Deletes the GL object from the GPU when it is no longer used.
|
AudioData.DataType |
getDataType() |
float |
getDuration() |
int |
getId() |
int |
getId(int index) |
int[] |
getIds() |
long |
getUniqueId()
Returns a unique ID for this NativeObject.
|
int |
getUnqueuedBufferBytes() |
void |
initIds(int count) |
boolean |
isEOF() |
boolean |
isSeekable() |
int |
readSamples(byte[] buf)
Reads samples from the stream.
|
int |
readSamples(byte[] buf,
int offset,
int length)
Reads samples from the stream.
|
void |
resetObject()
Called when the GL context is restarted to reset all IDs.
|
void |
setId(int id)
Sets the ID of the NativeObject.
|
void |
setId(int index,
int id) |
void |
setIds(int[] ids) |
void |
setTime(float time) |
void |
setUnqueuedBufferBytes(int unqueuedBuffers) |
void |
updateData(java.io.InputStream in,
float duration) |
getBitsPerSample, getChannels, getSampleRate, setupFormat
clearUpdateNeeded, clone, deleteNativeBuffers, dispose, getWeakRef, isUpdateNeeded, setUpdateNeeded, toString
protected java.io.InputStream in
protected float duration
protected boolean open
protected boolean eof
protected int[] ids
protected int unqueuedBuffersBytes
public void updateData(java.io.InputStream in, float duration)
public int readSamples(byte[] buf, int offset, int length)
buf
- Buffer where to read the samplesoffset
- The offset in the buffer where to read sampleslength
- The length inside the buffer where to read samplespublic int readSamples(byte[] buf)
buf
- Buffer where to read the samplesreadSamples(byte[], int, int)
public float getDuration()
getDuration
in class AudioData
public int getId()
getId
in class NativeObject
public void setId(int id)
NativeObject
setId
in class NativeObject
id
- The ID to setpublic void initIds(int count)
public int getId(int index)
public void setId(int index, int id)
public int[] getIds()
public void setIds(int[] ids)
public AudioData.DataType getDataType()
getDataType
in class AudioData
Buffer
or Stream
.public void resetObject()
NativeObject
resetObject
in class NativeObject
public void deleteObject(java.lang.Object rendererObject)
NativeObject
deleteObject
in class NativeObject
rendererObject
- The renderer to be used to delete the objectpublic NativeObject createDestructableClone()
NativeObject
createDestructableClone
in class NativeObject
public boolean isEOF()
public void close()
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
java.io.IOException
public boolean isSeekable()
public int getUnqueuedBufferBytes()
public void setUnqueuedBufferBytes(int unqueuedBuffers)
public void setTime(float time)
public long getUniqueId()
NativeObject
getUniqueId
in class NativeObject