PAL/NTSC noise fixed
This commit is contained in:
parent
72f17fb40c
commit
dea31f040e
|
@ -100,7 +100,7 @@ static const uint32 NoiseFreqTablePAL[0x10] =
|
|||
236, 354, 472, 708, 944, 1890, 3778
|
||||
};
|
||||
|
||||
/*static*/ const uint32 *NoiseFreqTable = NoiseFreqTableNTSC;
|
||||
const uint32 *NoiseFreqTable = NoiseFreqTableNTSC; // for lua only
|
||||
|
||||
static const uint32 NTSCDMCTable[0x10]=
|
||||
{
|
||||
|
@ -880,10 +880,13 @@ static void RDoTriangleNoisePCMLQ(void)
|
|||
rea2:
|
||||
//used to added <<(16+2) when the noise table
|
||||
//values were half.
|
||||
noiseacc+=NoiseFreqTable[PSG[0xE]&0xF]<<(16+1);
|
||||
if(PAL)
|
||||
noiseacc+=NoiseFreqTablePAL[PSG[0xE]&0xF]<<(16+1);
|
||||
else
|
||||
noiseacc+=NoiseFreqTableNTSC[PSG[0xE]&0xF]<<(16+1);
|
||||
nreg=(nreg<<1)+(((nreg>>nshift)^(nreg>>14))&1);
|
||||
nreg&=0x7fff;
|
||||
noiseout=amptab[(nreg>>0xe)];
|
||||
noiseout=amptab[(nreg>>0xe)&1];
|
||||
if(noiseacc<=0) goto rea2;
|
||||
totalout = wlookup2[tcout+noiseout+RawDALatch];
|
||||
} /* noiseacc<=0 */
|
||||
|
@ -921,10 +924,13 @@ static void RDoTriangleNoisePCMLQ(void)
|
|||
area2:
|
||||
//used to be added <<(16+2) when the noise table
|
||||
//values were half.
|
||||
noiseacc+=NoiseFreqTable[PSG[0xE]&0xF]<<(16+1);
|
||||
if(PAL)
|
||||
noiseacc+=NoiseFreqTablePAL[PSG[0xE]&0xF]<<(16+1);
|
||||
else
|
||||
noiseacc+=NoiseFreqTableNTSC[PSG[0xE]&0xF]<<(16+1);
|
||||
nreg=(nreg<<1)+(((nreg>>nshift)^(nreg>>14))&1);
|
||||
nreg&=0x7fff;
|
||||
noiseout=amptab[(nreg>>0xe)];
|
||||
noiseout=amptab[(nreg>>0xe)&1];
|
||||
if(noiseacc<=0) goto area2;
|
||||
totalout = wlookup2[tcout+noiseout+RawDALatch];
|
||||
} /* noiseacc<=0 */
|
||||
|
@ -957,7 +963,7 @@ static void RDoNoise(void)
|
|||
|
||||
amptab[0]<<=1;
|
||||
|
||||
outo=amptab[nreg&1]; //(nreg>>0xe)&1];
|
||||
outo=amptab[(nreg>>0xe)&1];
|
||||
|
||||
if(!lengthcount[3])
|
||||
{
|
||||
|
@ -972,7 +978,10 @@ static void RDoNoise(void)
|
|||
if(!wlcount[3])
|
||||
{
|
||||
uint8 feedback;
|
||||
wlcount[3]=NoiseFreqTable[PSG[0xE]&0xF];
|
||||
if(PAL)
|
||||
wlcount[3]=NoiseFreqTablePAL[PSG[0xE]&0xF];
|
||||
else
|
||||
wlcount[3]=NoiseFreqTableNTSC[PSG[0xE]&0xF];
|
||||
feedback=((nreg>>8)&1)^((nreg>>14)&1);
|
||||
nreg=(nreg<<1)+feedback;
|
||||
nreg&=0x7fff;
|
||||
|
@ -987,7 +996,10 @@ static void RDoNoise(void)
|
|||
if(!wlcount[3])
|
||||
{
|
||||
uint8 feedback;
|
||||
wlcount[3]=NoiseFreqTable[PSG[0xE]&0xF];
|
||||
if(PAL)
|
||||
wlcount[3]=NoiseFreqTablePAL[PSG[0xE]&0xF];
|
||||
else
|
||||
wlcount[3]=NoiseFreqTableNTSC[PSG[0xE]&0xF];
|
||||
feedback=((nreg>>13)&1)^((nreg>>14)&1);
|
||||
nreg=(nreg<<1)+feedback;
|
||||
nreg&=0x7fff;
|
||||
|
@ -1115,11 +1127,6 @@ void FCEUSND_Reset(void)
|
|||
fcnt=0;
|
||||
nreg=1;
|
||||
|
||||
if (PAL)
|
||||
NoiseFreqTable = NoiseFreqTablePAL;
|
||||
else
|
||||
NoiseFreqTable = NoiseFreqTableNTSC;
|
||||
|
||||
for(x=0;x<2;x++)
|
||||
{
|
||||
wlcount[x]=2048;
|
||||
|
|
Loading…
Reference in New Issue