From 0f760a365e223ca0b19d07f6ce040912e85ec18a Mon Sep 17 00:00:00 2001 From: LTVA1 <87536432+LTVA1@users.noreply.github.com> Date: Sat, 28 Oct 2023 10:15:41 +0300 Subject: [PATCH] standlalone cutoff macro (with correct relative mode) --- src/engine/platform/c64.cpp | 13 +++++++++++++ src/gui/insEdit.cpp | 9 +++++++++ 2 files changed, 22 insertions(+) diff --git a/src/engine/platform/c64.cpp b/src/engine/platform/c64.cpp index 11070c26c..55615eecc 100644 --- a/src/engine/platform/c64.cpp +++ b/src/engine/platform/c64.cpp @@ -173,6 +173,19 @@ void DivPlatformC64::tick(bool sysTick) { willUpdateFilter=true; } } + if (chan[i].std.alg.had) { //new cutoff macro! + DivInstrument* ins = parent->getIns(chan[i].ins, DIV_INS_C64); + if (ins->c64.filterIsAbs) { + filtCut = MIN(2047, chan[i].std.alg.val); + } + else { + filtCut += ((signed char)chan[i].std.alg.val) * 7; //new macro should not be executed in inverted way when in relative mode jesus + if (filtCut > 2047) filtCut = 2047; + if (filtCut < 0) filtCut = 0; + } + willUpdateFilter = true; + } + if (NEW_ARP_STRAT) { chan[i].handleArp(); } else if (chan[i].std.arp.had) { diff --git a/src/gui/insEdit.cpp b/src/gui/insEdit.cpp index e93367424..7b2b1e2aa 100644 --- a/src/gui/insEdit.cpp +++ b/src/gui/insEdit.cpp @@ -6437,6 +6437,15 @@ void FurnaceGUI::drawInsEdit() { } if (ex1Max>0) { if (ins->type==DIV_INS_C64) { + int cutoffmin = -64; + int cutoffmax = 64; + + if (ins->c64.filterIsAbs) { + ins->std.algMacro.vZoom = -1; + cutoffmin = 0; + cutoffmax = 2047; + } + macroList.push_back(FurnaceGUIMacroDesc("Filter Cutoff", &ins->std.algMacro, cutoffmin, cutoffmax, 160, uiColors[GUI_COLOR_MACRO_OTHER])); macroList.push_back(FurnaceGUIMacroDesc("Filter Mode",&ins->std.ex1Macro,0,ex1Max,64,uiColors[GUI_COLOR_MACRO_OTHER],false,NULL,NULL,true,filtModeBits)); } else if (ins->type==DIV_INS_SAA1099) { macroList.push_back(FurnaceGUIMacroDesc("Envelope",&ins->std.ex1Macro,0,ex1Max,160,uiColors[GUI_COLOR_MACRO_OTHER],false,NULL,NULL,true,saaEnvBits));