make Furnace fast

This commit is contained in:
tildearrow 2022-12-07 23:34:01 -05:00
parent c91e947ea3
commit 1caf61421b
2 changed files with 7 additions and 4 deletions

View file

@ -11,7 +11,7 @@ defaults:
shell: bash
env:
BUILD_TYPE: Debug
BUILD_TYPE: Release
jobs:
build:

View file

@ -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) {