Fix OPL4 mixer volume, mixer effect description (x: Left, y: Right)

This commit is contained in:
cam900 2024-07-17 18:26:40 +09:00
parent 4174be22c1
commit 346d34c6e7
3 changed files with 16 additions and 4 deletions

View file

@ -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);
}

View file

@ -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];

View file

@ -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>}},