SN: prepare for new easy threshold formula
This commit is contained in:
parent
a2be33cf95
commit
c91e947ea3
|
@ -125,6 +125,9 @@ double DivPlatformSMS::NOTE_SN(int ch, int note) {
|
||||||
if (parent->song.linearPitch==2 || !easyNoise) {
|
if (parent->song.linearPitch==2 || !easyNoise) {
|
||||||
return NOTE_PERIODIC(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((CHIP_CLOCK/(easyStartingPeriod*CHIP_DIVIDER))/parent->song.tuning)/log(2.0));
|
||||||
if (note>easyThreshold) {
|
if (note>easyThreshold) {
|
||||||
return MAX(0,easyStartingPeriod-(note-easyThreshold));
|
return MAX(0,easyStartingPeriod-(note-easyThreshold));
|
||||||
}
|
}
|
||||||
|
@ -132,8 +135,9 @@ double DivPlatformSMS::NOTE_SN(int ch, int note) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int DivPlatformSMS::snCalcFreq(int ch) {
|
int DivPlatformSMS::snCalcFreq(int ch) {
|
||||||
if (parent->song.linearPitch==2 && easyNoise && chan[ch].baseFreq+chan[ch].pitch+chan[ch].pitch2>(easyThreshold<<7)) {
|
int easyThreshold=round(128.0*log((CHIP_CLOCK/(easyStartingPeriod*CHIP_DIVIDER))/parent->song.tuning)/log(2.0));
|
||||||
int ret=(((easyStartingPeriod<<7)+0x40)-(chan[ch].baseFreq+chan[ch].pitch+chan[ch].pitch2-(easyThreshold<<7)))>>7;
|
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;
|
if (ret<0) ret=0;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -464,38 +468,24 @@ void DivPlatformSMS::setFlags(const DivConfig& flags) {
|
||||||
switch (flags.getInt("clockSel",0)) {
|
switch (flags.getInt("clockSel",0)) {
|
||||||
case 1:
|
case 1:
|
||||||
chipClock=COLOR_PAL*4.0/5.0;
|
chipClock=COLOR_PAL*4.0/5.0;
|
||||||
easyThreshold=84;
|
|
||||||
easyStartingPeriod=13;
|
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
chipClock=4000000;
|
chipClock=4000000;
|
||||||
easyThreshold=86;
|
|
||||||
easyStartingPeriod=13;
|
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
chipClock=COLOR_NTSC/2.0;
|
chipClock=COLOR_NTSC/2.0;
|
||||||
easyThreshold=72;
|
|
||||||
easyStartingPeriod=13;
|
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
chipClock=3000000;
|
chipClock=3000000;
|
||||||
easyThreshold=81;
|
|
||||||
easyStartingPeriod=13;
|
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
chipClock=2000000;
|
chipClock=2000000;
|
||||||
easyThreshold=74;
|
|
||||||
easyStartingPeriod=13;
|
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
chipClock=COLOR_NTSC/8.0;
|
chipClock=COLOR_NTSC/8.0;
|
||||||
easyThreshold=48;
|
|
||||||
easyStartingPeriod=13;
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
chipClock=COLOR_NTSC;
|
chipClock=COLOR_NTSC;
|
||||||
easyThreshold=84;
|
|
||||||
easyStartingPeriod=13;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
CHECK_CUSTOM_CLOCK;
|
CHECK_CUSTOM_CLOCK;
|
||||||
|
@ -569,6 +559,7 @@ void DivPlatformSMS::setFlags(const DivConfig& flags) {
|
||||||
stereo=false;
|
stereo=false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
rate=chipClock/divider;
|
rate=chipClock/divider;
|
||||||
for (int i=0; i<4; i++) {
|
for (int i=0; i<4; i++) {
|
||||||
oscBuf[i]->rate=rate;
|
oscBuf[i]->rate=rate;
|
||||||
|
|
|
@ -65,8 +65,6 @@ class DivPlatformSMS: public DivDispatch {
|
||||||
int divider=16;
|
int divider=16;
|
||||||
double toneDivider=64.0;
|
double toneDivider=64.0;
|
||||||
double noiseDivider=64.0;
|
double noiseDivider=64.0;
|
||||||
int easyThreshold;
|
|
||||||
int easyStartingPeriod;
|
|
||||||
bool updateSNMode;
|
bool updateSNMode;
|
||||||
bool resetPhase;
|
bool resetPhase;
|
||||||
bool isRealSN;
|
bool isRealSN;
|
||||||
|
|
Loading…
Reference in New Issue