aboutsummaryrefslogtreecommitdiffstats
path: root/test/run_normalize.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-12-14 21:36:25 +0100
committerMax Kellermann <max@duempel.org>2009-12-25 17:51:08 +0100
commit870436a592b081c4630b9ecc36ff8daecf6496cc (patch)
tree96aca67066a54b308cd2958467bb17b81234f3fb /test/run_normalize.c
parent6a17233f78d177bacc3b13fa4e8ac15fe08a4f51 (diff)
downloadmpd-870436a592b081c4630b9ecc36ff8daecf6496cc.tar.gz
mpd-870436a592b081c4630b9ecc36ff8daecf6496cc.tar.xz
mpd-870436a592b081c4630b9ecc36ff8daecf6496cc.zip
output_init: use the normalize filter plugin
Use the plugin instead of the glue code in normalize.c. This is used wrapped inside a "autoconv" filter, to enable normalization for all input file formats.
Diffstat (limited to '')
-rw-r--r--test/run_normalize.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/test/run_normalize.c b/test/run_normalize.c
index 979be9201..33446d884 100644
--- a/test/run_normalize.c
+++ b/test/run_normalize.c
@@ -24,10 +24,9 @@
*/
#include "config.h"
-#include "normalize.h"
+#include "AudioCompress/compress.h"
#include "audio_parser.h"
#include "audio_format.h"
-#include "conf.h"
#include <glib.h>
@@ -35,20 +34,12 @@
#include <unistd.h>
#include <string.h>
-bool
-config_get_bool(const char *name, bool default_value)
-{
- if (strcmp(name, CONF_VOLUME_NORMALIZATION) == 0)
- return true;
- else
- return default_value;
-}
-
int main(int argc, char **argv)
{
GError *error = NULL;
struct audio_format audio_format;
bool ret;
+ struct Compressor *compressor;
static char buffer[4096];
ssize_t nbytes;
@@ -68,12 +59,13 @@ int main(int argc, char **argv)
} else
audio_format_init(&audio_format, 48000, 16, 2);
- initNormalization();
+ compressor = Compressor_new(0);
while ((nbytes = read(0, buffer, sizeof(buffer))) > 0) {
- normalizeData(buffer, nbytes, &audio_format);
+ Compressor_Process_int16(compressor,
+ (int16_t *)buffer, nbytes / 2);
write(1, buffer, nbytes);
}
- finishNormalization();
+ Compressor_delete(compressor);
}