X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=Pico%2Fsound%2Fsound.c;h=fbb81c8902ed98a0cbbda0f4daff8c98f9e3fac3;hb=4a32f01f5527929fe5feafd53937007dcfd64735;hp=d901a1dce8f210360d99ec6eafb9a3ee853c6c83;hpb=b542be4686241c9e0722ff8e452980f9ac2b4d7c;p=picodrive.git diff --git a/Pico/sound/sound.c b/Pico/sound/sound.c index d901a1d..fbb81c8 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; } @@ -260,9 +265,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 +375,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 +398,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 }