add undocumented option --apply-replaygain-which-is-not-lossless to flac; required...
authorJosh Coalson <jcoalson@users.sourceforce.net>
Wed, 17 Dec 2003 04:51:06 +0000 (04:51 +0000)
committerJosh Coalson <jcoalson@users.sourceforce.net>
Wed, 17 Dec 2003 04:51:06 +0000 (04:51 +0000)
56 files changed:
FLAC.dsw
configure.in
include/share/Makefile.am
include/share/grabbag/replaygain.h
include/share/replaygain_analysis.h [moved from include/share/gain_analysis.h with 100% similarity]
include/share/replaygain_synthesis.h [moved from src/plugin_common/replaygain_synthesis.h with 56% similarity]
src/flac/Makefile.am
src/flac/Makefile.lite
src/flac/decode.c
src/flac/decode.h
src/flac/encode.c
src/flac/flac.dsp
src/flac/main.c
src/flac/string.c
src/metaflac/Makefile.am
src/metaflac/Makefile.lite
src/metaflac/metaflac.dsp
src/plugin_common/Makefile.am
src/plugin_common/Makefile.lite
src/plugin_common/all.h
src/plugin_common/plugin_common_static.dsp
src/plugin_winamp2/in_flac.c
src/plugin_winamp2/in_flac.dsp
src/plugin_xmms/Makefile.am
src/plugin_xmms/Makefile.lite
src/plugin_xmms/configure.c
src/plugin_xmms/plugin.c
src/share/Makefile.am
src/share/Makefile.lite
src/share/grabbag/replaygain.c
src/share/replaygain_analysis/Makefile.am [moved from src/share/gain_analysis/Makefile.am with 63% similarity]
src/share/replaygain_analysis/Makefile.lite [moved from src/share/gain_analysis/Makefile.lite with 75% similarity]
src/share/replaygain_analysis/replaygain_analysis.c [moved from src/share/gain_analysis/gain_analysis.c with 97% similarity]
src/share/replaygain_analysis/replaygain_analysis_static.dsp [moved from src/share/gain_analysis/gain_analysis_static.dsp with 72% similarity]
src/share/replaygain_synthesis/Makefile.am [new file with mode: 0644]
src/share/replaygain_synthesis/Makefile.lite [new file with mode: 0644]
src/share/replaygain_synthesis/include/Makefile.am [moved from src/plugin_common/include/Makefile.am with 91% similarity]
src/share/replaygain_synthesis/include/private/Makefile.am [moved from src/plugin_common/include/private/Makefile.am with 91% similarity]
src/share/replaygain_synthesis/include/private/fast_float_math_hack.h [moved from src/plugin_common/include/private/fast_float_math_hack.h with 100% similarity]
src/share/replaygain_synthesis/replaygain_synthesis.c [moved from src/plugin_common/replaygain_synthesis.c with 92% similarity]
src/share/replaygain_synthesis/replaygain_synthesis_static.dsp [new file with mode: 0644]
src/test_grabbag/cuesheet/Makefile.am
src/test_grabbag/cuesheet/Makefile.lite
src/test_grabbag/cuesheet/test_cuesheet.dsp
src/test_libFLAC++/Makefile.am
src/test_libFLAC++/Makefile.lite
src/test_libFLAC++/test_libFLAC++.dsp
src/test_libFLAC/Makefile.am
src/test_libFLAC/Makefile.lite
src/test_libFLAC/test_libFLAC.dsp
src/test_libOggFLAC++/Makefile.am
src/test_libOggFLAC++/Makefile.lite
src/test_libOggFLAC++/test_libOggFLAC++.dsp
src/test_libOggFLAC/Makefile.am
src/test_libOggFLAC/Makefile.lite
src/test_libOggFLAC/test_libOggFLAC.dsp

index 8d52fce..0ef1afd 100644 (file)
--- a/FLAC.dsw
+++ b/FLAC.dsw
@@ -48,7 +48,10 @@ Package=<4>
     Project_Dep_Name grabbag_static\r
     End Project Dependency\r
     Begin Project Dependency\r
-    Project_Dep_Name gain_analysis_static\r
+    Project_Dep_Name replaygain_analysis_static\r
+    End Project Dependency\r
+    Begin Project Dependency\r
+    Project_Dep_Name replaygain_synthesis_static\r
     End Project Dependency\r
     Begin Project Dependency\r
     Project_Dep_Name getopt_static\r
@@ -132,7 +135,10 @@ Package=<4>
     Project_Dep_Name grabbag_static\r
     End Project Dependency\r
     Begin Project Dependency\r
-    Project_Dep_Name gain_analysis_static\r
+    Project_Dep_Name replaygain_analysis_static\r
+    End Project Dependency\r
+    Begin Project Dependency\r
+    Project_Dep_Name replaygain_synthesis_static\r
     End Project Dependency\r
     Begin Project Dependency\r
     Project_Dep_Name getopt_static\r
@@ -189,7 +195,10 @@ Package=<4>
     Project_Dep_Name grabbag_static\r
     End Project Dependency\r
     Begin Project Dependency\r
-    Project_Dep_Name gain_analysis_static\r
+    Project_Dep_Name replaygain_analysis_static\r
+    End Project Dependency\r
+    Begin Project Dependency\r
+    Project_Dep_Name replaygain_synthesis_static\r
     End Project Dependency\r
     Begin Project Dependency\r
     Project_Dep_Name getopt_static\r
@@ -231,7 +240,19 @@ Package=<4>
 \r
 ###############################################################################\r
 \r
-Project: "gain_analysis_static"=.\src\share\gain_analysis\gain_analysis_static.dsp - Package Owner=<4>\r
+Project: "replaygain_analysis_static"=.\src\share\replaygain_analysis\replaygain_analysis_static.dsp - Package Owner=<4>\r
+\r
+Package=<5>\r
+{{{\r
+}}}\r
+\r
+Package=<4>\r
+{{{\r
+}}}\r
+\r
+###############################################################################\r
+\r
+Project: "replaygain_synthesis_static"=.\src\share\replaygain_synthesis\replaygain_synthesis_static.dsp - Package Owner=<4>\r
 \r
 Package=<5>\r
 {{{\r
@@ -267,7 +288,7 @@ Package=<4>
     Project_Dep_Name libFLAC_static\r
     End Project Dependency\r
     Begin Project Dependency\r
-    Project_Dep_Name gain_analysis_static\r
+    Project_Dep_Name replaygain_analysis_static\r
     End Project Dependency\r
 }}}\r
 \r
@@ -420,7 +441,7 @@ Package=<5>
 Package=<4>\r
 {{{\r
     Begin Project Dependency\r
-    Project_Dep_Name gain_analysis_static\r
+    Project_Dep_Name replaygain_analysis_static\r
     End Project Dependency\r
     Begin Project Dependency\r
     Project_Dep_Name getopt_static\r
@@ -447,6 +468,9 @@ Package=<5>
 Package=<4>\r
 {{{\r
     Begin Project Dependency\r
+    Project_Dep_Name replaygain_synthesis_static\r
+    End Project Dependency\r
+    Begin Project Dependency\r
     Project_Dep_Name libFLAC_static\r
     End Project Dependency\r
 }}}\r
index b0070b8..02199e5 100644 (file)
@@ -19,7 +19,7 @@
 # instead of FLAC__ since autoconf triggers off 'AC_' in strings
 
 AC_INIT(src/flac/main.c)
-AM_INIT_AUTOMAKE(flac, 1.1.0)
+AM_INIT_AUTOMAKE(flac, CVS-20031217)
 
 # Don't automagically regenerate autoconf/automake generated files unless
 # explicitly requested.  Eases autobuilding -mdz
@@ -361,9 +361,10 @@ AC_OUTPUT( \
        src/plugin_winamp3/Makefile \
        src/plugin_xmms/Makefile \
        src/share/Makefile \
-       src/share/gain_analysis/Makefile \
        src/share/getopt/Makefile \
        src/share/grabbag/Makefile \
+       src/share/replaygain_analysis/Makefile \
+       src/share/replaygain_synthesis/Makefile \
        src/share/utf8/Makefile \
        src/test_grabbag/Makefile \
        src/test_grabbag/cuesheet/Makefile \
index da52478..b50d883 100644 (file)
@@ -5,7 +5,8 @@ AUTOMAKE_OPTIONS = foreign
 SUBDIRS = grabbag
 
 EXTRA_DIST = \
-       gain_analysis.h \
        getopt.h \
        grabbag.h \
+       replaygain_analysis.h \
+       replaygain_synthesis.h \
        utf8.h
index 0d6ce80..2bf890b 100644 (file)
@@ -17,7 +17,7 @@
  */
 
 /*
- * This wraps the gain_analysis lib, which is LGPL.  This wrapper
+ * This wraps the replaygain_analysis lib, which is LGPL.  This wrapper
  * allows analysis of different input resolutions by automatically
  * scaling the input signal
  */
similarity index 56%
rename from src/plugin_common/replaygain_synthesis.h
rename to include/share/replaygain_synthesis.h
index 6a21bb1..600a8a6 100644 (file)
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
-#ifndef FLAC__PLUGIN_COMMON__REPLAYGAIN_SYNTHESIS_H
-#define FLAC__PLUGIN_COMMON__REPLAYGAIN_SYNTHESIS_H
+#ifndef FLAC__SHARE__REPLAYGAIN_SYNTHESIS_H
+#define FLAC__SHARE__REPLAYGAIN_SYNTHESIS_H
 
-#include "defs.h"
+#include <stdlib.h> /* for size_t */
 #include "FLAC/ordinals.h"
 
+#define FLAC_SHARE__MAX_SUPPORTED_CHANNELS 2
+
 typedef enum {
        NOISE_SHAPING_NONE = 0,
        NOISE_SHAPING_LOW = 1,
-       NOISE_SHAPING_MEDUIM = 2,
+       NOISE_SHAPING_MEDIUM = 2,
        NOISE_SHAPING_HIGH = 3
 } NoiseShaping;
 
@@ -34,16 +36,16 @@ typedef struct {
        FLAC__uint64  Mask;
        double        Add;
        float         Dither;
-       float         ErrorHistory     [FLAC_PLUGIN__MAX_SUPPORTED_CHANNELS] [16];  /* 16th order Noise shaping */
-       float         DitherHistory    [FLAC_PLUGIN__MAX_SUPPORTED_CHANNELS] [16];
-       int           LastRandomNumber [FLAC_PLUGIN__MAX_SUPPORTED_CHANNELS];
+       float         ErrorHistory     [FLAC_SHARE__MAX_SUPPORTED_CHANNELS] [16];  /* 16th order Noise shaping */
+       float         DitherHistory    [FLAC_SHARE__MAX_SUPPORTED_CHANNELS] [16];
+       int           LastRandomNumber [FLAC_SHARE__MAX_SUPPORTED_CHANNELS];
        unsigned      LastHistoryIndex;
        NoiseShaping  ShapingType;
 } DitherContext;
 
-void FLAC__plugin_common__init_dither_context(DitherContext *dither, int bits, int shapingtype);
+void FLAC__replaygain_synthesis__init_dither_context(DitherContext *dither, int bits, int shapingtype);
 
 /* scale = (float) pow(10., (double)replaygain * 0.05); */
-int FLAC__plugin_common__apply_gain(FLAC__byte *data_out, FLAC__bool little_endian_data_out, const FLAC__int32 * const input[], unsigned wide_samples, unsigned channels, const unsigned source_bps, const unsigned target_bps, const float scale, const FLAC__bool hard_limit, FLAC__bool do_dithering, DitherContext *dither_context);
+size_t FLAC__replaygain_synthesis__apply_gain(FLAC__byte *data_out, FLAC__bool little_endian_data_out, FLAC__bool unsigned_data_out, const FLAC__int32 * const input[], unsigned wide_samples, unsigned channels, const unsigned source_bps, const unsigned target_bps, const float scale, const FLAC__bool hard_limit, FLAC__bool do_dithering, DitherContext *dither_context);
 
 #endif
index c2d70bb..08b40c7 100644 (file)
@@ -44,8 +44,9 @@ flac_SOURCES = \
 flac_LDADD = \
        $(NEED_OGGFLAC_LIB) \
        $(top_builddir)/src/share/grabbag/libgrabbag.la \
-       $(top_builddir)/src/share/gain_analysis/libgain_analysis.la \
        $(top_builddir)/src/share/getopt/libgetopt.a \
+       $(top_builddir)/src/share/replaygain_analysis/libreplaygain_analysis.la \
+       $(top_builddir)/src/share/replaygain_synthesis/libreplaygain_synthesis.la \
        $(top_builddir)/src/share/utf8/libutf8.la \
        $(top_builddir)/src/libFLAC/libFLAC.la \
        @OGG_LIBS@ \
index 32b8263..f4c9854 100644 (file)
@@ -24,16 +24,16 @@ topdir = ../..
 PROGRAM_NAME = flac
 ifeq ($(DARWIN_BUILD),yes)
 INCLUDES     = -I./include -I$(topdir)/include
-LIBS         = -lgrabbag -lFLAC -lgain_analysis -lgetopt -lutf8 -lc -lm
+LIBS         = -lgrabbag -lFLAC -lreplaygain_analysis -lreplaygain_synthesis -lgetopt -lutf8 -lc -lm
 else
 #@@@ TODO: conditionalize ogg includes, defines, and -logg
 ifeq ($(SOLARIS_BUILD),yes)
 INCLUDES     = -I./include -I$(topdir)/include -I$(HOME)/local/include -DFLAC__HAS_OGG
-LIBS         = -lgrabbag -lOggFLAC -lFLAC -lgain_analysis -lgetopt -lutf8 -lm -L$(HOME)/local/lib -logg
+LIBS         = -lgrabbag -lOggFLAC -lFLAC -lreplaygain_analysis -lreplaygain_synthesis -lgetopt -lutf8 -lm -L$(HOME)/local/lib -logg
 else
 #@@@ TODO: conditionalize ogg includes, defines, and -logg
 INCLUDES     = -I./include -I$(topdir)/include -I$(HOME)/local/include -DFLAC__HAS_OGG
-LIBS         = -lgrabbag -lOggFLAC -lFLAC -lgain_analysis -lgetopt -lutf8 -lm -L$(HOME)/local/lib -logg
+LIBS         = -lgrabbag -lOggFLAC -lFLAC -lreplaygain_analysis -lreplaygain_synthesis -lgetopt -lutf8 -lm -L$(HOME)/local/lib -logg
 endif
 endif
 
index 372f7ee..4a6235b 100644 (file)
@@ -31,6 +31,7 @@
 #include <string.h> /* for strcmp() */
 #include "FLAC/all.h"
 #include "share/grabbag.h"
+#include "share/replaygain_synthesis.h"
 #include "decode.h"
 
 #ifdef FLAC__HAS_OGG
@@ -46,6 +47,13 @@ typedef struct {
        FLAC__bool is_aiff_out;
        FLAC__bool is_wave_out;
        FLAC__bool continue_through_decode_errors;
+
+       struct {
+               replaygain_synthesis_spec_t spec;
+               double scale;
+               DitherContext dither_context;
+       } replaygain;
+
        FLAC__bool test_only;
        FLAC__bool analysis_mode;
        analysis_options aopts;
@@ -97,7 +105,7 @@ static FLAC__bool is_big_endian_host_;
 /*
  * local routines
  */
-static FLAC__bool DecoderSession_construct(DecoderSession *d, FLAC__bool is_ogg, FLAC__bool verbose, FLAC__bool is_aiff_out, FLAC__bool is_wave_out, FLAC__bool continue_through_decode_errors, FLAC__bool analysis_mode, analysis_options aopts, utils__SkipUntilSpecification *skip_specification, utils__SkipUntilSpecification *until_specification, const char *infilename, const char *outfilename);
+static FLAC__bool DecoderSession_construct(DecoderSession *d, FLAC__bool is_ogg, FLAC__bool verbose, FLAC__bool is_aiff_out, FLAC__bool is_wave_out, FLAC__bool continue_through_decode_errors, replaygain_synthesis_spec_t replaygain_synthesis_spec, FLAC__bool analysis_mode, analysis_options aopts, utils__SkipUntilSpecification *skip_specification, utils__SkipUntilSpecification *until_specification, const char *infilename, const char *outfilename);
 static void DecoderSession_destroy(DecoderSession *d, FLAC__bool error_occurred);
 static FLAC__bool DecoderSession_init_decoder(DecoderSession *d, decode_options_t decode_options, const char *infilename);
 static FLAC__bool DecoderSession_process(DecoderSession *d);
@@ -144,6 +152,7 @@ int flac__decode_aiff(const char *infilename, const char *outfilename, FLAC__boo
                        /*is_aiff_out=*/true,
                        /*is_wave_out=*/false,
                        options.common.continue_through_decode_errors,
+                       options.common.replaygain_synthesis_spec,
                        analysis_mode,
                        aopts,
                        &options.common.skip_specification,
@@ -179,6 +188,7 @@ int flac__decode_wav(const char *infilename, const char *outfilename, FLAC__bool
                        /*is_aiff_out=*/false,
                        /*is_wave_out=*/true,
                        options.common.continue_through_decode_errors,
+                       options.common.replaygain_synthesis_spec,
                        analysis_mode,
                        aopts,
                        &options.common.skip_specification,
@@ -217,6 +227,7 @@ int flac__decode_raw(const char *infilename, const char *outfilename, FLAC__bool
                        /*is_aiff_out=*/false,
                        /*is_wave_out=*/false,
                        options.common.continue_through_decode_errors,
+                       options.common.replaygain_synthesis_spec,
                        analysis_mode,
                        aopts,
                        &options.common.skip_specification,
@@ -236,7 +247,7 @@ int flac__decode_raw(const char *infilename, const char *outfilename, FLAC__bool
        return DecoderSession_finish_ok(&decoder_session);
 }
 
-FLAC__bool DecoderSession_construct(DecoderSession *d, FLAC__bool is_ogg, FLAC__bool verbose, FLAC__bool is_aiff_out, FLAC__bool is_wave_out, FLAC__bool continue_through_decode_errors, FLAC__bool analysis_mode, analysis_options aopts, utils__SkipUntilSpecification *skip_specification, utils__SkipUntilSpecification *until_specification, const char *infilename, const char *outfilename)
+FLAC__bool DecoderSession_construct(DecoderSession *d, FLAC__bool is_ogg, FLAC__bool verbose, FLAC__bool is_aiff_out, FLAC__bool is_wave_out, FLAC__bool continue_through_decode_errors, replaygain_synthesis_spec_t replaygain_synthesis_spec, FLAC__bool analysis_mode, analysis_options aopts, utils__SkipUntilSpecification *skip_specification, utils__SkipUntilSpecification *until_specification, const char *infilename, const char *outfilename)
 {
 #ifdef FLAC__HAS_OGG
        d->is_ogg = is_ogg;
@@ -248,6 +259,9 @@ FLAC__bool DecoderSession_construct(DecoderSession *d, FLAC__bool is_ogg, FLAC__
        d->is_aiff_out = is_aiff_out;
        d->is_wave_out = is_wave_out;
        d->continue_through_decode_errors = continue_through_decode_errors;
+       d->replaygain.spec = replaygain_synthesis_spec;
+       d->replaygain.scale = 0.0;
+       /* d->replaygain.dither_context gets initialized later once we know the sample resolution */
        d->test_only = (0 == outfilename);
        d->analysis_mode = analysis_mode;
        d->aopts = aopts;
@@ -338,6 +352,8 @@ FLAC__bool DecoderSession_init_decoder(DecoderSession *decoder_session, decode_o
 
                if(!decode_options.use_first_serial_number)
                        OggFLAC__stream_decoder_set_serial_number(decoder_session->decoder.ogg.stream, decode_options.serial_number);
+               if (decoder_session->replaygain.spec.apply)
+                       OggFLAC__stream_decoder_set_metadata_respond(decoder_session->decoder.ogg.stream, FLAC__METADATA_TYPE_VORBIS_COMMENT);
 
                OggFLAC__stream_decoder_set_read_callback(decoder_session->decoder.ogg.stream, read_callback);
                /*
@@ -369,6 +385,8 @@ FLAC__bool DecoderSession_init_decoder(DecoderSession *decoder_session, decode_o
 
                FLAC__file_decoder_set_md5_checking(decoder_session->decoder.flac.file, true);
                FLAC__file_decoder_set_filename(decoder_session->decoder.flac.file, infilename);
+               if (decoder_session->replaygain.spec.apply)
+                       FLAC__file_decoder_set_metadata_respond(decoder_session->decoder.flac.file, FLAC__METADATA_TYPE_VORBIS_COMMENT);
                /*
                 * The three ugly casts here are to 'downcast' the 'void *' argument of
                 * the callback down to 'FLAC__FileDecoder *'.
@@ -800,7 +818,25 @@ FLAC__StreamDecoderWriteStatus write_callback(const void *decoder, const FLAC__F
                        flac__analyze_frame(frame, decoder_session->frame_counter-1, decoder_session->aopts, fout);
                }
                else if(!decoder_session->test_only) {
-                       if(bps == 8) {
+                       if (decoder_session->replaygain.spec.apply) {
+                               const size_t n = FLAC__replaygain_synthesis__apply_gain(
+                                       u8buffer,
+                                       is_big_endian,
+                                       is_unsigned_samples,
+                                       buffer,
+                                       wide_samples,
+                                       channels,
+                                       bps, /* source_bps */
+                                       bps, /* target_bps */
+                                       decoder_session->replaygain.scale,
+                                       decoder_session->replaygain.spec.limiter == RGSS_LIMIT__HARD, /* hard_limit */
+                                       decoder_session->replaygain.spec.noise_shaping != NOISE_SHAPING_NONE, /* do_dithering */
+                                       &decoder_session->replaygain.dither_context
+                               );
+                               if(flac__utils_fwrite(u8buffer, 1, n, fout) != n)
+                                       return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
+                       }
+                       else if(bps == 8) {
                                if(is_unsigned_samples) {
                                        for(sample = wide_sample = 0; wide_sample < wide_samples; wide_sample++)
                                                for(channel = 0; channel < channels; channel++, sample++)
@@ -1047,6 +1083,23 @@ void metadata_callback(const void *decoder, const FLAC__StreamMetadata *metadata
                        }
                }
        }
+       else if(metadata->type == FLAC__METADATA_TYPE_VORBIS_COMMENT) {
+               if (decoder_session->replaygain.spec.apply) {
+                       double gain, peak;
+                       if (!(decoder_session->replaygain.spec.apply = grabbag__replaygain_load_from_vorbiscomment(metadata, decoder_session->replaygain.spec.use_album_gain, &gain, &peak))) {
+                               fprintf(stderr, "%s: WARNING: can't get %s ReplayGain tag\n", decoder_session->inbasefilename, decoder_session->replaygain.spec.use_album_gain? "album":"track");
+                       }
+                       else {
+                               const char *ls[] = { "no", "peak", "hard" };
+                               const char *ns[] = { "no", "low", "medium", "high" };
+                               decoder_session->replaygain.scale = grabbag__replaygain_compute_scale_factor(peak, gain, decoder_session->replaygain.spec.preamp, decoder_session->replaygain.spec.limiter == RGSS_LIMIT__PEAK);
+                               assert(decoder_session->bps > 0 && decoder_session->bps <= 32);
+                               FLAC__replaygain_synthesis__init_dither_context(&decoder_session->replaygain.dither_context, decoder_session->bps, decoder_session->replaygain.spec.noise_shaping);
+                               fprintf(stderr, "%s: INFO: applying %s ReplayGain (gain=%0.2fdB+preamp=%0.1fdB, %s noise shaping, %s limiting) to output\n", decoder_session->inbasefilename, decoder_session->replaygain.spec.use_album_gain? "album":"track", gain, decoder_session->replaygain.spec.preamp, ns[decoder_session->replaygain.spec.noise_shaping], ls[decoder_session->replaygain.spec.limiter]);
+                               fprintf(stderr, "%s: WARNING: applying ReplayGain is not lossless\n", decoder_session->inbasefilename);
+                       }
+               }
+       }
 }
 
 void error_callback(const void *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data)
index 4eb85e6..9e3f10a 100644 (file)
 
 #include "analyze.h"
 #include "utils.h"
+#include "share/replaygain_synthesis.h"
 
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
 typedef struct {
+       FLAC__bool apply;
+       FLAC__bool use_album_gain; /* false => use track gain */
+       enum { RGSS_LIMIT__NONE, RGSS_LIMIT__PEAK, RGSS_LIMIT__HARD} limiter;
+       NoiseShaping noise_shaping;
+       double preamp;
+} replaygain_synthesis_spec_t;
+
+typedef struct {
        FLAC__bool verbose;
        FLAC__bool continue_through_decode_errors;
+       replaygain_synthesis_spec_t replaygain_synthesis_spec;
 #ifdef FLAC__HAS_OGG
        FLAC__bool is_ogg;
        FLAC__bool use_first_serial_number;
index 05c5813..d7e573b 100644 (file)
@@ -1825,6 +1825,8 @@ void ogg_stream_encoder_metadata_callback(const OggFLAC__StreamEncoder *encoder,
 
 void ogg_file_encoder_progress_callback(const OggFLAC__FileEncoder *encoder, FLAC__uint64 bytes_written, FLAC__uint64 samples_written, unsigned frames_written, unsigned total_frames_estimate, void *client_data)
 {
+       (void)encoder;
+
        flac_file_encoder_progress_callback(0, bytes_written, samples_written, frames_written, total_frames_estimate, client_data);
 }
 
index dfdda7d..4420ec0 100644 (file)
@@ -51,7 +51,7 @@ BSC32=bscmake.exe
 # ADD BSC32 /nologo\r
 LINK32=link.exe\r
 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386\r
-# ADD LINK32 ..\..\obj\release\lib\grabbag_static.lib ..\..\obj\release\lib\libOggFLAC_static.lib ..\..\obj\release\lib\libFLAC_static.lib ..\..\obj\release\lib\gain_analysis_static.lib ..\..\obj\release\lib\getopt_static.lib ..\..\obj\release\lib\utf8_static.lib ..\..\obj\release\lib\ogg_static.lib /nologo /subsystem:console /machine:I386\r
+# ADD LINK32 ..\..\obj\release\lib\grabbag_static.lib ..\..\obj\release\lib\libOggFLAC_static.lib ..\..\obj\release\lib\libFLAC_static.lib ..\..\obj\release\lib\replaygain_analysis_static.lib ..\..\obj\release\lib\replaygain_synthesis_static.lib ..\..\obj\release\lib\getopt_static.lib ..\..\obj\release\lib\utf8_static.lib ..\..\obj\release\lib\ogg_static.lib /nologo /subsystem:console /machine:I386\r
 \r
 !ELSEIF  "$(CFG)" == "flac - Win32 Debug"\r
 \r
@@ -76,7 +76,7 @@ BSC32=bscmake.exe
 # ADD BSC32 /nologo\r
 LINK32=link.exe\r
 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
-# ADD LINK32 ..\..\obj\debug\lib\grabbag_static.lib ..\..\obj\debug\lib\libOggFLAC_static.lib ..\..\obj\debug\lib\libFLAC_static.lib ..\..\obj\debug\lib\gain_analysis_static.lib ..\..\obj\debug\lib\getopt_static.lib ..\..\obj\debug\lib\utf8_static.lib ..\..\obj\release\lib\ogg_static.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
+# ADD LINK32 ..\..\obj\debug\lib\grabbag_static.lib ..\..\obj\debug\lib\libOggFLAC_static.lib ..\..\obj\debug\lib\libFLAC_static.lib ..\..\obj\debug\lib\replaygain_analysis_static.lib ..\..\obj\debug\lib\replaygain_synthesis_static.lib ..\..\obj\debug\lib\getopt_static.lib ..\..\obj\debug\lib\utf8_static.lib ..\..\obj\release\lib\ogg_static.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
 \r
 !ENDIF \r
 \r
index 1454cf9..61806b7 100644 (file)
@@ -85,103 +85,104 @@ static struct share__option long_options_[] = {
        /*
         * general options
         */
-       { "help", 0, 0, 'h' },
-       { "explain", 0, 0, 'H' },
-       { "version", 0, 0, 'v' },
-       { "decode", 0, 0, 'd' },
-       { "analyze", 0, 0, 'a' },
-       { "test", 0, 0, 't' },
-       { "stdout", 0, 0, 'c' },
-       { "silent", 0, 0, 's' },
-       { "delete-input-file", 0, 0, 0 },
-       { "output-prefix", 1, 0, 0 },
-       { "output-name", 1, 0, 'o' },
-       { "skip", 1, 0, 0 },
-       { "until", 1, 0, 0 },
+       { "help"             , share__no_argument, 0, 'h' },
+       { "explain"          , share__no_argument, 0, 'H' },
+       { "version"          , share__no_argument, 0, 'v' },
+       { "decode"           , share__no_argument, 0, 'd' },
+       { "analyze"          , share__no_argument, 0, 'a' },
+       { "test"             , share__no_argument, 0, 't' },
+       { "stdout"           , share__no_argument, 0, 'c' },
+       { "silent"           , share__no_argument, 0, 's' },
+       { "delete-input-file", share__no_argument, 0, 0 },
+       { "output-prefix"    , share__required_argument, 0, 0 },
+       { "output-name"      , share__required_argument, 0, 'o' },
+       { "skip"             , share__required_argument, 0, 0 },
+       { "until"            , share__required_argument, 0, 0 },
 
        /*
         * decoding options
         */
-       { "decode-through-errors", 0, 0, 'F' },
+       { "decode-through-errors", share__no_argument, 0, 'F' },
+       { "apply-replaygain-which-is-not-lossless", share__optional_argument, 0, 0 }, /* undocumented */
 
        /*
         * encoding options
         */
-       { "cuesheet", 1, 0, 0 },
-       { "no-cued-seekpoints", 0, 0, 0 },
-       { "tag", 1, 0, 'T' },
-       { "compression-level-0", 0, 0, '0' },
-       { "compression-level-1", 0, 0, '1' },
-       { "compression-level-2", 0, 0, '2' },
-       { "compression-level-3", 0, 0, '3' },
-       { "compression-level-4", 0, 0, '4' },
-       { "compression-level-5", 0, 0, '5' },
-       { "compression-level-6", 0, 0, '6' },
-       { "compression-level-7", 0, 0, '7' },
-       { "compression-level-8", 0, 0, '8' },
-       { "compression-level-9", 0, 0, '9' },
-       { "best", 0, 0, '8' },
-       { "fast", 0, 0, '0' },
-       { "super-secret-totally-impractical-compression-level", 0, 0, 0 },
-       { "verify", 0, 0, 'V' },
-       { "force-aiff-format", 0, 0, 0 },
-       { "force-raw-format", 0, 0, 0 },
-       { "lax", 0, 0, 0 },
-       { "replay-gain", 0, 0, 0 },
-       { "sector-align", 0, 0, 0 },
-       { "seekpoint", 1, 0, 'S' },
-       { "padding", 1, 0, 'P' },
+       { "cuesheet"                  , share__required_argument, 0, 0 },
+       { "no-cued-seekpoints"        , share__no_argument, 0, 0 },
+       { "tag"                       , share__required_argument, 0, 'T' },
+       { "compression-level-0"       , share__no_argument, 0, '0' },
+       { "compression-level-1"       , share__no_argument, 0, '1' },
+       { "compression-level-2"       , share__no_argument, 0, '2' },
+       { "compression-level-3"       , share__no_argument, 0, '3' },
+       { "compression-level-4"       , share__no_argument, 0, '4' },
+       { "compression-level-5"       , share__no_argument, 0, '5' },
+       { "compression-level-6"       , share__no_argument, 0, '6' },
+       { "compression-level-7"       , share__no_argument, 0, '7' },
+       { "compression-level-8"       , share__no_argument, 0, '8' },
+       { "compression-level-9"       , share__no_argument, 0, '9' },
+       { "best"                      , share__no_argument, 0, '8' },
+       { "fast"                      , share__no_argument, 0, '0' },
+       { "super-secret-totally-impractical-compression-level", share__no_argument, 0, 0 },
+       { "verify"                    , share__no_argument, 0, 'V' },
+       { "force-aiff-format"         , share__no_argument, 0, 0 },
+       { "force-raw-format"          , share__no_argument, 0, 0 },
+       { "lax"                       , share__no_argument, 0, 0 },
+       { "replay-gain"               , share__no_argument, 0, 0 },
+       { "sector-align"              , share__no_argument, 0, 0 },
+       { "seekpoint"                 , share__required_argument, 0, 'S' },
+       { "padding"                   , share__required_argument, 0, 'P' },
 #ifdef FLAC__HAS_OGG
-       { "ogg", 0, 0, 0 },
-       { "serial-number", 1, 0, 0 },
+       { "ogg"                       , share__no_argument, 0, 0 },
+       { "serial-number"             , share__required_argument, 0, 0 },
 #endif
-       { "blocksize", 1, 0, 'b' },
-       { "exhaustive-model-search", 0, 0, 'e' },
-       { "max-lpc-order", 1, 0, 'l' },
-       { "mid-side", 0, 0, 'm' },
-       { "adaptive-mid-side", 0, 0, 'M' },
-       { "qlp-coeff-precision-search", 0, 0, 'p' },
-       { "qlp-coeff-precision", 1, 0, 'q' },
-       { "rice-partition-order", 1, 0, 'r' },
-       { "endian", 1, 0, 0 },
-       { "channels", 1, 0, 0 },
-       { "bps", 1, 0, 0 },
-       { "sample-rate", 1, 0, 0 },
-       { "sign", 1, 0, 0 },
+       { "blocksize"                 , share__required_argument, 0, 'b' },
+       { "exhaustive-model-search"   , share__no_argument, 0, 'e' },
+       { "max-lpc-order"             , share__required_argument, 0, 'l' },
+       { "mid-side"                  , share__no_argument, 0, 'm' },
+       { "adaptive-mid-side"         , share__no_argument, 0, 'M' },
+       { "qlp-coeff-precision-search", share__no_argument, 0, 'p' },
+       { "qlp-coeff-precision"       , share__required_argument, 0, 'q' },
+       { "rice-partition-order"      , share__required_argument, 0, 'r' },
+       { "endian"                    , share__required_argument, 0, 0 },
+       { "channels"                  , share__required_argument, 0, 0 },
+       { "bps"                       , share__required_argument, 0, 0 },
+       { "sample-rate"               , share__required_argument, 0, 0 },
+       { "sign"                      , share__required_argument, 0, 0 },
 
        /*
         * analysis options
         */
-       { "residual-gnu-plot", 0, 0, 0 },
-       { "residual-text", 0, 0, 0 },
+       { "residual-gnu-plot", share__no_argument, 0, 0 },
+       { "residual-text", share__no_argument, 0, 0 },
 
        /*
         * negatives
         */
-       { "no-decode-through-errors", 0, 0, 0 },
-       { "no-silent", 0, 0, 0 },
-       { "no-seektable", 0, 0, 0 },
-       { "no-delete-input-file", 0, 0, 0 },
-       { "no-replay-gain", 0, 0, 0 },
-       { "no-sector-align", 0, 0, 0 },
-       { "no-lax", 0, 0, 0 },
+       { "no-decode-through-errors"  , share__no_argument, 0, 0 },
+       { "no-silent"                 , share__no_argument, 0, 0 },
+       { "no-seektable"              , share__no_argument, 0, 0 },
+       { "no-delete-input-file"      , share__no_argument, 0, 0 },
+       { "no-replay-gain"            , share__no_argument, 0, 0 },
+       { "no-sector-align"           , share__no_argument, 0, 0 },
+       { "no-lax"                    , share__no_argument, 0, 0 },
 #ifdef FLAC__HAS_OGG
-       { "no-ogg", 0, 0, 0 },
+       { "no-ogg"                    , share__no_argument, 0, 0 },
 #endif
-       { "no-exhaustive-model-search", 0, 0, 0 },
-       { "no-mid-side", 0, 0, 0 },
-       { "no-adaptive-mid-side", 0, 0, 0 },
-       { "no-qlp-coeff-prec-search", 0, 0, 0 },
-       { "no-padding", 0, 0, 0 },
-       { "no-verify", 0, 0, 0 },
-       { "no-residual-gnuplot", 0, 0, 0 },
-       { "no-residual-text", 0, 0, 0 },
+       { "no-exhaustive-model-search", share__no_argument, 0, 0 },
+       { "no-mid-side"               , share__no_argument, 0, 0 },
+       { "no-adaptive-mid-side"      , share__no_argument, 0, 0 },
+       { "no-qlp-coeff-prec-search"  , share__no_argument, 0, 0 },
+       { "no-padding"                , share__no_argument, 0, 0 },
+       { "no-verify"                 , share__no_argument, 0, 0 },
+       { "no-residual-gnuplot"       , share__no_argument, 0, 0 },
+       { "no-residual-text"          , share__no_argument, 0, 0 },
        /*
         * undocumented debugging options for the test suite
         */
-       { "disable-constant-subframes", 0, 0, 0 },
-       { "disable-fixed-subframes", 0, 0, 0 },
-       { "disable-verbatim-subframes", 0, 0, 0 },
+       { "disable-constant-subframes", share__no_argument, 0, 0 },
+       { "disable-fixed-subframes"   , share__no_argument, 0, 0 },
+       { "disable-verbatim-subframes", share__no_argument, 0, 0 },
 
        {0, 0, 0, 0}
 };
@@ -199,6 +200,7 @@ static struct {
        FLAC__bool verify;
        FLAC__bool verbose;
        FLAC__bool continue_through_decode_errors;
+       replaygain_synthesis_spec_t replaygain_synthesis_spec;
        FLAC__bool lax;
        FLAC__bool test_only;
        FLAC__bool analyze;
@@ -520,6 +522,11 @@ FLAC__bool init_options()
        option_values.verify = false;
        option_values.verbose = true;
        option_values.continue_through_decode_errors = false;
+       option_values.replaygain_synthesis_spec.apply = false;
+       option_values.replaygain_synthesis_spec.use_album_gain = true;
+       option_values.replaygain_synthesis_spec.limiter = RGSS_LIMIT__HARD;
+       option_values.replaygain_synthesis_spec.noise_shaping = NOISE_SHAPING_LOW;
+       option_values.replaygain_synthesis_spec.preamp = 0.0;
        option_values.lax = false;
        option_values.test_only = false;
        option_values.analyze = false;
@@ -635,6 +642,31 @@ int parse_option(int short_option, const char *long_option, const char *option_a
                        FLAC__ASSERT(0 != option_argument);
                        option_values.until_specification = option_argument;
                }
+               else if(0 == strcmp(long_option, "apply-replaygain-which-is-not-lossless")) {
+                       option_values.replaygain_synthesis_spec.apply = true;
+                       if (0 != option_argument) {
+                               char *p;
+                               option_values.replaygain_synthesis_spec.limiter = RGSS_LIMIT__NONE;
+                               option_values.replaygain_synthesis_spec.noise_shaping = NOISE_SHAPING_NONE;
+                               option_values.replaygain_synthesis_spec.preamp = strtod(option_argument, &p);
+                               for ( ; *p; p++) {
+                                       if (*p == 'a')
+                                               option_values.replaygain_synthesis_spec.use_album_gain = true;
+                                       else if (*p == 't')
+                                               option_values.replaygain_synthesis_spec.use_album_gain = false;
+                                       else if (*p == 'l')
+                                               option_values.replaygain_synthesis_spec.limiter = RGSS_LIMIT__PEAK;
+                                       else if (*p == 'L')
+                                               option_values.replaygain_synthesis_spec.limiter = RGSS_LIMIT__HARD;
+                                       else if (*p == 'n' && p[1] >= '0' && p[1] <= '3') {
+                                               option_values.replaygain_synthesis_spec.noise_shaping = p[1] - '0';
+                                               p++;
+                                       }
+                                       else
+                                               return usage_error("ERROR: bad specification string \"%s\" for --%s\n", option_argument, long_option);
+                               }
+                       }
+               }
                else if(0 == strcmp(long_option, "cuesheet")) {
                        FLAC__ASSERT(0 != option_argument);
                        option_values.cuesheet_filename = option_argument;
@@ -1570,6 +1602,7 @@ int decode_file(const char *infilename)
 
        common_options.verbose = option_values.verbose;
        common_options.continue_through_decode_errors = option_values.continue_through_decode_errors;
+       common_options.replaygain_synthesis_spec = option_values.replaygain_synthesis_spec;
 #ifdef FLAC__HAS_OGG
        common_options.is_ogg = treat_as_ogg;
        common_options.use_first_serial_number = !option_values.has_serial_number;
index c25ea13..9b0d49f 100644 (file)
@@ -1,6 +1,8 @@
 /* flac - Command-line FLAC encoder/decoder
  */
 
+#include <string.h>
+
 #include "utils.h"
 
 /*     $OpenBSD: strlcpy.c,v 1.8 2003/06/17 21:56:24 millert Exp $
index 129b960..0ef8aa4 100644 (file)
@@ -40,7 +40,7 @@ metaflac_LDFLAGS =
 
 metaflac_LDADD = \
        $(top_builddir)/src/share/grabbag/libgrabbag.la \
-       $(top_builddir)/src/share/gain_analysis/libgain_analysis.la \
+       $(top_builddir)/src/share/replaygain_analysis/libreplaygain_analysis.la \
        $(top_builddir)/src/share/getopt/libgetopt.a \
        $(top_builddir)/src/share/utf8/libutf8.la \
        $(top_builddir)/src/libFLAC/libFLAC.la \
index dc7f556..4733f40 100644 (file)
@@ -23,7 +23,7 @@ topdir = ../..
 
 PROGRAM_NAME = metaflac
 INCLUDES     = -I./include -I$(topdir)/include
-LIBS         = -lgrabbag -lFLAC -lgain_analysis -lgetopt -lutf8 -lm
+LIBS         = -lgrabbag -lFLAC -lreplaygain_analysis -lgetopt -lutf8 -lm
 
 SRCS_C = \
        main.c \
index ce15728..4856426 100644 (file)
@@ -51,7 +51,7 @@ BSC32=bscmake.exe
 # ADD BSC32 /nologo\r
 LINK32=link.exe\r
 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386\r
-# ADD LINK32 ..\..\obj\release\lib\grabbag_static.lib ..\..\obj\release\lib\libFLAC_static.lib ..\..\obj\release\lib\gain_analysis_static.lib ..\..\obj\release\lib\getopt_static.lib ..\..\obj\release\lib\utf8_static.lib /nologo /subsystem:console /machine:I386\r
+# ADD LINK32 ..\..\obj\release\lib\grabbag_static.lib ..\..\obj\release\lib\libFLAC_static.lib ..\..\obj\release\lib\replaygain_analysis_static.lib ..\..\obj\release\lib\getopt_static.lib ..\..\obj\release\lib\utf8_static.lib /nologo /subsystem:console /machine:I386\r
 \r
 !ELSEIF  "$(CFG)" == "metaflac - Win32 Debug"\r
 \r
@@ -76,7 +76,7 @@ BSC32=bscmake.exe
 # ADD BSC32 /nologo\r
 LINK32=link.exe\r
 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
-# ADD LINK32 ..\..\obj\debug\lib\grabbag_static.lib ..\..\obj\debug\lib\libFLAC_static.lib ..\..\obj\debug\lib\gain_analysis_static.lib ..\..\obj\debug\lib\getopt_static.lib ..\..\obj\debug\lib\utf8_static.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
+# ADD LINK32 ..\..\obj\debug\lib\grabbag_static.lib ..\..\obj\debug\lib\libFLAC_static.lib ..\..\obj\debug\lib\replaygain_analysis_static.lib ..\..\obj\debug\lib\getopt_static.lib ..\..\obj\debug\lib\utf8_static.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
 \r
 !ENDIF \r
 \r
index 687791a..4d5e9ac 100644 (file)
@@ -2,8 +2,6 @@
 
 AUTOMAKE_OPTIONS = foreign
 
-SUBDIRS = include .
-
 INCLUDES = -I$(top_srcdir)/include @ID3LIB_CFLAGS@
 
 noinst_LTLIBRARIES = libplugin_common.la
@@ -17,7 +15,6 @@ noinst_HEADERS = \
        id3v1.h \
        id3v2.h \
        locale_hack.h \
-       replaygain_synthesis.h \
        vorbiscomment.h
 
 libplugin_common_la_SOURCES = \
@@ -26,7 +23,6 @@ libplugin_common_la_SOURCES = \
        dither.c \
        id3v1.c \
        id3v2.c \
-       replaygain_synthesis.c \
        vorbiscomment.c
 
 EXTRA_DIST = \
index f091608..2b6c7ca 100644 (file)
@@ -5,7 +5,7 @@
 topdir = ../..
 
 LIB_NAME = libplugin_common
-INCLUDES = -I./include -I$(topdir)/include -I$(HOME)/local/include
+INCLUDES = -I$(topdir)/include -I$(HOME)/local/include
 DEFINES  = -DFLAC__HAS_ID3LIB -DID3LIB_MAJOR=3 -DID3LIB_MINOR=8 -DID3LIB_PATCH=0
 
 SRCS_C = \
@@ -14,7 +14,6 @@ SRCS_C = \
        dither.c \
        id3v1.c \
        id3v2.c \
-       replaygain_synthesis.c \
        vorbiscomment.c
 
 include $(topdir)/build/lib.mk
index b7e88de..c43e63d 100644 (file)
@@ -25,7 +25,6 @@
 #include "id3v1.h"
 #include "id3v2.h"
 #include "locale_hack.h"
-#include "replaygain_synthesis.h"
 #include "vorbiscomment.h"
 
 #endif
index 006c395..e20bc53 100644 (file)
@@ -105,10 +105,6 @@ SOURCE=.\id3v2.c
 # End Source File\r
 # Begin Source File\r
 \r
-SOURCE=.\replaygain_synthesis.c\r
-# End Source File\r
-# Begin Source File\r
-\r
 SOURCE=.\vorbiscomment.c\r
 # End Source File\r
 # End Group\r
@@ -153,10 +149,6 @@ SOURCE=.\locale_hack.h
 # End Source File\r
 # Begin Source File\r
 \r
-SOURCE=.\replaygain_synthesis.h\r
-# End Source File\r
-# Begin Source File\r
-\r
 SOURCE=.\vorbiscomment.h\r
 # End Source File\r
 # End Group\r
index c7dccb6..7de7057 100644 (file)
@@ -26,6 +26,7 @@
 #include "FLAC/all.h"
 #include "plugin_common/all.h"
 #include "share/grabbag.h"
+#include "share/replaygain_synthesis.h"
 #include "config.h"
 #include "infobox.h"
 #include "tagz.h"
@@ -151,7 +152,7 @@ int play(char *fn)
                cfg.resolution.normal.dither_24_to_16 ? min(file_info_.bits_per_sample, 16) : file_info_.bits_per_sample;
 
        if (file_info_.has_replaygain && cfg.replaygain.enable && cfg.resolution.replaygain.dither)
-               FLAC__plugin_common__init_dither_context(&file_info_.dither_context, file_info_.bits_per_sample, cfg.resolution.replaygain.noise_shaping);
+               FLAC__replaygain_synthesis__init_dither_context(&file_info_.dither_context, file_info_.bits_per_sample, cfg.resolution.replaygain.noise_shaping);
 
        maxlatency = mod_.outMod->Open(file_info_.sample_rate, file_info_.channels, file_info_.output_bits_per_sample, -1, -1);
        if (maxlatency < 0) /* error opening device */
@@ -354,9 +355,10 @@ static DWORD WINAPI DecodeThread(void *unused)
                                unsigned i;
 
                                if(cfg.replaygain.enable && file_info_.has_replaygain) {
-                                       bytes = (int)FLAC__plugin_common__apply_gain(
+                                       bytes = (int)FLAC__replaygain_synthesis__apply_gain(
                                                sample_buffer_,
                                                true, /* little_endian_data_out */
+                                               target_bps == 8, /* unsigned_data_out */
                                                reservoir_,
                                                n,
                                                channels,
index b7d9525..21655d1 100644 (file)
@@ -53,7 +53,7 @@ BSC32=bscmake.exe
 # ADD BSC32 /nologo\r
 LINK32=link.exe\r
 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386\r
-# ADD LINK32 plugin_common_static.lib grabbag_static.lib libFLAC_static.lib gain_analysis_static.lib kernel32.lib user32.lib /nologo /dll /machine:I386 /out:"../../obj/release/bin/in_flac.dll" /libpath:"../../obj/release/lib" /opt:nowin98\r
+# ADD LINK32 plugin_common_static.lib grabbag_static.lib libFLAC_static.lib replaygain_analysis_static.lib replaygain_synthesis_static.lib kernel32.lib user32.lib /nologo /dll /machine:I386 /out:"../../obj/release/bin/in_flac.dll" /libpath:"../../obj/release/lib" /opt:nowin98\r
 # SUBTRACT LINK32 /pdb:none\r
 \r
 !ELSEIF  "$(CFG)" == "in_flac - Win32 Debug"\r
@@ -80,7 +80,7 @@ BSC32=bscmake.exe
 # ADD BSC32 /nologo\r
 LINK32=link.exe\r
 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept\r
-# ADD LINK32 plugin_common_static.lib grabbag_static.lib libFLAC_static.lib gain_analysis_static.lib kernel32.lib user32.lib /nologo /dll /debug /machine:I386 /out:"../../obj/debug/bin/in_flac.dll" /pdbtype:sept /libpath:"../../obj/debug/lib"\r
+# ADD LINK32 plugin_common_static.lib grabbag_static.lib libFLAC_static.lib replaygain_analysis_static.lib replaygain_synthesis_static.lib kernel32.lib user32.lib /nologo /dll /debug /machine:I386 /out:"../../obj/debug/bin/in_flac.dll" /pdbtype:sept /libpath:"../../obj/debug/lib"\r
 # SUBTRACT LINK32 /pdb:none\r
 \r
 !ENDIF \r
index 4039d43..d919e2c 100644 (file)
@@ -59,7 +59,8 @@ endif
 libxmms_flac_la_LIBADD = \
        $(top_builddir)/src/plugin_common/libplugin_common.la \
        $(top_builddir)/src/share/grabbag/libgrabbag.la \
-       $(top_builddir)/src/share/gain_analysis/libgain_analysis.la \
+       $(top_builddir)/src/share/replaygain_analysis/libreplaygain_analysis.la \
+       $(top_builddir)/src/share/replaygain_synthesis/libreplaygain_synthesis.la \
        $(top_builddir)/src/share/utf8/libutf8.la \
        $(top_builddir)/src/libFLAC/libFLAC.la \
        -L$(top_builddir)/src/libFLAC/.libs \
index 6ef1bb9..1becbc8 100644 (file)
@@ -24,7 +24,7 @@ topdir = ../..
 LIB_NAME  = libxmms-flac
 INCLUDES  = $(shell xmms-config --cflags) -I./include -I$(topdir)/include -I..
 # refer to the static libs explicitly
-LIBS = $(topdir)/obj/$(BUILD)/lib/libFLAC.a $(topdir)/obj/$(BUILD)/lib/libplugin_common.a $(topdir)/obj/$(BUILD)/lib/libgrabbag.a $(topdir)/obj/$(BUILD)/lib/libgain_analysis.a $(HOME)/local/lib/libid3.a -lstdc++ -lz
+LIBS = $(topdir)/obj/$(BUILD)/lib/libFLAC.a $(topdir)/obj/$(BUILD)/lib/libplugin_common.a $(topdir)/obj/$(BUILD)/lib/libgrabbag.a $(topdir)/obj/$(BUILD)/lib/libreplaygain_analysis.a $(topdir)/obj/$(BUILD)/lib/libreplaygain_synthesis.a $(HOME)/local/lib/libid3.a -lstdc++ -lz
 
 SRCS_C = \
        charset.c \
index 706a8f6..2a47bd2 100644 (file)
@@ -35,6 +35,7 @@
 #include <xmms/plugin.h>
 
 #include "plugin_common/locale_hack.h"
+#include "share/replaygain_synthesis.h" /* for NOISE_SHAPING_LOW */
 #include "charset.h"
 #include "configure.h"
 
@@ -68,7 +69,7 @@ flac_config_t flac_cfg = {
                        /* replaygain */
                        {
                                TRUE, /* dither */
-                               1, /* noise_shaping */
+                               NOISE_SHAPING_LOW, /* noise_shaping */
                                16 /* bps_out */
                        }
                }
index 0fb5b01..5b6cf92 100644 (file)
@@ -38,6 +38,7 @@
 #include "FLAC/all.h"
 #include "plugin_common/all.h"
 #include "share/grabbag.h"
+#include "share/replaygain_synthesis.h"
 #include "configure.h"
 #include "wrap_id3.h"
 #include "charset.h"
@@ -255,7 +256,7 @@ void FLAC_XMMS__play_file(char *filename)
                        return;
                }
        }
-       FLAC__plugin_common__init_dither_context(&file_info_.dither_context, file_info_.sample_format_bytes_per_sample * 8, flac_cfg.output.resolution.replaygain.noise_shaping);
+       FLAC__replaygain_synthesis__init_dither_context(&file_info_.dither_context, file_info_.sample_format_bytes_per_sample * 8, flac_cfg.output.resolution.replaygain.noise_shaping);
        file_info_.is_playing = true;
 
        if(flac_ip.output->open_audio(file_info_.sample_format, file_info_.sample_rate, file_info_.channels) == 0) {
@@ -501,19 +502,20 @@ FLAC__StreamDecoderWriteStatus write_callback_(const FLAC__FileDecoder *decoder,
                sample_buffer_first_ = 0;
        }
        sample_buffer_start = sample_buffer_ + sample_buffer_last_ * channels * file_info->sample_format_bytes_per_sample;
-       if(file_info_.has_replaygain && flac_cfg.output.replaygain.enable) {
-               FLAC__plugin_common__apply_gain(
+       if(file_info->has_replaygain && flac_cfg.output.replaygain.enable) {
+               FLAC__replaygain_synthesis__apply_gain(
                                sample_buffer_start,
                                !is_big_endian_host_,
+                               file_info->sample_format_bytes_per_sample == 1, /* unsigned_data_out */
                                buffer,
                                wide_samples,
                                channels,
                                bits_per_sample,
                                file_info->sample_format_bytes_per_sample * 8,
-                               file_info_.replay_scale,
+                               file_info->replay_scale,
                                flac_cfg.output.replaygain.hard_limit,
                                flac_cfg.output.resolution.replaygain.dither,
-                               &file_info_.dither_context
+                               &file_info->dither_context
                );
        }
        else if(is_big_endian_host_) {
@@ -557,8 +559,8 @@ void metadata_callback_(const FLAC__FileDecoder *decoder, const FLAC__StreamMeta
        else if(metadata->type == FLAC__METADATA_TYPE_VORBIS_COMMENT) {
                double gain, peak;
                if(grabbag__replaygain_load_from_vorbiscomment(metadata, flac_cfg.output.replaygain.album_mode, &gain, &peak)) {
-                       file_info_.has_replaygain = true;
-                       file_info_.replay_scale = grabbag__replaygain_compute_scale_factor(peak, gain, (double)flac_cfg.output.replaygain.preamp, /*prevent_clipping=*/!flac_cfg.output.replaygain.hard_limit);
+                       file_info->has_replaygain = true;
+                       file_info->replay_scale = grabbag__replaygain_compute_scale_factor(peak, gain, (double)flac_cfg.output.replaygain.preamp, /*prevent_clipping=*/!flac_cfg.output.replaygain.hard_limit);
                }
        }
 }
index c217bc3..caf597d 100644 (file)
@@ -15,7 +15,7 @@
 #  restrictive of those mentioned above.  See the file COPYING.Xiph in this
 #  distribution.
 
-SUBDIRS = gain_analysis getopt grabbag utf8
+SUBDIRS = getopt replaygain_analysis replaygain_synthesis grabbag utf8
 
 EXTRA_DIST = \
        Makefile.lite \
index c567902..3fffc7f 100644 (file)
@@ -15,8 +15,8 @@
 #  restrictive of those mentioned above.  See the file COPYING.Xiph in this
 #  distribution.
 
-.PHONY: all gain_analysis getopt grabbag utf8
-all: gain_analysis getopt grabbag utf8
+.PHONY: all getopt grabbag replaygain_analysis replaygain_synthesis utf8
+all: getopt grabbag replaygain_analysis replaygain_synthesis utf8
 
 DEFAULT_CONFIG = release
 
@@ -30,20 +30,24 @@ debug   : all
 valgrind: all
 release : all
 
-gain_analysis:
-       (cd $@ ; $(MAKE) -f Makefile.lite $(CONFIG))
-
 getopt:
        (cd $@ ; $(MAKE) -f Makefile.lite $(CONFIG))
 
 grabbag:
        (cd $@ ; $(MAKE) -f Makefile.lite $(CONFIG))
 
+replaygain_analysis:
+       (cd $@ ; $(MAKE) -f Makefile.lite $(CONFIG))
+
+replaygain_synthesis:
+       (cd $@ ; $(MAKE) -f Makefile.lite $(CONFIG))
+
 utf8:
        (cd $@ ; $(MAKE) -f Makefile.lite $(CONFIG))
 
 clean:
-       -(cd gain_analysis ; $(MAKE) -f Makefile.lite clean)
        -(cd getopt ; $(MAKE) -f Makefile.lite clean)
        -(cd grabbag ; $(MAKE) -f Makefile.lite clean)
+       -(cd replaygain_analysis ; $(MAKE) -f Makefile.lite clean)
+       -(cd replaygain_synthesis ; $(MAKE) -f Makefile.lite clean)
        -(cd utf8 ; $(MAKE) -f Makefile.lite clean)
index 2c695e4..61db0c1 100644 (file)
@@ -17,7 +17,7 @@
  */
 
 #include "share/grabbag.h"
-#include "share/gain_analysis.h"
+#include "share/replaygain_analysis.h"
 #include "FLAC/assert.h"
 #include "FLAC/file_decoder.h"
 #include "FLAC/metadata.h"
similarity index 63%
rename from src/share/gain_analysis/Makefile.am
rename to src/share/replaygain_analysis/Makefile.am
index f934fa5..a7ad915 100644 (file)
@@ -4,13 +4,13 @@ AUTOMAKE_OPTIONS = foreign
 
 INCLUDES = -I$(top_srcdir)/include/share
 
-noinst_LTLIBRARIES = libgain_analysis.la
+noinst_LTLIBRARIES = libreplaygain_analysis.la
 
-libgain_analysis_la_SOURCES = gain_analysis.c
+libreplaygain_analysis_la_SOURCES = replaygain_analysis.c
 
 EXTRA_DIST = \
        Makefile.lite \
-       gain_analysis_static.dsp
+       replaygain_analysis_static.dsp
 
 debug:
        $(MAKE) all CFLAGS="@DEBUG@"
similarity index 75%
rename from src/share/gain_analysis/Makefile.lite
rename to src/share/replaygain_analysis/Makefile.lite
index 7b28c73..8c4c698 100644 (file)
@@ -4,11 +4,11 @@
 
 topdir = ../../..
 
-LIB_NAME = libgain_analysis
+LIB_NAME = libreplaygain_analysis
 INCLUDES = -I$(topdir)/include/share
 
 SRCS_C = \
-       gain_analysis.c
+       replaygain_analysis.c
 
 include $(topdir)/build/lib.mk
 
@@ -94,7 +94,7 @@
 #include <string.h>\r
 #include <math.h>\r
 \r
-#include "gain_analysis.h"\r
+#include "replaygain_analysis.h"\r
 \r
 typedef unsigned short  Uint16_t;\r
 typedef signed short    Int16_t;\r
@@ -410,4 +410,4 @@ GetAlbumGain ( void )
     return analyzeResult ( B, sizeof(B)/sizeof(*B) );\r
 }\r
 \r
-/* end of gain_analysis.c */\r
+/* end of replaygain_analysis.c */\r
@@ -1,34 +1,34 @@
-# Microsoft Developer Studio Project File - Name="gain_analysis_static" - Package Owner=<4>\r
+# Microsoft Developer Studio Project File - Name="replaygain_analysis_static" - Package Owner=<4>\r
 # Microsoft Developer Studio Generated Build File, Format Version 6.00\r
 # ** DO NOT EDIT **\r
 \r
 # TARGTYPE "Win32 (x86) Static Library" 0x0104\r
 \r
-CFG=gain_analysis_static - Win32 Debug\r
+CFG=replaygain_analysis_static - Win32 Debug\r
 !MESSAGE This is not a valid makefile. To build this project using NMAKE,\r
 !MESSAGE use the Export Makefile command and run\r
 !MESSAGE \r
-!MESSAGE NMAKE /f "gain_analysis_static.mak".\r
+!MESSAGE NMAKE /f "replaygain_analysis_static.mak".\r
 !MESSAGE \r
 !MESSAGE You can specify a configuration when running NMAKE\r
 !MESSAGE by defining the macro CFG on the command line. For example:\r
 !MESSAGE \r
-!MESSAGE NMAKE /f "gain_analysis_static.mak" CFG="gain_analysis_static - Win32 Debug"\r
+!MESSAGE NMAKE /f "replaygain_analysis_static.mak" CFG="replaygain_analysis_static - Win32 Debug"\r
 !MESSAGE \r
 !MESSAGE Possible choices for configuration are:\r
 !MESSAGE \r
-!MESSAGE "gain_analysis_static - Win32 Release" (based on "Win32 (x86) Static Library")\r
-!MESSAGE "gain_analysis_static - Win32 Debug" (based on "Win32 (x86) Static Library")\r
+!MESSAGE "replaygain_analysis_static - Win32 Release" (based on "Win32 (x86) Static Library")\r
+!MESSAGE "replaygain_analysis_static - Win32 Debug" (based on "Win32 (x86) Static Library")\r
 !MESSAGE \r
 \r
 # Begin Project\r
 # PROP AllowPerConfigDependencies 0\r
-# PROP Scc_ProjName "gain_analysis"\r
+# PROP Scc_ProjName "replaygain_analysis"\r
 # PROP Scc_LocalPath "..\..\.."\r
 CPP=cl.exe\r
 RSC=rc.exe\r
 \r
-!IF  "$(CFG)" == "gain_analysis_static - Win32 Release"\r
+!IF  "$(CFG)" == "replaygain_analysis_static - Win32 Release"\r
 \r
 # PROP BASE Use_MFC 0\r
 # PROP BASE Use_Debug_Libraries 0\r
@@ -51,7 +51,7 @@ LIB32=link.exe -lib
 # ADD BASE LIB32 /nologo\r
 # ADD LIB32 /nologo /nodefaultlib\r
 \r
-!ELSEIF  "$(CFG)" == "gain_analysis_static - Win32 Debug"\r
+!ELSEIF  "$(CFG)" == "replaygain_analysis_static - Win32 Debug"\r
 \r
 # PROP BASE Use_MFC 0\r
 # PROP BASE Use_Debug_Libraries 1\r
@@ -78,14 +78,14 @@ LIB32=link.exe -lib
 \r
 # Begin Target\r
 \r
-# Name "gain_analysis_static - Win32 Release"\r
-# Name "gain_analysis_static - Win32 Debug"\r
+# Name "replaygain_analysis_static - Win32 Release"\r
+# Name "replaygain_analysis_static - Win32 Debug"\r
 # Begin Group "Source Files"\r
 \r
 # PROP Default_Filter "c"\r
 # Begin Source File\r
 \r
-SOURCE=.\gain_analysis.c\r
+SOURCE=.\replaygain_analysis.c\r
 # End Source File\r
 # End Group\r
 # Begin Group "Private Header Files"\r
@@ -101,7 +101,7 @@ SOURCE=.\gain_analysis.c
 # PROP Default_Filter ""\r
 # Begin Source File\r
 \r
-SOURCE=..\..\..\include\share\gain_analysis.h\r
+SOURCE=..\..\..\include\share\replaygain_analysis.h\r
 # End Source File\r
 # End Group\r
 # End Target\r
diff --git a/src/share/replaygain_synthesis/Makefile.am b/src/share/replaygain_synthesis/Makefile.am
new file mode 100644 (file)
index 0000000..f94d672
--- /dev/null
@@ -0,0 +1,21 @@
+## Process this file with automake to produce Makefile.in
+
+AUTOMAKE_OPTIONS = foreign
+
+SUBDIRS = include .
+
+INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/include/share
+
+noinst_LTLIBRARIES = libreplaygain_synthesis.la
+
+libreplaygain_synthesis_la_SOURCES = replaygain_synthesis.c
+
+EXTRA_DIST = \
+       Makefile.lite \
+       replaygain_synthesis_static.dsp
+
+debug:
+       $(MAKE) all CFLAGS="@DEBUG@"
+
+profile:
+       $(MAKE) all CFLAGS="@PROFILE@"
diff --git a/src/share/replaygain_synthesis/Makefile.lite b/src/share/replaygain_synthesis/Makefile.lite
new file mode 100644 (file)
index 0000000..e58e708
--- /dev/null
@@ -0,0 +1,15 @@
+#
+# GNU makefile
+#
+
+topdir = ../../..
+
+LIB_NAME = libreplaygain_synthesis
+INCLUDES = -I./include -I$(topdir)/include -I$(topdir)/include/share
+
+SRCS_C = \
+       replaygain_synthesis.c
+
+include $(topdir)/build/lib.mk
+
+# DO NOT DELETE THIS LINE -- make depend depends on it.
similarity index 91%
rename from src/plugin_common/include/Makefile.am
rename to src/share/replaygain_synthesis/include/Makefile.am
index f542f4d..1f9c108 100644 (file)
@@ -1,4 +1,4 @@
-#  plugin_common - Routines common to several plugins
+#  replaygain_synthesis - Routines for applying ReplayGain to a signal
 #  Copyright (C) 2002,2003  Josh Coalson
 # 
 #  This program is free software; you can redistribute it and/or
@@ -1,4 +1,4 @@
-#  plugin_common - Routines common to several plugins
+#  replaygain_synthesis - Routines for applying ReplayGain to a signal
 #  Copyright (C) 2002,2003  Josh Coalson
 # 
 #  This program is free software; you can redistribute it and/or
@@ -1,4 +1,4 @@
-/* plugin_common - Routines common to several plugins
+/* replaygain_synthesis - Routines for applying ReplayGain to a signal
  * Copyright (C) 2002,2003  Josh Coalson
  *
  * This program is free software; you can redistribute it and/or
@@ -199,7 +199,7 @@ static double scalar16_(const float* x, const float* y)
 }
 
 
-void FLAC__plugin_common__init_dither_context(DitherContext *d, int bits, int shapingtype)
+void FLAC__replaygain_synthesis__init_dither_context(DitherContext *d, int bits, int shapingtype)
 {
        static unsigned char default_dither [] = { 92, 92, 88, 84, 81, 78, 74, 67,  0,  0 };
        static const float*               F [] = { F44_0, F44_1, F44_2, F44_3 };
@@ -288,7 +288,7 @@ static FLAC__INLINE FLAC__int64 dither_output_(DitherContext *d, FLAC__bool do_d
 #endif
 
 
-int FLAC__plugin_common__apply_gain(FLAC__byte *data_out, FLAC__bool little_endian_data_out, const FLAC__int32 * const input[], unsigned wide_samples, unsigned channels, const unsigned source_bps, const unsigned target_bps, const float scale, const FLAC__bool hard_limit, FLAC__bool do_dithering, DitherContext *dither_context)
+size_t FLAC__replaygain_synthesis__apply_gain(FLAC__byte *data_out, FLAC__bool little_endian_data_out, FLAC__bool unsigned_data_out, const FLAC__int32 * const input[], unsigned wide_samples, unsigned channels, const unsigned source_bps, const unsigned target_bps, const float scale, const FLAC__bool hard_limit, FLAC__bool do_dithering, DitherContext *dither_context)
 {
        static const FLAC__int32 conv_factors_[33] = {
                -1, /* 0 bits-per-sample (not supported) */
@@ -375,12 +375,14 @@ int FLAC__plugin_common__apply_gain(FLAC__byte *data_out, FLAC__bool little_endi
        const FLAC__int32 *input_;
        double sample;
        const unsigned bytes_per_sample = target_bps / 8;
-       unsigned inc = bytes_per_sample * channels, last_history_index = dither_context->LastHistoryIndex;
+       const unsigned last_history_index = dither_context->LastHistoryIndex;
        NoiseShaping noise_shaping = dither_context->ShapingType;
        FLAC__int64 val64;
        FLAC__int32 val32;
+       FLAC__int32 uval32;
+       const FLAC__uint32 twiggle = 1u << (target_bps - 1);
 
-       FLAC__ASSERT(channels > 0 && channels <= FLAC_PLUGIN__MAX_SUPPORTED_CHANNELS);
+       FLAC__ASSERT(channels > 0 && channels <= FLAC_SHARE__MAX_SUPPORTED_CHANNELS);
        FLAC__ASSERT(source_bps >= 4);
        FLAC__ASSERT(target_bps >= 4);
        FLAC__ASSERT(source_bps <= 32);
@@ -388,9 +390,10 @@ int FLAC__plugin_common__apply_gain(FLAC__byte *data_out, FLAC__bool little_endi
        FLAC__ASSERT((target_bps & 7) == 0);
 
        for(channel = 0; channel < channels; channel++) {
+               const unsigned incr = bytes_per_sample * channels;
                data_out = start + bytes_per_sample * channel;
                input_ = input[channel];
-               for(i = 0; i < wide_samples; i++, data_out += inc) {
+               for(i = 0; i < wide_samples; i++, data_out += incr) {
                        sample = (double)input_[i] * multi_scale;
 
                        if(hard_limit) {
@@ -410,33 +413,36 @@ int FLAC__plugin_common__apply_gain(FLAC__byte *data_out, FLAC__bool little_endi
                        else if(val64 < hard_clip_factor)
                                val32 = (FLAC__int32)hard_clip_factor;
 
+                       uval32 = (FLAC__uint32)val32;
+                       if (unsigned_data_out)
+                               uval32 ^= twiggle;
+
                        if (little_endian_data_out) {
                                switch(target_bps) {
-                                       case 8:
-                                               data_out[0] = val32 ^ 0x80;
-                                               break;
                                        case 24:
-                                               data_out[2] = (FLAC__byte)(val32 >> 16);
+                                               data_out[2] = (FLAC__byte)(uval32 >> 16);
                                                /* fall through */
                                        case 16:
-                                               data_out[1] = (FLAC__byte)(val32 >> 8);
-                                               data_out[0] = (FLAC__byte)val32;
+                                               data_out[1] = (FLAC__byte)(uval32 >> 8);
+                                               /* fall through */
+                                       case 8:
+                                               data_out[0] = (FLAC__byte)uval32;
                                                break;
                                }
                        }
                        else {
                                switch(target_bps) {
-                                       case 8:
-                                               data_out[0] = val32 ^ 0x80;
+                                       case 24:
+                                               data_out[0] = (FLAC__byte)(uval32 >> 16);
+                                               data_out[1] = (FLAC__byte)(uval32 >> 8);
+                                               data_out[2] = (FLAC__byte)uval32;
                                                break;
                                        case 16:
-                                               data_out[0] = (FLAC__byte)(val32 >> 8);
-                                               data_out[1] = (FLAC__byte)val32;
+                                               data_out[0] = (FLAC__byte)(uval32 >> 8);
+                                               data_out[1] = (FLAC__byte)uval32;
                                                break;
-                                       case 24:
-                                               data_out[0] = (FLAC__byte)(val32 >> 16);
-                                               data_out[1] = (FLAC__byte)(val32 >> 8);
-                                               data_out[2] = (FLAC__byte)val32;
+                                       case 8:
+                                               data_out[0] = (FLAC__byte)uval32;
                                                break;
                                }
                        }
@@ -444,5 +450,5 @@ int FLAC__plugin_common__apply_gain(FLAC__byte *data_out, FLAC__bool little_endi
        }
        dither_context->LastHistoryIndex = (last_history_index + wide_samples) % 32;
 
-       return data_out - start;
+       return wide_samples * channels * (target_bps/8);
 }
diff --git a/src/share/replaygain_synthesis/replaygain_synthesis_static.dsp b/src/share/replaygain_synthesis/replaygain_synthesis_static.dsp
new file mode 100644 (file)
index 0000000..cfe7706
--- /dev/null
@@ -0,0 +1,108 @@
+# Microsoft Developer Studio Project File - Name="replaygain_synthesis_static" - Package Owner=<4>\r
+# Microsoft Developer Studio Generated Build File, Format Version 6.00\r
+# ** DO NOT EDIT **\r
+\r
+# TARGTYPE "Win32 (x86) Static Library" 0x0104\r
+\r
+CFG=replaygain_synthesis_static - Win32 Debug\r
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,\r
+!MESSAGE use the Export Makefile command and run\r
+!MESSAGE \r
+!MESSAGE NMAKE /f "replaygain_synthesis_static.mak".\r
+!MESSAGE \r
+!MESSAGE You can specify a configuration when running NMAKE\r
+!MESSAGE by defining the macro CFG on the command line. For example:\r
+!MESSAGE \r
+!MESSAGE NMAKE /f "replaygain_synthesis_static.mak" CFG="replaygain_synthesis_static - Win32 Debug"\r
+!MESSAGE \r
+!MESSAGE Possible choices for configuration are:\r
+!MESSAGE \r
+!MESSAGE "replaygain_synthesis_static - Win32 Release" (based on "Win32 (x86) Static Library")\r
+!MESSAGE "replaygain_synthesis_static - Win32 Debug" (based on "Win32 (x86) Static Library")\r
+!MESSAGE \r
+\r
+# Begin Project\r
+# PROP AllowPerConfigDependencies 0\r
+# PROP Scc_ProjName "replaygain_synthesis"\r
+# PROP Scc_LocalPath "..\..\.."\r
+CPP=cl.exe\r
+RSC=rc.exe\r
+\r
+!IF  "$(CFG)" == "replaygain_synthesis_static - Win32 Release"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 0\r
+# PROP BASE Output_Dir "Release"\r
+# PROP BASE Intermediate_Dir "Release"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 0\r
+# PROP Output_Dir "..\..\..\obj\release\lib"\r
+# PROP Intermediate_Dir "Release_static"\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c\r
+# ADD CPP /nologo /MD /W3 /GX /O2 /Op /I ".\include" /I "..\..\..\include\share" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c\r
+# ADD BASE RSC /l 0x409 /d "NDEBUG"\r
+# ADD RSC /l 0x409 /d "NDEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LIB32=link.exe -lib\r
+# ADD BASE LIB32 /nologo\r
+# ADD LIB32 /nologo /nodefaultlib\r
+\r
+!ELSEIF  "$(CFG)" == "replaygain_synthesis_static - Win32 Debug"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 1\r
+# PROP BASE Output_Dir "Debug"\r
+# PROP BASE Intermediate_Dir "Debug"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 1\r
+# PROP Output_Dir "..\..\..\obj\debug\lib"\r
+# PROP Intermediate_Dir "Debug_static"\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c\r
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".\include" /I "..\..\..\include\share" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c\r
+# ADD BASE RSC /l 0x409 /d "_DEBUG"\r
+# ADD RSC /l 0x409 /d "_DEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LIB32=link.exe -lib\r
+# ADD BASE LIB32 /nologo\r
+# ADD LIB32 /nologo /nodefaultlib\r
+\r
+!ENDIF \r
+\r
+# Begin Target\r
+\r
+# Name "replaygain_synthesis_static - Win32 Release"\r
+# Name "replaygain_synthesis_static - Win32 Debug"\r
+# Begin Group "Source Files"\r
+\r
+# PROP Default_Filter "c"\r
+# Begin Source File\r
+\r
+SOURCE=.\replaygain_synthesis.c\r
+# End Source File\r
+# End Group\r
+# Begin Group "Private Header Files"\r
+\r
+# PROP Default_Filter ""\r
+# End Group\r
+# Begin Group "Protected Header Files"\r
+\r
+# PROP Default_Filter ""\r
+# End Group\r
+# Begin Group "Public Header Files"\r
+\r
+# PROP Default_Filter ""\r
+# Begin Source File\r
+\r
+SOURCE=..\..\..\include\share\replaygain_synthesis.h\r
+# End Source File\r
+# End Group\r
+# End Target\r
+# End Project\r
index 871e42a..9c2652c 100644 (file)
@@ -26,7 +26,7 @@ test_cuesheet_SOURCES = \
        main.c
 test_cuesheet_LDADD = \
        $(top_builddir)/src/share/grabbag/libgrabbag.la \
-       $(top_builddir)/src/share/gain_analysis/libgain_analysis.la \
+       $(top_builddir)/src/share/replaygain_analysis/libreplaygain_analysis.la \
        $(top_builddir)/src/libFLAC/libFLAC.la \
        -lm
 
index 38c6980..fb58e61 100644 (file)
@@ -23,7 +23,7 @@ topdir = ../../..
 
 PROGRAM_NAME = test_cuesheet
 INCLUDES     = -I./include -I$(topdir)/include
-LIBS         = -lgrabbag -lgain_analysis -lFLAC -lm
+LIBS         = -lgrabbag -lreplaygain_analysis -lFLAC -lm
 SRCS_C = \
        main.c
 
index a33ee10..b0ffa89 100644 (file)
@@ -51,7 +51,7 @@ BSC32=bscmake.exe
 # ADD BSC32 /nologo\r
 LINK32=link.exe\r
 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386\r
-# ADD LINK32 ..\..\..\obj\release\lib\grabbag_static.lib ..\..\..\obj\release\lib\gain_analysis_static.lib ..\..\..\obj\release\lib\libFLAC_static.lib /nologo /subsystem:console /machine:I386\r
+# ADD LINK32 ..\..\..\obj\release\lib\grabbag_static.lib ..\..\..\obj\release\lib\replaygain_analysis_static.lib ..\..\..\obj\release\lib\libFLAC_static.lib /nologo /subsystem:console /machine:I386\r
 \r
 !ELSEIF  "$(CFG)" == "test_cuesheet - Win32 Debug"\r
 \r
@@ -76,7 +76,7 @@ BSC32=bscmake.exe
 # ADD BSC32 /nologo\r
 LINK32=link.exe\r
 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
-# ADD LINK32 ..\..\..\obj\debug\lib\grabbag_static.lib ..\..\..\obj\debug\lib\gain_analysis_static.lib ..\..\..\obj\debug\lib\libFLAC_static.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
+# ADD LINK32 ..\..\..\obj\debug\lib\grabbag_static.lib ..\..\..\obj\debug\lib\replaygain_analysis_static.lib ..\..\..\obj\debug\lib\libFLAC_static.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
 \r
 !ENDIF \r
 \r
index a03fa7f..0bcdb04 100644 (file)
@@ -25,7 +25,7 @@ EXTRA_DIST = \
 noinst_PROGRAMS = test_libFLAC++
 test_libFLAC___LDADD = \
        $(top_builddir)/src/share/grabbag/libgrabbag.la \
-       $(top_builddir)/src/share/gain_analysis/libgain_analysis.la \
+       $(top_builddir)/src/share/replaygain_analysis/libreplaygain_analysis.la \
        $(top_builddir)/src/libFLAC++/libFLAC++.la \
        $(top_builddir)/src/libFLAC/libFLAC.la \
        -lm
index a2a3de8..b7010f1 100644 (file)
@@ -23,7 +23,7 @@ topdir = ../..
 
 PROGRAM_NAME = test_libFLAC++
 INCLUDES     = -I$(topdir)/include
-LIBS         = -lgrabbag -lgain_analysis -lFLAC++ -lFLAC -lm
+LIBS         = -lgrabbag -lreplaygain_analysis -lFLAC++ -lFLAC -lm
 SRCS_C = \
        file_utils.c \
        metadata_utils.c
index 975c822..0702a7d 100644 (file)
@@ -51,7 +51,7 @@ BSC32=bscmake.exe
 # ADD BSC32 /nologo\r
 LINK32=link.exe\r
 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386\r
-# ADD LINK32 ..\..\obj\release\lib\grabbag_static.lib ..\..\obj\release\lib\gain_analysis_static.lib ..\..\obj\release\lib\libFLAC++_static.lib ..\..\obj\release\lib\libFLAC_static.lib /nologo /subsystem:console /machine:I386\r
+# ADD LINK32 ..\..\obj\release\lib\grabbag_static.lib ..\..\obj\release\lib\replaygain_analysis_static.lib ..\..\obj\release\lib\libFLAC++_static.lib ..\..\obj\release\lib\libFLAC_static.lib /nologo /subsystem:console /machine:I386\r
 \r
 !ELSEIF  "$(CFG)" == "test_libFLAC++ - Win32 Debug"\r
 \r
@@ -76,7 +76,7 @@ BSC32=bscmake.exe
 # ADD BSC32 /nologo\r
 LINK32=link.exe\r
 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
-# ADD LINK32 ..\..\obj\debug\lib\grabbag_static.lib ..\..\obj\debug\lib\gain_analysis_static.lib ..\..\obj\debug\lib\libFLAC++_static.lib ..\..\obj\debug\lib\libFLAC_static.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
+# ADD LINK32 ..\..\obj\debug\lib\grabbag_static.lib ..\..\obj\debug\lib\replaygain_analysis_static.lib ..\..\obj\debug\lib\libFLAC++_static.lib ..\..\obj\debug\lib\libFLAC_static.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
 \r
 !ENDIF \r
 \r
index 3008ac8..fbc088e 100644 (file)
@@ -25,7 +25,7 @@ INCLUDES = -I$(top_srcdir)/src/libFLAC/include
 noinst_PROGRAMS = test_libFLAC
 test_libFLAC_LDADD = \
        $(top_builddir)/src/share/grabbag/libgrabbag.la \
-       $(top_builddir)/src/share/gain_analysis/libgain_analysis.la \
+       $(top_builddir)/src/share/replaygain_analysis/libreplaygain_analysis.la \
        $(top_builddir)/src/libFLAC/libFLAC.la \
        -lm
 test_libFLAC_SOURCES = \
index a5bb012..effcb1b 100644 (file)
@@ -23,7 +23,7 @@ topdir = ../..
 
 PROGRAM_NAME = test_libFLAC
 INCLUDES     = -I../libFLAC/include -I$(topdir)/include
-LIBS         = -lgrabbag -lgain_analysis -lFLAC -lm
+LIBS         = -lgrabbag -lreplaygain_analysis -lFLAC -lm
 SRCS_C = \
        bitbuffer.c \
        decoders.c \
index 7cfec33..6ce4c61 100644 (file)
@@ -51,7 +51,7 @@ BSC32=bscmake.exe
 # ADD BSC32 /nologo\r
 LINK32=link.exe\r
 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386\r
-# ADD LINK32 ..\..\obj\release\lib\grabbag_static.lib ..\..\obj\release\lib\gain_analysis_static.lib ..\..\obj\release\lib\libFLAC_static.lib /nologo /subsystem:console /machine:I386\r
+# ADD LINK32 ..\..\obj\release\lib\grabbag_static.lib ..\..\obj\release\lib\replaygain_analysis_static.lib ..\..\obj\release\lib\libFLAC_static.lib /nologo /subsystem:console /machine:I386\r
 \r
 !ELSEIF  "$(CFG)" == "test_libFLAC - Win32 Debug"\r
 \r
@@ -76,7 +76,7 @@ BSC32=bscmake.exe
 # ADD BSC32 /nologo\r
 LINK32=link.exe\r
 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
-# ADD LINK32 ..\..\obj\debug\lib\grabbag_static.lib ..\..\obj\debug\lib\gain_analysis_static.lib ..\..\obj\debug\lib\libFLAC_static.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
+# ADD LINK32 ..\..\obj\debug\lib\grabbag_static.lib ..\..\obj\debug\lib\replaygain_analysis_static.lib ..\..\obj\debug\lib\libFLAC_static.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
 \r
 !ENDIF \r
 \r
index 4fbeb63..b16e1e5 100644 (file)
@@ -25,7 +25,7 @@ CFLAGS = @CFLAGS@ @OGG_CFLAGS@
 noinst_PROGRAMS = test_libOggFLAC++
 test_libOggFLAC___LDADD = \
        $(top_builddir)/src/share/grabbag/libgrabbag.la \
-       $(top_builddir)/src/share/gain_analysis/libgain_analysis.la \
+       $(top_builddir)/src/share/replaygain_analysis/libreplaygain_analysis.la \
        $(top_builddir)/src/libOggFLAC++/libOggFLAC++.la \
        $(top_builddir)/src/libOggFLAC/libOggFLAC.la \
        $(top_builddir)/src/libFLAC/libFLAC.la \
index 66f87ff..68c566c 100644 (file)
@@ -24,7 +24,7 @@ topdir = ../..
 PROGRAM_NAME = test_libOggFLAC++
 #@@@ TODO: conditionalize ogg lib path and -logg
 INCLUDES     = -I$(topdir)/include
-LIBS         = -lgrabbag -lgain_analysis -lOggFLAC++ -lOggFLAC -lFLAC -L$(HOME)/local/lib -logg -lm
+LIBS         = -lgrabbag -lreplaygain_analysis -lOggFLAC++ -lOggFLAC -lFLAC -L$(HOME)/local/lib -logg -lm
 SRCS_C = \
        file_utils.c \
        metadata_utils.c
index 273f8f1..a1b6c06 100644 (file)
@@ -51,7 +51,7 @@ BSC32=bscmake.exe
 # ADD BSC32 /nologo\r
 LINK32=link.exe\r
 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386\r
-# ADD LINK32 ..\..\obj\release\lib\grabbag_static.lib ..\..\obj\release\lib\gain_analysis_static.lib ..\..\obj\release\lib\libOggFLAC++_static.lib ..\..\obj\release\lib\libOggFLAC_static.lib ..\..\obj\release\lib\libFLAC++_static.lib ..\..\obj\release\lib\libFLAC_static.lib ..\..\obj\release\lib\ogg_static.lib /nologo /subsystem:console /machine:I386\r
+# ADD LINK32 ..\..\obj\release\lib\grabbag_static.lib ..\..\obj\release\lib\replaygain_analysis_static.lib ..\..\obj\release\lib\libOggFLAC++_static.lib ..\..\obj\release\lib\libOggFLAC_static.lib ..\..\obj\release\lib\libFLAC++_static.lib ..\..\obj\release\lib\libFLAC_static.lib ..\..\obj\release\lib\ogg_static.lib /nologo /subsystem:console /machine:I386\r
 \r
 !ELSEIF  "$(CFG)" == "test_libOggFLAC++ - Win32 Debug"\r
 \r
@@ -76,7 +76,7 @@ BSC32=bscmake.exe
 # ADD BSC32 /nologo\r
 LINK32=link.exe\r
 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
-# ADD LINK32 ..\..\obj\debug\lib\grabbag_static.lib ..\..\obj\debug\lib\gain_analysis_static.lib ..\..\obj\debug\lib\libOggFLAC++_static.lib ..\..\obj\debug\lib\libOggFLAC_static.lib ..\..\obj\debug\lib\libFLAC++_static.lib ..\..\obj\debug\lib\libFLAC_static.lib ..\..\obj\release\lib\ogg_static.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
+# ADD LINK32 ..\..\obj\debug\lib\grabbag_static.lib ..\..\obj\debug\lib\replaygain_analysis_static.lib ..\..\obj\debug\lib\libOggFLAC++_static.lib ..\..\obj\debug\lib\libOggFLAC_static.lib ..\..\obj\debug\lib\libFLAC++_static.lib ..\..\obj\debug\lib\libFLAC_static.lib ..\..\obj\release\lib\ogg_static.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
 \r
 !ENDIF \r
 \r
index 6bcc99f..41ff1fe 100644 (file)
@@ -25,7 +25,7 @@ INCLUDES =
 noinst_PROGRAMS = test_libOggFLAC
 test_libOggFLAC_LDADD = \
        $(top_builddir)/src/share/grabbag/libgrabbag.la \
-       $(top_builddir)/src/share/gain_analysis/libgain_analysis.la \
+       $(top_builddir)/src/share/replaygain_analysis/libreplaygain_analysis.la \
        $(top_builddir)/src/libOggFLAC/libOggFLAC.la \
        $(top_builddir)/src/libFLAC/libFLAC.la \
        @OGG_LIBS@ \
index 56f8a18..f4bd14b 100644 (file)
@@ -24,7 +24,7 @@ topdir = ../..
 PROGRAM_NAME = test_libOggFLAC
 #@@@ TODO: conditionalize ogg lib path and -logg
 INCLUDES     = -I$(topdir)/include
-LIBS         = -lgrabbag -lgain_analysis -lOggFLAC -lFLAC -L$(HOME)/local/lib -logg -lm
+LIBS         = -lgrabbag -lreplaygain_analysis -lOggFLAC -lFLAC -L$(HOME)/local/lib -logg -lm
 SRCS_C = \
        decoders.c \
        encoders.c \
index df2edb5..57ef25b 100644 (file)
@@ -51,7 +51,7 @@ BSC32=bscmake.exe
 # ADD BSC32 /nologo\r
 LINK32=link.exe\r
 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386\r
-# ADD LINK32 ..\..\obj\release\lib\grabbag_static.lib ..\..\obj\release\lib\gain_analysis_static.lib ..\..\obj\release\lib\libOggFLAC_static.lib ..\..\obj\release\lib\libFLAC_static.lib ..\..\obj\release\lib\ogg_static.lib /nologo /subsystem:console /machine:I386\r
+# ADD LINK32 ..\..\obj\release\lib\grabbag_static.lib ..\..\obj\release\lib\replaygain_analysis_static.lib ..\..\obj\release\lib\libOggFLAC_static.lib ..\..\obj\release\lib\libFLAC_static.lib ..\..\obj\release\lib\ogg_static.lib /nologo /subsystem:console /machine:I386\r
 \r
 !ELSEIF  "$(CFG)" == "test_libOggFLAC - Win32 Debug"\r
 \r
@@ -76,7 +76,7 @@ BSC32=bscmake.exe
 # ADD BSC32 /nologo\r
 LINK32=link.exe\r
 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
-# ADD LINK32 ..\..\obj\debug\lib\grabbag_static.lib ..\..\obj\debug\lib\gain_analysis_static.lib ..\..\obj\debug\lib\libOggFLAC_static.lib ..\..\obj\debug\lib\libFLAC_static.lib ..\..\obj\release\lib\ogg_static.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
+# ADD LINK32 ..\..\obj\debug\lib\grabbag_static.lib ..\..\obj\debug\lib\replaygain_analysis_static.lib ..\..\obj\debug\lib\libOggFLAC_static.lib ..\..\obj\debug\lib\libFLAC_static.lib ..\..\obj\release\lib\ogg_static.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
 \r
 !ENDIF \r
 \r