Enum Class PcmEncoding

java.lang.Object
java.lang.Enum<PcmEncoding>
com.tino1b2be.dtmf.io.PcmEncoding
All Implemented Interfaces:
Serializable, Comparable<PcmEncoding>, Constable

public enum PcmEncoding extends Enum<PcmEncoding>
PCM encoding discriminator for RawPcmAudioSource and other linear-PCM carriers in dtmf-io.

The encoding is orthogonal to endianness and bit depth: a raw PCM byte buffer is fully described by the triple (bitDepth, byteOrder, encoding), and RawPcmAudioSource's constructor takes all three as separate parameters. This enum captures only the numeric-format dimension of the tuple; little-endian vs big-endian is carried by ByteOrder.

Not every (encoding, bitDepth) pair is valid. The cross-reference table below is enforced by RawPcmAudioSource's constructor validation (Requirements 7.7 and 7.8) and by the WAV provider's fmt chunk parser:

  • SIGNED_INT — valid bit depths are {16, 24, 32, 64}. Two's-complement signed integer PCM; by far the most common encoding in the wild (WAV PCM_SIGNED, telephony recordings, CD audio).
  • UNSIGNED_INT — valid bit depths are {16, 24, 32, 64}. Unsigned integer PCM, in which the midpoint 2^(bitDepth - 1) represents silence. Rare at these bit depths (the classic unsigned-PCM use case is 8-bit WAV, which is out of scope for this module); supported here for generality.
  • IEEE_FLOAT — valid bit depths are {32, 64} only. IEEE 754 floating point samples, already in [-1.0, 1.0] by convention and therefore read without scaling. Constructing a RawPcmAudioSource with IEEE_FLOAT at 16 or 24 bits throws IllegalArgumentException.

Bit depth 8 is not represented by any value of this enum because the whole module targets 16, 24, 32, and 64 bits (Requirement 3.4). MP3 sources do not use this enum: they always decode to signed 16-bit PCM and bypass the raw-PCM constructor path entirely.

Since:
2.1.0
See Also:
  • Enum Constant Details

    • SIGNED_INT

      public static final PcmEncoding SIGNED_INT
      Two's-complement signed integer PCM. Valid bit depths: {16, 24, 32, 64}.
    • UNSIGNED_INT

      public static final PcmEncoding UNSIGNED_INT
      Unsigned integer PCM; the midpoint 2^(bitDepth - 1) represents silence. Valid bit depths: {16, 24, 32, 64}.
    • IEEE_FLOAT

      public static final PcmEncoding IEEE_FLOAT
      IEEE 754 floating-point PCM, already in [-1.0, 1.0] by convention and read without scaling. Valid bit depths: {32, 64} only.
  • Method Details

    • values

      public static PcmEncoding[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static PcmEncoding valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null