public class FloatSampleBuffer extends Object implements SampleBuffer, Iterator<Float>
SampleChunk
s 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, wait
forEach, spliterator
forEachRemaining
public 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 SampleBuffer
index
- 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 SampleBuffer
index
- The index of the sample to set.sample
- The sample value to set.SampleBuffer.set(int, float)
public int size()
size
in interface SampleBuffer
SampleBuffer.size()
public AudioFormat getFormat()
getFormat
in interface SampleBuffer
AudioFormat
for this set of samples.SampleBuffer.getFormat()
public void setFormat(AudioFormat af)
setFormat
in interface SampleBuffer
af
- The AudioFormat
SampleBuffer.setFormat(org.openimaj.audio.AudioFormat)
public SampleChunk getSampleChunk()
getSampleChunk
in interface SampleBuffer
SampleChunk
containing data in this buffer.SampleBuffer.getSampleChunk()
public SampleChunk getSampleChunk(int channel)
getSampleChunk
in interface SampleBuffer
channel
- The channelSampleChunk
containing data in this buffer.SampleBuffer.getSampleChunk(int)
public double[] asDoubleArray()
asDoubleArray
in interface SampleBuffer
SampleBuffer.asDoubleArray()
public double[][] asDoubleChannelArray()
asDoubleChannelArray
in interface SampleBuffer
SampleBuffer.asDoubleChannelArray()
public float[] asFloatArray()
asFloatArray
in interface SampleBuffer
SampleBuffer.asDoubleArray()
public float[][] asFloatChannelArray()
asFloatChannelArray
in interface SampleBuffer
SampleBuffer.asDoubleChannelArray()
public float getUnscaled(int index)
getUnscaled
in interface SampleBuffer
index
- 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 SampleBuffer
SampleBuffer.getStartTimecode()