a couple code style changes

This commit is contained in:
tildearrow 2024-09-21 04:36:22 -05:00
parent 3ade67a889
commit 987bff8b75
8 changed files with 60 additions and 63 deletions

View file

@ -67,20 +67,17 @@ void DivPlatformSoundUnit::writeControlUpper(int ch) {
void DivPlatformSoundUnit::tick(bool sysTick) {
for (int i=0; i<8; i++) {
chan[i].std.next();
if(sysTick)
{
if(chan[i].pw_slide != 0)
{
chan[i].virtual_duty -= chan[i].pw_slide;
chan[i].virtual_duty = CLAMP(chan[i].virtual_duty, 0, 0xfff);
chan[i].duty = chan[i].virtual_duty >> 5;
if (sysTick) {
if (chan[i].pw_slide!=0) {
chan[i].virtual_duty-=chan[i].pw_slide;
chan[i].virtual_duty=CLAMP(chan[i].virtual_duty,0,0xfff);
chan[i].duty=chan[i].virtual_duty>>5;
chWrite(i,0x08,chan[i].duty);
}
if(chan[i].cutoff_slide != 0)
{
chan[i].cutoff += chan[i].cutoff_slide * 4;
chan[i].cutoff = CLAMP(chan[i].cutoff, 0, 0x3fff);
if (chan[i].cutoff_slide!=0) {
chan[i].cutoff+=chan[i].cutoff_slide*4;
chan[i].cutoff=CLAMP(chan[i].cutoff,0,0x3fff);
chWrite(i,0x06,chan[i].cutoff&0xff);
chWrite(i,0x07,chan[i].cutoff>>8);
@ -105,7 +102,7 @@ void DivPlatformSoundUnit::tick(bool sysTick) {
}
if (chan[i].std.duty.had) {
chan[i].duty=chan[i].std.duty.val;
chan[i].virtual_duty = (unsigned short)chan[i].duty << 5;
chan[i].virtual_duty=(unsigned short)chan[i].duty<<5;
chWrite(i,0x08,chan[i].duty);
}
if (chan[i].std.wave.had) {
@ -371,7 +368,7 @@ int DivPlatformSoundUnit::dispatch(DivCommand c) {
break;
case DIV_CMD_STD_NOISE_MODE:
chan[c.chan].duty=c.value&127;
chan[c.chan].virtual_duty = (unsigned short)chan[c.chan].duty << 5;
chan[c.chan].virtual_duty=(unsigned short)chan[c.chan].duty << 5;
chWrite(c.chan,0x08,chan[c.chan].duty);
break;
case DIV_CMD_C64_RESONANCE:
@ -520,10 +517,10 @@ int DivPlatformSoundUnit::dispatch(DivCommand c) {
chan[c.chan].inPorta=c.value;
break;
case DIV_CMD_C64_PW_SLIDE:
chan[c.chan].pw_slide = c.value * c.value2;
chan[c.chan].pw_slide=c.value*c.value2;
break;
case DIV_CMD_C64_CUTOFF_SLIDE:
chan[c.chan].cutoff_slide = c.value * c.value2;
chan[c.chan].cutoff_slide=c.value*c.value2;
break;
case DIV_CMD_GET_VOLMAX:
return 127;
@ -592,10 +589,10 @@ void DivPlatformSoundUnit::reset() {
chan[i]=DivPlatformSoundUnit::Channel();
chan[i].std.setEngine(parent);
chan[i].cutoff_slide = 0;
chan[i].pw_slide = 0;
chan[i].cutoff_slide=0;
chan[i].pw_slide=0;
chan[i].virtual_duty = 0x800; //for some reason duty by default is 50%
chan[i].virtual_duty=0x800; // for some reason duty by default is 50%
}
if (dumpWrites) {
addWrite(0xffffffff,0);