Package ej.audio.mp3
Class Mp3AudioFormat
- java.lang.Object
-
- ej.audio.AudioFormat
-
- ej.audio.mp3.Mp3AudioFormat
-
public class Mp3AudioFormat extends AudioFormat
AudioFormatwhich represents the format of an audio sink with the MP3 encoding.
-
-
Constructor Summary
Constructors Constructor Description Mp3AudioFormat(int sampleRateHz, int numChannels)Creates an MP3 audio format.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Mp3AudioFormatgetAudioFormatFromInputStream(InputStream inputStream)GetsAudioFormatfrom the givenInputStream.StringgetEncoding()Returns the data format of an audio stream.int[]getParameters()Returns the parameters of this audio format.
-
-
-
Constructor Detail
-
Mp3AudioFormat
public Mp3AudioFormat(int sampleRateHz, int numChannels)Creates an MP3 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.
-
-
Method Detail
-
getAudioFormatFromInputStream
public static Mp3AudioFormat getAudioFormatFromInputStream(InputStream inputStream) throws AudioException, IOException
GetsAudioFormatfrom the givenInputStream.- Parameters:
inputStream- the input stream- Returns:
- the audio format
- Throws:
AudioException- when format is not recognizedIOException- when input stream cannot be read
-
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.
-
-