Package ej.audio.oggvorbis
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 Summary
ConstructorsConstructorDescriptionOggVorbisAudioFormat(int sampleRateHz, int numChannels) Creates an Ogg Vorbis audio format. -
Method Summary
Modifier and TypeMethodDescriptionstatic OggVorbisAudioFormatgetAudioFormatFromInputStream(InputStream inputStream) Creates anOggVorbisAudioFormatby parsing the Ogg Vorbis identification header from the given stream.int[]
-
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 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:
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
- Specified by:
getEncodingin classej.audio.AudioFormat
-
getParameters
public int[] getParameters()- Specified by:
getParametersin classej.audio.AudioFormat
-