public class SampleBuffer16Bit extends Object implements SampleBuffer, Iterator<Float>
SampleBuffer for 16-bit sample chunks.| Constructor and Description |
|---|
SampleBuffer16Bit(AudioFormat af,
int nSamples)
Create a new 16-bit sample buffer using the given sample format at the
given size.
|
SampleBuffer16Bit(SampleChunk samples,
AudioFormat af)
Create a new 16-bit sample buffer using the given samples and the given
audio format.
|
| Modifier and Type | Method and Description |
|---|---|
double[] |
asDoubleArray()
Returns the normalised (0..1) sample buffer data as a double array.
|
double[][] |
asDoubleChannelArray()
Returns the samples in their channels as normalise (0..1) sample buffer
data.
|
float[] |
asFloatArray()
Returns the normalised (0..1) sample buffer data as a float array.
|
float[][] |
asFloatChannelArray()
Returns the samples in their channels as normalise (0..1) sample buffer
data.
|
float |
get(int index)
Get the sample at the given index.
|
AudioFormat |
getFormat()
Returns the audio format for this set of samples.
|
SampleChunk |
getSampleChunk()
Return a sample chunk that contains the data from this sample buffer.
|
SampleChunk |
getSampleChunk(int channel)
Return a sample chunk that contains the data from a specific channel in
this sample buffer.
|
AudioTimecode |
getStartTimecode()
Returns the timecode of the start of this sample buffer.
|
float |
getUnscaled(int index)
Returns the sample value at the given index without scaling - that is, at
it's original sample value.
|
boolean |
hasNext() |
Iterator<Float> |
iterator() |
Float |
next() |
void |
remove() |
void |
set(int index,
float sample)
Set the sample value at the given index.
|
void |
setFormat(AudioFormat af)
Reset the audio format for the samples in this buffer.
|
void |
setStartTimecode(AudioTimecode timecode)
Set the timecode for this buffer.
|
int |
size()
Returns the size of this buffer.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEach, spliteratorforEachRemainingpublic SampleBuffer16Bit(SampleChunk samples, AudioFormat af)
samples - The samples to buffer.af - The audio format.public SampleBuffer16Bit(AudioFormat af, int nSamples)
af - The audio format of the samplesnSamples - The number of samplespublic SampleChunk getSampleChunk()
getSampleChunk in interface SampleBufferSampleChunk containing data in this buffer.SampleBuffer.getSampleChunk()public SampleChunk getSampleChunk(int channel)
getSampleChunk().getSampleChunk in interface SampleBufferchannel - The channelSampleChunk containing data in this buffer.SampleBuffer.getSampleChunk(int)public float get(int index)
Integer.MAX_VALUE and Integer.MIN_VALUE.
That sample will be signed.get in interface SampleBufferindex - The index of the sample to retrieveSampleBuffer.get(int)public float getUnscaled(int index)
getUnscaled in interface SampleBufferindex - The index to retrieveSampleBuffer.getUnscaled(int)public void set(int index, float sample)
Integer.MAX_VALUE and Integer.MIN_VALUE
(i.e. it should be signed).set in interface SampleBufferindex - The index of the sample to set.sample - The sample value to set.SampleBuffer.set(int, float)public int size()
size in interface SampleBufferSampleBuffer.size()public AudioFormat getFormat()
getFormat in interface SampleBufferAudioFormat for this set of samples.SampleBuffer.getFormat()public void setFormat(AudioFormat af)
setFormat in interface SampleBufferaf - The AudioFormatSampleBuffer.setFormat(org.openimaj.audio.AudioFormat)public double[] asDoubleArray()
asDoubleArray in interface SampleBufferSampleBuffer.asDoubleArray()public double[][] asDoubleChannelArray()
asDoubleChannelArray in interface SampleBufferSampleBuffer.asDoubleChannelArray()public float[] asFloatArray()
asFloatArray in interface SampleBufferSampleBuffer.asDoubleArray()public float[][] asFloatChannelArray()
asFloatChannelArray in interface SampleBufferSampleBuffer.asDoubleChannelArray()public Iterator<Float> iterator()
iterator in interface Iterable<Float>Iterable.iterator()public boolean hasNext()
hasNext in interface Iterator<Float>Iterator.hasNext()public void remove()
remove in interface Iterator<Float>Iterator.remove()public AudioTimecode getStartTimecode()
SampleBuffergetStartTimecode in interface SampleBufferpublic void setStartTimecode(AudioTimecode timecode)
timecode - The timecode