diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ffe48ee1..149d234c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,7 +11,7 @@ defaults: shell: bash env: - BUILD_TYPE: Debug + BUILD_TYPE: Release jobs: build: diff --git a/src/engine/platform/sms.cpp b/src/engine/platform/sms.cpp index 16a7c501..1d51f56b 100644 --- a/src/engine/platform/sms.cpp +++ b/src/engine/platform/sms.cpp @@ -127,7 +127,7 @@ double DivPlatformSMS::NOTE_SN(int ch, int 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((CHIP_CLOCK/(easyStartingPeriod*CHIP_DIVIDER))/parent->song.tuning)/log(2.0)); + int easyThreshold=round(log((chipClock/(easyStartingPeriod*CHIP_DIVIDER))/parent->song.tuning)/log(2.0)); if (note>easyThreshold) { return MAX(0,easyStartingPeriod-(note-easyThreshold)); } @@ -135,13 +135,16 @@ double DivPlatformSMS::NOTE_SN(int ch, int note) { } int DivPlatformSMS::snCalcFreq(int ch) { - int easyThreshold=round(128.0*log((CHIP_CLOCK/(easyStartingPeriod*CHIP_DIVIDER))/parent->song.tuning)/log(2.0)); + 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)); 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; return ret; } - return parent->calcFreq(chan[ch].baseFreq,chan[ch].pitch,true,0,chan[ch].pitch2,chipClock,ch==3?noiseDivider:toneDivider); + return parent->calcFreq(chan[ch].baseFreq,chan[ch].pitch,true,0,chan[ch].pitch2,chipClock,CHIP_DIVIDER); } void DivPlatformSMS::tick(bool sysTick) {