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, wait
forEach, spliterator
forEachRemaining
public 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 SampleBuffer
SampleChunk
containing data in this buffer.SampleBuffer.getSampleChunk()
public SampleChunk getSampleChunk(int channel)
getSampleChunk()
.getSampleChunk
in interface SampleBuffer
channel
- 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 SampleBuffer
index
- The index of the sample to retrieveSampleBuffer.get(int)
public float getUnscaled(int index)
getUnscaled
in interface SampleBuffer
index
- 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 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 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 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()
SampleBuffer
getStartTimecode
in interface SampleBuffer
public void setStartTimecode(AudioTimecode timecode)
timecode
- The timecode