added PicoGetStat() for win32
[picodrive.git] / Pico / sound / sound.c
index b966b1f..64e172a 100644 (file)
@@ -15,6 +15,8 @@
 #include "../cd/pcm.h"\r
 #include "mix.h"\r
 \r
+void (*PsndMix_32_to_16l)(short *dest, int *src, int count) = mix_32_to_16l_stereo;\r
+\r
 // master int buffer to mix to\r
 static int PsndBuffer[2*44100/50];\r
 \r
@@ -151,6 +153,9 @@ void PsndRerate(int preserve_state)
   memset32(PsndBuffer, 0, sizeof(PsndBuffer)/4);\r
   if (PsndOut)\r
     PsndClear();\r
+\r
+  // set mixer\r
+  PsndMix_32_to_16l = (PicoOpt & 8) ? mix_32_to_16l_stereo : mix_32_to_16_mono;\r
 }\r
 \r
 \r
@@ -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;\r
   offset <<= stereo;\r
 \r
+#if !SIMPLE_WRITE_SOUND\r
   if (offset == 0) { // should happen once per frame\r
     // compensate for float part of PsndLen\r
     PsndLen_exc_cnt += PsndLen_exc_add;\r
@@ -235,6 +241,7 @@ PICO_INTERNAL int PsndRender(int offset, int length)
       length++;\r
     }\r
   }\r
+#endif\r
 \r
   // PSG\r
   if (PicoOpt & 2)\r
@@ -260,9 +267,7 @@ PICO_INTERNAL int PsndRender(int offset, int length)
     mp3_update(buf32, length, stereo);\r
 \r
   // convert + limit to normal 16bit output\r
-  if (stereo)\r
-       mix_32_to_16l_stereo(PsndOut+offset, buf32, length);\r
-  else mix_32_to_16_mono   (PsndOut+offset, buf32, length);\r
+  PsndMix_32_to_16l(PsndOut+offset, buf32, length);\r
 \r
   return length;\r
 }\r