public class ShortSample extends AudioSample
SampleLoader
,
FixedRateMonoReader
,
FixedRateStereoReader
,
VariableRateMonoReader
,
VariableRateStereoReader
channelsPerFrame, numFrames
maxFrames
Constructor and Description |
---|
ShortSample() |
ShortSample(int numFrames,
int channelsPerFrame) |
ShortSample(short[] data)
Constructor for mono samples with data.
|
ShortSample(short[] data,
int channelsPerFrame)
Constructor for multi-channel samples with data.
|
Modifier and Type | Method and Description |
---|---|
void |
allocate(int numFrames,
int channelsPerFrame) |
void |
read(int startFrame,
short[] data,
int startIndex,
int numFrames)
Note that in a stereo sample, a frame has two values.
|
void |
read(short[] data) |
double |
readDouble(int index)
Read a sample converted to a double in the range -1.0 to almost 1.0.
|
short |
readShort(int index) |
void |
write(int startFrame,
short[] data,
int startIndex,
int numFrames)
Note that in a stereo sample, a frame has two values.
|
void |
write(short[] data) |
void |
writeDouble(int index,
double value)
Write a double that will be clipped to the range -1.0 to almost 1.0 and converted to a short.
|
void |
writeShort(int index,
short value) |
addMarker, getChannelsPerFrame, getFrameRate, getMarker, getMarkerCount, getNumFrames, getPitch, getRateScaler, setChannelsPerFrame, setFrameRate, setPitch
getMaxFrames, getReleaseBegin, getReleaseEnd, getSustainBegin, getSustainEnd, setNumFrames, setReleaseBegin, setReleaseEnd, setSustainBegin, setSustainEnd
public ShortSample()
public ShortSample(int numFrames, int channelsPerFrame)
public ShortSample(short[] data)
public ShortSample(short[] data, int channelsPerFrame)
public void allocate(int numFrames, int channelsPerFrame)
allocate
in class AudioSample
public void write(int startFrame, short[] 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, short[] 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(short[] data)
public void read(short[] data)
public short readShort(int index)
public void writeShort(int index, short value)
public double readDouble(int index)
readDouble
in interface SequentialData
readDouble
in class SequentialDataCommon
index
- sample index is ((frameIndex * channelsPerFrame) + channelIndex)public void writeDouble(int index, double value)
writeDouble
in interface SequentialData
writeDouble
in class SequentialDataCommon
index
- sample index is ((frameIndex * channelsPerFrame) + channelIndex)value
- the value to be written