diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2007-02-21 00:18:06 +0000 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2007-02-21 00:18:06 +0000 |
commit | 3096d0a5404a6b3f7f908c66690537826bf51c65 (patch) | |
tree | f53bf18caa75ba7b83207b86341e75993fab001d | |
parent | 3d2e5c6dc47c6b1003edb1addd5e24d7feb62a2b (diff) | |
download | rockbox-3096d0a5404a6b3f7f908c66690537826bf51c65.tar.gz rockbox-3096d0a5404a6b3f7f908c66690537826bf51c65.zip |
SPC Codec: Now that output clipping is left to the core DSP, some especially loud tracks would have multiplication overflows when fading out at the end. Fixed.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12422 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/codecs/spc.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/apps/codecs/spc.c b/apps/codecs/spc.c index 87b5972087..8d621dd677 100644 --- a/apps/codecs/spc.c +++ b/apps/codecs/spc.c @@ -767,16 +767,24 @@ static int play_track( void ) /* fade? */ if (curtime>ID666.length) { +#ifdef CPU_COLDFIRE + /* Have to switch modes to do this */ + long macsr = coldfire_get_macsr(); + coldfire_set_macsr(EMAC_SATURATE | EMAC_FRACTIONAL | EMAC_ROUND); +#endif int i; for (i=0;i<WAV_CHUNK_SIZE;i++) { if (lasttimesample+i>fadestartsample) { if (fadevol>0) { - samples[i] = (samples[i]*(fadevol>>24))>>7; - samples[i+WAV_CHUNK_SIZE] = (samples[i+WAV_CHUNK_SIZE]*(fadevol>>24))>>7; + samples[i] = FRACMUL(samples[i], fadevol); + samples[i+WAV_CHUNK_SIZE] = FRACMUL(samples[i+WAV_CHUNK_SIZE], fadevol); } else samples[i]=samples[i+WAV_CHUNK_SIZE]=0; fadevol-=fadedec; } } +#ifdef CPU_COLDFIRE + coldfire_set_macsr(macsr); +#endif } /* end? */ if (lasttimesample>=fadeendsample) |