From d8cb703b1e86c9f910211a976d8bed0c7a99379a Mon Sep 17 00:00:00 2001 From: Miika Pekkarinen Date: Sun, 26 Jun 2005 19:41:29 +0000 Subject: Initial DSP implementation. DSP supports resampling audio stream from codecs (currently works corrently only with mp3's, somebody should fix that). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6877 a1c6a512-1295-4272-9138-f99709370657 --- apps/codecs/wav.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'apps/codecs/wav.c') diff --git a/apps/codecs/wav.c b/apps/codecs/wav.c index dfed97d..49bd12d 100644 --- a/apps/codecs/wav.c +++ b/apps/codecs/wav.c @@ -20,6 +20,7 @@ #include "codec.h" #include "playback.h" #include "lib/codeclib.h" +#include "dsp.h" #define BYTESWAP(x) (((x>>8) & 0xff) | ((x<<8) & 0xff00)) @@ -60,12 +61,26 @@ enum codec_status codec_start(struct codec_api* api) ci->configure(CODEC_SET_FILEBUF_WATERMARK, (int *)(1024*512)); ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, (int *)(1024*256)); + ci->configure(DSP_DITHER, (bool *)false); + ci->configure(DSP_SET_STEREO_MODE, (int *)STEREO_INTERLEAVED); + ci->configure(DSP_SET_SAMPLE_DEPTH, (int *)(16)); + next_track: if (codec_init(api)) { return CODEC_ERROR; } + while (!rb->taginfo_ready) + rb->yield(); + + if (rb->id3->frequency != NATIVE_FREQUENCY) { + rb->configure(DSP_SET_FREQUENCY, (long *)(rb->id3->frequency)); + rb->configure(CODEC_DSP_ENABLE, (bool *)true); + } else { + rb->configure(CODEC_DSP_ENABLE, (bool *)false); + } + /* FIX: Correctly parse WAV header - we assume canonical 44-byte header */ header=ci->request_buffer(&n,44); @@ -116,7 +131,7 @@ enum codec_status codec_start(struct codec_api* api) /* Byte-swap data */ for (i=0;i