public class LameEncoder
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static int |
BITRATE_AUTO |
static int |
CHANNEL_MODE_AUTO |
static int |
CHANNEL_MODE_DUAL_CHANNEL |
static int |
CHANNEL_MODE_JOINT_STEREO |
static int |
CHANNEL_MODE_MONO |
static int |
CHANNEL_MODE_STEREO |
static int |
MPEG_VERSION_1 |
static int |
MPEG_VERSION_2 |
static int |
MPEG_VERSION_2DOT5 |
static javax.sound.sampled.AudioFormat.Encoding |
MPEG1L3 |
static javax.sound.sampled.AudioFormat.Encoding |
MPEG2DOT5L3 |
static javax.sound.sampled.AudioFormat.Encoding |
MPEG2L3 |
static java.lang.String |
P_BITRATE
property key to read/set the bitrate: an Integer value.
|
static java.lang.String |
P_CHMODE
property key to read/set the channel mode: a String, one of
"jointstereo", "dual", "mono",
"auto" (default).
|
static java.lang.String |
P_QUALITY
property key to read/set the quality: an Integer from 1 (highest) to 9
(lowest).
|
static java.lang.String |
P_VBR
property key to read/set the VBR mode: an instance of Boolean (default:
false)
|
static int |
QUALITY_HIGH |
static int |
QUALITY_HIGHEST |
static int |
QUALITY_LOW |
static int |
QUALITY_LOWEST |
static int |
QUALITY_MIDDLE |
| Constructor and Description |
|---|
LameEncoder() |
LameEncoder(javax.sound.sampled.AudioFormat sourceFormat)
Initializes the encoder with the given source/PCM format.
|
LameEncoder(javax.sound.sampled.AudioFormat sourceFormat,
javax.sound.sampled.AudioFormat targetFormat)
Initializes the encoder with the given source/PCM format.
|
LameEncoder(javax.sound.sampled.AudioFormat sourceFormat,
int bitRate,
int channelMode,
int quality,
boolean VBR)
Initializes the encoder, overriding any parameters set in the audio
format's properties or in the system properties.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
float |
convertByteArrayToFloat(byte[] bytes,
int offset,
java.nio.ByteOrder byteOrder) |
int |
encodeBuffer(byte[] pcm,
int offset,
int length,
byte[] encoded)
Encode a block of data.
|
int |
encodeFinish(byte[] encoded) |
int |
getEffectiveBitRate() |
int |
getEffectiveChannelMode() |
javax.sound.sampled.AudioFormat.Encoding |
getEffectiveEncoding() |
javax.sound.sampled.AudioFormat |
getEffectiveFormat()
Return the audioformat representing the encoded mp3 stream.
|
int |
getEffectiveQuality() |
int |
getEffectiveSampleRate() |
boolean |
getEffectiveVBR() |
java.lang.String |
getEncoderVersion()
returns -1 if string is too short or returns one of the exception
constants if everything OK, returns the length of the string
|
int |
getInputBufferSize() |
int |
getMP3BufferSize() |
int |
getOutputBufferSize() |
int |
getPCMBufferSize()
Returns the buffer needed pcm buffer size.
|
javax.sound.sampled.AudioFormat |
getSourceFormat() |
javax.sound.sampled.AudioFormat |
getTargetFormat() |
void |
setFormat(javax.sound.sampled.AudioFormat sourceFormat,
javax.sound.sampled.AudioFormat targetFormat) |
void |
setSourceFormat(javax.sound.sampled.AudioFormat sourceFormat) |
void |
setTargetFormat(javax.sound.sampled.AudioFormat targetFormat) |
public static final javax.sound.sampled.AudioFormat.Encoding MPEG1L3
public static final javax.sound.sampled.AudioFormat.Encoding MPEG2L3
public static final javax.sound.sampled.AudioFormat.Encoding MPEG2DOT5L3
public static final java.lang.String P_VBR
public static final java.lang.String P_CHMODE
public static final java.lang.String P_BITRATE
public static final java.lang.String P_QUALITY
public static final int MPEG_VERSION_2
public static final int MPEG_VERSION_1
public static final int MPEG_VERSION_2DOT5
public static final int QUALITY_LOWEST
public static final int QUALITY_LOW
public static final int QUALITY_MIDDLE
public static final int QUALITY_HIGH
public static final int QUALITY_HIGHEST
public static final int CHANNEL_MODE_STEREO
public static final int CHANNEL_MODE_JOINT_STEREO
public static final int CHANNEL_MODE_DUAL_CHANNEL
public static final int CHANNEL_MODE_MONO
public static final int CHANNEL_MODE_AUTO
public static final int BITRATE_AUTO
public LameEncoder()
public LameEncoder(javax.sound.sampled.AudioFormat sourceFormat)
java.lang.IllegalArgumentException - when parameters are not supported by LAME.public LameEncoder(javax.sound.sampled.AudioFormat sourceFormat,
javax.sound.sampled.AudioFormat targetFormat)
java.lang.IllegalArgumentException - when parameters are not supported by LAME.public LameEncoder(javax.sound.sampled.AudioFormat sourceFormat,
int bitRate,
int channelMode,
int quality,
boolean VBR)
java.lang.IllegalArgumentException - when parameters are not supported by LAME.public void setSourceFormat(javax.sound.sampled.AudioFormat sourceFormat)
public void setTargetFormat(javax.sound.sampled.AudioFormat targetFormat)
public void setFormat(javax.sound.sampled.AudioFormat sourceFormat,
javax.sound.sampled.AudioFormat targetFormat)
public java.lang.String getEncoderVersion()
public int getPCMBufferSize()
public int getMP3BufferSize()
public int getInputBufferSize()
public int getOutputBufferSize()
public int encodeBuffer(byte[] pcm,
int offset,
int length,
byte[] encoded)
throws java.lang.ArrayIndexOutOfBoundsException
encoded array is too small, an
ArrayIndexOutOfBoundsException is thrown. length should be
the value returned by getPCMBufferSize.encoded. May be 0.java.lang.ArrayIndexOutOfBoundsExceptionpublic int encodeFinish(byte[] encoded)
public void close()
public javax.sound.sampled.AudioFormat getEffectiveFormat()
public int getEffectiveQuality()
public int getEffectiveBitRate()
public int getEffectiveChannelMode()
public boolean getEffectiveVBR()
public int getEffectiveSampleRate()
public javax.sound.sampled.AudioFormat.Encoding getEffectiveEncoding()
public final float convertByteArrayToFloat(byte[] bytes,
int offset,
java.nio.ByteOrder byteOrder)
public javax.sound.sampled.AudioFormat getSourceFormat()
public javax.sound.sampled.AudioFormat getTargetFormat()