Class PcmAudioFormat

java.lang.Object
ej.audio.AudioFormat
ej.audio.format.PcmAudioFormat

public class PcmAudioFormat extends AudioFormat
AudioFormat which represents the format of an audio sink with the PCM (Pulse-Code Modulation) encoding.
  • Constructor Details

    • PcmAudioFormat

      public PcmAudioFormat(int sampleRate, int numChannels, int bitDepth, boolean isBigEndian, boolean isSigned)
      Creates a PCM audio format.
      Parameters:
      sampleRate - the sample rate (in Hz).
      numChannels - the number of channels.
      bitDepth - the bit depth (the number of bits per sample: 8, 16, 24 or 32).
      isBigEndian - whether the data is in big endian or in little endian.
      isSigned - whether the data is signed or unsigned.
      Throws:
      IllegalArgumentException - if the given sample rate, the given number of channels or the given bit depth is less than or equal to zero.
  • Method Details

    • getEncoding

      public String getEncoding()
      Description copied from class: AudioFormat
      Returns the data format of an audio stream.
      Specified by:
      getEncoding in class AudioFormat
      Returns:
      the encoding format string.
    • getParameters

      public int[] getParameters()
      Description copied from class: AudioFormat
      Returns the parameters of this audio format.

      The parameters depend on the encoding. The semantics of every parameter is known by the low-level audio implementation.

      Specified by:
      getParameters in class AudioFormat
      Returns:
      the parameters.