Package ej.audio.oggvorbis
Class OggVorbisAudioFormat
- java.lang.Object
-
- ej.audio.AudioFormat
-
- ej.audio.oggvorbis.OggVorbisAudioFormat
-
public class OggVorbisAudioFormat extends AudioFormat
AudioFormatwhich represents the format of an audio sink with the Ogg Vorbis encoding.
-
-
Constructor Summary
Constructors Constructor Description OggVorbisAudioFormat(int sampleRateHz, int numChannels)Creates an Ogg Vorbis audio format.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static OggVorbisAudioFormatgetAudioFormatFromInputStream(InputStream inputStream)Creates anOggVorbisAudioFormatby parsing the Ogg Vorbis identification header from the given stream.StringgetEncoding()Returns the data format of an audio stream.int[]getParameters()Returns the parameters of this audio format.
-
-
-
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 anOggVorbisAudioFormatby 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
OggVorbisAudioFormatdescribed 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:AudioFormatReturns the data format of an audio stream.- Specified by:
getEncodingin classAudioFormat- Returns:
- the encoding format string.
-
getParameters
public int[] getParameters()
Description copied from class:AudioFormatReturns 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:
getParametersin classAudioFormat- Returns:
- the parameters.
-
-