diff options
author | Miika Pekkarinen <miipekk@ihme.org> | 2005-06-26 19:41:29 +0000 |
---|---|---|
committer | Miika Pekkarinen <miipekk@ihme.org> | 2005-06-26 19:41:29 +0000 |
commit | d8cb703b1e86c9f910211a976d8bed0c7a99379a (patch) | |
tree | 6db3b698d83e639974bd6603225ff11891652113 /apps/codecs/vorbis.c | |
parent | 316eb6538e2fc88efa93248deb761679071409f1 (diff) |
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
Diffstat (limited to 'apps/codecs/vorbis.c')
-rw-r--r-- | apps/codecs/vorbis.c | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/apps/codecs/vorbis.c b/apps/codecs/vorbis.c index f2939aa68d..9afeb053e1 100644 --- a/apps/codecs/vorbis.c +++ b/apps/codecs/vorbis.c @@ -21,6 +21,7 @@ #include "Tremor/ivorbisfile.h" #include "playback.h" +#include "dsp.h" #include "lib/codeclib.h" static struct codec_api* rb; @@ -92,10 +93,6 @@ enum codec_status codec_start(struct codec_api* api) long n; int current_section; int eof; -#if BYTE_ORDER == BIG_ENDIAN - int i; - char x; -#endif TEST_CODEC_API(api); @@ -110,15 +107,27 @@ enum codec_status codec_start(struct codec_api* api) rb->configure(CODEC_SET_FILEBUF_LIMIT, (int *)(1024*1024*2)); rb->configure(CODEC_SET_FILEBUF_CHUNKSIZE, (int *)(1024*64)); - /* We need to flush reserver memory every track load. */ + rb->configure(DSP_DITHER, (bool *)false); + rb->configure(DSP_SET_STEREO_MODE, (int *)STEREO_INTERLEAVED); + rb->configure(DSP_SET_SAMPLE_DEPTH, (int *)(16)); + +/* We need to flush reserver memory every track load. */ next_track: if (codec_init(rb)) { 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); + } + /* Create a decoder instance */ - callbacks.read_func=read_handler; callbacks.seek_func=seek_handler; callbacks.tell_func=tell_handler; @@ -148,17 +157,10 @@ enum codec_status codec_start(struct codec_api* api) if (rb->stop_codec || rb->reload_codec) break ; - rb->yield(); while (!rb->audiobuffer_insert(pcmbuf, n)) rb->yield(); rb->set_elapsed(ov_time_tell(&vf)); - -#if BYTE_ORDER == BIG_ENDIAN - for (i=0;i<n;i+=2) { - x=pcmbuf[i]; pcmbuf[i]=pcmbuf[i+1]; pcmbuf[i+1]=x; - } -#endif } } |