SMS: fix channel 3 muting at the beginning of song

This commit is contained in:
tildearrow 2022-02-12 22:50:31 -05:00
parent 3da54fc519
commit 271c0dc08b

View file

@ -77,7 +77,6 @@ void DivPlatformSMS::tick() {
chan[3].freq=parent->calcFreq(chan[3].baseFreq,chan[3].pitch-1-(isRealSN?127:0),true); chan[3].freq=parent->calcFreq(chan[3].baseFreq,chan[3].pitch-1-(isRealSN?127:0),true);
if (chan[3].freq>1023) chan[3].freq=1023; if (chan[3].freq>1023) chan[3].freq=1023;
if (chan[3].actualNote>0x5d) chan[3].freq=0x01; if (chan[3].actualNote>0x5d) chan[3].freq=0x01;
chan[3].freqChanged=false;
if (snNoiseMode&2) { // take period from channel 3 if (snNoiseMode&2) { // take period from channel 3
if (updateSNMode || resetPhase) { if (updateSNMode || resetPhase) {
if (snNoiseMode&1) { if (snNoiseMode&1) {
@ -85,10 +84,16 @@ void DivPlatformSMS::tick() {
} else { } else {
rWrite(0xe3); rWrite(0xe3);
} }
} if (updateSNMode) {
rWrite(0xdf); rWrite(0xdf);
}
}
if (chan[3].freqChanged) {
rWrite(0xc0|(chan[3].freq&15)); rWrite(0xc0|(chan[3].freq&15));
rWrite(chan[3].freq>>4); rWrite(chan[3].freq>>4);
}
} else { // 3 fixed values } else { // 3 fixed values
unsigned char value; unsigned char value;
if (chan[3].std.hadArp) { if (chan[3].std.hadArp) {
@ -105,6 +110,7 @@ void DivPlatformSMS::tick() {
rWrite(0xe0|value|((snNoiseMode&1)<<2)); rWrite(0xe0|value|((snNoiseMode&1)<<2));
} }
} }
chan[3].freqChanged=false;
updateSNMode=false; updateSNMode=false;
} }
} }
@ -233,7 +239,8 @@ void DivPlatformSMS::reset() {
} }
sn->device_start(); sn->device_start();
snNoiseMode=3; snNoiseMode=3;
updateSNMode=true; rWrite(0xe7);
updateSNMode=false;
} }
bool DivPlatformSMS::keyOffAffectsArp(int ch) { bool DivPlatformSMS::keyOffAffectsArp(int ch) {