diff options
Diffstat (limited to 'apps/codecs/wav.c')
-rw-r--r-- | apps/codecs/wav.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/apps/codecs/wav.c b/apps/codecs/wav.c index dfed97d64c..49bd12da1f 100644 --- a/apps/codecs/wav.c +++ b/apps/codecs/wav.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include "codec.h" | 20 | #include "codec.h" |
21 | #include "playback.h" | 21 | #include "playback.h" |
22 | #include "lib/codeclib.h" | 22 | #include "lib/codeclib.h" |
23 | #include "dsp.h" | ||
23 | 24 | ||
24 | #define BYTESWAP(x) (((x>>8) & 0xff) | ((x<<8) & 0xff00)) | 25 | #define BYTESWAP(x) (((x>>8) & 0xff) | ((x<<8) & 0xff00)) |
25 | 26 | ||
@@ -60,12 +61,26 @@ enum codec_status codec_start(struct codec_api* api) | |||
60 | ci->configure(CODEC_SET_FILEBUF_WATERMARK, (int *)(1024*512)); | 61 | ci->configure(CODEC_SET_FILEBUF_WATERMARK, (int *)(1024*512)); |
61 | ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, (int *)(1024*256)); | 62 | ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, (int *)(1024*256)); |
62 | 63 | ||
64 | ci->configure(DSP_DITHER, (bool *)false); | ||
65 | ci->configure(DSP_SET_STEREO_MODE, (int *)STEREO_INTERLEAVED); | ||
66 | ci->configure(DSP_SET_SAMPLE_DEPTH, (int *)(16)); | ||
67 | |||
63 | next_track: | 68 | next_track: |
64 | 69 | ||
65 | if (codec_init(api)) { | 70 | if (codec_init(api)) { |
66 | return CODEC_ERROR; | 71 | return CODEC_ERROR; |
67 | } | 72 | } |
68 | 73 | ||
74 | while (!rb->taginfo_ready) | ||
75 | rb->yield(); | ||
76 | |||
77 | if (rb->id3->frequency != NATIVE_FREQUENCY) { | ||
78 | rb->configure(DSP_SET_FREQUENCY, (long *)(rb->id3->frequency)); | ||
79 | rb->configure(CODEC_DSP_ENABLE, (bool *)true); | ||
80 | } else { | ||
81 | rb->configure(CODEC_DSP_ENABLE, (bool *)false); | ||
82 | } | ||
83 | |||
69 | /* FIX: Correctly parse WAV header - we assume canonical 44-byte header */ | 84 | /* FIX: Correctly parse WAV header - we assume canonical 44-byte header */ |
70 | 85 | ||
71 | header=ci->request_buffer(&n,44); | 86 | header=ci->request_buffer(&n,44); |
@@ -116,7 +131,7 @@ enum codec_status codec_start(struct codec_api* api) | |||
116 | 131 | ||
117 | /* Byte-swap data */ | 132 | /* Byte-swap data */ |
118 | for (i=0;i<n/2;i++) { | 133 | for (i=0;i<n/2;i++) { |
119 | wavbuf[i]=BYTESWAP(wavbuf[i]); | 134 | wavbuf[i]=SWAB16(wavbuf[i]); |
120 | } | 135 | } |
121 | 136 | ||
122 | samplesdone+=nsamples; | 137 | samplesdone+=nsamples; |