net.beadsproject.beads.data
Class Buffer

java.lang.Object
  extended by net.beadsproject.beads.data.Buffer
All Implemented Interfaces:
java.io.Serializable

public class Buffer
extends java.lang.Object
implements java.io.Serializable

A Buffer stores a one-dimensional buffer of floats for use as a wavetable or a window.

Author:
ollie
See Also:
BufferFactory, Serialized Form

Field Summary
 float[] buf
          The buffer data.
static java.util.Hashtable<java.lang.String,Buffer> staticBufs
          A static storage area for common buffers, such as a sine wave.
 
Constructor Summary
Buffer(int size)
          Instantiates a new buffer.
 
Method Summary
 float getValueFraction(float fraction)
          Returns the value of the buffer at the given fraction along its length (0 = start, 1 = end).
 float getValueIndex(int index)
          Returns the value of the buffer at a specific index.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

staticBufs

public static final java.util.Hashtable<java.lang.String,Buffer> staticBufs
A static storage area for common buffers, such as a sine wave. Used by BufferFactory to keep track of common buffers.


buf

public final float[] buf
The buffer data.

Constructor Detail

Buffer

public Buffer(int size)
Instantiates a new buffer.

Parameters:
size - the size of the buffer.
Method Detail

getValueFraction

public float getValueFraction(float fraction)
Returns the value of the buffer at the given fraction along its length (0 = start, 1 = end).

Parameters:
fraction - the point along the buffer to inspect.
Returns:
the value at that point.

getValueIndex

public float getValueIndex(int index)
Returns the value of the buffer at a specific index.

Parameters:
index - the index to inspect.
Returns:
the value at that point.