From 0ee8309432c11172f7cc536cbee08d140605437b Mon Sep 17 00:00:00 2001 From: tildearrow Date: Thu, 8 Dec 2022 01:10:02 -0500 Subject: [PATCH] SN: fix easy noise --- src/engine/platform/sms.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/engine/platform/sms.cpp b/src/engine/platform/sms.cpp index 1d51f56b..8fe0c1de 100644 --- a/src/engine/platform/sms.cpp +++ b/src/engine/platform/sms.cpp @@ -126,8 +126,7 @@ double DivPlatformSMS::NOTE_SN(int ch, int note) { return NOTE_PERIODIC(note); } int easyStartingPeriod=16; - //int easyThreshold=round(CHIP_CLOCK/(parent->song.tuning*0.0625*pow(2.0,(float)(nbase+384)/(128.0*12.0)))/CHIP_DIVIDER); - int easyThreshold=round(log((chipClock/(easyStartingPeriod*CHIP_DIVIDER))/parent->song.tuning)/log(2.0)); + int easyThreshold=round(12.0*log((chipClock/(easyStartingPeriod*CHIP_DIVIDER))/(0.0625*parent->song.tuning))/log(2.0))-3; if (note>easyThreshold) { return MAX(0,easyStartingPeriod-(note-easyThreshold)); } @@ -138,7 +137,7 @@ int DivPlatformSMS::snCalcFreq(int ch) { double CHIP_DIVIDER=toneDivider; if (ch==3) CHIP_DIVIDER=noiseDivider; int easyStartingPeriod=16; - int easyThreshold=round(128.0*log((chipClock/(easyStartingPeriod*CHIP_DIVIDER))/parent->song.tuning)/log(2.0)); + int easyThreshold=round(128.0*12.0*log((chipClock/(easyStartingPeriod*CHIP_DIVIDER))/(0.0625*parent->song.tuning))/log(2.0))-384+64; if (parent->song.linearPitch==2 && easyNoise && chan[ch].baseFreq+chan[ch].pitch+chan[ch].pitch2>(easyThreshold)) { int ret=(((easyStartingPeriod<<7))-(chan[ch].baseFreq+chan[ch].pitch+chan[ch].pitch2-(easyThreshold)))>>7; if (ret<0) ret=0;