X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=pico%2Fsound%2Fsound.c;h=e799e93686cb01aea53206f83a06f6e079e50160;hb=075672bf9f028490174bd3fbebe957a47a10b09d;hp=a67ebcca09288d0c54f3964e305061a35dd2b7f5;hpb=e42a47e2086e6512519dd86af420363498302f49;p=picodrive.git diff --git a/pico/sound/sound.c b/pico/sound/sound.c index a67ebcc..e799e93 100644 --- a/pico/sound/sound.c +++ b/pico/sound/sound.c @@ -141,9 +141,9 @@ void PsndRerate(int preserve_state) PsndClear(); // set mixer - PsndMix_32_to_16l = (PicoOpt & POPT_EN_STEREO) ? mix_32_to_16l_stereo : mix_32_to_16_mono; + PsndMix_32_to_16l = (PicoIn.opt & POPT_EN_STEREO) ? mix_32_to_16l_stereo : mix_32_to_16_mono; - if (PicoAHW & PAHW_PICO) + if (PicoIn.AHW & PAHW_PICO) PicoReratePico(); } @@ -159,7 +159,7 @@ PICO_INTERNAL void PsndStartFrame(void) } PsndDacLine = PsndPsgLine = 0; - emustatus &= ~1; + Pico.m.status &= ~1; dac_info[224] = PsndLen_use; } @@ -183,7 +183,7 @@ PICO_INTERNAL void PsndDoDAC(int line_to) if (!PsndOut) return; - if (PicoOpt & POPT_EN_STEREO) { + if (PicoIn.opt & POPT_EN_STEREO) { short *d = PsndOut + pos*2; for (; len > 0; len--, d+=2) *d += dout; } else { @@ -211,10 +211,10 @@ PICO_INTERNAL void PsndDoPSG(int line_to) PsndPsgLine = line_to + 1; - if (!PsndOut || !(PicoOpt & POPT_EN_PSG)) + if (!PsndOut || !(PicoIn.opt & POPT_EN_PSG)) return; - if (PicoOpt & POPT_EN_STEREO) { + if (PicoIn.opt & POPT_EN_STEREO) { stereo = 1; pos <<= 1; } @@ -272,7 +272,7 @@ PICO_INTERNAL void PsndClear(void) { int len = PsndLen; if (PsndLen_exc_add) len++; - if (PicoOpt & POPT_EN_STEREO) + if (PicoIn.opt & POPT_EN_STEREO) memset32((int *) PsndOut, 0, len); // assume PsndOut to be aligned else { short *out = PsndOut; @@ -287,19 +287,19 @@ static int PsndRender(int offset, int length) { int buf32_updated = 0; int *buf32 = PsndBuffer+offset; - int stereo = (PicoOpt & 8) >> 3; + int stereo = (PicoIn.opt & 8) >> 3; offset <<= stereo; pprof_start(sound); - if (PicoAHW & PAHW_PICO) { + if (PicoIn.AHW & PAHW_PICO) { PicoPicoPCMUpdate(PsndOut+offset, length, stereo); return length; } // Add in the stereo FM buffer - if (PicoOpt & POPT_EN_FM) { + if (PicoIn.opt & POPT_EN_FM) { buf32_updated = YM2612UpdateOne(buf32, length, stereo, 1); } else memset32(buf32, 0, length<cdda_stream != NULL && !(Pico_mcd->s68k_regs[0x36] & 1)) { @@ -326,7 +326,7 @@ static int PsndRender(int offset, int length) cdda_raw_update(buf32, length); } - if ((PicoAHW & PAHW_32X) && (PicoOpt & POPT_EN_PWM)) + if ((PicoIn.AHW & PAHW_32X) && (PicoIn.opt & POPT_EN_PWM)) p32x_pwm_update(buf32, length, stereo); // convert + limit to normal 16bit output @@ -348,45 +348,44 @@ PICO_INTERNAL void PsndGetSamples(int y) if (y == 224) { - if (emustatus & 2) + if (Pico.m.status & 2) curr_pos += PsndRender(curr_pos, PsndLen-PsndLen/2); else curr_pos = PsndRender(0, PsndLen_use); - if (emustatus & 1) - emustatus |= 2; - else emustatus &= ~2; + if (Pico.m.status & 1) + Pico.m.status |= 2; + else Pico.m.status &= ~2; if (PicoWriteSound) - PicoWriteSound(curr_pos * ((PicoOpt & POPT_EN_STEREO) ? 4 : 2)); + PicoWriteSound(curr_pos * ((PicoIn.opt & POPT_EN_STEREO) ? 4 : 2)); // clear sound buffer PsndClear(); PsndDacLine = 224; dac_info[224] = 0; } - else if (emustatus & 3) { - emustatus|= 2; - emustatus&=~1; + else if (Pico.m.status & 3) { + Pico.m.status |= 2; + Pico.m.status &= ~1; curr_pos = PsndRender(0, PsndLen/2); } } PICO_INTERNAL void PsndGetSamplesMS(void) { - int stereo = (PicoOpt & 8) >> 3; int length = PsndLen_use; - // PSG - if (PicoOpt & POPT_EN_PSG) - SN76496Update(PsndOut, length, stereo); + PsndDoPSG(223); // upmix to "stereo" if needed - if (stereo) { + if (PicoIn.opt & POPT_EN_STEREO) { int i, *p; for (i = length, p = (void *)PsndOut; i > 0; i--, p++) *p |= *p << 16; } if (PicoWriteSound != NULL) - PicoWriteSound(length * ((PicoOpt & POPT_EN_STEREO) ? 4 : 2)); + PicoWriteSound(length * ((PicoIn.opt & POPT_EN_STEREO) ? 4 : 2)); PsndClear(); + + dac_info[224] = 0; } // vim:shiftwidth=2:ts=2:expandtab