diff options
Diffstat (limited to 'src/normalize.c')
-rw-r--r-- | src/normalize.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/normalize.c b/src/normalize.c index 63c0d15cb..1c8173def 100644 --- a/src/normalize.c +++ b/src/normalize.c @@ -17,8 +17,9 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#include "config.h" #include "normalize.h" -#include "compress.h" +#include "AudioCompress/compress.h" #include "conf.h" #include "audio_format.h" @@ -26,24 +27,28 @@ 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; + if (format->format != SAMPLE_FORMAT_S16 || format->channels != 2) + return; - CompressDo(buffer, bufferSize); + Compressor_Process_int16(compressor, buffer, bufferSize / 2); } |