From 08a93f9c4d2e5203a9da35dc4d505dc77b817030 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Tue, 26 Sep 2023 12:23:38 -0500 Subject: [PATCH] Namco WSG: fix noise mode --- doc/4-instrument/wsg.md | 2 +- src/engine/platform/namcowsg.cpp | 3 ++- src/engine/sysDef.cpp | 6 +++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/doc/4-instrument/wsg.md b/doc/4-instrument/wsg.md index 5c32f50b2..eb379ff04 100644 --- a/doc/4-instrument/wsg.md +++ b/doc/4-instrument/wsg.md @@ -11,7 +11,7 @@ this allows you to enable and configure the Furnace wavetable synthesizer. see [ - **Volume**: volume sequence. - **Arpeggio**: pitch sequence. - **Noise**: specifies noise pitch. - - only applicable for Namco C30, and even so, only on the last 4 channels. + - only applicable for Namco C30. - **Waveform**: specifies wavetable sequence. - **Panning (left)**: output level of left channel. - Namco C30 only. diff --git a/src/engine/platform/namcowsg.cpp b/src/engine/platform/namcowsg.cpp index f6b6d062a..0aa4bbd94 100644 --- a/src/engine/platform/namcowsg.cpp +++ b/src/engine/platform/namcowsg.cpp @@ -201,7 +201,7 @@ void DivPlatformNamcoWSG::tick(bool sysTick) { if (chan[i].std.vol.had) { chan[i].outVol=((chan[i].vol&15)*MIN(15,chan[i].std.vol.val))>>4; } - if (chan[i].std.duty.had && i>=4) { + if (chan[i].std.duty.had) { chan[i].noise=chan[i].std.duty.val; chan[i].freqChanged=true; } @@ -418,6 +418,7 @@ int DivPlatformNamcoWSG::dispatch(DivCommand c) { } case DIV_CMD_STD_NOISE_MODE: chan[c.chan].noise=c.value; + chan[c.chan].freqChanged=true; break; case DIV_CMD_PANNING: { chan[c.chan].pan=(c.value&0xf0)|(c.value2>>4); diff --git a/src/engine/sysDef.cpp b/src/engine/sysDef.cpp index 17ab8cfc3..6b1365e4d 100644 --- a/src/engine/sysDef.cpp +++ b/src/engine/sysDef.cpp @@ -1708,6 +1708,10 @@ void DivEngine::registerSystems() { EffectHandlerMap namcoEffectHandlerMap={ {0x10, {DIV_CMD_WAVE, "10xx: Set waveform"}}, + }; + + EffectHandlerMap namcoC30EffectHandlerMap={ + {0x10, {DIV_CMD_WAVE, "10xx: Set waveform"}}, {0x11, {DIV_CMD_STD_NOISE_MODE, "11xx: Toggle noise mode"}}, }; @@ -1741,7 +1745,7 @@ void DivEngine::registerSystems() { {DIV_CH_WAVE, DIV_CH_WAVE, DIV_CH_WAVE, DIV_CH_WAVE, DIV_CH_WAVE, DIV_CH_WAVE, DIV_CH_WAVE, DIV_CH_WAVE}, {DIV_INS_NAMCO, DIV_INS_NAMCO, DIV_INS_NAMCO, DIV_INS_NAMCO, DIV_INS_NAMCO, DIV_INS_NAMCO, DIV_INS_NAMCO, DIV_INS_NAMCO}, {}, - namcoEffectHandlerMap + namcoC30EffectHandlerMap ); sysDefs[DIV_SYSTEM_MSM5232]=new DivSysDef(