org.tritonus.lowlevel.lame
Class Lame

java.lang.Object
  extended byorg.tritonus.lowlevel.lame.Lame

public class Lame
extends Object


Field Summary
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 QUALITY_HIGH
           
static int QUALITY_HIGHEST
           
static int QUALITY_LOW
           
static int QUALITY_LOWEST
           
static int QUALITY_MIDDLE
           
 
Constructor Summary
Lame(AudioFormat sourceFormat)
          Initializes the decoder with DEFAULT_BITRATE, DEFAULT_CHANNEL_MODE, DEFAULT_QUALITY, and DEFAULT_VBR Throws IllegalArgumentException when parameters are not supported by LAME.
Lame(AudioFormat sourceFormat, int bitRate, int channelMode, int quality, boolean VBR)
          Initializes the decoder.
 
Method Summary
 void close()
           
 int encodeBuffer(byte[] pcm, int offset, int length, byte[] encoded)
          Encode a block of data.
 int encodeFinish(byte[] encoded)
           
 int getEffectiveBitRate()
           
 int getEffectiveChannelMode()
           
 AudioFormat.Encoding getEffectiveEncoding()
           
 int getEffectiveQuality()
           
 int getEffectiveSampleRate()
           
 boolean getEffectiveVBR()
           
 String getEncoderVersion()
           
static String getLinkError()
           
 int getMP3BufferSize()
           
 int getPCMBufferSize()
          Returns the buffer needed pcm buffer size.
static boolean isLibAvailable()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

QUALITY_LOWEST

public static final int QUALITY_LOWEST
See Also:
Constant Field Values

QUALITY_LOW

public static final int QUALITY_LOW
See Also:
Constant Field Values

QUALITY_MIDDLE

public static final int QUALITY_MIDDLE
See Also:
Constant Field Values

QUALITY_HIGH

public static final int QUALITY_HIGH
See Also:
Constant Field Values

QUALITY_HIGHEST

public static final int QUALITY_HIGHEST
See Also:
Constant Field Values

CHANNEL_MODE_STEREO

public static final int CHANNEL_MODE_STEREO
See Also:
Constant Field Values

CHANNEL_MODE_JOINT_STEREO

public static final int CHANNEL_MODE_JOINT_STEREO
See Also:
Constant Field Values

CHANNEL_MODE_DUAL_CHANNEL

public static final int CHANNEL_MODE_DUAL_CHANNEL
See Also:
Constant Field Values

CHANNEL_MODE_MONO

public static final int CHANNEL_MODE_MONO
See Also:
Constant Field Values

CHANNEL_MODE_AUTO

public static final int CHANNEL_MODE_AUTO
See Also:
Constant Field Values

BITRATE_AUTO

public static final int BITRATE_AUTO
See Also:
Constant Field Values
Constructor Detail

Lame

public Lame(AudioFormat sourceFormat)
Initializes the decoder with DEFAULT_BITRATE, DEFAULT_CHANNEL_MODE, DEFAULT_QUALITY, and DEFAULT_VBR Throws IllegalArgumentException when parameters are not supported by LAME.


Lame

public Lame(AudioFormat sourceFormat,
            int bitRate,
            int channelMode,
            int quality,
            boolean VBR)
Initializes the decoder. Throws IllegalArgumentException when parameters are not supported by LAME.

Method Detail

getEncoderVersion

public String getEncoderVersion()

getPCMBufferSize

public int getPCMBufferSize()
Returns the buffer needed pcm buffer size. The passed parameter is a wished buffer size. The implementation of the encoder may return a lower or higher buffer size. The encoder must be initalized (i.e. not closed) at this point. A return value of <0 denotes an error.


getMP3BufferSize

public int getMP3BufferSize()

encodeBuffer

public int encodeBuffer(byte[] pcm,
                        int offset,
                        int length,
                        byte[] encoded)
                 throws ArrayIndexOutOfBoundsException
Encode a block of data. Throws IllegalArgumentException when parameters are wrong. When the encoded array is too small, an ArrayIndexOutOfBoundsException is thrown. length should be the value returned by getPCMBufferSize.

Returns:
the number of bytes written to encoded. May be 0.
Throws:
ArrayIndexOutOfBoundsException

encodeFinish

public int encodeFinish(byte[] encoded)

close

public void close()

isLibAvailable

public static boolean isLibAvailable()

getLinkError

public static String getLinkError()

getEffectiveQuality

public int getEffectiveQuality()

getEffectiveBitRate

public int getEffectiveBitRate()

getEffectiveChannelMode

public int getEffectiveChannelMode()

getEffectiveVBR

public boolean getEffectiveVBR()

getEffectiveSampleRate

public int getEffectiveSampleRate()

getEffectiveEncoding

public AudioFormat.Encoding getEffectiveEncoding()