clamp wave data

issue #267
This commit is contained in:
tildearrow 2022-03-11 16:58:43 -05:00
parent 5fadcf4891
commit ab3884e5aa
4 changed files with 20 additions and 6 deletions

View file

@ -138,7 +138,10 @@ void DivPlatformPCE::updateWave(int ch) {
if (wt->max<1 || wt->len<1) {
chWrite(ch,0x06,0);
} else {
chWrite(ch,0x06,wt->data[i*wt->len/32]*31/wt->max);
int data=wt->data[i*wt->len/32]*31/wt->max;
if (data<0) data=0;
if (data>31) data=31;
chWrite(ch,0x06,data);
}
}
if (chan[ch].active) {