From 9e1b43f4015f4641daaf84295da99f107fe73e3f Mon Sep 17 00:00:00 2001 From: tildearrow Date: Thu, 16 May 2024 12:35:34 -0500 Subject: [PATCH] OPLL: add effect to change patch 10xx --- doc/7-systems/opll.md | 1 + src/engine/platform/opll.cpp | 7 +++++++ src/engine/sysDef.cpp | 1 + 3 files changed, 9 insertions(+) diff --git a/doc/7-systems/opll.md b/doc/7-systems/opll.md index 4de890b22..dbbea413b 100644 --- a/doc/7-systems/opll.md +++ b/doc/7-systems/opll.md @@ -27,6 +27,7 @@ the YM2413 is equipped with the following features: ## effects +- `10xx`: **change patch.** - `11xx`: **set feedback of channel.** - `12xx`: **set operator 1 level.** - `13xx`: **set operator 2 level.** diff --git a/src/engine/platform/opll.cpp b/src/engine/platform/opll.cpp index a5b554c6d..c231b749b 100644 --- a/src/engine/platform/opll.cpp +++ b/src/engine/platform/opll.cpp @@ -692,6 +692,13 @@ int DivPlatformOPLL::dispatch(DivCommand c) { chan[c.chan].freqChanged=true; break; } + case DIV_CMD_WAVE: { + if (c.chan>=6 && (crapDrums || properDrums)) break; + if (c.chan>=9) break; + chan[c.chan].state.opllPreset=c.value&15; + rWrite(0x30+c.chan,((15-VOL_SCALE_LOG_BROKEN(chan[c.chan].outVol,15-chan[c.chan].state.op[1].tl,15))&15)|(chan[c.chan].state.opllPreset<<4)); + break; + } case DIV_CMD_FM_FB: { if (c.chan>=9 && !properDrums) return 0; //DivInstrumentFM::Operator& mod=chan[c.chan].state.op[0]; diff --git a/src/engine/sysDef.cpp b/src/engine/sysDef.cpp index 45e0bb52a..1e52ce837 100644 --- a/src/engine/sysDef.cpp +++ b/src/engine/sysDef.cpp @@ -550,6 +550,7 @@ void DivEngine::registerSystems() { }); EffectHandlerMap fmOPLLPostEffectHandlerMap={ + {0x10, {DIV_CMD_WAVE, "10xx: Set patch (0 to F)"}}, {0x11, {DIV_CMD_FM_FB, "11xx: Set feedback (0 to 7)"}}, {0x12, {DIV_CMD_FM_TL, "12xx: Set level of operator 1 (0 highest, 3F lowest)", constVal<0>, effectVal}}, {0x13, {DIV_CMD_FM_TL, "13xx: Set level of operator 2 (0 highest, 3F lowest)", constVal<1>, effectVal}},