diff options
author | J. Shagam <fluffy@beesbuzz.biz> | 2009-12-02 18:11:53 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-12-02 18:11:53 +0100 |
commit | 4076523198655b1b459c8014c0ff8de76d720703 (patch) | |
tree | 6a46f769caf550cd20b25f70c6eaefa2be7198a0 /src/normalize.c | |
parent | 3857bb99909a3b2816c86f19d3bc3776ab7c8f4f (diff) | |
download | mpd-4076523198655b1b459c8014c0ff8de76d720703.tar.gz mpd-4076523198655b1b459c8014c0ff8de76d720703.tar.xz mpd-4076523198655b1b459c8014c0ff8de76d720703.zip |
compress: upgraded to AudioCompress 2.0
Copied sources from
http://beesbuzz.biz/code/audiocompress/AudioCompress-2.0.tar.gz
[mk: created this patch under fluffy's name and fixed some gcc
signed/unsigned comparison warnings]
Diffstat (limited to 'src/normalize.c')
-rw-r--r-- | src/normalize.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/normalize.c b/src/normalize.c index f8304cd1f..f9201df64 100644 --- a/src/normalize.c +++ b/src/normalize.c @@ -19,7 +19,7 @@ #include "config.h" #include "normalize.h" -#include "compress.h" +#include "AudioCompress/compress.h" #include "conf.h" #include "audio_format.h" @@ -27,24 +27,27 @@ int normalizationEnabled; +static struct Compressor *compressor; + void initNormalization(void) { normalizationEnabled = config_get_bool(CONF_VOLUME_NORMALIZATION, DEFAULT_VOLUME_NORMALIZATION); if (normalizationEnabled) - CompressCfg(0, ANTICLIP, TARGET, GAINMAX, GAINSMOOTH, BUCKETS); + compressor = Compressor_new(0); } void finishNormalization(void) { - if (normalizationEnabled) CompressFree(); + if (normalizationEnabled) + Compressor_delete(compressor); } -void normalizeData(char *buffer, int bufferSize, +void normalizeData(void *buffer, int bufferSize, const struct audio_format *format) { if ((format->bits != 16) || (format->channels != 2)) return; - CompressDo(buffer, bufferSize); + Compressor_Process_int16(compressor, buffer, bufferSize / 2); } |