Class OggVorbisAudioFormat

java.lang.Object
ej.audio.AudioFormat
ej.audio.oggvorbis.OggVorbisAudioFormat

public class OggVorbisAudioFormat extends ej.audio.AudioFormat
AudioFormat which represents the format of an audio sink with the Ogg Vorbis encoding.
  • Constructor Details

    • OggVorbisAudioFormat

      public OggVorbisAudioFormat(int sampleRateHz, int numChannels)
      Creates an Ogg Vorbis audio format.
      Parameters:
      sampleRateHz - the sample rate (in Hz).
      numChannels - the number of channels.
      Throws:
      IllegalArgumentException - if the given sample rate or the given number of channels is less than or equal to zero.
      Since:
      3.0.0
  • Method Details

    • getAudioFormatFromInputStream

      public static OggVorbisAudioFormat getAudioFormatFromInputStream(InputStream inputStream) throws ej.audio.AudioException, IOException
      Creates an OggVorbisAudioFormat by parsing the Ogg Vorbis identification header from the given stream.

      The stream position is restored after parsing, so the same stream can subsequently be fed to an AudioSink. The stream must support mark/reset.

      Parameters:
      inputStream - the Ogg Vorbis input stream; must support mark/reset.
      Returns:
      the OggVorbisAudioFormat described by the stream header.
      Throws:
      ej.audio.AudioException - if the stream is not a valid Ogg Vorbis stream or the format is not recognized.
      IOException - if the stream cannot be read.
      Since:
      3.0.0
    • getEncoding

      public String getEncoding()
      Specified by:
      getEncoding in class ej.audio.AudioFormat
    • getParameters

      public int[] getParameters()
      Specified by:
      getParameters in class ej.audio.AudioFormat