From 73a9eb5cccd8f84bcbf3c3d3deb5e6c722ee2368 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Fri, 30 Sep 2022 04:02:11 -0500 Subject: [PATCH] SNES: easier filter config --- src/engine/platform/snes.cpp | 51 ++++++++++++++++------ src/engine/platform/snes.h | 8 ++++ src/gui/sysConf.cpp | 84 ++++++++++++++++++++++++++++++++++++ 3 files changed, 129 insertions(+), 14 deletions(-) diff --git a/src/engine/platform/snes.cpp b/src/engine/platform/snes.cpp index f76047c8d..0edc88aa6 100644 --- a/src/engine/platform/snes.cpp +++ b/src/engine/platform/snes.cpp @@ -672,21 +672,27 @@ void DivPlatformSNES::reset() { writeControl=false; writeNoise=false; writePitchMod=false; - writeEcho=false; + writeEcho=true; - echoDelay=0; - echoFeedback=0; - echoFIR[0]=127; - echoFIR[1]=0; - echoFIR[2]=0; - echoFIR[3]=0; - echoFIR[4]=0; - echoFIR[5]=0; - echoFIR[6]=0; - echoFIR[7]=0; - echoVolL=127; - echoVolR=127; - echoOn=false; + echoDelay=initEchoDelay; + echoFeedback=initEchoFeedback; + echoFIR[0]=initEchoFIR[0]; + echoFIR[1]=initEchoFIR[1]; + echoFIR[2]=initEchoFIR[2]; + echoFIR[3]=initEchoFIR[3]; + echoFIR[4]=initEchoFIR[4]; + echoFIR[5]=initEchoFIR[5]; + echoFIR[6]=initEchoFIR[6]; + echoFIR[7]=initEchoFIR[7]; + echoVolL=initEchoVolL; + echoVolR=initEchoVolR; + echoOn=initEchoOn; + + for (int i=0; i<8; i++) { + if (initEchoMask&(1<15) echoDelay=15; + altered=true; + } rightClickable + + if (CWSliderInt("Feedback##EchoFeedback",&echoFeedback,-128,127)) { + if (echoFeedback<-128) echoFeedback=-128; + if (echoFeedback>127) echoFeedback=127; + altered=true; + } rightClickable + + ImGui::Text("Echo volume:"); + if (CWSliderInt("Left##EchoVolL",&echoVolL,-128,127)) { + if (echoVolL<-128) echoVolL=-128; + if (echoVolL>127) echoVolL=127; + altered=true; + } rightClickable + if (CWSliderInt("Right##EchoVolL",&echoVolR,-128,127)) { + if (echoVolR<-128) echoVolR=-128; + if (echoVolR>127) echoVolR=127; + altered=true; + } rightClickable + + ImGui::Text("Echo filter:"); + for (int i=0; i<8; i++) { + snprintf(temp,63,"%d##FIR%d",i+1,i); + if (CWSliderInt(temp,&echoFilter[i],-128,127)) { + if (echoFilter[i]<-128) echoFilter[i]=-128; + if (echoFilter[i]>127) echoFilter[i]=127; + altered=true; + } rightClickable + } + if (altered) { e->lockSave([&]() { flags.set("volScaleL",127-vsL); flags.set("volScaleR",127-vsR); + flags.set("echo",echo); + flags.set("echoVolL",echoVolL); + flags.set("echoVolR",echoVolR); + flags.set("echoDelay",echoDelay); + flags.set("echoFeedback",echoFeedback); + flags.set("echoFilter0",echoFilter[0]); + flags.set("echoFilter1",echoFilter[1]); + flags.set("echoFilter2",echoFilter[2]); + flags.set("echoFilter3",echoFilter[3]); + flags.set("echoFilter4",echoFilter[4]); + flags.set("echoFilter5",echoFilter[5]); + flags.set("echoFilter6",echoFilter[6]); + flags.set("echoFilter7",echoFilter[7]); + flags.set("echoMask",echoMask); }); } + break; } case DIV_SYSTEM_SWAN: