From 788ccfb3344d82bcc0f6bddb346684263ce1dbfe Mon Sep 17 00:00:00 2001 From: tildearrow Date: Wed, 9 Feb 2022 12:43:27 -0500 Subject: [PATCH] unscrew alg + volume --- src/engine/platform/arcade.cpp | 13 +++++++++++++ src/engine/platform/genesis.cpp | 13 +++++++++++++ src/engine/platform/ym2610.cpp | 13 +++++++++++++ 3 files changed, 39 insertions(+) diff --git a/src/engine/platform/arcade.cpp b/src/engine/platform/arcade.cpp index f3badf19c..366bcaff4 100644 --- a/src/engine/platform/arcade.cpp +++ b/src/engine/platform/arcade.cpp @@ -276,6 +276,19 @@ void DivPlatformArcade::tick() { } else { rWrite(chanOffs[i]+ADDR_LR_FB_ALG,(chan[i].state.alg&7)|(chan[i].state.fb<<3)|((chan[i].chVolL&1)<<6)|((chan[i].chVolR&1)<<7)); } + for (int j=0; j<4; j++) { + unsigned short baseAddr=chanOffs[i]|opOffs[j]; + DivInstrumentFM::Operator& op=chan[i].state.op[j]; + if (isMuted[i]) { + rWrite(baseAddr+ADDR_TL,127); + } else { + if (isOutput[chan[i].state.alg][j]) { + rWrite(baseAddr+ADDR_TL,127-(((127-op.tl)*(chan[i].outVol&0x7f))/127)); + } else { + rWrite(baseAddr+ADDR_TL,op.tl); + } + } + } } if (chan[i].std.hadFb) { chan[i].state.fb=chan[i].std.fb; diff --git a/src/engine/platform/genesis.cpp b/src/engine/platform/genesis.cpp index 76c2dab39..3f5640ad6 100644 --- a/src/engine/platform/genesis.cpp +++ b/src/engine/platform/genesis.cpp @@ -201,6 +201,19 @@ void DivPlatformGenesis::tick() { if (chan[i].std.hadAlg) { chan[i].state.alg=chan[i].std.alg; rWrite(chanOffs[i]+ADDR_FB_ALG,(chan[i].state.alg&7)|(chan[i].state.fb<<3)); + for (int j=0; j<4; j++) { + unsigned short baseAddr=chanOffs[i]|opOffs[j]; + DivInstrumentFM::Operator& op=chan[i].state.op[j]; + if (isMuted[i]) { + rWrite(baseAddr+ADDR_TL,127); + } else { + if (isOutput[chan[i].state.alg][j]) { + rWrite(baseAddr+ADDR_TL,127-(((127-op.tl)*(chan[i].outVol&0x7f))/127)); + } else { + rWrite(baseAddr+ADDR_TL,op.tl); + } + } + } } if (chan[i].std.hadFb) { chan[i].state.fb=chan[i].std.fb; diff --git a/src/engine/platform/ym2610.cpp b/src/engine/platform/ym2610.cpp index 944d8dbcd..93f0af3d0 100644 --- a/src/engine/platform/ym2610.cpp +++ b/src/engine/platform/ym2610.cpp @@ -183,6 +183,19 @@ void DivPlatformYM2610::tick() { if (chan[i].std.hadAlg) { chan[i].state.alg=chan[i].std.alg; rWrite(chanOffs[i]+ADDR_FB_ALG,(chan[i].state.alg&7)|(chan[i].state.fb<<3)); + for (int j=0; j<4; j++) { + unsigned short baseAddr=chanOffs[i]|opOffs[j]; + DivInstrumentFM::Operator& op=chan[i].state.op[j]; + if (isMuted[i]) { + rWrite(baseAddr+ADDR_TL,127); + } else { + if (isOutput[chan[i].state.alg][j]) { + rWrite(baseAddr+ADDR_TL,127-(((127-op.tl)*(chan[i].outVol&0x7f))/127)); + } else { + rWrite(baseAddr+ADDR_TL,op.tl); + } + } + } } if (chan[i].std.hadFb) { chan[i].state.fb=chan[i].std.fb;