X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=pico%2Fsound%2Fsound.c;h=daf62b012696728d16a39e98fd93c0f6e3129054;hb=74f5e726ba66ace3c4976a4ac5f13a92fdbfbae1;hp=39ae2910e6fe39fdaa05d0d8a82bb88e526c0795;hpb=1cfc5cc4ce06642b9bc45ca3b9d32793718e9455;p=picodrive.git diff --git a/pico/sound/sound.c b/pico/sound/sound.c index 39ae291..daf62b0 100644 --- a/pico/sound/sound.c +++ b/pico/sound/sound.c @@ -297,7 +297,7 @@ PICO_INTERNAL void PsndClear(void) } -PICO_INTERNAL int PsndRender(int offset, int length) +static int PsndRender(int offset, int length) { int buf32_updated = 0; int *buf32 = PsndBuffer+offset; @@ -361,6 +361,35 @@ PICO_INTERNAL int PsndRender(int offset, int length) return length; } +// to be called on 224 or line_sample scanlines only +PICO_INTERNAL void PsndGetSamples(int y) +{ +#if SIMPLE_WRITE_SOUND + if (y != 224) return; + PsndRender(0, PsndLen); + if (PicoWriteSound) PicoWriteSound(PsndLen); + PsndClear(); +#else + static int curr_pos = 0; + + if (y == 224) + { + if (emustatus & 2) + curr_pos += PsndRender(curr_pos, PsndLen-PsndLen/2); + else curr_pos = PsndRender(0, PsndLen); + if (emustatus&1) emustatus|=2; else emustatus&=~2; + if (PicoWriteSound) PicoWriteSound(curr_pos); + // clear sound buffer + PsndClear(); + } + else if (emustatus & 3) { + emustatus|= 2; + emustatus&=~1; + curr_pos = PsndRender(0, PsndLen/2); + } +#endif +} + // ----------------------------------------------------------------- // z80 stuff