--- np2/sound/psggeng.c 2003/10/25 17:29:38 1.4 +++ np2/sound/psggeng.c 2003/11/14 05:26:53 1.6 @@ -1,31 +1,11 @@ #include "compiler.h" +#include "parts.h" #include "sound.h" #include "psggen.h" extern PSGGENCFG psggencfg; -// ¥Æ¥¹¥È - -static UINT32 rnds; - -static UINT psg_rand(void) { - - UINT32 rand0; - UINT32 rand1; - UINT c; - - rand0 = rnds & 0xffff; - rand1 = rnds >> 16; - rand0 = (rand0 >> 5) + (rand0 << 11); - rand0 += 60043; - rand1 -= 4953 + ((rand0 >> 16) & 1); - c = (rand1 >> 15) & 1; - rand1 = (rand1 << 1) + c; - rand0 += rand1 + c; - rnds = (rand1 << 16) + (rand0 & 0xffff); - return(rand0); -} void SOUNDCALL psggen_getpcm(PSGGEN psg, SINT32 *pcm, UINT count) { @@ -80,7 +60,7 @@ void SOUNDCALL psggen_getpcm(PSGGEN psg, psg->noise.count -= psg->noise.freq; if (psg->noise.count > countbak) { // psg->noise.base = GETRAND() & (1 << (1 << PSGADDEDBIT)); - psg->noise.base = psg_rand() & (1 << (1 << PSGADDEDBIT)); + psg->noise.base = rand_get() & (1 << (1 << PSGADDEDBIT)); } noisetbl += psg->noise.base; noisetbl >>= 1; @@ -88,10 +68,10 @@ void SOUNDCALL psggen_getpcm(PSGGEN psg, } tone = psg->tone; toneterm = tone + 3; - samp = 0; do { psgvol = (*(tone->pvol)) & 15; if (psgvol) { + samp = 0; vol = psggencfg.volume[psgvol]; switch(mixer & 9) { case 0: // no mix @@ -130,11 +110,15 @@ void SOUNDCALL psggen_getpcm(PSGGEN psg, } break; } + if (!(tone->pan & 1)) { + pcm[0] += samp; + } + if (!(tone->pan & 2)) { + pcm[1] += samp; + } } mixer >>= 1; } while(++tone < toneterm); - pcm[0] += samp; - pcm[1] += samp; pcm += 2; } while(--count); }