X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=Pico%2Fsound%2Fsound.c;h=64e172a07c3710875ea213b5d603f40cc9ce39dd;hb=8e5427a06854695302a879dba5f0cbb3886e7253;hp=b966b1f79f1bb20585430af11a42a9e110be48ee;hpb=c6196c0f0108d27df27d576ece320b3ec5705bb3;p=picodrive.git diff --git a/Pico/sound/sound.c b/Pico/sound/sound.c index b966b1f..64e172a 100644 --- a/Pico/sound/sound.c +++ b/Pico/sound/sound.c @@ -15,6 +15,8 @@ #include "../cd/pcm.h" #include "mix.h" +void (*PsndMix_32_to_16l)(short *dest, int *src, int count) = mix_32_to_16l_stereo; + // master int buffer to mix to static int PsndBuffer[2*44100/50]; @@ -151,6 +153,9 @@ void PsndRerate(int preserve_state) memset32(PsndBuffer, 0, sizeof(PsndBuffer)/4); if (PsndOut) PsndClear(); + + // set mixer + PsndMix_32_to_16l = (PicoOpt & 8) ? mix_32_to_16l_stereo : mix_32_to_16_mono; } @@ -227,6 +232,7 @@ PICO_INTERNAL int PsndRender(int offset, int length) int do_pcm = (PicoMCD&1) && (PicoOpt&0x400) && (Pico_mcd->pcm.control & 0x80) && Pico_mcd->pcm.enabled; offset <<= stereo; +#if !SIMPLE_WRITE_SOUND if (offset == 0) { // should happen once per frame // compensate for float part of PsndLen PsndLen_exc_cnt += PsndLen_exc_add; @@ -235,6 +241,7 @@ PICO_INTERNAL int PsndRender(int offset, int length) length++; } } +#endif // PSG if (PicoOpt & 2) @@ -260,9 +267,7 @@ PICO_INTERNAL int PsndRender(int offset, int length) mp3_update(buf32, length, stereo); // convert + limit to normal 16bit output - if (stereo) - mix_32_to_16l_stereo(PsndOut+offset, buf32, length); - else mix_32_to_16_mono (PsndOut+offset, buf32, length); + PsndMix_32_to_16l(PsndOut+offset, buf32, length); return length; }