Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## ddf.minim
Interface AudioBuffer

    public interface AudioBuffer

An `AudioBuffer` is specifically a buffer of floating point samples corresponding to a single channel of streaming audio. It is readonly, but you can obtain a copy of the samples in the buffer by using `toArray()`. In fact, when drawing a waveform, you should use `toArray` rather than iterating over the buffer itself. This is because it is possible that the samples in the buffer will be replaced with new ones between calls to `get(int)`, which results in a waveform that appears to have discontinuities in it.

Author:
  Damien Di Fede

Method Summary
`float` | `get(int i)` Gets the `ith` sample in the buffer.
`float` | `level()` Gets the current level of the buffer.
`int` | `size()` Returns the length of the buffer.
`float[]` | `toArray()` Returns the samples in the buffer in a new float array.

Method Detail

### size

    int size()

  Returns the length of the buffer.

  Returns:
    the number of samples in the buffer

### get

    float get(int i)

  Gets the `ith` sample in the buffer. This method does not do bounds checking, so it may throw an exception.

  Parameters:
    `i` - the index of the sample you want to get
  Returns:
    the `ith` sample

### level

    float level()

  Gets the current level of the buffer. It is calculated as the root-mean-squared of all the samples in the buffer.

  Returns:
    the RMS amplitude of the buffer

### toArray

    float[] toArray()

  Returns the samples in the buffer in a new float array. Modifying the samples in the returned array will not change the samples in the buffer.

  Returns:
    a new float array containing the buffer's samples

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD