# /home/humfrn01/Projects/twolame/trunk/libtwolame/twolame.h File Reference

Go to the source code of this file.

## Defines

#define | TWOLAME_SAMPLES_PER_FRAME (1152)

## Typedefs

typedef twolame_options_struct | twolame_options

## Enumerations

enum | TWOLAME_MPEG_mode { TWOLAME_AUTO_MODE = -1, TWOLAME_STEREO = 0, TWOLAME_JOINT_STEREO, TWOLAME_DUAL_CHANNEL, TWOLAME_MONO }
enum | TWOLAME_MPEG_version { TWOLAME_MPEG2 = 0, TWOLAME_MPEG1 }
enum | TWOLAME_Padding { TWOLAME_PAD_NO = 0, TWOLAME_PAD_ALL }
enum | TWOLAME_Emphasis { TWOLAME_EMPHASIS_N = 0, TWOLAME_EMPHASIS_5 = 1, TWOLAME_EMPHASIS_C = 3 }

## Functions

const char * | get_twolame_version (void)
const char * | get_twolame_url (void)
void | twolame_print_config (twolame_options *glopts)
twolame_options * | twolame_init (void)
int | twolame_init_params (twolame_options *glopts)
int | twolame_encode_buffer (twolame_options *glopts, const short int leftpcm[], const short int rightpcm[], int num_samples, unsigned char *mp2buffer, int mp2buffer_size)
int | twolame_encode_buffer_interleaved (twolame_options *glopts, const short int pcm[], int num_samples, unsigned char *mp2buffer, int mp2buffer_size)
int | twolame_encode_buffer_float32 (twolame_options *glopts, const float leftpcm[], const float rightpcm[], int num_samples, unsigned char *mp2buffer, int mp2buffer_size)
int | twolame_encode_buffer_float32_interleaved (twolame_options *glopts, const float pcm[], int num_samples, unsigned char *mp2buffer, int mp2buffer_size)
int | twolame_encode_flush (twolame_options *glopts, unsigned char *mp2buffer, int mp2buffer_size)
void | twolame_close (twolame_options **glopts)
int | twolame_set_verbosity (twolame_options *glopts, int verbosity)
int | twolame_get_verbosity (twolame_options *glopts)
int | twolame_set_mode (twolame_options *glopts, TWOLAME_MPEG_mode mode)
TWOLAME_MPEG_mode | twolame_get_mode (twolame_options *glopts)
const char * | twolame_get_mode_name (twolame_options *glopts)
int | twolame_set_version (twolame_options *glopts, TWOLAME_MPEG_version version)
TWOLAME_MPEG_version | twolame_get_version (twolame_options *glopts)
const char * | twolame_get_version_name (twolame_options *glopts)
int | twolame_get_framelength (twolame_options *glopts)
int | twolame_set_psymodel (twolame_options *glopts, int psymodel)
int | twolame_get_psymodel (twolame_options *glopts)
int | twolame_set_num_channels (twolame_options *glopts, int num_channels)
int | twolame_get_num_channels (twolame_options *glopts)
int | twolame_set_scale (twolame_options *glopts, float scale)
float | twolame_get_scale (twolame_options *glopts)
int | twolame_set_scale_left (twolame_options *glopts, float scale)
float | twolame_get_scale_left (twolame_options *glopts)
int | twolame_set_scale_right (twolame_options *glopts, float scale)
float | twolame_get_scale_right (twolame_options *glopts)
int | twolame_set_in_samplerate (twolame_options *glopts, int samplerate)
int | twolame_get_in_samplerate (twolame_options *glopts)
int | twolame_set_out_samplerate (twolame_options *glopts, int samplerate)
int | twolame_get_out_samplerate (twolame_options *glopts)
int | twolame_set_bitrate (twolame_options *glopts, int bitrate)
int | twolame_get_bitrate (twolame_options *glopts)
int | twolame_set_brate (twolame_options *glopts, int bitrate)
int | twolame_get_brate (twolame_options *glopts)
int | twolame_set_padding (twolame_options *glopts, TWOLAME_Padding padding)
TWOLAME_Padding | twolame_get_padding (twolame_options *glopts)
int | twolame_set_energy_levels (twolame_options *glopts, int energylevels)
int | twolame_get_energy_levels (twolame_options *glopts)
int | twolame_set_num_ancillary_bits (twolame_options *glopts, int num)
int | twolame_get_num_ancillary_bits (twolame_options *glopts)
int | twolame_set_emphasis (twolame_options *glopts, TWOLAME_Emphasis emphasis)
TWOLAME_Emphasis | twolame_get_emphasis (twolame_options *glopts)
int | twolame_set_error_protection (twolame_options *glopts, int err_protection)
int | twolame_get_error_protection (twolame_options *glopts)
int | twolame_set_copyright (twolame_options *glopts, int copyright)
int | twolame_get_copyright (twolame_options *glopts)
int | twolame_set_original (twolame_options *glopts, int original)
int | twolame_get_original (twolame_options *glopts)
int | twolame_set_VBR (twolame_options *glopts, int vbr)
int | twolame_get_VBR (twolame_options *glopts)
int | twolame_set_VBR_level (twolame_options *glopts, float level)
float | twolame_get_VBR_level (twolame_options *glopts)
int | twolame_set_ATH_level (twolame_options *glopts, float level)
float | twolame_get_ATH_level (twolame_options *glopts)
int | twolame_set_VBR_max_bitrate_kbps (twolame_options *glopts, int bitrate)
int | twolame_get_VBR_max_bitrate_kbps (twolame_options *glopts)
int | twolame_set_quick_mode (twolame_options *glopts, int quickmode)
int | twolame_get_quick_mode (twolame_options *glopts)
int | twolame_set_quick_count (twolame_options *glopts, int quickcount)
int | twolame_get_quick_count (twolame_options *glopts)
int | twolame_set_DAB (twolame_options *glopts, int dab)
int | twolame_get_DAB (twolame_options *glopts)
int | twolame_set_DAB_xpad_length (twolame_options *glopts, int length)
int | twolame_get_DAB_xpad_length (twolame_options *glopts)
int | twolame_set_DAB_crc_length (twolame_options *glopts, int length)
int | twolame_get_DAB_crc_length (twolame_options *glopts)

## Detailed Description

## Define Documentation

#define TWOLAME_SAMPLES_PER_FRAME (1152)

Number of samples per frame of Layer 2 MPEG Audio

## Typedef Documentation

typedef struct twolame_options_struct twolame_options

Opaque data type for the twolame encoder options.

## Enumeration Type Documentation

enum TWOLAME_MPEG_mode

MPEG modes

Enumerator:

  TWOLAME_AUTO_MODE | Choose Mode Automatically
  TWOLAME_STEREO | Stereo
  TWOLAME_JOINT_STEREO | Joint Stereo
  TWOLAME_DUAL_CHANNEL | Dual Channel
  TWOLAME_MONO | Mono

enum TWOLAME_MPEG_version

MPEG Version.

MPEG2 is for Lower Sampling Frequencies - LSF < 32000.

Enumerator:

  TWOLAME_MPEG2 | MPEG-2 - for sample rates less than 32k
  TWOLAME_MPEG1 | MPEG-1

enum TWOLAME_Padding

Padding types.

Enumerator:

  TWOLAME_PAD_NO | No Padding
  TWOLAME_PAD_ALL | Pad all frames

enum TWOLAME_Emphasis

Emphasis types.

Enumerator:

  TWOLAME_EMPHASIS_N | No Emphasis
  TWOLAME_EMPHASIS_5 | 50/15 ms
  TWOLAME_EMPHASIS_C | CCIT J.17

## Function Documentation

const char* get_twolame_version | ( | void |  | ) |

Get the version number of the TwoLAME library. eg "0.3.1".

Returns:
  The version number as a C string

const char* get_twolame_url | ( | void |  | ) |

Get the URL of the TwoLAME homepage. eg "http://www.twolame.org/".

Returns:
  The url as a C string

void twolame_print_config | ( | twolame_options * | glopts | ) |

Print the library version and encoder parameter settings to STDERR.

Will display differnent ammounts of information depending on the verbosity setting. If verbosity is set to 0 then no message will be displayed.

Parameters:

  | glopts | Options pointer created by twolame_init()

twolame_options* twolame_init | ( | void |  | ) |

Initialise the twolame encoder.

Sets defaults for all parameters. Will return NULL if malloc() failed, otherwise returns a pointer which you then need to pass to all future API calls.

Returns:
  a pointer to your new options data structure

int twolame_init_params | ( | twolame_options * | glopts | ) |

Prepare to start encoding.

You must call twolame_init_params() before you start encoding. It will check call your parameters to make sure they are valid, as well as allocating buffers and initising internally used variables.

Parameters:

  | glopts | Options pointer created by twolame_init()

Returns:
  0 if all patameters are valid, non-zero if something is invalid

int twolame_encode_buffer | ( | twolame_options * | glopts,
|  | const short int | leftpcm[],
|  | const short int | rightpcm[],
|  | int | num_samples,
|  | unsigned char * | mp2buffer,
|  | int | mp2buffer_size |
| ) |  |  |

Encode some 16-bit PCM audio to MP2.

Takes 16-bit PCM audio samples from seperate left and right buffers and places encoded audio into mp2buffer.

Parameters:

  | glopts | twolame options pointer
  | leftpcm | Left channel audio samples
  | rightpcm | Right channel audio samples
  | num_samples | Number of samples per channel
  | mp2buffer | Buffer to place encoded audio into
  | mp2buffer_size | Size of the output buffer

Returns:
  The number of bytes put in output buffer or a negative value on error

int twolame_encode_buffer_interleaved | ( | twolame_options * | glopts,
|  | const short int | pcm[],
|  | int | num_samples,
|  | unsigned char * | mp2buffer,
|  | int | mp2buffer_size |
| ) |  |  |

Encode some 16-bit PCM audio to MP2.

Takes interleaved 16-bit PCM audio samples from a single buffer and places encoded audio into mp2buffer.

Parameters:

  | glopts | twolame options pointer
  | pcm | Audio samples for left AND right channels
  | num_samples | Number of samples per channel
  | mp2buffer | Buffer to place encoded audio into
  | mp2buffer_size | Size of the output buffer

Returns:
  The number of bytes put in output buffer or a negative value on error

int twolame_encode_buffer_float32 | ( | twolame_options * | glopts,
|  | const float | leftpcm[],
|  | const float | rightpcm[],
|  | int | num_samples,
|  | unsigned char * | mp2buffer,
|  | int | mp2buffer_size |
| ) |  |  |

Encode some 32-bit PCM audio to MP2.

Takes 32-bit floating point PCM audio samples from seperate left and right buffers and places encoded audio into mp2buffer.

Note: the 32-bit samples are currently scaled down to 16-bit samples internally.

Parameters:

  | glopts | twolame options pointer
  | leftpcm | Left channel audio samples
  | rightpcm | Right channel audio samples
  | num_samples | Number of samples per channel
  | mp2buffer | Buffer to place encoded audio into
  | mp2buffer_size | Size of the output buffer

Returns:
  The number of bytes put in output buffer or a negative value on error

int twolame_encode_buffer_float32_interleaved | ( | twolame_options * | glopts,
|  | const float | pcm[],
|  | int | num_samples,
|  | unsigned char * | mp2buffer,
|  | int | mp2buffer_size |
| ) |  |  |

Encode some 32-bit PCM audio to MP2.

Takes 32-bit floating point PCM audio samples from a single buffer and places encoded audio into mp2buffer.

Parameters:

  | glopts | twolame options pointer
  | pcm | Audio samples for left AND right channels
  | num_samples | Number of samples per channel
  | mp2buffer | Buffer to place encoded audio into
  | mp2buffer_size | Size of the output buffer

Returns:
  The number of bytes put in output buffer or a negative value on error

int twolame_encode_flush | ( | twolame_options * | glopts,
|  | unsigned char * | mp2buffer,
|  | int | mp2buffer_size |
| ) |  |  |

Encode any remains buffered PCM audio to MP2.

Encodes any remaining audio samples in the libtwolame internal sample buffer. This function will return at most a single frame of MPEG Audio, and at least 0 frames.

Parameters:

  | glopts | twolame options pointer
  | mp2buffer | Buffer to place encoded audio into
  | mp2buffer_size | Size of the output buffer

Returns:
  The number of bytes put in output buffer or a negative value on error

void twolame_close | ( | twolame_options ** | glopts | ) |

Shut down the twolame encoder.

Shuts down the twolame encoder and frees all memory that it previously allocated. You should call this once you have finished all your encoding. This function will set your glopts pointer to NULL for you.

Parameters:

  | glopts | pointer to twolame options pointer

int twolame_set_verbosity | ( | twolame_options * | glopts,
|  | int | verbosity |
| ) |  |  |

Set the verbosity of the encoder.

Sets how verbose the encoder is with the debug and informational messages it displays. The higher the number, the more messages it will display. Set to 0 for no status messages to STDERR ( error messages will still be displayed ).

Default: 1

Parameters:

  | glopts | pointer to twolame options pointer
  | verbosity | integer between 0 and 10

Returns:
  0 if successful, non-zero on failure

int twolame_get_verbosity | ( | twolame_options * | glopts | ) |

Get the verbosity of the encoder.

Parameters:

  | glopts | pointer to twolame options pointer

Returns:
  integer indicating the verbosity of the encoder (0-10)

int twolame_set_mode | ( | twolame_options * | glopts,
|  | TWOLAME_MPEG_mode | mode |
| ) |  |  |

Set the MPEG Audio Mode (Mono, Stereo, etc) for the output stream.

Default: TWOLAME_AUTO_MODE

Parameters:

  | glopts | pointer to twolame options pointer
  | mode | the mode to set to

Returns:
  0 if successful, non-zero on failure

TWOLAME_MPEG_mode twolame_get_mode | ( | twolame_options * | glopts | ) |

Get the MPEG Audio mode of the output stream.

Parameters:

  | glopts | pointer to twolame options pointer

Returns:
  the MPEG audio mode

const char* twolame_get_mode_name | ( | twolame_options * | glopts | ) |

Get a string name for the current MPEG Audio mode.

Parameters:

  | glopts | pointer to twolame options pointer

Returns:
  the name of the MPEG audio mode as a string

int twolame_set_version | ( | twolame_options * | glopts,
|  | TWOLAME_MPEG_version | version |
| ) |  |  |

Set the MPEG version of the MPEG audio stream.

Default: TWOLAME_MPEG1

Parameters:

  | glopts | pointer to twolame options pointer
  | version | the version to set to

Returns:
  0 if successful, non-zero on failure

TWOLAME_MPEG_version twolame_get_version | ( | twolame_options * | glopts | ) |

Get the MPEG version of the output stream.

Parameters:

  | glopts | pointer to twolame options pointer

Returns:
  the MPEG version

const char* twolame_get_version_name | ( | twolame_options * | glopts | ) |

Get a string name for the current MPEG version.

Parameters:

  | glopts | pointer to twolame options pointer

Returns:
  the name of the MPEG version as a string

int twolame_get_framelength | ( | twolame_options * | glopts | ) |

Get the number of bytes per MPEG audio frame, for current settings.

Parameters:

  | glopts | pointer to twolame options pointer

Returns:
  the number of bytes per frame

int twolame_set_psymodel | ( | twolame_options * | glopts,
|  | int | psymodel |
| ) |  |  |

Set the Psychoacoustic Model used to encode the audio.

Default: 3

Parameters:

  | glopts | pointer to twolame options pointer
  | psymodel | the psychoacoustic model number

Returns:
  0 if successful, non-zero on failure

int twolame_get_psymodel | ( | twolame_options * | glopts | ) |

Get the Psychoacoustic Model used to encode the audio.

Parameters:

  | glopts | pointer to twolame options pointer

Returns:
  the psychoacoustic model number

int twolame_set_num_channels | ( | twolame_options * | glopts,
|  | int | num_channels |
| ) |  |  |

Set the number of channels in the input stream.

If this is different the number of channels in the output stream (set by mode) then the encoder will automatically downmix/upmix the audio.

Default: 2

Parameters:

  | glopts | pointer to twolame options pointer
  | num_channels | the number of input channels

Returns:
  0 if successful, non-zero on failure

int twolame_get_num_channels | ( | twolame_options * | glopts | ) |

Get the number of channels in the input stream.

Parameters:

  | glopts | pointer to twolame options pointer

Returns:
  the number of channels

int twolame_set_scale | ( | twolame_options * | glopts,
|  | float | scale |
| ) |  |  |

Set the scaling level for audio before encoding.

Set to 0 to disable.

Default: 0

Parameters:

  | glopts | pointer to twolame options pointer
  | scale | the amount to scale by

Returns:
  0 if successful, non-zero on failure

float twolame_get_scale | ( | twolame_options * | glopts | ) |

Get the scaling level for audio before encoding.

Parameters:

  | glopts | pointer to twolame options pointer

Returns:
  the amount to scale audio sample by

int twolame_set_scale_left | ( | twolame_options * | glopts,
|  | float | scale |
| ) |  |  |

Set the scaling level for left channel audio before encoding.

Set to 0 to disable.

Default: 0

Parameters:

  | glopts | pointer to twolame options pointer
  | scale | the amount to scale by

Returns:
  0 if successful, non-zero on failure

float twolame_get_scale_left | ( | twolame_options * | glopts | ) |

Get the scaling level for audio left channel before encoding.

Parameters:

  | glopts | pointer to twolame options pointer

Returns:
  the amount to scale left channel audio samples by

int twolame_set_scale_right | ( | twolame_options * | glopts,
|  | float | scale |
| ) |  |  |

Set the scaling level for right channel audio before encoding.

Set to 0 to disable.

Default: 0

Parameters:

  | glopts | pointer to twolame options pointer
  | scale | the amount to scale by

Returns:
  0 if successful, non-zero on failure

float twolame_get_scale_right | ( | twolame_options * | glopts | ) |

Get the scaling level for audio right channel before encoding.

Parameters:

  | glopts | pointer to twolame options pointer

Returns:
  the amount to scale right channel audio samples by

int twolame_set_in_samplerate | ( | twolame_options * | glopts,
|  | int | samplerate |
| ) |  |  |

Set the samplerate of the PCM audio input.

Default: 44100

Parameters:

  | glopts | pointer to twolame options pointer
  | samplerate | the samplerate in Hz

Returns:
  0 if successful, non-zero on failure

int twolame_get_in_samplerate | ( | twolame_options * | glopts | ) |

Get the samplerate of the PCM audio input.

Parameters:

  | glopts | pointer to twolame options pointer

Returns:
  the input samplerate

int twolame_set_out_samplerate | ( | twolame_options * | glopts,
|  | int | samplerate |
| ) |  |  |

Set the samplerate of the MPEG audio output.

Default: 44100

Parameters:

  | glopts | pointer to twolame options pointer
  | samplerate | the samplerate in Hz

Returns:
  0 if successful, non-zero on failure

int twolame_get_out_samplerate | ( | twolame_options * | glopts | ) |

Get the samplerate of the MPEG audio output.

Parameters:

  | glopts | pointer to twolame options pointer

Returns:
  the output samplerate

int twolame_set_bitrate | ( | twolame_options * | glopts,
|  | int | bitrate |
| ) |  |  |

Set the bitrate of the MPEG audio output stream.

Default: 192

Parameters:

  | glopts | pointer to twolame options pointer
  | bitrate | the bitrate in kbps

Returns:
  0 if successful, non-zero on failure

int twolame_get_bitrate | ( | twolame_options * | glopts | ) |

Get the bitrate of the MPEG audio output.

Parameters:

  | glopts | pointer to twolame options pointer

Returns:
  the output bitrate in kbps

int twolame_set_brate | ( | twolame_options * | glopts,
|  | int | bitrate |
| ) |  |  |

Set the bitrate of the MPEG audio output stream (LAME style).

same as twolame_set_bitrate()

int twolame_get_brate | ( | twolame_options * | glopts | ) |

Get the bitrate of the MPEG audio output stream (LAME style).

same as twolame_get_bitrate()

int twolame_set_padding | ( | twolame_options * | glopts,
|  | TWOLAME_Padding | padding |
| ) |  |  |

Set frame padding for the MPEG audio output stream.

i.e. adjust frame sizes to achieve overall target bitrate

Default: TWOLAME_PAD_NO

Parameters:

  | glopts | pointer to twolame options pointer
  | padding | the padding type

Returns:
  0 if successful, non-zero on failure

TWOLAME_Padding twolame_get_padding | ( | twolame_options * | glopts | ) |

Get the padding type of the MPEG audio output.

Parameters:

  | glopts | pointer to twolame options pointer

Returns:
  the output bitrate in kbps

int twolame_set_energy_levels | ( | twolame_options * | glopts,
|  | int | energylevels |
| ) |  |  |

Enable/Disable Energy Level Extension.

Enable writing the peak PCM level (energy level) at the end of each MPEG audio frame (in the ancillary bits). This function will automatically call twolame_set_num_ancillary_bits() to set the required number of ancillary bits for this feature.

The energy level extension is commonly used in the broadcast industry for visualising the audio in editing applications without decoding.

Default: FALSE

Parameters:

  | glopts | pointer to twolame options pointer
  | energylevels | energy level extension state (TRUE/FALSE)

Returns:
  0 if successful, non-zero on failure

int twolame_get_energy_levels | ( | twolame_options * | glopts | ) |

Get the Energy Level Extension state.

Parameters:

  | glopts | pointer to twolame options pointer

Returns:
  state of the Energy Level Extension (TRUE/FALSE)

int twolame_set_num_ancillary_bits | ( | twolame_options * | glopts,
|  | int | num |
| ) |  |  |

Set number of Ancillary Bits at end of frame.

Default: 0

Parameters:

  | glopts | pointer to twolame options pointer
  | num | number of bits to reserve

Returns:
  0 if successful, non-zero on failure

int twolame_get_num_ancillary_bits | ( | twolame_options * | glopts | ) |

Get the number of Ancillary Bits at end of frame.

Parameters:

  | glopts | pointer to twolame options pointer

Returns:
  number of Ancillary Bits at end of frame

int twolame_set_emphasis | ( | twolame_options * | glopts,
|  | TWOLAME_Emphasis | emphasis |
| ) |  |  |

Set the type of pre-emphasis to be applied to the decoded audio.

Default: TWOLAME_EMPHASIS_N

Parameters:

  | glopts | pointer to twolame options pointer
  | emphasis | the type of pre-emphasis

Returns:
  0 if successful, non-zero on failure

TWOLAME_Emphasis twolame_get_emphasis | ( | twolame_options * | glopts | ) |

Get the type of pre-emphasis to be applied to the decoded audio.

Parameters:

  | glopts | pointer to twolame options pointer

Returns:
  the type of pre-emphasis

int twolame_set_error_protection | ( | twolame_options * | glopts,
|  | int | err_protection |
| ) |  |  |

Enable/Disable CRC Error Protection.

Default: FALSE

Parameters:

  | glopts | pointer to twolame options pointer
  | err_protection | error protection state (TRUE/FALSE)

Returns:
  0 if successful, non-zero on failure

int twolame_get_error_protection | ( | twolame_options * | glopts | ) |

Get the CRC Error Protection state.

Parameters:

  | glopts | pointer to twolame options pointer

Returns:
  state of Error Protection (TRUE/FALSE)

int twolame_set_copyright | ( | twolame_options * | glopts,
|  | int | copyright |
| ) |  |  |

Set the MPEG Audio Copyright flag.

Indicates that MPEG stream is copyrighted.

Default: FALSE

Parameters:

  | glopts | pointer to twolame options pointer
  | copyright | copyright flag state (TRUE/FALSE)

Returns:
  0 if successful, non-zero on failure

int twolame_get_copyright | ( | twolame_options * | glopts | ) |

Get the copright flag state

Parameters:

  | glopts | pointer to twolame options pointer

Returns:
  state of the copyright flag (TRUE/FALSE)

int twolame_set_original | ( | twolame_options * | glopts,
|  | int | original |
| ) |  |  |

Set the MPEG Audio Original flag.

Default: FALSE

Parameters:

  | glopts | pointer to twolame options pointer
  | original | original flag state (TRUE/FALSE)

Returns:
  0 if successful, non-zero on failure

int twolame_get_original | ( | twolame_options * | glopts | ) |

Get the origianl flag state.

Parameters:

  | glopts | pointer to twolame options pointer

Returns:
  state of the original flag (TRUE/FALSE)

int twolame_set_VBR | ( | twolame_options * | glopts,
|  | int | vbr |
| ) |  |  |

Enable/Disable VBR (Variable Bit Rate) mode.

Default: FALSE

Parameters:

  | glopts | pointer to twolame options pointer
  | vbr | VBR state (TRUE/FALSE)

Returns:
  0 if successful, non-zero on failure

int twolame_get_VBR | ( | twolame_options * | glopts | ) |

Get the VBR state.

Parameters:

  | glopts | pointer to twolame options pointer

Returns:
  state of VBR (TRUE/FALSE)

int twolame_set_VBR_level | ( | twolame_options * | glopts,
|  | float | level |
| ) |  |  |

Set the level/quality of the VBR audio.

The level value can is a measurement of quality - the higher the level the higher the average bitrate of the resultant file.

Default: 5.0

Parameters:

  | glopts | pointer to twolame options pointer
  | level | quality level (-10 to 10)

Returns:
  0 if successful, non-zero on failure

float twolame_get_VBR_level | ( | twolame_options * | glopts | ) |

Get the level/quality of the VBR audio.

Parameters:

  | glopts | pointer to twolame options pointer

Returns:
  quality value for VBR

int twolame_set_ATH_level | ( | twolame_options * | glopts,
|  | float | level |
| ) |  |  |

Set the adjustment (in dB) applied to the ATH for Psycho models 3 and 4.

Default: 0.0

Parameters:

  | glopts | pointer to twolame options pointer
  | level | adjustment level in db

Returns:
  0 if successful, non-zero on failure

float twolame_get_ATH_level | ( | twolame_options * | glopts | ) |

Get the adjustment (in dB) applied to the ATH for Psycho models 3 and 4.

Parameters:

  | glopts | pointer to twolame options pointer

Returns:
  adjustment level in db

int twolame_set_VBR_max_bitrate_kbps | ( | twolame_options * | glopts,
|  | int | bitrate |
| ) |  |  |

Set the upper bitrate for VBR

Default: 0 (off)

Parameters:

  | glopts | pointer to twolame options pointer
  | bitrate | upper bitrate for VBR

Returns:
  0 if successful, non-zero on failure

int twolame_get_VBR_max_bitrate_kbps | ( | twolame_options * | glopts | ) |

Get the upper bitrate for VBR.

Parameters:

  | glopts | pointer to twolame options pointer

Returns:
  the upper bitrate for VBR

int twolame_set_quick_mode | ( | twolame_options * | glopts,
|  | int | quickmode |
| ) |  |  |

Enable/Disable the quick mode for psycho model calculation.

Default: FALSE

Parameters:

  | glopts | pointer to twolame options pointer
  | quickmode | the state of quick mode (TRUE/FALSE)

Returns:
  0 if successful, non-zero on failure

int twolame_get_quick_mode | ( | twolame_options * | glopts | ) |

Get the state of quick mode.

Parameters:

  | glopts | pointer to twolame options pointer

Returns:
  the state of quick mode (TRUE/FALSE)

int twolame_set_quick_count | ( | twolame_options * | glopts,
|  | int | quickcount |
| ) |  |  |

Set how often the psy model is calculated.

Default: 10

Parameters:

  | glopts | pointer to twolame options pointer
  | quickcount | number of frames between calculations

Returns:
  0 if successful, non-zero on failure

int twolame_get_quick_count | ( | twolame_options * | glopts | ) |

Get the how often the psy model is calculated.

Parameters:

  | glopts | pointer to twolame options pointer

Returns:
  number of frames between calculations

int twolame_set_DAB | ( | twolame_options * | glopts,
|  | int | dab |
| ) |  |  |

Enable/Disable the Eureka 147 DAB extensions for MP2.

Default: FALSE

Parameters:

  | glopts | pointer to twolame options pointer
  | dab | state of DAB extensions (TRUE/FALSE)

Returns:
  0 if successful, non-zero on failure

int twolame_get_DAB | ( | twolame_options * | glopts | ) |

Get the state of the DAB extensions

Parameters:

  | glopts | pointer to twolame options pointer

Returns:
  the state of DAB (TRUE/FALSE)

int twolame_set_DAB_xpad_length | ( | twolame_options * | glopts,
|  | int | length |
| ) |  |  |

Set the number of bytes to reserve for DAB XPAD data.

Default: 0

Parameters:

  | glopts | pointer to twolame options pointer
  | length | number of bytes to reserve

Returns:
  0 if successful, non-zero on failure

int twolame_get_DAB_xpad_length | ( | twolame_options * | glopts | ) |

Get the number of bytes reserved for DAB XPAD data.

Parameters:

  | glopts | pointer to twolame options pointer

Returns:
  number of XPAD bytes

int twolame_set_DAB_crc_length | ( | twolame_options * | glopts,
|  | int | length |
| ) |  |  |

Set the CRC error protection length for DAB.

Default: 2

Parameters:

  | glopts | pointer to twolame options pointer
  | length | length of DAB CRC

Returns:
  0 if successful, non-zero on failure

int twolame_get_DAB_crc_length | ( | twolame_options * | glopts | ) |

Get the CRC error protection length for DAB.

Parameters:

  | glopts | pointer to twolame options pointer

Returns:
  length of DAB CRC