parent
5fadcf4891
commit
ab3884e5aa
|
@ -97,8 +97,12 @@ void DivPlatformGB::updateWave() {
|
|||
if (wt->max<1 || wt->len<1) {
|
||||
rWrite(0x30+i,0);
|
||||
} else {
|
||||
unsigned char nibble1=15-((wt->data[(i*2)*wt->len/32]*15)/wt->max);
|
||||
unsigned char nibble2=15-((wt->data[(1+i*2)*wt->len/32]*15)/wt->max);
|
||||
int nibble1=15-((wt->data[(i*2)*wt->len/32]*15)/wt->max);
|
||||
int nibble2=15-((wt->data[(1+i*2)*wt->len/32]*15)/wt->max);
|
||||
if (nibble1<0) nibble1=0;
|
||||
if (nibble1>15) nibble1=15;
|
||||
if (nibble2<0) nibble2=0;
|
||||
if (nibble2>15) nibble2=15;
|
||||
rWrite(0x30+i,(nibble1<<4)|nibble2);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -119,8 +119,12 @@ void DivPlatformSwan::updateWave(int ch) {
|
|||
}
|
||||
} else {
|
||||
for (int i=0; i<16; i++) {
|
||||
unsigned char nibble1=(wt->data[(i*2)*wt->len/32]*15)/wt->max;
|
||||
unsigned char nibble2=(wt->data[(1+i*2)*wt->len/32]*15)/wt->max;
|
||||
int nibble1=(wt->data[(i*2)*wt->len/32]*15)/wt->max;
|
||||
int nibble2=(wt->data[(1+i*2)*wt->len/32]*15)/wt->max;
|
||||
if (nibble1<0) nibble1=0;
|
||||
if (nibble1>15) nibble1=15;
|
||||
if (nibble2<0) nibble2=0;
|
||||
if (nibble2>15) nibble2=15;
|
||||
rWrite(addr+i,nibble1|(nibble2<<4));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -282,7 +282,10 @@ void DivPlatformX1_010::updateWave(int ch) {
|
|||
if (wt->max<1 || wt->len<1) {
|
||||
waveWrite(ch,i,0);
|
||||
} else {
|
||||
waveWrite(ch,i,wt->data[i*wt->len/128]*255/wt->max);
|
||||
int data=wt->data[i*wt->len/128]*255/wt->max;
|
||||
if (data<0) data=0;
|
||||
if (data>255) data=255;
|
||||
waveWrite(ch,i,data);
|
||||
}
|
||||
}
|
||||
if (!chan[ch].pcm) {
|
||||
|
|
Loading…
Reference in New Issue