Source file: /~heha/hsn/puh.zip/lame_global_flags.h

#pragma once

#ifndef lame_internal_flags_defined
#define lame_internal_flags_defined
struct lame_internal_flags;
typedef struct lame_internal_flags lame_internal_flags;
#endif


typedef enum short_block_e {
  short_block_not_set = -1, /* allow LAME to decide */
  short_block_allowed = 0, /* LAME may use them, even different block types for L/R */
  short_block_coupled, /* LAME may use them, but always same block types in L/R */
  short_block_dispensed, /* LAME will not use short blocks, long blocks only */
  short_block_forced  /* LAME will not use long blocks, short blocks only */
} short_block_t;

/***********************************************************************
*
*  Control Parameters set by User.  These parameters are here for
*  backwards compatibility with the old, non-shared lib API.
*  Please use the lame_set_variablename() functions below
*
*
***********************************************************************/
struct lame_global_struct {	// das Gottobjekt!
  unsigned class_id;

    /* input description */
  unsigned long num_samples; /* number of samples. default=2^32-1           */
  int     num_channels;    /* input number of channels. default=2         */
  int     samplerate_in;   /* input_samp_rate in Hz. default=44.1 kHz     */
  int     samplerate_out;  /* output_samp_rate.
                                default: LAME picks best value
                                at least not used for MP3 decoding:
                                Remember 44.1 kHz MP3s and AC97           */
  float   scale;           /* scale input by this amount before encoding
                                at least not used for MP3 decoding          */
  float   scale_left;      /* scale input of channel 0 (left) by this
                                amount before encoding                      */
  float   scale_right;     /* scale input of channel 1 (right) by this
                                amount before encoding                      */

    /* general control params */
  int     analysis;        /* collect data for a MP3 frame analyzer?      */
  bool write_lame_tag;  /* add Xing VBR tag?                           */
  bool decode_only;     /* use lame/mpglib to convert mp3 to wav       */
  char quality;         /* quality setting 0=best,  9=worst  default=5 */
  MPEG_mode mode;	// see enum in lame.h, default = LAME picks best value
  bool force_ms;        /* force M/S mode.  requires mode=1            */
  bool free_format;	// use free format? default=0
  bool findReplayGain;	// find the RG value? default=0
  bool decode_on_the_fly; // decode on the fly? default=0
  bool write_id3tag_automatic; /* 1 (default) writes ID3 tags, 0 not */

  int     nogap_total;
  int     nogap_current;

  int     substep_shaping;
  int     noise_shaping;
  int     subblock_gain;   /*  0 = no, 1 = yes */
  int     use_best_huffman; /* 0 = no.  1=outside loop  2=inside loop(slow) */

    /*
     * set either brate>0  or compression_ratio>0, LAME will compute
     * the value of the variable not set.
     * Default is compression_ratio = 11.025
     */
  int     brate;           /* bitrate                                    */
  float compression_ratio; /* sizeof(wav file)/sizeof(mp3 file)          */
    /* frame params */
  bool copyright;       /* mark as copyright. default=0           */
  bool original;        /* mark as original. default=1            */
  bool extension;       /* the MP3 'private extension' bit.
                                Meaningless                            */
  char emphasis;        /* 0..3, Input PCM is emphased PCM (for
                                instance from one of the rarely
                                emphased CDs), it is STRONGLY not
                                recommended to use this, because
                                psycho does not take it into account,
                                and last but not least many decoders
                                don't care about these bits          */
  bool error_protection; /* use 2 bytes per frame for a CRC
                                 checksum. default=0                    */
  buffer_constraint strict_ISO;      /* enforce ISO spec as much as possible   */

  bool disable_reservoir; /* use bit reservoir?                     */

    /* quantization/noise shaping */
  int     quant_comp;
  int     quant_comp_short;
  int     experimentalY;
  int     experimentalZ;
  char exp_nspsytune;

  char preset;

    /* VBR control */
  vbr_mode VBR;
  float   VBR_q_frac;      /* Range [0,...,1[ */
  int     VBR_q;           /* Range [0,...,9] */	// Scheiße!
  int     VBR_mean_bitrate_kbps;
  int     VBR_min_bitrate_kbps;
  int     VBR_max_bitrate_kbps;
  bool VBR_hard_min;    /* strictly enforce VBR_min_bitrate
                                normaly, it will be violated for analog
                                silence                                 */

    /* resampling and filtering */
  int     lowpassfreq;     /* freq in Hz. 0=lame choses.
                                -1=no filter                          */
  int     highpassfreq;    /* freq in Hz. 0=lame choses.
                                -1=no filter                          */
  int     lowpasswidth;    /* freq width of filter, in Hz
                               (default=15%)                         */
  int     highpasswidth;   /* freq width of filter, in Hz
                                (default=15%)                         */

    /*
     * psycho acoustics and other arguments which you should not change
     * unless you know what you are doing
     */
  float   maskingadjust;
  float   maskingadjust_short;
  bool ATHonly;         /* only use ATH                         */
  bool ATHshort;        /* only use ATH for short blocks        */
  bool noATH;           /* disable ATH                          */
  int     ATHtype;         /* select ATH formula                   */
  float   ATHcurve;        /* change ATH formula 4 shape           */
  float   ATH_lower_db;    /* lower ATH by this many db            */
  int     athaa_type;      /* select ATH auto-adjust scheme        */
  float   athaa_sensitivity; /* dB, tune active region of auto-level */
  short_block_t short_blocks;
  int     useTemporal;     /* use temporal masking effect          */
  float   interChRatio;
  float   msfix;           /* Naoki's adjustment of Mid/Side maskings */
  int     tune;            /* 0 off, 1 on */
  float   tune_value_a;    /* used to pass values for debugging and stuff */
  float   attackthre;      /* attack threshold for L/R/M channel */
  float   attackthre_s;    /* attack threshold for S channel */
  struct {
    void    (*msgf) (const char *format, va_list ap);
    void    (*debugf) (const char *format, va_list ap);
    void    (*errorf) (const char *format, va_list ap);
  } report;

  /************************************************************************/
    /* internal variables, do not set...                                    */
    /* provided because they may be of use to calling application           */
  /************************************************************************/

  int     lame_allocated_gfp; /* is this struct owned by calling
                                  program or lame?                     */



  /**************************************************************************/
    /* more internal variables are stored in this structure:                  */
  /**************************************************************************/
  lame_internal_flags *internal_flags;
  struct {
    bool mmx,amd3dnow,sse;
  }asm_optimizations;
//set_get.cpp:
  int lame_set_preset(int);
/* number of samples.  default = 2^32-1   */
  void set_num_samples(unsigned long n)		{num_samples=n;}
  unsigned long get_num_samples() const		{return num_samples;}
/* freq in Hz to apply lowpass. Default = 0 = lame chooses.  -1 = disabled */
  void lame_set_lowpassfreq(int k)		{lowpassfreq = k;}
  int lame_get_lowpassfreq()const		{return lowpassfreq;}
/* width of transition band, in Hz.  Default = one polyphase filter band */
  void lame_set_lowpasswidth(int k)		{lowpasswidth = k;}
  int lame_get_lowpasswidth()const		{return lowpasswidth;}
/* another experimental option.  for testing only */
  void lame_set_experimentalY(int k)		{experimentalY = k;}
  int lame_get_experimentalY()const		{return experimentalY;}
/* another experimental option.  for testing only */
  void lame_set_experimentalZ(int k)		{experimentalZ = k;}
  int lame_get_experimentalZ()const		{return experimentalZ;}
/* input sample rate in Hz.  default = 44100hz */
  void set_in_samplerate(int n) {samplerate_in=n;}
  int get_in_samplerate() const {return samplerate_in;}
/* number of channels in input stream. default=2  */
  void set_num_channels(int n) {num_channels=n;}
  int get_num_channels() const {return num_channels;}
// scale the input by this amount before encoding.  default=1
  void set_scale(float v) {scale=v;}
  float get_scale() const {return scale;}
// scale the channel 0 (left) input by this amount before encoding.  default=1
  int lame_set_scale_left(float);
  float lame_get_scale_left() const;
// scale the channel 1 (right) input by this amount before encoding.  default=1
  int lame_set_scale_right(float);
  float lame_get_scale_right() const;
/*output sample rate in Hz.  default = 0, which means LAME picks best value
  based on the amount of compression.  MPEG only allows:
  MPEG1    32, 44.1,   48khz
  MPEG2    16, 22.05,  24
  MPEG2.5   8, 11.025, 12 */
  void set_out_samplerate(int n)		{samplerate_out=n;}
  int get_out_samplerate() const		{return samplerate_out;}
  bool is_valid() const;
/********************************************************************
 * quantization/noise shaping 
 ***********************************************************************/
/* select psychoacoustic model */
  void lame_set_experimentalX(int k)		{lame_set_quant_comp(k);lame_set_quant_comp_short(k);}
  int lame_get_experimentalX()const		{return lame_get_quant_comp();}
/* select a different "best quantization" function. default=0  */
  void lame_set_quant_comp(int k)		{quant_comp = k;}
  int lame_get_quant_comp()const		{return quant_comp;}
  void lame_set_quant_comp_short(int k)		{quant_comp_short = k;}
  int lame_get_quant_comp_short()const		{return quant_comp_short;}
/* freq in Hz to apply highpass. Default = 0 = lame chooses.  -1 = disabled */
  void lame_set_highpassfreq(int k)		{highpassfreq = k;}
  int lame_get_highpassfreq()const		{return highpassfreq;}
// Filtering control Width of transition band (in Hz). default = one polyphase filter band
  void lame_set_highpasswidth(int k)		{highpasswidth = k;}
  int lame_get_highpasswidth()const		{return highpasswidth;}
/* manage short blocks */
  void lame_set_short_threshold(float, float);
  void lame_set_short_threshold_lrm(float k)	{attackthre = k;}
  float lame_get_short_threshold_lrm()const	{return attackthre;}
  void lame_set_short_threshold_s(float k)	{attackthre_s=k;}
  float lame_get_short_threshold_s()const	{return attackthre_s;}
/* Adjust masking values. */
  void lame_set_maskingadjust(float k)		{maskingadjust = k;}
  float lame_get_maskingadjust()const		{return maskingadjust;}
  void lame_set_maskingadjust_short(float k)	{maskingadjust_short = k;}
  float lame_get_maskingadjust_short()const	{return maskingadjust_short;}
/* select ATH formula 4 shape */
  void lame_set_ATHcurve(float k)		{ATHcurve=k;}
  float lame_get_ATHcurve()const		{return ATHcurve;}
  void lame_set_preset_notune(int)		{}
/* substep shaping method */
  int lame_set_substep(int);
  int lame_get_substep()const;
/* scalefactors scale */
  int lame_set_sfscale(bool);
  bool lame_get_sfscale()const;
/* subblock gain */
  int lame_set_subblock_gain(int);
  int lame_get_subblock_gain()const;
/*presets*/
  int apply_preset(int,bool);
  void lame_set_tune(float k)			{tune_value_a=k; tune=true;} /* FOR INTERNAL USE ONLY just another daily changing developer switch  */
  void lame_set_msfix(float k)			{msfix=k;}
  float lame_get_msfix()const			{return msfix;}
/* select ATH formula */
  void lame_set_ATHtype(int k)			{ATHtype=k;}
  int lame_get_ATHtype()const			{return ATHtype;}
/* disable the bit reservoir. For testing only. default=0 */
  void lame_set_disable_reservoir(bool k)	{disable_reservoir=k;}
  bool lame_get_disable_reservoir()const	{return disable_reservoir;}
/* Naoki's psycho acoustic model.  default=0 */
  void lame_set_exp_nspsytune(char k)		{exp_nspsytune=k;}
  char lame_get_exp_nspsytune()const		{return exp_nspsytune;}
/********************************************************************
 * psycho acoustics and other arguments which you should not change
 * unless you know what you are doing
 ***********************************************************************/
/* only use ATH for masking */
  void lame_set_ATHonly(bool k)			{ATHonly=k;}
  bool lame_get_ATHonly()const			{return ATHonly;}
/* only use ATH for short blocks */
  void lame_set_ATHshort(bool k)		{ATHshort=k;}
  bool lame_get_ATHshort()const			{return ATHshort;}
/* disable ATH */
  void lame_set_noATH(bool k)			{noATH=k;}
  bool lame_get_noATH()const			{return noATH;}
/* lower ATH by this many db */
  void lame_set_ATHlower(float k)		{ATH_lower_db=k;}
  float lame_get_ATHlower()const		{return ATH_lower_db;}
/* select ATH adaptive adjustment type */
  void lame_set_athaa_type(int k)		{athaa_type=k;}
  int lame_get_athaa_type()const		{return athaa_type;}
/* select the loudness approximation used by the ATH adaptive auto-leveling  */
  void lame_set_athaa_loudapprox(int)		{}
  int lame_get_athaa_loudapprox()const		{return 2;}
/* adjust (in dB) the point below which adaptive ATH level adjustment occurs */
  void lame_set_athaa_sensitivity(float k)	{athaa_sensitivity = k;}
  float lame_get_athaa_sensitivity()const	{return athaa_sensitivity;}
/* OBSOLETE: predictability limit (ISO tonality formula) */
  void lame_set_cwlimit(int)			{}
  int lame_get_cwlimit()const			{return 0;}
/* allow blocktypes to differ between channels? default: 0 for jstereo, 1 for stereo */
  int lame_set_allow_diff_short(bool);
  bool lame_get_allow_diff_short()const;
/* use temporal masking effect (default = 1) */
  int lame_set_useTemporal(int);
  int lame_get_useTemporal()const;
/* use temporal masking effect (default = 1) */
  int lame_set_interChRatio(float);
  float lame_get_interChRatio()const;
/* disable short blocks */
  int lame_set_no_short_blocks(int);
  int lame_get_no_short_blocks()const;
/* force short blocks */
  int lame_set_force_short_blocks(int);
  int lame_get_force_short_blocks()const;
/* Input PCM is emphased PCM (for instance from one of the rarely
   emphased CDs), it is STRONGLY not recommended to use this, because
   psycho does not take it into account, and last but not least many decoders
   ignore these bits */
  void lame_set_emphasis(char k)		{if ((unsigned)k<4) emphasis=k;}
  char lame_get_emphasis()const			{return emphasis;}
/* OPTIONAL: Normally, this is called by lame_init_params().
 * It writes id3v2 and Xing headers into the front of the bitstream,
 * and sets frame counters and bitrate histogram data to 0.
 * You can also call this after lame_encode_flush_nogap(). */
  int lame_init_bitstream();

/* OPTIONAL: print internal lame configuration to message handler */
public:
  void lame_print_config()const;
  void lame_print_internals()const;
private:
  lame_encode_buffer_template(void const*, void const*, int, unsigned char*, int, enum PCMSampleType, int, FLOAT);
//psymodel.cpp
public:
  int psymodel_init() const;
//lame.cpp
private:
  void lame_init_qval();
//presets.cpp
  void apply_vbr_preset(int,bool);
/* write tag into stream at current position */
public:
  int id3tag_write_v2();
  int id3tag_write_v1();
/*
 * NOTE: A version 2 tag will NOT be added unless one of the text fields won't
 * fit in a version 1 tag (e.g. the title string is longer than 30 characters),
 * or the "id3tag_add_v2" or "id3tag_v2_only" functions are used.
 */

/* as lame_encode_buffer, but for long's
 * !! NOTE: !! data must still be scaled to be in the same range as
 * short int, +/- 32768
 *
 * This scaling was a mistake (doesn't allow one to exploit full
 * precision of type 'long'.  Use lame_encode_buffer_long2() instead.
 *
 */
  int lame_encode_buffer_long(
        const long     buffer_l [],       /* PCM data for left channel     */
        const long     buffer_r [],       /* PCM data for right channel    */
        const int           nsamples,      /* number of samples per channel */
        unsigned char*      mp3buf,        /* pointer to encoded MP3 stream */
        const int           mp3buf_size ); /* number of valid octets in this
                                              stream                        */

/* Same as lame_encode_buffer_long(), but with correct scaling.
 * !! NOTE: !! data must still be scaled to be in the same range as
 * type 'long'.   Data should be in the range:  +/- 2^(8*size(long)-1)
 *
 */
  int lame_encode_buffer_long2(
        const long     buffer_l [],       /* PCM data for left channel     */
        const long     buffer_r [],       /* PCM data for right channel    */
        const int           nsamples,      /* number of samples per channel */
        unsigned char*      mp3buf,        /* pointer to encoded MP3 stream */
        const int           mp3buf_size ); /* number of valid octets in this
                                              stream                        */

/* as lame_encode_buffer, but for int's
 * !! NOTE: !! input should be scaled to the maximum range of 'int'
 * If int is 4 bytes, then the values should range from
 * +/- 2147483648.
 *
 * This routine does not (and cannot, without loosing precision) use
 * the same scaling as the rest of the lame_encode_buffer() routines.
 *
 */
  int lame_encode_buffer_int(
        const int      buffer_l [],       /* PCM data for left channel     */
        const int      buffer_r [],       /* PCM data for right channel    */
        const int           nsamples,      /* number of samples per channel */
        unsigned char*      mp3buf,        /* pointer to encoded MP3 stream */
        const int           mp3buf_size ); /* number of valid octets in this
                                              stream                        */

/*
 * as above, but for interleaved data.
 * !! NOTE: !! data must still be scaled to be in the same range as
 * type 'int32_t'.   Data should be in the range:  +/- 2^(8*size(int32_t)-1)
 * NOTE:
 * num_samples = number of samples in the L (or R)
 * channel, not the total number of samples in pcm[]
 */
  int lame_encode_buffer_interleaved_int(
        const int       pcm [],            /* PCM data for left and right
                                              channel, interleaved          */
        const int       nsamples,          /* number of samples per channel,
                                              _not_ number of samples in
                                              pcm[]                         */
        unsigned char*  mp3buf,            /* pointer to encoded MP3 stream */
        const int       mp3buf_size );     /* number of valid octets in this
                                              stream                        */



/*
 * REQUIRED:
 * lame_encode_flush will flush the intenal PCM buffers, padding with
 * 0's to make sure the final frame is complete, and then flush
 * the internal MP3 buffers, and thus may return a
 * final few mp3 frames.  'mp3buf' should be at least 7200 bytes long
 * to hold all possible emitted data.
 *
 * will also write id3v1 tags (if any) into the bitstream
 *
 * return code = number of bytes output to mp3buf. Can be 0
 */
  int lame_encode_flush(
        unsigned char*       mp3buf, /* pointer to encoded MP3 stream         */
        int                  size);  /* number of valid octets in this stream */

/*
 * OPTIONAL:
 * lame_encode_flush_nogap will flush the internal mp3 buffers and pad
 * the last frame with ancillary data so it is a complete mp3 frame.
 *
 * 'mp3buf' should be at least 7200 bytes long
 * to hold all possible emitted data.
 *
 * After a call to this routine, the outputed mp3 data is complete, but
 * you may continue to encode new PCM samples and write future mp3 data
 * to a different file.  The two mp3 files will play back with no gaps
 * if they are concatenated together.
 *
 * This routine will NOT write id3v1 tags into the bitstream.
 *
 * return code = number of bytes output to mp3buf. Can be 0
 */
  int lame_encode_flush_nogap(
        unsigned char*       mp3buf, /* pointer to encoded MP3 stream         */
        int                  size);  /* number of valid octets in this stream */




/*
 * OPTIONAL:    some simple statistics
 * a bitrate histogram to visualize the distribution of used frame sizes
 * a stereo mode histogram to visualize the distribution of used stereo
 *   modes, useful in joint-stereo mode only
 *   0: LR    left-right encoded
 *   1: LR-I  left-right and intensity encoded (currently not supported)
 *   2: MS    mid-side encoded
 *   3: MS-I  mid-side and intensity encoded (currently not supported)
 *
 * attention: don't call them after lame_encode_finish
 * suggested: lame_encode_flush -> lame_*_hist -> lame_close
 */

  void lame_bitrate_hist(int bitrate_count[14])const;
  void lame_bitrate_kbps(int bitrate_kbps [14])const;
  void lame_stereo_mode_hist(int stereo_mode_count[4])const;
  void lame_bitrate_stereo_mode_hist(int bitrate_stmode_count[14][4])const;
  void lame_block_type_hist(int btype_count[6])const;
  void lame_bitrate_block_type_hist(int bitrate_btype_count[14][6])const;
/* OPTIONAL:
 * lame_mp3_tags_fid will rewrite a Xing VBR tag to the mp3 file with file
 * pointer fid.  These calls perform forward and backwards seeks, so make
 * sure fid is a real file.  Make sure lame_encode_flush has been called,
 * and all mp3 data has been written to the file before calling this
 * function.
 * NOTE:
 * if VBR  tags are turned off by the user, or turned off by LAME because
 * the output is not a regular file, this call does nothing
 * NOTE:
 * LAME wants to read from the file to skip an optional ID3v2 tag, so
 * make sure you opened the file for writing and reading.
 * NOTE:
 * You can call lame_get_lametag_frame instead, if you want to insert
 * the lametag yourself.
*/
  void lame_mp3_tags_fid(FILE*);
/* OPTIONAL:
 * lame_get_lametag_frame copies the final LAME-tag into 'buffer'.
 * The function returns the number of bytes copied into buffer, or
 * the required buffer size, if the provided buffer is too small.
 * Function failed, if the return value is larger than 'size'!
 * Make sure lame_encode flush has been called before calling this function.
 * NOTE:
 * if VBR  tags are turned off by the user, or turned off by LAME,
 * this call does nothing and returns 0.
 * NOTE:
 * LAME inserted an empty frame in the beginning of mp3 audio data,
 * which you have to replace by the final LAME-tag frame after encoding.
 * In case there is no ID3v2 tag, usually this frame will be the very first
 * data in your mp3 file. If you put some other leading data into your
 * file, you'll have to do some bookkeeping about where to write this buffer.
 */
  size_t lame_get_lametag_frame(unsigned char*,size_t)const;

/* REQUIRED: final call to free all remaining buffers */
  int lame_close();
/* OBSOLETE:
 * lame_encode_finish combines lame_encode_flush() and lame_close() in
 * one call.  However, once this call is made, the statistics routines
 * will no longer work because the data will have been cleared, and
 * lame_mp3_tags_fid() cannot be called to add data to the VBR header
 */
  int lame_encode_finish(unsigned char*,int);

/*
 * input pcm data, output (maybe) mp3 frames.
 * This routine handles all buffering, resampling and filtering for you.
 *
 * return code     number of bytes output in mp3buf. Can be 0
 *                 -1:  mp3buf was too small
 *                 -2:  malloc() problem
 *                 -3:  lame_init_params() not called
 *                 -4:  psycho acoustic problems
 *
 * The required mp3buf_size can be computed from num_samples,
 * samplerate and encoding rate, but here is a worst case estimate:
 *
 * mp3buf_size in bytes = 1.25*num_samples + 7200
 *
 * I think a tighter bound could be:  (mt, March 2000)
 * MPEG1:
 *    num_samples*(bitrate/8)/samplerate + 4*1152*(bitrate/8)/samplerate + 512
 * MPEG2:
 *    num_samples*(bitrate/8)/samplerate + 4*576*(bitrate/8)/samplerate + 256
 *
 * but test first if you use that!
 *
 * set mp3buf_size = 0 and LAME will not check if mp3buf_size is
 * large enough.
 *
 * NOTE:
 * if gfp->num_channels=2, but gfp->mode = 3 (mono), the L & R channels
 * will be averaged into the L channel before encoding only the L channel
 * This will overwrite the data in buffer_l[] and buffer_r[].
 *
*/
  int lame_encode_buffer (
        const short int     buffer_l [],   /* PCM data for left channel     */
        const short int     buffer_r [],   /* PCM data for right channel    */
        const int           nsamples,      /* number of samples per channel */
        unsigned char*      mp3buf,        /* pointer to encoded MP3 stream */
        const int           mp3buf_size ); /* number of valid octets in this
                                              stream                        */

/*
 * as above, but input has L & R channel data interleaved.
 * NOTE:
 * num_samples = number of samples in the L (or R)
 * channel, not the total number of samples in pcm[]
 */
  int lame_encode_buffer_interleaved(
        short int           pcm[],         /* PCM data for left and right
                                              channel, interleaved          */
        int                 num_samples,   /* number of samples per channel,
                                              _not_ number of samples in
                                              pcm[]                         */
        unsigned char*      mp3buf,        /* pointer to encoded MP3 stream */
        int                 mp3buf_size ); /* number of valid octets in this
                                              stream                        */


/* as lame_encode_buffer, but for 'float's.
 * !! NOTE: !! data must still be scaled to be in the same range as
 * short int, +/- 32768
 */
  int lame_encode_buffer_float(
        const float         pcm_l [],      /* PCM data for left channel     */
        const float         pcm_r [],      /* PCM data for right channel    */
        const int           nsamples,      /* number of samples per channel */
        unsigned char*      mp3buf,        /* pointer to encoded MP3 stream */
        const int           mp3buf_size ); /* number of valid octets in this
                                              stream                        */

/* as lame_encode_buffer, but for 'float's.
 * !! NOTE: !! data must be scaled to +/- 1 full scale
 */
  int lame_encode_buffer_ieee_float(
        const float     pcm_l [],          /* PCM data for left channel     */
        const float     pcm_r [],          /* PCM data for right channel    */
        const int       nsamples,
        unsigned char * mp3buf,
        const int       mp3buf_size);
  int lame_encode_buffer_interleaved_ieee_float(
        const float     pcm[],             /* PCM data for left and right
                                              channel, interleaved          */
        const int       nsamples,
        unsigned char * mp3buf,
        const int       mp3buf_size);

/* as lame_encode_buffer, but for 'double's.
 * !! NOTE: !! data must be scaled to +/- 1 full scale
 */
  int lame_encode_buffer_ieee_double(
        const double    pcm_l [],          /* PCM data for left channel     */
        const double    pcm_r [],          /* PCM data for right channel    */
        const int       nsamples,
        unsigned char * mp3buf,
        const int       mp3buf_size);
 int lame_encode_buffer_interleaved_ieee_double(
        const double    pcm[],             /* PCM data for left and right
                                              channel, interleaved          */
        const int       nsamples,
        unsigned char * mp3buf,
        const int       mp3buf_size);

  int InitVbrTag();
  int PutVbrTag(FILE*)const;
/* obsolete version */
  int lame_init_old();
  void dump_config();
private:
  int PutLameVBR(size_t,unsigned char*,uint16_t)const;
//get_set.cpp
public:
/* for preset */
  void lame_set_preset_expopts(int)			{}
/************************************************************************/
/* internal variables, cannot be set...                                 */
/* provided because they may be of use to calling application           */
/************************************************************************/
/* version  0=MPEG-2  1=MPEG-1  (2=MPEG-2.5)     */
  int lame_get_version()const;
/* encoder delay   */
  int lame_get_encoder_delay()const;
/*padding appended to the input to make sure decoder can fully decode
  all input.  Note that this value can only be calculated during the
  call to lame_encoder_flush().  Before lame_encoder_flush() has
  been called, the value of encoder_padding = 0.
*/
  int lame_get_encoder_padding()const;
/* size of MPEG frame */
  int lame_get_framesize()const;
/* number of PCM samples buffered, but not yet encoded to mp3 data. */
  int lame_get_mf_samples_to_encode()const;
/*size (bytes) of mp3 data buffered, but not yet encoded.
  this is the number of bytes which would be output by a call to
  lame_encode_flush_nogap.  NOTE: lame_encode_flush() will return
  more bytes than this because it will encode the reamining buffered
  PCM samples before flushing the mp3 buffers.
*/
  int lame_get_size_mp3buffer()const;
/* number of frames encoded so far */
  int lame_get_frameNum()const;
/* lame's estimate of the total number of frames to be encoded
   only valid if calling program set num_samples
*/
  int lame_get_totalframes()const;
/* RadioGain value. Multiplied by 10 and rounded to the nearest. */
  int lame_get_RadioGain()const;
/* AudiophileGain value. Multipled by 10 and rounded to the nearest. */
  int lame_get_AudiophileGain()const;
/* the peak sample */
  float lame_get_PeakSample()const;
/* Gain change required for preventing clipping. The value is correct only if
   peak sample searching was enabled. If negative then the waveform
   already does not clip. The value is multiplied by 10 and rounded up. */
  int lame_get_noclipGainChange()const;
/* user-specified scale factor required for preventing clipping. Value is
   correct only if peak sample searching was enabled and no user-specified
   scaling was performed. If negative then either the waveform already does
   not clip or the value cannot be determined */
  float lame_get_noclipScale()const;

/* returns the limit of PCM samples, which one can pass in an encode call
   under the constrain of a provided buffer of size buffer_size */
  int lame_get_maximum_number_of_samples(size_t buffer_size);

/*
 * REQUIRED:
 * sets more internal configuration based on data provided above.
 * returns -1 if something failed.
 */
  int lame_init_params();
/*
  mode = 0,1,2,3 = stereo, jstereo, dual channel (not supported), mono
  default: lame picks based on compression ration and input channels
*/
  void lame_set_mode(MPEG_mode k)	{if (k<MAX_INDICATOR) mode=k;}
  MPEG_mode lame_get_mode()const	{return mode;}
/*
  mode_automs.  Use a M/S mode with a switching threshold based on
  compression ratio
  DEPRECATED
*/
  void lame_set_mode_automs(bool k)	{lame_set_mode(JOINT_STEREO);}
  bool lame_get_mode_automs()const	{return true;}
/*
 * OPTIONAL:
 * Set printf like error/debug/message reporting functions.
 * The second argument has to be a pointer to a function which looks like
 *   void my_debugf(const char *format, va_list ap)
 *   {
 *       (void) vfprintf(stdout, format, ap);
 *   }
 * If you use NULL as the value of the pointer in the set function, the
 * lame buildin function will be used (prints to stderr).
 * To quiet any output you have to replace the body of the example function
 * with just "return;" and use it in the set function.
 */
  void lame_set_errorf(lame_report_function f)		{report.errorf = f;}
  void lame_set_debugf(lame_report_function f)		{report.debugf = f;}
  void lame_set_msgf  (lame_report_function f)		{report.msgf = f;}
/* set one of brate compression ratio.  default is compression ratio of 11.  */
  void lame_set_brate(int k)				{brate=k; if (k > 320) disable_reservoir = true;}
  int lame_get_brate()const				{return brate;}
  void lame_set_compression_ratio(float k)		{compression_ratio=k;}
  float lame_get_compression_ratio()const		{return compression_ratio;}
//  int lame_set_preset(int);
  void lame_set_asm_optimizations(int,bool);
/********************************************************************
 *  frame params
 ***********************************************************************/
/* mark as copyright.  default=0 */
  void lame_set_copyright(bool k)			{copyright=k;}
  bool lame_get_copyright()const			{return copyright;}
/* mark as original.  default=1 */
  void lame_set_original(bool k)			{original=k;}
  bool lame_get_original()const				{return original;}
/* error_protection.  Use 2 bytes from each frame for CRC checksum. default=0 */
  void lame_set_error_protection(bool k)		{error_protection=k;}
  bool lame_get_error_protection()const			{return error_protection;}
/* padding_type. 0=pad no frames  1=pad all frames 2=adjust padding(default) */
  void lame_set_padding_type(Padding_type)		{}
  Padding_type lame_get_padding_type()const		{return PAD_ADJUST;}


/* MP3 'private extension' bit  Meaningless.  default=0 */
  void lame_set_extension(bool k)			{extension=k;}
  bool lame_get_extension()const			{return extension;}
/* enforce strict ISO compliance.  default=0 */
  void lame_set_strict_ISO(buffer_constraint k)		{strict_ISO=k;}
  buffer_constraint lame_get_strict_ISO()const		{return strict_ISO;}
  void PresetOptions(LONG myPreset);
//presets.cpp
  int apply_abr_preset(int p, bool enforce);
/*
  internal algorithm selection.  True quality is determined by the bitrate
  but this variable will effect quality by selecting expensive or cheap algorithms.
  quality=0..9.  0=best (very slow).  9=worst.
  recommended:  2     near-best quality, not too slow
                5     good quality, fast
                7     ok quality, really fast
*/
  void lame_set_quality(char k)				{if (k<0) k=0; if (k>9) k=9; quality=k;}
  char lame_get_quality()const				{return quality;}
/* 1=encode a Vorbis .ogg file.  default=0 DEPRECATED */
  void lame_set_ogg(bool)				{}
  bool lame_get_ogg()const				{return false;}
/*
  force_ms.  Force M/S for all frames.  For testing only.
  default = 0 (disabled)
*/
  void lame_set_force_ms(bool k)			{force_ms=k;}
  bool lame_get_force_ms()const				{return force_ms;}
/* use free_format?  default = 0 (disabled) */
  void lame_set_free_format(bool k)			{free_format=k;}
  bool lame_get_free_format()const			{return free_format;}
/* perform ReplayGain analysis?  default = 0 (disabled) */
  void lame_set_findReplayGain(bool k)			{findReplayGain=k;}
  bool lame_get_findReplayGain()const			{return findReplayGain;}
/* decode on the fly. Search for the peak sample. If the ReplayGain
 * analysis is enabled then perform the analysis on the decoded data
 * stream. default = 0 (disabled)
 * NOTE: if this option is set the build-in decoder should not be used */
  void lame_set_decode_on_the_fly(bool k)		{decode_on_the_fly=k;}
  bool lame_get_decode_on_the_fly()const		{return decode_on_the_fly;}
/* DEPRECATED: now does the same as lame_set_findReplayGain()
   default = 0 (disabled) */
  void lame_set_ReplayGain_input(bool k)		{lame_set_findReplayGain(k);}
  bool lame_get_ReplayGain_input()const			{return lame_get_findReplayGain();}
/* DEPRECATED: now does the same as
   lame_set_decode_on_the_fly() && lame_set_findReplayGain()
   default = 0 (disabled) */
  void lame_set_ReplayGain_decode(bool k)		{lame_set_decode_on_the_fly(k); lame_set_findReplayGain(k);}
  bool lame_get_ReplayGain_decode()const		{return lame_get_decode_on_the_fly() && lame_get_findReplayGain();}

/* DEPRECATED: now does the same as lame_set_decode_on_the_fly()
   default = 0 (disabled) */
  void lame_set_findPeakSample(bool k)			{lame_set_decode_on_the_fly(k);}
  bool lame_get_findPeakSample()const			{return lame_get_decode_on_the_fly();}
/* counters for gapless encoding */
  int lame_set_nogap_total(int k)			{nogap_total=k;}
  int lame_get_nogap_total()const			{return nogap_total;}
  int lame_set_nogap_currentindex(int k)		{nogap_current=k;}
  int lame_get_nogap_currentindex()const		{return nogap_current;}

/********************************************************************
 *  general control parameters
 ***********************************************************************/
/* 1=cause LAME to collect data for an MP3 frame analyzer. default=0 */
  void lame_set_analysis(int);
  int lame_get_analysis()const;
/*
  1 = write a Xing VBR header frame.
  default = 1
  this variable must have been added by a Hungarian notation Windows programmer :-)
*/
  void lame_set_bWriteVbrTag(bool k)			{write_lame_tag=k;}
  bool lame_get_bWriteVbrTag()const			{return write_lame_tag;}

/* 1=decode only.  use lame/mpglib to convert mp3/ogg to wav.  default=0 */
  void lame_set_decode_only(bool k)			{decode_only=k;}
  bool lame_get_decode_only()const			{return decode_only;}
/********************************************************************
 * VBR control
 ***********************************************************************/
/* Types of VBR.  default = vbr_off = CBR */
  void lame_set_VBR(vbr_mode k)				{if ((unsigned)k<vbr_max_indicator) VBR = k;}
  vbr_mode lame_get_VBR()const				{return VBR;}
/* VBR quality level.  0=highest  9=lowest  */
  void lame_set_VBR_q(char k)				{if (k<0) k=0; if (k>9) k=9; VBR_q=k; VBR_q_frac=0;}
  char lame_get_VBR_q()const				{return VBR_q;}
/* VBR quality level.  0=highest  9=lowest, Range [0,...,10[  */
  void lame_set_VBR_quality(float k)			{if (k<0) k=0; if (k>=10) k=9.999; VBR_q=char(k); VBR_q_frac=k-VBR_q;}
  float lame_get_VBR_quality()const			{return VBR_q+VBR_q_frac;}
/********************************************************************
 * VBR control
 ***********************************************************************/
/* Ignored except for VBR=vbr_abr (ABR mode) */
  void lame_set_VBR_mean_bitrate_kbps(int k)		{VBR_mean_bitrate_kbps = k;}
  int lame_get_VBR_mean_bitrate_kbps()const		{return VBR_mean_bitrate_kbps;}
  void lame_set_VBR_min_bitrate_kbps(int k)		{VBR_min_bitrate_kbps = k;}
  int lame_get_VBR_min_bitrate_kbps()const		{return VBR_min_bitrate_kbps;}
  void lame_set_VBR_max_bitrate_kbps(int k)		{VBR_max_bitrate_kbps = k;}
  int lame_get_VBR_max_bitrate_kbps()const		{return VBR_max_bitrate_kbps;}
/*
  1=strictly enforce VBR_min_bitrate.  Normally it will be violated for
  analog silence
*/
  void lame_set_VBR_hard_min(bool k)			{VBR_hard_min = k;}
  bool lame_get_VBR_hard_min()const			{return VBR_hard_min;}
/* normaly lame_init_param writes ID3v2 tags into the audio stream
 * Call lame_set_write_id3tag_automatic(gfp, 0) before lame_init_param
 * to turn off this behaviour and get ID3v2 tag with above function
 * write it yourself into your file.
 */
  void lame_set_write_id3tag_automatic(bool k)		{write_id3tag_automatic=k;}
  bool lame_get_write_id3tag_automatic()const		{return write_id3tag_automatic;}
private:
  bool is_lame_internal_flags_null()const		{return !(this && internal_flags);}
  int id3v2_add_lngA(uint32_t frame_id, char const *desc, char const *text);
  int id3v2_add_lngW(uint32_t frame_id, unsigned short const *desc, unsigned short const *text);
  void copyV1ToV2(int frame_id, char const *s);
  void id3v2AddLameVersion();
  void id3v2AddAudioDuration(double ms);
  void id3tag_init();
  void id3tag_add_v2();
  int id3tag_set_genreW(const wchar_t* text);
  int id3tag_set_albumart(const char *, size_t);
  int id3tag_set_userinfoA(uint32_t, char const *);
  int id3tag_set_userinfoW(uint32_t, const wchar_t*);
  char const* id3v2_get_language()const;
  int id3v2_addA(uint32_t, char const *, char const *, char const *);
  int id3v2_addW(uint32_t, char const *, const wchar_t*, const wchar_t*);
  int id3tag_set_textinfoA(char const *, char const *);
  int id3tag_set_textinfoW(char const *, const wchar_t*);
  int id3tag_set_commentA(char const *lang, char const *, char const *);
  int id3tag_set_commentW(char const *lang, wchar_t const *, wchar_t const *);
  void id3tag_set_title(const char *);
  void id3tag_set_artist(const char *);
  void id3tag_set_album(const char *);
  void id3tag_set_year(const char *);
  int id3tag_set_genre(const char *);
  void id3tag_set_comment(const char *);
  int id3tag_set_track(const char *);
  int id3tag_set_fieldvalue(const char *);
  int id3tag_set_fieldvalueW(const wchar_t *);
/* lame_get_id3v1_tag copies ID3v1 tag into buffer.
 * Function returns number of bytes copied into buffer, or number
 * of bytes rquired if buffer 'size' is too small.
 * Function fails, if returned value is larger than 'size'.
 * NOTE:
 * This functions does nothing, if user/LAME disabled ID3v1 tag.
 */
  size_t lame_get_id3v1_tag(unsigned char*, size_t);
  size_t lame_get_id3v2_tag(unsigned char*, size_t);
};
Detected encoding: ANSI (CP1252)4
Wrong umlauts? - Assume file is ANSI (CP1252) encoded