From 4c5c4a647b8b51cb4dd6afaf458ed3168b77292f Mon Sep 17 00:00:00 2001 From: tildearrow Date: Tue, 15 Mar 2022 15:28:45 -0500 Subject: [PATCH] OPL: some fixes --- src/engine/platform/opl.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/engine/platform/opl.cpp b/src/engine/platform/opl.cpp index 443ef81d6..259799378 100644 --- a/src/engine/platform/opl.cpp +++ b/src/engine/platform/opl.cpp @@ -481,6 +481,10 @@ void DivPlatformOPL::muteChannel(int ch, bool mute) { int DivPlatformOPL::dispatch(DivCommand c) { // TODO: drums mode! if (c.chan>=melodicChans) return 0; + // ineffective in 4-op mode + if (oplType==3 && c.chan<14 && (c.chan&1) && c.cmd!=DIV_CMD_GET_VOLMAX && c.cmd!=DIV_ALWAYS_SET_VOLUME) { + if (chan[c.chan-1].fourOp) return 0; + } switch (c.cmd) { case DIV_CMD_NOTE_ON: { DivInstrument* ins=parent->getIns(chan[c.chan].ins); @@ -589,6 +593,9 @@ int DivPlatformOPL::dispatch(DivCommand c) { break; } case DIV_CMD_GET_VOLUME: { + if (pretendYMU) { + return pow(((double)chan[c.chan].vol/63.0),2.0)*127.0; + } return chan[c.chan].vol; break; } @@ -599,6 +606,7 @@ int DivPlatformOPL::dispatch(DivCommand c) { chan[c.chan].ins=c.value; break; case DIV_CMD_PANNING: { + if (oplType!=3) break; if (c.value==0) { chan[c.chan].pan=3; } else { @@ -616,7 +624,6 @@ int DivPlatformOPL::dispatch(DivCommand c) { rWrite(chanMap[c.chan+1]+ADDR_LR_FB_ALG,((chan[c.chan].state.alg>>1)&1)|(chan[c.chan].state.fb<<1)|((chan[c.chan].pan&3)<<4)); } } - //rWrite(chanOffs[c.chan]+ADDR_LRAF,(isMuted[c.chan]?0:(chan[c.chan].pan<<6))|(chan[c.chan].state.fms&7)|((chan[c.chan].state.ams&3)<<4)); break; } case DIV_CMD_PITCH: { @@ -739,6 +746,8 @@ int DivPlatformOPL::dispatch(DivCommand c) { void DivPlatformOPL::forceIns() { for (int i=0; i5); + return false; } bool DivPlatformOPL::keyOffAffectsPorta(int ch) { - return (ch>5); + return false; } void DivPlatformOPL::notifyInsChange(int ins) {