sms wip: Alex kidd shinobi plays sound
[picodrive.git] / pico / sound / sound.c
index e1e0408..7f3fd8d 100644 (file)
@@ -396,3 +396,30 @@ PICO_INTERNAL void PsndGetSamples(int y)
 #endif\r
 }\r
 \r
+PICO_INTERNAL void PsndGetSamplesMS(void)\r
+{\r
+  int *buf32 = PsndBuffer;\r
+  int stereo = (PicoOpt & 8) >> 3;\r
+  int length = PsndLen;\r
+\r
+#if !SIMPLE_WRITE_SOUND\r
+  // compensate for float part of PsndLen\r
+  PsndLen_exc_cnt += PsndLen_exc_add;\r
+  if (PsndLen_exc_cnt >= 0x10000) {\r
+    PsndLen_exc_cnt -= 0x10000;\r
+    length++;\r
+  }\r
+#endif\r
+\r
+  // PSG\r
+  if (PicoOpt & POPT_EN_PSG)\r
+    SN76496Update(PsndOut, length, stereo);\r
+\r
+  // convert + limit to normal 16bit output\r
+  PsndMix_32_to_16l(PsndOut, buf32, length);\r
+\r
+  if (PicoWriteSound != NULL)\r
+    PicoWriteSound(length);\r
+  PsndClear();\r
+}\r
+\r