summaryrefslogtreecommitdiffstats
path: root/apps/codecs/adx.c
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2011-04-27 03:08:23 +0000
committerMichael Sevakis <jethead71@rockbox.org>2011-04-27 03:08:23 +0000
commitc537d5958e8b421ac4f9bef6c8b9e7425a6cf167 (patch)
tree7ed36518fb6524da7bbd913ba7619b85b5d15d23 /apps/codecs/adx.c
parentdcf0f8de4a37ff1d2ea510aef75fa67977a8bdcc (diff)
downloadrockbox-c537d5958e8b421ac4f9bef6c8b9e7425a6cf167.tar.gz
rockbox-c537d5958e8b421ac4f9bef6c8b9e7425a6cf167.zip
Commit FS#12069 - Playback rework - first stages. Gives as thorough as possible a treatment of codec management, track change and metadata logic as possible while maintaining fairly narrow focus and not rewriting everything all at once. Please see the rockbox-dev mail archive on 2011-04-25 (Playback engine rework) for a more thorough manifest of what was addressed. Plugins and codecs become incompatible.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29785 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs/adx.c')
-rw-r--r--apps/codecs/adx.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/apps/codecs/adx.c b/apps/codecs/adx.c
index 832b94797b..a1b57fce58 100644
--- a/apps/codecs/adx.c
+++ b/apps/codecs/adx.c
@@ -45,7 +45,19 @@ static const long cutoff = 500;
static int16_t samples[WAV_CHUNK_SIZE] IBSS_ATTR;
/* this is the codec entry point */
-enum codec_status codec_main(void)
+enum codec_status codec_main(enum codec_entry_call_reason reason)
+{
+ if (reason == CODEC_LOAD) {
+ /* Generic codec initialisation */
+ /* we only render 16 bits */
+ ci->configure(DSP_SET_SAMPLE_DEPTH, 16);
+ }
+
+ return CODEC_OK;
+}
+
+/* this is called for each file to process */
+enum codec_status codec_run(void)
{
int channels;
int sampleswritten, i;
@@ -62,12 +74,8 @@ enum codec_status codec_main(void)
off_t chanstart, bufoff;
/*long coef1=0x7298L,coef2=-0x3350L;*/
long coef1, coef2;
+ intptr_t param;
- /* Generic codec initialisation */
- /* we only render 16 bits */
- ci->configure(DSP_SET_SAMPLE_DEPTH, 16);
-
-next_track:
DEBUGF("ADX: next_track\n");
if (codec_init()) {
return CODEC_ERROR;
@@ -77,10 +85,6 @@ next_track:
/* init history */
ch1_1=ch1_2=ch2_1=ch2_2=0;
- /* wait for track info to load */
- if (codec_wait_taginfo() != 0)
- goto request_next_track;
-
codec_set_replaygain(ci->id3);
/* Get header */
@@ -226,10 +230,10 @@ next_track:
/* The main decoder loop */
while (!endofstream) {
- ci->yield();
- if (ci->stop_codec || ci->new_track) {
+ enum codec_command_action action = ci->get_command(&param);
+
+ if (action == CODEC_ACTION_HALT)
break;
- }
/* do we need to loop? */
if (bufoff > end_adr-18*channels && looping) {
@@ -254,17 +258,17 @@ next_track:
}
/* do we need to seek? */
- if (ci->seek_time) {
+ if (action == CODEC_ACTION_SEEK_TIME) {
uint32_t newpos;
- DEBUGF("ADX: seek to %ldms\n",ci->seek_time);
+ DEBUGF("ADX: seek to %ldms\n", (long)param);
endofstream = 0;
loop_count = 0;
fade_count = -1; /* disable fade */
fade_frames = 1;
- newpos = (((uint64_t)avgbytespersec*(ci->seek_time - 1))
+ newpos = (((uint64_t)avgbytespersec*param)
/ (1000LL*18*channels))*(18*channels);
bufoff = chanstart + newpos;
while (bufoff > end_adr-18*channels) {
@@ -385,9 +389,5 @@ next_track:
1000LL/avgbytespersec);
}
-request_next_track:
- if (ci->request_next_track())
- goto next_track;
-
return CODEC_OK;
}