diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2012-02-05 22:35:23 -0500 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2012-02-05 22:35:23 -0500 |
commit | 691c7a76148d3e8f46c98add6d0b78666b503e96 (patch) | |
tree | b0ba0538abae85e43c1394e921303cb7ee6e12d1 /firmware/asm/pcm-mixer.c | |
parent | 64f71e66b2ed6e7ac39cb505b8c1a753006809df (diff) |
Make generic pcm-mixer.c more generic in the way it writes output.
Also remove unused firmmware/asm/generic directory.
Change-Id: If1961f96f4292f00227a9b0148181152ac405e51
Diffstat (limited to 'firmware/asm/pcm-mixer.c')
-rw-r--r-- | firmware/asm/pcm-mixer.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/firmware/asm/pcm-mixer.c b/firmware/asm/pcm-mixer.c index 369e830427..bedaa4c7cb 100644 --- a/firmware/asm/pcm-mixer.c +++ b/firmware/asm/pcm-mixer.c @@ -25,10 +25,9 @@ #include "m68k/pcm-mixer.c" #else -/* generic pcm-mixer.c */ #include "dsp-util.h" /* for clip_sample_16 */ /* Mix channels' samples and apply gain factors */ -static FORCE_INLINE void mix_samples(uint32_t *out, +static FORCE_INLINE void mix_samples(uint16_t *out, int16_t *src0, int32_t src0_amp, int16_t *src1, @@ -42,9 +41,10 @@ static FORCE_INLINE void mix_samples(uint32_t *out, { int32_t l = *src0++ + *src1++; int32_t h = *src0++ + *src1++; - *out++ = (uint16_t)clip_sample_16(l) | (clip_sample_16(h) << 16); + *out++ = clip_sample_16(l); + *out++ = clip_sample_16(h); } - while ((size -= 4) > 0); + while ((size -= 2*sizeof(int16_t)) > 0); } else if (src0_amp != MIX_AMP_UNITY && src1_amp != MIX_AMP_UNITY) { @@ -53,9 +53,10 @@ static FORCE_INLINE void mix_samples(uint32_t *out, { int32_t l = (*src0++ * src0_amp >> 16) + (*src1++ * src1_amp >> 16); int32_t h = (*src0++ * src0_amp >> 16) + (*src1++ * src1_amp >> 16); - *out++ = (uint16_t)clip_sample_16(l) | (clip_sample_16(h) << 16); + *out++ = clip_sample_16(l); + *out++ = clip_sample_16(h); } - while ((size -= 4) > 0); + while ((size -= 2*sizeof(int16_t)) > 0); } else { @@ -74,9 +75,10 @@ static FORCE_INLINE void mix_samples(uint32_t *out, { int32_t l = *src0++ + (*src1++ * src1_amp >> 16); int32_t h = *src0++ + (*src1++ * src1_amp >> 16); - *out++ = (uint16_t)clip_sample_16(l) | (clip_sample_16(h) << 16); + *out++ = clip_sample_16(l); + *out++ = clip_sample_16(h); } - while ((size -= 4) > 0); + while ((size -= 2*sizeof(int16_t)) > 0); } } @@ -97,12 +99,13 @@ static FORCE_INLINE void write_samples(uint32_t *out, do { int32_t l = *src++ * amp >> 16; - int32_t h = *src++ * amp & 0xffff0000; - *out++ = (uint16_t)l | h; + int32_t h = *src++ * amp >> 16; + *out++ = l; + *out++ = h; } - while ((size -= 4) > 0); + while ((size -= 2*sizeof(int16_t)) > 0); } } -#endif +#endif /* CPU_* */ |