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

@ -159,19 +159,16 @@ void DivPlatformC64::tick(bool sysTick) {
chan[i].std.next();
if(sysTick)
{
if(chan[i].pw_slide != 0)
{
chan[i].duty -= chan[i].pw_slide;
chan[i].duty = CLAMP(chan[i].duty, 0, 0xfff);
if (sysTick) {
if (chan[i].pw_slide!=0) {
chan[i].duty-=chan[i].pw_slide;
chan[i].duty=CLAMP(chan[i].duty,0,0xfff);
rWrite(i*7+2,chan[i].duty&0xff);
rWrite(i*7+3,(chan[i].duty>>8) | (chan[i].outVol << 4));
rWrite(i*7+3,(chan[i].duty>>8)|(chan[i].outVol<<4));
}
if(cutoff_slide != 0)
{
filtCut += cutoff_slide;
filtCut = CLAMP(filtCut, 0, 0x7ff);
if (cutoff_slide!=0) {
filtCut+=cutoff_slide;
filtCut=CLAMP(filtCut,0,0x7ff);
updateFilter();
}
}
@ -554,10 +551,10 @@ int DivPlatformC64::dispatch(DivCommand c) {
rWrite(c.chan*7+6,(chan[c.chan].sustain<<4)|(chan[c.chan].release));
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:
cutoff_slide = c.value * c.value2;
cutoff_slide=c.value*c.value2;
break;
case DIV_CMD_MACRO_OFF:
chan[c.chan].std.mask(c.value,true);

View file

@ -531,7 +531,7 @@ void DivPlatformDave::getPaired(int ch, std::vector<DivChannelPair>& ret) {
if (chan[ch].ringMod) {
ret.push_back(DivChannelPair(_("ring"),(ch+2)&3));
}
if (chan[ch].lowPass && ch == 3) {
if (chan[ch].lowPass && ch==3) {
ret.push_back(DivChannelPair(_("low"),2));
}
}

View file

@ -771,7 +771,7 @@ int DivPlatformGBAMinMod::init(DivEngine* p, int channels, int sugRate, const Di
setFlags(flags);
reset();
maxCPU = 0.0; //initialize!
maxCPU=0.0; // initialize!
return 16;
}

View file

@ -114,19 +114,16 @@ void DivPlatformSID2::tick(bool sysTick) {
chan[i].std.next();
if(sysTick)
{
if(chan[i].pw_slide != 0)
{
chan[i].duty -= chan[i].pw_slide;
chan[i].duty = CLAMP(chan[i].duty, 0, 0xfff);
if (sysTick) {
if (chan[i].pw_slide!=0) {
chan[i].duty-=chan[i].pw_slide;
chan[i].duty=CLAMP(chan[i].duty,0,0xfff);
rWrite(i*7+2,chan[i].duty&0xff);
rWrite(i*7+3,(chan[i].duty>>8) | (chan[i].outVol << 4));
rWrite(i*7+3,(chan[i].duty>>8)|(chan[i].outVol<<4));
}
if(chan[i].cutoff_slide != 0)
{
chan[i].filtCut += chan[i].cutoff_slide;
chan[i].filtCut = CLAMP(chan[i].filtCut, 0, 0xfff);
if (chan[i].cutoff_slide!=0) {
chan[i].filtCut+=chan[i].cutoff_slide;
chan[i].filtCut=CLAMP(chan[i].filtCut,0,0xfff);
updateFilter(i);
}
}
@ -540,10 +537,10 @@ int DivPlatformSID2::dispatch(DivCommand c) {
}
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_MACRO_OFF:
chan[c.chan].std.mask(c.value,true);
@ -600,22 +597,16 @@ DivMacroInt* DivPlatformSID2::getChanMacroInt(int ch) {
void DivPlatformSID2::getPaired(int ch, std::vector<DivChannelPair>& ret) {
if (chan[ch].ring) {
if(ch == 0)
{
if (ch==0) {
ret.push_back(DivChannelPair(_("ring"),2));
}
else
{
} else {
ret.push_back(DivChannelPair(_("ring"),(ch-1)%3));
}
}
if (chan[ch].sync) {
if(ch == 0)
{
if (ch==0) {
ret.push_back(DivChannelPair(_("sync"),2));
}
else
{
} else {
ret.push_back(DivChannelPair(_("sync"),(ch-1)%3));
}
}
@ -626,10 +617,9 @@ DivChannelModeHints DivPlatformSID2::getModeHints(int ch) {
ret.count=1;
ret.hint[0]=ICON_FA_BELL_SLASH_O;
ret.type[0]=0;
if (ch == 2 && (chan[ch].filtControl & 8)) {
ret.type[0] = 7;
}
else if (!chan[ch].gate) {
if (ch==2 && (chan[ch].filtControl & 8)) {
ret.type[0]=7;
} else if (!chan[ch].gate) {
ret.type[0]=4;
}

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);