public class FloatSample extends AudioSample implements Function
SampleLoader
,
FixedRateMonoReader
,
FixedRateStereoReader
,
VariableRateMonoReader
,
VariableRateStereoReader
channelsPerFrame, numFrames
maxFrames
Constructor and Description |
---|
FloatSample() |
FloatSample(float[] data)
Constructor for mono samples with data.
|
FloatSample(float[] data,
int channelsPerFrame)
Constructor for multi-channel samples with data.
|
FloatSample(int numFrames)
Constructor for mono samples.
|
FloatSample(int numFrames,
int channelsPerFrame)
Create an silent sample with enough memory to hold the audio data.
|
Modifier and Type | Method and Description |
---|---|
void |
allocate(int numFrames,
int channelsPerFrame)
Allocate memory to hold the audio data.
|
double |
evaluate(double input)
Convert an input value to an output value.
|
double |
interpolate(double fractionalIndex) |
void |
read(float[] data) |
void |
read(int startFrame,
float[] data,
int startIndex,
int numFrames)
Note that in a stereo sample, a frame has two values.
|
double |
readDouble(int index)
Read a value from the sample independently from the internal storage format.
|
void |
write(float[] data)
Write the entire array to the sample.
|
void |
write(int startFrame,
float[] data,
int startIndex,
int numFrames)
Note that in a stereo sample, a frame has two values.
|
void |
writeDouble(int index,
double value)
Write a value at the given index.
|
addMarker, getChannelsPerFrame, getFrameRate, getMarker, getMarkerCount, getNumFrames, getPitch, getRateScaler, setChannelsPerFrame, setFrameRate, setPitch
getMaxFrames, getReleaseBegin, getReleaseEnd, getSustainBegin, getSustainEnd, setNumFrames, setReleaseBegin, setReleaseEnd, setSustainBegin, setSustainEnd
public FloatSample()
public FloatSample(int numFrames)
public FloatSample(float[] data)
public FloatSample(float[] data, int channelsPerFrame)
public FloatSample(int numFrames, int channelsPerFrame)
numFrames
- number of sample groups. A stereo frame contains 2 samples.channelsPerFrame
- 1 for mono, 2 for stereopublic void allocate(int numFrames, int channelsPerFrame)
allocate
in class AudioSample
numFrames
- number of sample groups. A stereo frame contains 2 samples.channelsPerFrame
- 1 for mono, 2 for stereopublic void write(int startFrame, float[] data, int startIndex, int numFrames)
startFrame
- index of frame in the sampledata
- data to be writtenstartIndex
- index of first value in arraynumFrames
- public void read(int startFrame, float[] data, int startIndex, int numFrames)
startFrame
- index of frame in the sampledata
- array to receive the data from the samplestartIndex
- index of first location in array to start fillingnumFrames
- public void write(float[] data)
data
- public void read(float[] data)
public double readDouble(int index)
SequentialData
readDouble
in interface SequentialData
readDouble
in class SequentialDataCommon
index
- sample index is ((frameIndex * channelsPerFrame) + channelIndex)public void writeDouble(int index, double value)
SequentialData
writeDouble
in interface SequentialData
writeDouble
in class SequentialDataCommon
index
- sample index is ((frameIndex * channelsPerFrame) + channelIndex)value
- the value to be writtenpublic double interpolate(double fractionalIndex)