YM2612: more DualPCM muting fixes

This commit is contained in:
tildearrow 2022-06-04 01:00:29 -05:00
parent 641648ca0f
commit a550c4cb30

View file

@ -24,7 +24,7 @@
#include "genesisshared.h" #include "genesisshared.h"
#define IS_REALLY_MUTED(x) (isMuted[x] && (x<5 || !softPCM || (isMuted[5] && isMuted[6]) || !chan[5].dacMode)) #define IS_REALLY_MUTED(x) (isMuted[x] && (x<5 || !softPCM || (isMuted[5] && isMuted[6])))
static unsigned char konOffs[6]={ static unsigned char konOffs[6]={
0, 1, 2, 4, 5, 6 0, 1, 2, 4, 5, 6
@ -563,19 +563,23 @@ void DivPlatformGenesis::tick(bool sysTick) {
void DivPlatformGenesis::muteChannel(int ch, bool mute) { void DivPlatformGenesis::muteChannel(int ch, bool mute) {
isMuted[ch]=mute; isMuted[ch]=mute;
if (ch>5) return; if (ch>6) return;
for (int j=0; j<4; j++) { if (ch<6) {
unsigned short baseAddr=chanOffs[ch]|opOffs[j]; for (int j=0; j<4; j++) {
DivInstrumentFM::Operator& op=chan[ch].state.op[j]; unsigned short baseAddr=chanOffs[ch]|opOffs[j];
if (isMuted[ch]) { DivInstrumentFM::Operator& op=chan[ch].state.op[j];
rWrite(baseAddr+ADDR_TL,127); if (isMuted[ch]) {
} else { rWrite(baseAddr+ADDR_TL,127);
if (isOutput[chan[ch].state.alg][j]) {
rWrite(baseAddr+ADDR_TL,127-VOL_SCALE_LOG(127-op.tl,chan[ch].outVol&0x7f,127));
} else { } else {
rWrite(baseAddr+ADDR_TL,op.tl); if (isOutput[chan[ch].state.alg][j]) {
rWrite(baseAddr+ADDR_TL,127-VOL_SCALE_LOG(127-op.tl,chan[ch].outVol&0x7f,127));
} else {
rWrite(baseAddr+ADDR_TL,op.tl);
}
} }
} }
} else {
ch--;
} }
rWrite(chanOffs[ch]+ADDR_LRAF,(IS_REALLY_MUTED(ch)?0:(chan[ch].pan<<6))|(chan[ch].state.fms&7)|((chan[ch].state.ams&3)<<4)); rWrite(chanOffs[ch]+ADDR_LRAF,(IS_REALLY_MUTED(ch)?0:(chan[ch].pan<<6))|(chan[ch].state.fms&7)|((chan[ch].state.ams&3)<<4));
} }