summaryrefslogtreecommitdiff
path: root/apps/codecs/wav.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/codecs/wav.c')
-rw-r--r--apps/codecs/wav.c23
1 files changed, 2 insertions, 21 deletions
diff --git a/apps/codecs/wav.c b/apps/codecs/wav.c
index 9add1f512a..26cbf7f6a1 100644
--- a/apps/codecs/wav.c
+++ b/apps/codecs/wav.c
@@ -25,8 +25,6 @@ CODEC_HEADER
25/* Macro that sign extends an unsigned byte */ 25/* Macro that sign extends an unsigned byte */
26#define SE(x) ((int32_t)((int8_t)(x))) 26#define SE(x) ((int32_t)((int8_t)(x)))
27 27
28struct codec_api *rb;
29
30/* This codec support WAVE files with the following formats: 28/* This codec support WAVE files with the following formats:
31 * - PCM, up to 32 bits, supporting 32 bits playback when useful. 29 * - PCM, up to 32 bits, supporting 32 bits playback when useful.
32 * - ALAW and MULAW (16 bits compressed on 8 bits). 30 * - ALAW and MULAW (16 bits compressed on 8 bits).
@@ -95,14 +93,6 @@ enum
95/* for 44.1kHz stereo 16bits, this represents 0.023s ~= 1/50s */ 93/* for 44.1kHz stereo 16bits, this represents 0.023s ~= 1/50s */
96#define WAV_CHUNK_SIZE (1024*2) 94#define WAV_CHUNK_SIZE (1024*2)
97 95
98#ifdef USE_IRAM
99extern char iramcopy[];
100extern char iramstart[];
101extern char iramend[];
102extern char iedata[];
103extern char iend[];
104#endif
105
106static const int16_t alaw2linear16[256] ICONST_ATTR = { 96static const int16_t alaw2linear16[256] ICONST_ATTR = {
107 -5504, -5248, -6016, -5760, -4480, -4224, -4992, 97 -5504, -5248, -6016, -5760, -4480, -4224, -4992,
108 -4736, -7552, -7296, -8064, -7808, -6528, -6272, 98 -4736, -7552, -7296, -8064, -7808, -6528, -6272,
@@ -213,9 +203,8 @@ decode_dvi_adpcm(struct codec_api *ci,
213 size_t *pcmoutsize); 203 size_t *pcmoutsize);
214 204
215/* this is the codec entry point */ 205/* this is the codec entry point */
216enum codec_status codec_start(struct codec_api *api) 206enum codec_status codec_main(void)
217{ 207{
218 struct codec_api *ci;
219 uint32_t numbytes, bytesdone; 208 uint32_t numbytes, bytesdone;
220 uint32_t totalsamples = 0; 209 uint32_t totalsamples = 0;
221 uint16_t channels = 0; 210 uint16_t channels = 0;
@@ -235,20 +224,12 @@ enum codec_status codec_start(struct codec_api *api)
235 224
236 225
237 /* Generic codec initialisation */ 226 /* Generic codec initialisation */
238 rb = api;
239 ci = api;
240
241#ifdef USE_IRAM
242 ci->memcpy(iramstart, iramcopy, iramend - iramstart);
243 ci->memset(iedata, 0, iend - iedata);
244#endif
245
246 ci->configure(DSP_SET_SAMPLE_DEPTH, (long *)28); 227 ci->configure(DSP_SET_SAMPLE_DEPTH, (long *)28);
247 ci->configure(CODEC_SET_FILEBUF_WATERMARK, (int *)(1024*512)); 228 ci->configure(CODEC_SET_FILEBUF_WATERMARK, (int *)(1024*512));
248 ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, (int *)(1024*256)); 229 ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, (int *)(1024*256));
249 230
250next_track: 231next_track:
251 if (codec_init(api)) { 232 if (codec_init()) {
252 i = CODEC_ERROR; 233 i = CODEC_ERROR;
253 goto exit; 234 goto exit;
254 } 235 }