X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=Pico%2Fsound%2Fsound.c;h=64e172a07c3710875ea213b5d603f40cc9ce39dd;hb=03a265e5ebabff7adbb4f97387f81e9b0428dbee;hp=aa2acb2e4c75e761d3a32a1bbc26a408ed0edb6d;hpb=88b3d7c16ae976d332b8462de839b86f856a7180;p=picodrive.git diff --git a/Pico/sound/sound.c b/Pico/sound/sound.c index aa2acb2..64e172a 100644 --- a/Pico/sound/sound.c +++ b/Pico/sound/sound.c @@ -1,7 +1,7 @@ // This is part of Pico Library // (c) Copyright 2004 Dave, All rights reserved. -// (c) Copyright 2006 notaz, All rights reserved. +// (c) Copyright 2006,2007 notaz, All rights reserved. // Free for non-commercial use. // For commercial use, separate licencing terms must be obtained. @@ -11,18 +11,12 @@ #include "ym2612.h" #include "sn76496.h" -#if defined(_USE_MZ80) -#include "../../cpu/mz80/mz80.h" -#elif defined(_USE_DRZ80) -#include "../../cpu/DrZ80/drz80.h" -#elif defined(_USE_CZ80) -#include "../../cpu/cz80/cz80.h" -#endif - #include "../PicoInt.h" #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]; @@ -36,11 +30,6 @@ int PsndLen_exc_add=0; // this is for non-integer sample counts per line, eg. 22 int PsndLen_exc_cnt=0; short *PsndOut=NULL; // PCM data buffer -// from ym2612.c -extern int *ym2612_dacen; -extern INT32 *ym2612_dacout; -void YM2612TimerHandler(int c,int cnt); - // sn76496 extern int *sn76496_regs; @@ -164,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; } @@ -240,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; @@ -248,15 +241,16 @@ PICO_INTERNAL int PsndRender(int offset, int length) length++; } } +#endif // PSG if (PicoOpt & 2) SN76496Update(PsndOut+offset, length, stereo); // Add in the stereo FM buffer - if (PicoOpt & 1) + if (PicoOpt & 1) { buf32_updated = YM2612UpdateOne(buf32, length, stereo, 1); - else + } else memset32(buf32, 0, length<