fix PSG square wave

Was reading the wrong part of GBATek
This commit is contained in:
Aikku93 2022-06-12 19:03:48 +10:00
parent 6215418dc7
commit b2c4d449ca
1 changed files with 1 additions and 6 deletions

View File

@ -1120,12 +1120,7 @@ static FORCEINLINE s32 FetchPSGData(channel_struct *chan, s32 pos)
if(chan->num < 14) if(chan->num < 14)
{ {
// Doing this avoids using a LUT // Doing this avoids using a LUT
// Duty==0 (12.5%): -_______ return ((pos%8u) > chan->waveduty) ? (-0x7FFF) : (+0x7FFF);
// Duty==1 (25.0%): --______
// Duty==2 (50.0%): ----____
// Duty==3 (75.0%): ------__
u32 wavepos = (pos%8u) + (chan->waveduty != 0);
return (wavepos > chan->waveduty*2) ? (-0x7FFF) : (+0x7FFF);
} }
else else
{ {