Namco WSG: fix frequency overflow

This commit is contained in:
tildearrow 2023-01-14 13:34:08 -05:00
parent 844db05f10
commit ed11b6cf78
1 changed files with 2 additions and 1 deletions

View File

@ -230,7 +230,7 @@ void DivPlatformNamcoWSG::tick(bool sysTick) {
if (chan[i].std.pitch.had) {
if (chan[i].std.pitch.mode) {
chan[i].pitch2+=chan[i].std.pitch.val;
CLAMP_VAR(chan[i].pitch2,-32768,32767);
CLAMP_VAR(chan[i].pitch2,-1048575,1048575);
} else {
chan[i].pitch2=chan[i].std.pitch.val;
}
@ -244,6 +244,7 @@ void DivPlatformNamcoWSG::tick(bool sysTick) {
if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) {
//DivInstrument* ins=parent->getIns(chan[i].ins,DIV_INS_PCE);
chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,chan[i].fixedArp?chan[i].baseNoteOverride:chan[i].arpOff,chan[i].fixedArp,false,2,chan[i].pitch2,chipClock,CHIP_FREQBASE);
if (chan[i].freq<0) chan[i].freq=0;
if (chan[i].freq>1048575) chan[i].freq=1048575;
if (chan[i].keyOn) {
}