Package icyllis.modernui.audio
Class SoundSample
java.lang.Object
icyllis.modernui.audio.SoundSample
- All Implemented Interfaces:
AutoCloseable
- Direct Known Subclasses:
VorbisPullDecoder
Sampled sound provides uncompressed PCM audio samples decoded from an
InputStream or a FileChannel.
This is the pulling API.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intprotected intprotected int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidclose()intGet numbers of channels, either 1 or 2.intabstract intgetSamplesShortInterleaved(ShortBuffer pcmBuffer) floatGet the length of the sound in seconds.intGet numbers of samples in one channel.abstract booleanseek(int sampleOffset)
-
Field Details
-
mSampleRate
protected int mSampleRate -
mChannels
protected int mChannels -
mTotalSamples
protected int mTotalSamples
-
-
Constructor Details
-
SoundSample
public SoundSample()
-
-
Method Details
-
getSampleRate
public int getSampleRate() -
getChannels
public int getChannels()Get numbers of channels, either 1 or 2.- Returns:
- numbers of channels
-
getTotalSamples
public int getTotalSamples()Get numbers of samples in one channel.- Returns:
- total samples
-
getTotalLength
public float getTotalLength()Get the length of the sound in seconds.- Returns:
- total length
-
seek
public abstract boolean seek(int sampleOffset) - Returns:
- success or not
-
getSamplesShortInterleaved
- Returns:
- samples per channel
-
close
public abstract void close()- Specified by:
closein interfaceAutoCloseable
-