diff --git a/src/engine/platform/opl.cpp b/src/engine/platform/opl.cpp index 55086c71d..6405c6b72 100644 --- a/src/engine/platform/opl.cpp +++ b/src/engine/platform/opl.cpp @@ -2430,12 +2430,16 @@ int DivPlatformOPL::dispatch(DivCommand c) { break; case DIV_CMD_MULTIPCM_MIX_FM: if (chipType==4) { - rWrite(PCM_ADDR_MIX_FM,(CLAMP((0x70-(c.value&0x70)),0,0x70)>>1)|(CLAMP((7-(c.value&7)),0,7))); + fmMixL=CLAMP((c.value&0x70)>>4,0,7); + fmMixR=CLAMP((c.value&0x7),0,7); + immWrite(PCM_ADDR_MIX_FM,((7-fmMixR)<<3)|(7-fmMixL)); } break; case DIV_CMD_MULTIPCM_MIX_PCM: if (chipType==4) { - rWrite(PCM_ADDR_MIX_PCM,(CLAMP((0x70-(c.value&0x70)),0,0x70)>>1)|(CLAMP((7-(c.value&7)),0,7))); + pcmMixL=CLAMP((c.value&0x70)>>4,0,7); + pcmMixR=CLAMP((c.value&0x7),0,7); + immWrite(PCM_ADDR_MIX_PCM,((7-pcmMixR)<<3)|(7-pcmMixL)); } break; case DIV_CMD_MULTIPCM_LFO: @@ -2844,6 +2848,13 @@ void DivPlatformOPL::reset() { immWrite(0x105,3); // Reset wavetable header immWrite(0x202,(ramSize<=0x200000)?0x10:0x00); + // initialize mixer volume + fmMixL=7; + fmMixR=7; + pcmMixL=7; + pcmMixR=7; + immWrite(PCM_ADDR_MIX_FM,((7-fmMixR)<<3)|(7-fmMixL)); + immWrite(PCM_ADDR_MIX_PCM,((7-pcmMixR)<<3)|(7-pcmMixL)); } else { immWrite(0x105,1); } diff --git a/src/engine/platform/opl.h b/src/engine/platform/opl.h index e62f5ec84..453fa6786 100644 --- a/src/engine/platform/opl.h +++ b/src/engine/platform/opl.h @@ -134,6 +134,7 @@ class DivPlatformOPL: public DivDispatch { const unsigned char* outChanMap; int chipFreqBase, chipRateBase; int delay, chipType, oplType, chans, melodicChans, totalChans, adpcmChan=-1, pcmChanOffs=-1, sampleBank, totalOutputs, ramSize; + int fmMixL=7, fmMixR=7, pcmMixL=7, pcmMixR=7; unsigned char lastBusy; unsigned char drumState; unsigned char drumVol[5]; diff --git a/src/engine/sysDef.cpp b/src/engine/sysDef.cpp index bdadfa11f..6ba055993 100644 --- a/src/engine/sysDef.cpp +++ b/src/engine/sysDef.cpp @@ -601,8 +601,8 @@ void DivEngine::registerSystems() { EffectHandlerMap fmOPL4PostEffectHandlerMap(fmOPLPostEffectHandlerMap); fmOPL4PostEffectHandlerMap.insert({ - {0x1e, {DIV_CMD_MULTIPCM_MIX_FM, _("1Exy: FM global level (left, right; 0 to 7)"), effectVal}}, - {0x1f, {DIV_CMD_MULTIPCM_MIX_PCM, _("1Fxy: PCM global level (left, right; 0 to 7)"), effectVal}}, + {0x1e, {DIV_CMD_MULTIPCM_MIX_FM, _("1Exy: FM global level (x: left, y: right; 0 to 7)"), effectVal}}, + {0x1f, {DIV_CMD_MULTIPCM_MIX_PCM, _("1Fxy: PCM global level (x: left, y: right; 0 to 7)"), effectVal}}, {0x20, {DIV_CMD_MULTIPCM_LFO, _("20xx: PCM LFO Rate (0 to 7)"), effectValAnd<7>}}, {0x21, {DIV_CMD_MULTIPCM_VIB, _("21xx: PCM LFO PM Depth (0 to 7)"), effectValAnd<7>}}, {0x22, {DIV_CMD_MULTIPCM_AM, _("22xx: PCM LFO AM Depth (0 to 7)"), effectValAnd<7>}},