Added support for disabling the sound speakers (bit1 of POWCNT2)

This commit is contained in:
luigi__ 2009-01-17 12:12:42 +00:00
parent 2efd0e19e0
commit f538364e3b
2 changed files with 7 additions and 3 deletions

View File

@ -456,6 +456,9 @@ void MMU_clearMem()
memset(MMU.dscard, 0, sizeof(nds_dscard) * 2); memset(MMU.dscard, 0, sizeof(nds_dscard) * 2);
// Enable the sound speakers
T1WriteWord(MMU.ARM7_REG, 0x304, 0x0001);
MainScreen.offset = 0; MainScreen.offset = 0;
SubScreen.offset = 192; SubScreen.offset = 192;
osdA->setOffset(MainScreen.offset); osdA->setOffset(MainScreen.offset);

View File

@ -691,9 +691,7 @@ static INLINE void FetchADPCMData(channel_struct *chan, s32 *data)
diff = -diff;*/ diff = -diff;*/
diff = precalcdifftbl[chan->index][data4bit]; diff = precalcdifftbl[chan->index][data4bit];
#ifdef SPU_INTERPOLATE
chan->pcm16b_last = chan->pcm16b; chan->pcm16b_last = chan->pcm16b;
#endif
chan->pcm16b = MinMax(chan->pcm16b+diff, -0x8000, 0x7FFF); chan->pcm16b = MinMax(chan->pcm16b+diff, -0x8000, 0x7FFF);
//chan->index = MinMax(chan->index+indextbl[data4bit & 0x7], 0, 88); //chan->index = MinMax(chan->index+indextbl[data4bit & 0x7], 0, 88);
chan->index = precalcindextbl[chan->index][data4bit & 0x7]; chan->index = precalcindextbl[chan->index][data4bit & 0x7];
@ -1090,6 +1088,9 @@ static void SPU_MixAudio(SPU_struct *SPU, int length)
if(actuallyMix) if(actuallyMix)
memset(SPU->sndbuf, 0, length*4*2); memset(SPU->sndbuf, 0, length*4*2);
// If the sound speakers are disabled, don't output audio
if(!(T1ReadWord(MMU.ARM7_REG, 0x304) & 0x01))
return;
// If Master Enable isn't set, don't output audio // If Master Enable isn't set, don't output audio
if (!(T1ReadByte(MMU.ARM7_REG, 0x501) & 0x80)) if (!(T1ReadByte(MMU.ARM7_REG, 0x501) & 0x80))