Virtual Boy: fix noise phase reset

This commit is contained in:
tildearrow 2022-10-11 03:52:25 -05:00
parent 385a9adab2
commit 8b87905304
3 changed files with 18 additions and 4 deletions

View file

@ -128,9 +128,11 @@ void DivPlatformVB::updateWave(int ch) {
}
}
void DivPlatformVB::writeEnv(int ch) {
void DivPlatformVB::writeEnv(int ch, bool upperByteToo) {
chWrite(ch,0x04,(chan[ch].outVol<<4)|(chan[ch].envLow&15));
chWrite(ch,0x05,chan[ch].envHigh);
if (ch<5 || upperByteToo) {
chWrite(ch,0x05,chan[ch].envHigh);
}
}
void DivPlatformVB::tick(bool sysTick) {
@ -298,7 +300,7 @@ int DivPlatformVB::dispatch(DivCommand c) {
if (c.chan!=5) break;
chan[c.chan].envHigh&=~0x70;
chan[c.chan].envHigh|=(c.value&7)<<4;
writeEnv(c.chan);
writeEnv(c.chan,true);
break;
case DIV_CMD_STD_NOISE_FREQ:
chan[c.chan].envHigh&=~3;

View file

@ -81,7 +81,7 @@ class DivPlatformVB: public DivDispatch {
VSU* vb;
unsigned char regPool[0x600];
void updateWave(int ch);
void writeEnv(int ch);
void writeEnv(int ch, bool upperByteToo=false);
friend void putDispatchChip(void*,int);
friend void putDispatchChan(void*,int,int);
public: