BubSys: fix muting

This commit is contained in:
tildearrow 2022-03-30 00:15:42 -05:00
parent af6bbf9493
commit 80d67f9b23

View file

@ -56,6 +56,7 @@ void DivPlatformBubSysWSG::acquire(short* bufL, short* bufR, size_t start, size_
// Wavetable part // Wavetable part
for (int i=0; i<2; i++) { for (int i=0; i<2; i++) {
if (isMuted[i]) continue;
out+=chan[i].waveROM[k005289->addr(i)]*(regPool[2+i]&0xf); out+=chan[i].waveROM[k005289->addr(i)]*(regPool[2+i]&0xf);
} }
@ -80,7 +81,7 @@ void DivPlatformBubSysWSG::updateWave(int ch) {
} }
} }
if (chan[ch].active) { if (chan[ch].active) {
rWrite(2+ch,(chan[ch].wave<<5)|(isMuted[ch]?0:chan[ch].outVol)); rWrite(2+ch,(chan[ch].wave<<5)|chan[ch].outVol);
} }
} }
@ -89,9 +90,7 @@ void DivPlatformBubSysWSG::tick() {
chan[i].std.next(); chan[i].std.next();
if (chan[i].std.hadVol) { if (chan[i].std.hadVol) {
chan[i].outVol=((chan[i].vol&15)*MIN(15,chan[i].std.vol))/15; chan[i].outVol=((chan[i].vol&15)*MIN(15,chan[i].std.vol))/15;
if (!isMuted[i]) { rWrite(2+i,(chan[i].wave<<5)|chan[i].outVol);
rWrite(2+i,(chan[i].wave<<5)|chan[i].outVol);
}
} }
if (chan[i].std.hadArp) { if (chan[i].std.hadArp) {
if (!chan[i].inPorta) { if (!chan[i].inPorta) {
@ -129,7 +128,7 @@ void DivPlatformBubSysWSG::tick() {
updateWave(i); updateWave(i);
} }
} }
if (chan[i].keyOff && (!isMuted[i])) { if (chan[i].keyOff) {
rWrite(2+i,(chan[i].wave<<5)|0); rWrite(2+i,(chan[i].wave<<5)|0);
} }
if (chan[i].keyOn) chan[i].keyOn=false; if (chan[i].keyOn) chan[i].keyOn=false;
@ -150,7 +149,7 @@ int DivPlatformBubSysWSG::dispatch(DivCommand c) {
} }
chan[c.chan].active=true; chan[c.chan].active=true;
chan[c.chan].keyOn=true; chan[c.chan].keyOn=true;
if (!isMuted[c.chan]) rWrite(2+c.chan,(chan[c.chan].wave<<5)|chan[c.chan].vol); rWrite(2+c.chan,(chan[c.chan].wave<<5)|chan[c.chan].vol);
chan[c.chan].std.init(ins); chan[c.chan].std.init(ins);
break; break;
} }
@ -173,7 +172,7 @@ int DivPlatformBubSysWSG::dispatch(DivCommand c) {
chan[c.chan].vol=c.value; chan[c.chan].vol=c.value;
if (!chan[c.chan].std.hasVol) { if (!chan[c.chan].std.hasVol) {
chan[c.chan].outVol=c.value; chan[c.chan].outVol=c.value;
if (chan[c.chan].active && !isMuted[c.chan]) rWrite(2+c.chan,(chan[c.chan].wave<<5)|chan[c.chan].outVol); if (chan[c.chan].active) rWrite(2+c.chan,(chan[c.chan].wave<<5)|chan[c.chan].outVol);
} }
} }
break; break;
@ -240,7 +239,7 @@ int DivPlatformBubSysWSG::dispatch(DivCommand c) {
void DivPlatformBubSysWSG::muteChannel(int ch, bool mute) { void DivPlatformBubSysWSG::muteChannel(int ch, bool mute) {
isMuted[ch]=mute; isMuted[ch]=mute;
rWrite(2+ch,(chan[ch].wave<<5)|((chan[ch].active && isMuted[ch])?0:chan[ch].outVol)); //rWrite(2+ch,(chan[ch].wave<<5)|((chan[ch].active && isMuted[ch])?0:chan[ch].outVol));
} }
void DivPlatformBubSysWSG::forceIns() { void DivPlatformBubSysWSG::forceIns() {