X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=pico%2Fsound%2Fsound.c;h=5bb8e9d89fc216358958c98572e5ce1dae3db880;hb=cf82669f5072028f623a4b92516c74947040e563;hp=6e0db26ca7ccd700a11ebc0c9e4ca3953bd7b37d;hpb=af37bca858874b5cbd5ab126eaba1fad6ff7ab72;p=picodrive.git diff --git a/pico/sound/sound.c b/pico/sound/sound.c index 6e0db26..5bb8e9d 100644 --- a/pico/sound/sound.c +++ b/pico/sound/sound.c @@ -247,7 +247,7 @@ PICO_INTERNAL void cdda_start_play(void) lba_offset += Pico_mcd->TOC.Tracks[index].Offset; // find the actual file for this track - for (i = index; i >= 0; i--) + for (i = index; i > 0; i--) if (Pico_mcd->TOC.Tracks[i].F != NULL) break; if (Pico_mcd->TOC.Tracks[i].F == NULL) { @@ -291,7 +291,7 @@ PICO_INTERNAL void PsndClear(void) memset32((int *) PsndOut, 0, len); // assume PsndOut to be aligned else { short *out = PsndOut; - if ((int)out & 2) { *out++ = 0; len--; } + if ((long)out & 2) { *out++ = 0; len--; } memset32((int *) out, 0, len/2); if (len & 1) out[len-1] = 0; } @@ -308,6 +308,8 @@ static int PsndRender(int offset, int length) (Pico_mcd->pcm.control & 0x80) && Pico_mcd->pcm.enabled; offset <<= stereo; + pprof_start(sound); + #if !SIMPLE_WRITE_SOUND if (offset == 0) { // should happen once per frame // compensate for float part of PsndLen @@ -356,9 +358,14 @@ static int PsndRender(int offset, int length) cdda_raw_update(buf32, length); } + if ((PicoAHW & PAHW_32X) && (PicoOpt & POPT_EN_PWM)) + p32x_pwm_update(buf32, length, stereo); + // convert + limit to normal 16bit output PsndMix_32_to_16l(PsndOut+offset, buf32, length); + pprof_end(sound); + return length; }