Game Boy: fix volume column

This commit is contained in:
tildearrow 2022-08-14 23:07:19 -05:00
parent 9b6730607e
commit f8b3c089a4
2 changed files with 12 additions and 1 deletions

View file

@ -373,6 +373,8 @@ void DivPlatformGB::tick(bool sysTick) {
chan[i].killIt=false;
}
}
chan[i].soManyHacksToMakeItDefleCompatible=false;
}
}
@ -409,10 +411,16 @@ int DivPlatformGB::dispatch(DivCommand c) {
ws.init(ins,32,15,chan[c.chan].insChanged);
}
if ((chan[c.chan].insChanged || ins->gb.alwaysInit) && !chan[c.chan].softEnv) {
if (!chan[c.chan].soManyHacksToMakeItDefleCompatible) {
chan[c.chan].envVol=ins->gb.envVol;
}
chan[c.chan].envLen=ins->gb.envLen;
chan[c.chan].envDir=ins->gb.envDir;
chan[c.chan].soundLen=ins->gb.soundLen;
if (!chan[c.chan].soManyHacksToMakeItDefleCompatible) {
chan[c.chan].vol=chan[c.chan].envVol;
chan[c.chan].outVol=chan[c.chan].envVol;
}
}
if (c.chan==2 && chan[c.chan].softEnv) {
chan[c.chan].soundLen=64;
@ -460,6 +468,7 @@ int DivPlatformGB::dispatch(DivCommand c) {
}
if (!chan[c.chan].softEnv) {
chan[c.chan].envVol=chan[c.chan].vol;
chan[c.chan].soManyHacksToMakeItDefleCompatible=true;
} else if (c.chan!=2) {
chan[c.chan].envVol=chan[c.chan].vol;
if (!chan[c.chan].keyOn) chan[c.chan].killIt=true;

View file

@ -31,6 +31,7 @@ class DivPlatformGB: public DivDispatch {
int freq, baseFreq, pitch, pitch2, note, ins;
unsigned char duty, sweep;
bool active, insChanged, freqChanged, sweepChanged, keyOn, keyOff, inPorta, released, softEnv, killIt;
bool soManyHacksToMakeItDefleCompatible;
signed char vol, outVol, wave, lastKill;
unsigned char envVol, envDir, envLen, soundLen;
unsigned short hwSeqPos;
@ -59,6 +60,7 @@ class DivPlatformGB: public DivDispatch {
released(false),
softEnv(false),
killIt(false),
soManyHacksToMakeItDefleCompatible(false),
vol(15),
outVol(15),
wave(-1),