Package com.tino1b2be.dtmf.io.internal
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.
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 TypeMethodDescriptiondoubledecode(byte[] data, int offset) Decode a single PCM sample starting atoffsetinto a normaliseddoublein[-1.0, 1.0].
-
Method Details
-
decode
double decode(byte[] data, int offset) Decode a single PCM sample starting atoffsetinto a normaliseddoublein[-1.0, 1.0].- Parameters:
data- byte buffer holding raw PCM bytesoffset- 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
-