X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=pico%2Fsound%2Fsound.c;h=b1204e2277c5a5e6cbf36355aa9acf58e0b4a0fe;hb=8a19f430a526d011f593b633ea3811fc534123ea;hp=e1e0408c79a17d1b4d2b7229be2d4b50a3fa80eb;hpb=c8d1e9b66255c00a3bef7ca27ae019e3523d7a4b;p=picodrive.git diff --git a/pico/sound/sound.c b/pico/sound/sound.c index e1e0408..b1204e2 100644 --- a/pico/sound/sound.c +++ b/pico/sound/sound.c @@ -396,3 +396,33 @@ PICO_INTERNAL void PsndGetSamples(int y) #endif } +PICO_INTERNAL void PsndGetSamplesMS(void) +{ + 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); + + // upmix to "stereo" if needed + if (stereo) { + int i, *p; + for (i = length, p = (void *)PsndOut; i > 0; i--, p++) + *p |= *p << 16; + } + + if (PicoWriteSound != NULL) + PicoWriteSound(length); + PsndClear(); +} +