X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=pico%2Fsound%2Fsound.c;h=7f3fd8dfb58e35c2d886ec838735a301a94f2eb9;hb=2ec9bec58b89831cdead4cdec8f593c5b99d2715;hp=e1e0408c79a17d1b4d2b7229be2d4b50a3fa80eb;hpb=30eb4622c4b3d88dc5169ce255c66b40a22febbb;p=picodrive.git diff --git a/pico/sound/sound.c b/pico/sound/sound.c index e1e0408..7f3fd8d 100644 --- a/pico/sound/sound.c +++ b/pico/sound/sound.c @@ -396,3 +396,30 @@ PICO_INTERNAL void PsndGetSamples(int y) #endif } +PICO_INTERNAL void PsndGetSamplesMS(void) +{ + int *buf32 = PsndBuffer; + int stereo = (PicoOpt & 8) >> 3; + int length = PsndLen; + +#if !SIMPLE_WRITE_SOUND + // compensate for float part of PsndLen + PsndLen_exc_cnt += PsndLen_exc_add; + if (PsndLen_exc_cnt >= 0x10000) { + PsndLen_exc_cnt -= 0x10000; + length++; + } +#endif + + // PSG + if (PicoOpt & POPT_EN_PSG) + SN76496Update(PsndOut, length, stereo); + + // convert + limit to normal 16bit output + PsndMix_32_to_16l(PsndOut, buf32, length); + + if (PicoWriteSound != NULL) + PicoWriteSound(length); + PsndClear(); +} +