com.jme3.audio
Class AudioBuffer

java.lang.Object
  extended by com.jme3.util.NativeObject
      extended by com.jme3.audio.AudioData
          extended by com.jme3.audio.AudioBuffer
All Implemented Interfaces:
java.lang.Cloneable

public class AudioBuffer
extends AudioData

An AudioBuffer is an implementation of AudioData where the audio is buffered (stored in memory). All parts of it are accessible at any time.
AudioBuffers are useful for short sounds, like effects, etc.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.jme3.audio.AudioData
AudioData.DataType
 
Field Summary
protected  java.nio.ByteBuffer audioData
          The audio data buffer.
 
Fields inherited from class com.jme3.audio.AudioData
bitsPerSample, channels, sampleRate
 
Fields inherited from class com.jme3.util.NativeObject
handleRef, id, type, updateNeeded
 
Constructor Summary
  AudioBuffer()
           
protected AudioBuffer(int id)
           
 
Method Summary
 NativeObject createDestructableClone()
          Creates a shallow clone of this GL Object.
 void deleteObject(AudioRenderer ar)
           
 void deleteObject(java.lang.Object rendererObject)
          Deletes the GL object from the GPU when it is no longer used.
 java.nio.ByteBuffer getData()
           
 AudioData.DataType getDataType()
           
 float getDuration()
           
 void resetObject()
          Called when the GL context is restarted to reset all IDs.
 java.lang.String toString()
           
 void updateData(java.nio.ByteBuffer data)
          Update the data in the buffer with new data.
 
Methods inherited from class com.jme3.audio.AudioData
getBitsPerSample, getChannels, getSampleRate, setupFormat
 
Methods inherited from class com.jme3.util.NativeObject
clearUpdateNeeded, clone, getId, isUpdateNeeded, setId, setUpdateNeeded
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

audioData

protected java.nio.ByteBuffer audioData
The audio data buffer. Should be direct and native ordered.

Constructor Detail

AudioBuffer

public AudioBuffer()

AudioBuffer

protected AudioBuffer(int id)
Method Detail

getDataType

public AudioData.DataType getDataType()
Specified by:
getDataType in class AudioData
Returns:
The data type, either Buffer or Stream.

getDuration

public float getDuration()
Specified by:
getDuration in class AudioData
Returns:
The duration of the audio in seconds. It is expected that audio is uncompressed.

toString

public java.lang.String toString()
Overrides:
toString in class NativeObject

updateData

public void updateData(java.nio.ByteBuffer data)
Update the data in the buffer with new data.

Parameters:
data -

getData

public java.nio.ByteBuffer getData()
Returns:
The buffered audio data.

resetObject

public void resetObject()
Description copied from class: NativeObject
Called when the GL context is restarted to reset all IDs. Prevents "white textures" on display restart.

Specified by:
resetObject in class NativeObject

deleteObject

public void deleteObject(AudioRenderer ar)

deleteObject

public void deleteObject(java.lang.Object rendererObject)
Description copied from class: NativeObject
Deletes the GL object from the GPU when it is no longer used. Called automatically by the GL object manager.

Specified by:
deleteObject in class NativeObject
Parameters:
rendererObject - The renderer to be used to delete the object

createDestructableClone

public NativeObject createDestructableClone()
Description copied from class: NativeObject
Creates a shallow clone of this GL Object. The deleteObject method should be functional for this object.

Specified by:
createDestructableClone in class NativeObject