|
|
| version 1.3, 2003/10/22 14:13:25 | version 1.4, 2003/10/25 17:29:38 |
|---|---|
| Line 5 | Line 5 |
| extern PSGGENCFG psggencfg; | 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) { | void SOUNDCALL psggen_getpcm(PSGGEN psg, SINT32 *pcm, UINT count) { |
| Line 58 void SOUNDCALL psggen_getpcm(PSGGEN psg, | Line 79 void SOUNDCALL psggen_getpcm(PSGGEN psg, |
| countbak = psg->noise.count; | countbak = psg->noise.count; |
| psg->noise.count -= psg->noise.freq; | psg->noise.count -= psg->noise.freq; |
| if (psg->noise.count > countbak) { | if (psg->noise.count > countbak) { |
| psg->noise.base = GETRAND() & (1 << (1 << PSGADDEDBIT)); | // psg->noise.base = GETRAND() & (1 << (1 << PSGADDEDBIT)); |
| psg->noise.base = psg_rand() & (1 << (1 << PSGADDEDBIT)); | |
| } | } |
| noisetbl += psg->noise.base; | noisetbl += psg->noise.base; |
| noisetbl >>= 1; | noisetbl >>= 1; |