public class MultiChannelBuffer
extends java.lang.Object
| Constructor and Description |
|---|
MultiChannelBuffer(int bufferSize,
int numChannels)
Construct a MultiChannelBuffer, providing a size and number of channels.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getBufferSize()
Returns the length of this buffer in samples.
|
float[] |
getChannel(int channelNumber)
Returns the requested channel as a float array.
|
int |
getChannelCount()
Returns the number of channels in this buffer.
|
float |
getSample(int channelNumber,
float sampleIndex)
Returns the interpolated value of a sample in the given channel,
at the given offset from the beginning of the buffer,
For instance, getSample( 0, 30.5f ) will
return an interpolated sample value in channel 0 that is
between the value at 30 and the value at 31.
|
float |
getSample(int channelNumber,
int sampleIndex)
Returns the value of a sample in the given channel,
at the given offset from the beginning of the buffer.
|
void |
set(MultiChannelBuffer otherBuffer)
Copy the data in the provided MultiChannelBuffer to this MultiChannelBuffer.
|
void |
setBufferSize(int bufferSize)
Set the length of this buffer in sample frames.
|
void |
setChannel(int channelNumber,
float[] samples)
Sets all of the values in a particular channel using
the values of the provided float array.
|
void |
setChannelCount(int numChannels)
Set the number of channels this buffer contains.
|
void |
setSample(int channelNumber,
int sampleIndex,
float value)
Sets the value of a sample in the given channel at the given
offset from the beginning of the buffer.
|
public MultiChannelBuffer(int bufferSize,
int numChannels)
bufferSize - int: The length of the buffer in sample frames.numChannels - int: The number of channels the buffer should contain.public void set(MultiChannelBuffer otherBuffer)
otherBuffer - the MultiChannelBuffer to copypublic int getBufferSize()
public int getChannelCount()
public float getSample(int channelNumber,
int sampleIndex)
channelNumber - int: the channel to get the sample value fromsampleIndex - int: the offset from the beginning of the buffer, in samples.public float getSample(int channelNumber,
float sampleIndex)
channelNumber - int: the channel to get the sample value fromsampleIndex - float: the offset from the beginning of the buffer, in samples.public void setSample(int channelNumber,
int sampleIndex,
float value)
channelNumber - int: the channel of the buffersampleIndex - int: the sample offset from the beginning of the buffervalue - float: the sample value to setpublic float[] getChannel(int channelNumber)
channelNumber - int: the channel to returnpublic void setChannel(int channelNumber,
float[] samples)
channelNumber - int: the channel to setsamples - float[]: the array of values to copy into the channelpublic void setChannelCount(int numChannels)
numChannels - int: the number of channels this buffer should containpublic void setBufferSize(int bufferSize)
bufferSize - int: the new length of this buffer in sample frames