public class FloatSampleBuffer extends Object implements SampleBuffer, Iterator<Float>
SampleChunks cannot be retrieved from it.| Constructor and Description |
|---|
FloatSampleBuffer(double[] samples,
AudioFormat af) |
FloatSampleBuffer(float[] samples,
AudioFormat af) |
| Modifier and Type | Method and Description |
|---|---|
FloatSampleBuffer |
add(double scalar)
Add the scalar to all the samples
|
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()
Returns NULL.
|
SampleChunk |
getSampleChunk(int channel)
Returns NULL.
|
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() |
FloatSampleBuffer |
multiply(double scalar)
Multipy the samples by the given scalar
|
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.
|
int |
size()
Returns the size of this buffer.
|
gnu.trove.iterator.TFloatIterator |
tf_iterator()
Returns a trove float iterator
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEach, spliteratorforEachRemainingpublic FloatSampleBuffer(float[] samples, AudioFormat af)
samples - The samples to useaf - The audio format of the samplespublic FloatSampleBuffer(double[] samples, AudioFormat af)
samples - The samples to useaf - The audio formatpublic 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 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 SampleChunk getSampleChunk()
getSampleChunk in interface SampleBufferSampleChunk containing data in this buffer.SampleBuffer.getSampleChunk()public SampleChunk getSampleChunk(int channel)
getSampleChunk in interface SampleBufferchannel - The channelSampleChunk containing data in this buffer.SampleBuffer.getSampleChunk(int)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 float getUnscaled(int index)
getUnscaled in interface SampleBufferindex - The index to retrieveSampleBuffer.getUnscaled(int)public FloatSampleBuffer multiply(double scalar)
scalar - The scalarpublic FloatSampleBuffer add(double scalar)
scalar - The scalarpublic Iterator<Float> iterator()
iterator in interface Iterable<Float>Iterable.iterator()public gnu.trove.iterator.TFloatIterator tf_iterator()
public boolean hasNext()
hasNext in interface Iterator<Float>Iterator.hasNext()public void remove()
remove in interface Iterator<Float>Iterator.remove()public AudioTimecode getStartTimecode()
getStartTimecode in interface SampleBufferSampleBuffer.getStartTimecode()