From 3b8388d90cd3f1308e3d508e7b8c318ef149ab4e Mon Sep 17 00:00:00 2001 From: tildearrow Date: Sun, 6 Mar 2022 14:39:20 -0500 Subject: [PATCH] YM2151/2610/2612/Game Boy: fix panning - UNTESTED --- src/engine/platform/arcade.cpp | 4 ++-- src/engine/platform/gb.cpp | 1 + src/engine/platform/genesis.cpp | 14 ++++---------- src/engine/platform/genesisext.cpp | 16 +++++----------- src/engine/platform/ym2610.cpp | 14 ++++---------- src/engine/platform/ym2610b.cpp | 14 ++++---------- src/engine/platform/ym2610bext.cpp | 16 +++++----------- src/engine/platform/ym2610ext.cpp | 16 +++++----------- 8 files changed, 30 insertions(+), 65 deletions(-) diff --git a/src/engine/platform/arcade.cpp b/src/engine/platform/arcade.cpp index 15a255178..1af99eb75 100644 --- a/src/engine/platform/arcade.cpp +++ b/src/engine/platform/arcade.cpp @@ -495,8 +495,8 @@ int DivPlatformArcade::dispatch(DivCommand c) { chan[c.chan].ins=c.value; break; case DIV_CMD_PANNING: { - chan[c.chan].chVolL=((c.value>>4)==1); - chan[c.chan].chVolR=((c.value&15)==1); + chan[c.chan].chVolL=((c.value>>4)>0); + chan[c.chan].chVolR=((c.value&15)>0); if (isMuted[c.chan]) { rWrite(chanOffs[c.chan]+ADDR_LR_FB_ALG,(chan[c.chan].state.alg&7)|(chan[c.chan].state.fb<<3)); } else { diff --git a/src/engine/platform/gb.cpp b/src/engine/platform/gb.cpp index f02ea1970..a2b53ef77 100644 --- a/src/engine/platform/gb.cpp +++ b/src/engine/platform/gb.cpp @@ -340,6 +340,7 @@ int DivPlatformGB::dispatch(DivCommand c) { case DIV_CMD_PANNING: { lastPan&=~(0x11<0)|(((c.value>>4)>0)<<4) lastPan|=c.value<0)|(((c.value>>4)>0)<<1); } 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; diff --git a/src/engine/platform/genesisext.cpp b/src/engine/platform/genesisext.cpp index 364505db2..02305a9aa 100644 --- a/src/engine/platform/genesisext.cpp +++ b/src/engine/platform/genesisext.cpp @@ -106,16 +106,10 @@ int DivPlatformGenesisExt::dispatch(DivCommand c) { opChan[ch].ins=c.value; break; case DIV_CMD_PANNING: { - switch (c.value) { - case 0x01: - opChan[ch].pan=1; - break; - case 0x10: - opChan[ch].pan=2; - break; - default: - opChan[ch].pan=3; - break; + if (c.value==0) { + opChan[ch].pan=3; + } else { + opChan[ch].pan=((c.value&15)>0)|(((c.value>>4)>0)<<1); } // TODO: ??? rWrite(chanOffs[2]+0xb4,(opChan[ch].pan<<6)|(chan[2].state.fms&7)|((chan[2].state.ams&3)<<4)); @@ -378,4 +372,4 @@ void DivPlatformGenesisExt::quit() { } DivPlatformGenesisExt::~DivPlatformGenesisExt() { -} \ No newline at end of file +} diff --git a/src/engine/platform/ym2610.cpp b/src/engine/platform/ym2610.cpp index dd2447da4..1bd460fa1 100644 --- a/src/engine/platform/ym2610.cpp +++ b/src/engine/platform/ym2610.cpp @@ -892,16 +892,10 @@ int DivPlatformYM2610::dispatch(DivCommand c) { chan[c.chan].ins=c.value; break; case DIV_CMD_PANNING: { - switch (c.value) { - case 0x01: - chan[c.chan].pan=1; - break; - case 0x10: - chan[c.chan].pan=2; - break; - default: - chan[c.chan].pan=3; - break; + if (c.value==0) { + chan[c.chan].pan=3; + } else { + chan[c.chan].pan=((c.value&15)>0)|(((c.value>>4)>0)<<1); } if (c.chan>12) { immWrite(0x11,isMuted[c.chan]?0:(chan[c.chan].pan<<6)); diff --git a/src/engine/platform/ym2610b.cpp b/src/engine/platform/ym2610b.cpp index 27bb2afbb..a6bcf9ac7 100644 --- a/src/engine/platform/ym2610b.cpp +++ b/src/engine/platform/ym2610b.cpp @@ -955,16 +955,10 @@ int DivPlatformYM2610B::dispatch(DivCommand c) { chan[c.chan].ins=c.value; break; case DIV_CMD_PANNING: { - switch (c.value) { - case 0x01: - chan[c.chan].pan=1; - break; - case 0x10: - chan[c.chan].pan=2; - break; - default: - chan[c.chan].pan=3; - break; + if (c.value==0) { + chan[c.chan].pan=3; + } else { + chan[c.chan].pan=((c.value&15)>0)|(((c.value>>4)>0)<<1); } if (c.chan>14) { immWrite(0x11,isMuted[c.chan]?0:(chan[c.chan].pan<<6)); diff --git a/src/engine/platform/ym2610bext.cpp b/src/engine/platform/ym2610bext.cpp index f48fe19ab..5b3c3872e 100644 --- a/src/engine/platform/ym2610bext.cpp +++ b/src/engine/platform/ym2610bext.cpp @@ -97,16 +97,10 @@ int DivPlatformYM2610BExt::dispatch(DivCommand c) { opChan[ch].ins=c.value; break; case DIV_CMD_PANNING: { - switch (c.value) { - case 0x01: - opChan[ch].pan=1; - break; - case 0x10: - opChan[ch].pan=2; - break; - default: - opChan[ch].pan=3; - break; + if (c.value==0) { + opChan[ch].pan=3; + } else { + opChan[ch].pan=((c.value&15)>0)|(((c.value>>4)>0)<<1); } DivInstrument* ins=parent->getIns(opChan[ch].ins); // TODO: ??? @@ -334,4 +328,4 @@ void DivPlatformYM2610BExt::quit() { } DivPlatformYM2610BExt::~DivPlatformYM2610BExt() { -} \ No newline at end of file +} diff --git a/src/engine/platform/ym2610ext.cpp b/src/engine/platform/ym2610ext.cpp index aff4bbf33..5e633eb2c 100644 --- a/src/engine/platform/ym2610ext.cpp +++ b/src/engine/platform/ym2610ext.cpp @@ -97,16 +97,10 @@ int DivPlatformYM2610Ext::dispatch(DivCommand c) { opChan[ch].ins=c.value; break; case DIV_CMD_PANNING: { - switch (c.value) { - case 0x01: - opChan[ch].pan=1; - break; - case 0x10: - opChan[ch].pan=2; - break; - default: - opChan[ch].pan=3; - break; + if (c.value==0) { + opChan[ch].pan=3; + } else { + opChan[ch].pan=((c.value&15)>0)|(((c.value>>4)>0)<<1); } DivInstrument* ins=parent->getIns(opChan[ch].ins); // TODO: ??? @@ -334,4 +328,4 @@ void DivPlatformYM2610Ext::quit() { } DivPlatformYM2610Ext::~DivPlatformYM2610Ext() { -} \ No newline at end of file +}