Interface SampleConversion.SampleDecoder

Enclosing class:
SampleConversion
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public static interface SampleConversion.SampleDecoder
Primitive functional interface for a single-frame PCM decoder.

Implementations read bytesPerSample bytes from data starting at offset, interpret them per the decoder's fixed (bitDepth, byteOrder, encoding) tuple, and return the normalised double sample. Bounds checking is the caller's responsibility: each call assumes data contains enough bytes starting at offset.

Decoders are stateless and may be cached or shared across threads.

Since:
2.1.0
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    decode(byte[] data, int offset)
    Decode a single PCM sample starting at offset into a normalised double in [-1.0, 1.0].
  • Method Details

    • decode

      double decode(byte[] data, int offset)
      Decode a single PCM sample starting at offset into a normalised double in [-1.0, 1.0].
      Parameters:
      data - byte buffer holding raw PCM bytes
      offset - byte index of the first byte of the sample; the decoder reads the fixed number of bytes for its bit depth starting here
      Returns:
      normalised sample value