Package com.jme3.audio
Class AudioData
java.lang.Object
com.jme3.util.NativeObject
com.jme3.audio.AudioData
- All Implemented Interfaces:
Cloneable
- Direct Known Subclasses:
AndroidAudioData
,AudioBuffer
,AudioStream
AudioData
is an abstract representation
of audio data. There are two ways to handle audio data, short audio files
are to be stored entirely in memory, while long audio files (music) are
streamed from the hard drive as they are played.-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionprotected int
protected int
protected int
Fields inherited from class com.jme3.util.NativeObject
handleRef, id, INVALID_ID, objectManager, OBJTYPE_AUDIOBUFFER, OBJTYPE_AUDIOSTREAM, OBJTYPE_BO, OBJTYPE_FILTER, OBJTYPE_FRAMEBUFFER, OBJTYPE_SHADER, OBJTYPE_SHADERSOURCE, OBJTYPE_TEXTURE, OBJTYPE_VERTEXBUFFER, updateNeeded
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
int
abstract AudioData.DataType
abstract float
int
void
setupFormat
(int channels, int bitsPerSample, int sampleRate) Sets the format of the audio data.Methods inherited from class com.jme3.util.NativeObject
clearUpdateNeeded, clone, createDestructableClone, deleteNativeBuffers, deleteObject, dispose, getId, getUniqueId, getWeakRef, isUpdateNeeded, resetObject, setId, setUpdateNeeded, toString
-
Field Details
-
sampleRate
protected int sampleRate -
channels
protected int channels -
bitsPerSample
protected int bitsPerSample
-
-
Constructor Details
-
AudioData
public AudioData() -
AudioData
protected AudioData(int id)
-
-
Method Details
-
getDataType
- Returns:
- The data type, either
Buffer
orStream
.
-
getDuration
public abstract float getDuration()- Returns:
- the duration in seconds of the audio clip.
-
getBitsPerSample
public int getBitsPerSample()- Returns:
- Bits per single sample from a channel.
-
getChannels
public int getChannels()- Returns:
- Number of channels. 1 for mono, 2 for stereo, etc.
-
getSampleRate
public int getSampleRate()- Returns:
- The sample rate, or how many samples per second.
-
setupFormat
public void setupFormat(int channels, int bitsPerSample, int sampleRate) Sets the format of the audio data.- Parameters:
channels
- # of channels, 1 = mono, 2 = stereobitsPerSample
- Bits per sample, e.g 8 bits, 16 bits.sampleRate
- Sample rate, 44100, 22050, etc.
-