X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=Pico%2Fsound%2Fmix.c;h=c344fba09bb8594b727f01398865b127aec2d3b2;hb=eaa9417a9b52389534f0dcbae6263781ea809ab2;hp=8e4a63152a7d1b5b36bde25dcb13530d59f4dbbd;hpb=4f265db77684ec33f9533e7c76734498df03bba4;p=picodrive.git diff --git a/Pico/sound/mix.c b/Pico/sound/mix.c index 8e4a631..c344fba 100644 --- a/Pico/sound/mix.c +++ b/Pico/sound/mix.c @@ -1,3 +1,6 @@ +// some code for sample mixing +// (c) Copyright 2006-2007, Grazvydas "notaz" Ignotas + #define MAXOUT (+32767) #define MINOUT (-32768) @@ -8,22 +11,6 @@ } - - -void memcpy32(int *dest, int *src, int count) -{ - while (count--) - *dest++ = *src++; -} - - -void memset32(int *dest, int c, int count) -{ - while (count--) - *dest++ = c; -} - - void mix_32_to_16l_stereo(short *dest, int *src, int count) { int l, r; @@ -55,3 +42,33 @@ void mix_32_to_16_mono(short *dest, int *src, int count) } +void mix_16h_to_32(int *dest_buf, short *mp3_buf, int count) +{ + while (count--) + { + *dest_buf++ += *mp3_buf++ >> 1; + } +} + +void mix_16h_to_32_s1(int *dest_buf, short *mp3_buf, int count) +{ + count >>= 1; + while (count--) + { + *dest_buf++ += *mp3_buf++ >> 1; + *dest_buf++ += *mp3_buf++ >> 1; + mp3_buf += 1*2; + } +} + +void mix_16h_to_32_s2(int *dest_buf, short *mp3_buf, int count) +{ + count >>= 1; + while (count--) + { + *dest_buf++ += *mp3_buf++ >> 1; + *dest_buf++ += *mp3_buf++ >> 1; + mp3_buf += 3*2; + } +} +