X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=Pico%2Fsound%2Fsound.c;h=64e172a07c3710875ea213b5d603f40cc9ce39dd;hb=1b13dae0c45a068382ce2422b1d407ff47374039;hp=d901a1dce8f210360d99ec6eafb9a3ee853c6c83;hpb=b542be4686241c9e0722ff8e452980f9ac2b4d7c;p=picodrive.git diff --git a/Pico/sound/sound.c b/Pico/sound/sound.c index d901a1d..64e172a 100644 --- a/Pico/sound/sound.c +++ b/Pico/sound/sound.c @@ -15,6 +15,8 @@ #include "../cd/pcm.h" #include "mix.h" +void (*PsndMix_32_to_16l)(short *dest, int *src, int count) = mix_32_to_16l_stereo; + // master int buffer to mix to static int PsndBuffer[2*44100/50]; @@ -151,6 +153,9 @@ void PsndRerate(int preserve_state) memset32(PsndBuffer, 0, sizeof(PsndBuffer)/4); if (PsndOut) PsndClear(); + + // set mixer + PsndMix_32_to_16l = (PicoOpt & 8) ? mix_32_to_16l_stereo : mix_32_to_16_mono; } @@ -227,6 +232,7 @@ PICO_INTERNAL int PsndRender(int offset, int length) int do_pcm = (PicoMCD&1) && (PicoOpt&0x400) && (Pico_mcd->pcm.control & 0x80) && Pico_mcd->pcm.enabled; offset <<= stereo; +#if !SIMPLE_WRITE_SOUND if (offset == 0) { // should happen once per frame // compensate for float part of PsndLen PsndLen_exc_cnt += PsndLen_exc_add; @@ -235,6 +241,7 @@ PICO_INTERNAL int PsndRender(int offset, int length) length++; } } +#endif // PSG if (PicoOpt & 2) @@ -260,9 +267,7 @@ PICO_INTERNAL int PsndRender(int offset, int length) mp3_update(buf32, length, stereo); // convert + limit to normal 16bit output - if (stereo) - mix_32_to_16l_stereo(PsndOut+offset, buf32, length); - else mix_32_to_16_mono (PsndOut+offset, buf32, length); + PsndMix_32_to_16l(PsndOut+offset, buf32, length); return length; } @@ -372,7 +377,7 @@ PICO_INTERNAL void z80_init(void) memset(&CZ80, 0, sizeof(CZ80)); Cz80_Init(&CZ80); Cz80_Set_Fetch(&CZ80, 0x0000, 0x1fff, (UINT32)Pico.zram); // main RAM - Cz80_Set_Fetch(&CZ80, 0x2000, 0x3fff, (UINT32)Pico.zram - 0x2000); // mirror + Cz80_Set_Fetch(&CZ80, 0x2000, 0x3fff, (UINT32)Pico.zram); // mirror Cz80_Set_ReadB(&CZ80, (UINT8 (*)(UINT32 address))z80_read); // unused (hacked in) Cz80_Set_WriteB(&CZ80, z80_write); Cz80_Set_INPort(&CZ80, z80_in); @@ -395,6 +400,9 @@ PICO_INTERNAL void z80_reset(void) drZ80.Z80SP = drZ80.z80_rebaseSP(0x2000); // 0xf000 ? #elif defined(_USE_CZ80) Cz80_Reset(&CZ80); + Cz80_Set_Reg(&CZ80, CZ80_IX, 0xffff); + Cz80_Set_Reg(&CZ80, CZ80_IY, 0xffff); + Cz80_Set_Reg(&CZ80, CZ80_SP, 0x2000); #endif Pico.m.z80_fakeval = 0; // for faking when Z80 is disabled }