From f63c072517be4405b336401a7386eca1211629e5 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Sun, 15 May 2022 01:55:25 -0500 Subject: [PATCH] fix build failure --- src/engine/engine.cpp | 1 + src/engine/platform/ym2203ext.cpp | 25 ++++++++----------------- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/src/engine/engine.cpp b/src/engine/engine.cpp index 01f1a3a2e..e4a74d12d 100644 --- a/src/engine/engine.cpp +++ b/src/engine/engine.cpp @@ -885,6 +885,7 @@ bool DivEngine::addSystem(DivSystem which) { return true; } +// TODO: maybe issue with subsongs? bool DivEngine::removeSystem(int index, bool preserveOrder) { if (song.systemLen<=1) { lastError="cannot remove the last one"; diff --git a/src/engine/platform/ym2203ext.cpp b/src/engine/platform/ym2203ext.cpp index 7948d51e7..9ca77e9fc 100644 --- a/src/engine/platform/ym2203ext.cpp +++ b/src/engine/platform/ym2203ext.cpp @@ -463,27 +463,17 @@ void DivPlatformYM2203Ext::muteChannel(int ch, bool mute) { } void DivPlatformYM2203Ext::forceIns() { - for (int i=0; i<6; i++) { + for (int i=0; i<3; i++) { for (int j=0; j<4; j++) { unsigned short baseAddr=chanOffs[i]|opOffs[j]; DivInstrumentFM::Operator& op=chan[i].state.op[j]; - if (i==2) { // extended channel - if (isOpMuted[j]) { - rWrite(baseAddr+0x40,127); - } else if (isOutput[chan[i].state.alg][j]) { - rWrite(baseAddr+0x40,127-(((127-op.tl)*(opChan[j].vol&0x7f))/127)); - } else { - rWrite(baseAddr+0x40,op.tl); - } + if (isMuted[i]) { + rWrite(baseAddr+ADDR_TL,127); } else { - if (isMuted[i]) { - rWrite(baseAddr+ADDR_TL,127); + if (isOutput[chan[i].state.alg][j]) { + rWrite(baseAddr+ADDR_TL,127-(((127-op.tl)*(chan[i].outVol&0x7f))/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); - } + rWrite(baseAddr+ADDR_TL,op.tl); } } rWrite(baseAddr+ADDR_MULT_DT,(op.mult&15)|(dtTable[op.dt&7]<<4)); @@ -499,9 +489,10 @@ void DivPlatformYM2203Ext::forceIns() { chan[i].freqChanged=true; } } - for (int i=6; i<16; i++) { + for (int i=3; i<6; i++) { chan[i].insChanged=true; } + ay->forceIns(); ay->flushWrites(); for (DivRegWrite& i: ay->getRegisterWrites()) {