Package com.jme3.audio
Class AudioBuffer
java.lang.Object
com.jme3.util.NativeObject
com.jme3.audio.AudioData
com.jme3.audio.AudioBuffer
- All Implemented Interfaces:
- Cloneable
An 
AudioBuffers are useful for short sounds, like effects, etc.
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 SummaryNested classes/interfaces inherited from class com.jme3.audio.AudioDataAudioData.DataType
- 
Field SummaryFieldsFields inherited from class com.jme3.audio.AudioDatabitsPerSample, channels, sampleRateFields inherited from class com.jme3.util.NativeObjecthandleRef, id, INVALID_ID, objectManager, OBJTYPE_AUDIOBUFFER, OBJTYPE_AUDIOSTREAM, OBJTYPE_BO, OBJTYPE_FILTER, OBJTYPE_FRAMEBUFFER, OBJTYPE_SHADER, OBJTYPE_SHADERSOURCE, OBJTYPE_TEXTURE, OBJTYPE_VERTEXBUFFER, updateNeeded
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionCreates a shallow clone of this GL Object.protected voidDeletes any associated nativebuffers.voiddeleteObject(Object rendererObject) Deletes the GL object from the GPU when it is no longer used.getData()floatlongReturns a unique ID for this NativeObject.voidCalled when the GL context is restarted to reset all IDs.toString()voidupdateData(ByteBuffer data) Update the data in the buffer with new data.Methods inherited from class com.jme3.audio.AudioDatagetBitsPerSample, getChannels, getSampleRate, setupFormatMethods inherited from class com.jme3.util.NativeObjectclearUpdateNeeded, clone, dispose, getId, getWeakRef, isUpdateNeeded, setId, setUpdateNeeded
- 
Field Details- 
audioDataThe audio data buffer. Should be direct and native ordered.
 
- 
- 
Constructor Details- 
AudioBufferpublic AudioBuffer()
- 
AudioBufferprotected AudioBuffer(int id) 
 
- 
- 
Method Details- 
getDataType- Specified by:
- getDataTypein class- AudioData
- Returns:
- The data type, either BufferorStream.
 
- 
getDurationpublic float getDuration()- Specified by:
- getDurationin class- AudioData
- Returns:
- The duration of the audio in seconds. It is expected that audio is uncompressed.
 
- 
toString- Overrides:
- toStringin class- NativeObject
 
- 
updateDataUpdate the data in the buffer with new data.- Parameters:
- data- the audio data provided (not null, direct, alias created)
- Throws:
- IllegalArgumentException- if the provided buffer is not a direct buffer
 
- 
getData- Returns:
- The buffered audio data.
 
- 
resetObjectpublic void resetObject()Description copied from class:NativeObjectCalled when the GL context is restarted to reset all IDs. Prevents "white textures" on display restart.- Specified by:
- resetObjectin class- NativeObject
 
- 
deleteNativeBuffersprotected void deleteNativeBuffers()Description copied from class:NativeObjectDeletes any associated nativebuffers. This is necessary because it is unlikely that native buffers will be garbage collected naturally (due to how GC works), therefore the collection must be handled manually. Only implementations that manage native buffers need to override this method. Note that the behavior that occurs when a deleted native buffer is used is not defined, therefore this method is protected- Overrides:
- deleteNativeBuffersin class- NativeObject
 
- 
deleteObjectDescription copied from class:NativeObjectDeletes the GL object from the GPU when it is no longer used. Called automatically by the GL object manager.- Specified by:
- deleteObjectin class- NativeObject
- Parameters:
- rendererObject- The renderer to be used to delete the object
 
- 
createDestructableCloneDescription copied from class:NativeObjectCreates a shallow clone of this GL Object. The deleteObject method should be functional for this object.- Specified by:
- createDestructableClonein class- NativeObject
- Returns:
- a new instance
 
- 
getUniqueIdpublic long getUniqueId()Description copied from class:NativeObjectReturns a unique ID for this NativeObject. No other NativeObject shall have the same ID.- Specified by:
- getUniqueIdin class- NativeObject
- Returns:
- unique ID for this NativeObject.
 
 
-