Class OggVorbisAudioFormat


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

      • 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 Detail

      • getAudioFormatFromInputStream

        public static OggVorbisAudioFormat getAudioFormatFromInputStream​(InputStream inputStream)
                                                                  throws 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:
        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()
        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.