DIV_CMD_FM_ALG for OPM/OPN/OPZ

This commit is contained in:
tildearrow 2025-05-21 04:46:11 -05:00
parent 64f4db3ab8
commit 78fb9c4df5
7 changed files with 133 additions and 4 deletions

View file

@ -914,6 +914,25 @@ int DivPlatformYM2203::dispatch(DivCommand c) {
}
break;
}
case DIV_CMD_FM_ALG: {
if (c.chan>2) break;
chan[c.chan].state.alg=c.value&7;
rWrite(ADDR_FB_ALG+chanOffs[c.chan],(chan[c.chan].state.alg&7)|(chan[c.chan].state.fb<<3));
for (int i=0; i<4; i++) {
unsigned short baseAddr=chanOffs[c.chan]|opOffs[i];
DivInstrumentFM::Operator& op=chan[c.chan].state.op[i];
if (isMuted[c.chan] || !op.enable) {
rWrite(baseAddr+ADDR_TL,127);
} else {
if (KVS(c.chan,i)) {
rWrite(baseAddr+ADDR_TL,127-VOL_SCALE_LOG_BROKEN(127-op.tl,chan[c.chan].outVol&0x7f,127));
} else {
rWrite(baseAddr+ADDR_TL,op.tl);
}
}
}
break;
}
case DIV_CMD_FM_FB: {
if (c.chan>2) break;
chan[c.chan].state.fb=c.value&7;