prepare for proper center rate
the correct rate is 8372Hz rather than 8363Hz sadly this will require a compat flag so I am not making this change effective until 0.7 issue #2347
This commit is contained in:
parent
b95f9885a4
commit
9dee51851f
|
@ -2353,6 +2353,10 @@ double DivEngine::getSamplePreviewRate() {
|
||||||
return sPreview.rate;
|
return sPreview.rate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double DivEngine::getCenterRate() {
|
||||||
|
return song.oldCenterRate?8363.0:8372.0;
|
||||||
|
}
|
||||||
|
|
||||||
String DivEngine::getConfigPath() {
|
String DivEngine::getConfigPath() {
|
||||||
return configPath;
|
return configPath;
|
||||||
}
|
}
|
||||||
|
@ -2897,6 +2901,7 @@ int DivEngine::addSample() {
|
||||||
DivSample* sample=new DivSample;
|
DivSample* sample=new DivSample;
|
||||||
int sampleCount=(int)song.sample.size();
|
int sampleCount=(int)song.sample.size();
|
||||||
sample->name=fmt::sprintf(_("Sample %d"),sampleCount);
|
sample->name=fmt::sprintf(_("Sample %d"),sampleCount);
|
||||||
|
sample->centerRate=getCenterRate();
|
||||||
song.sample.push_back(sample);
|
song.sample.push_back(sample);
|
||||||
song.sampleLen=sampleCount+1;
|
song.sampleLen=sampleCount+1;
|
||||||
sPreview.sample=-1;
|
sPreview.sample=-1;
|
||||||
|
|
|
@ -839,6 +839,9 @@ class DivEngine {
|
||||||
// reset playback state
|
// reset playback state
|
||||||
void syncReset();
|
void syncReset();
|
||||||
|
|
||||||
|
// get C-4 rate for samples
|
||||||
|
double getCenterRate();
|
||||||
|
|
||||||
// sample preview query
|
// sample preview query
|
||||||
bool isPreviewingSample();
|
bool isPreviewingSample();
|
||||||
int getSamplePreviewSample();
|
int getSamplePreviewSample();
|
||||||
|
|
|
@ -429,7 +429,7 @@ void DivPlatformAmiga::tick(bool sysTick) {
|
||||||
if (s->centerRate<1) {
|
if (s->centerRate<1) {
|
||||||
off=1.0;
|
off=1.0;
|
||||||
} else {
|
} else {
|
||||||
off=8363.0/(double)s->centerRate;
|
off=parent->getCenterRate()/(double)s->centerRate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) {
|
if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) {
|
||||||
|
|
|
@ -515,7 +515,7 @@ void DivPlatformAY8910::tick(bool sysTick) {
|
||||||
if (s->centerRate<1) {
|
if (s->centerRate<1) {
|
||||||
off=1.0;
|
off=1.0;
|
||||||
} else {
|
} else {
|
||||||
off=8363.0/(double)s->centerRate;
|
off=parent->getCenterRate()/(double)s->centerRate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
chan[i].dac.rate=((double)rate*((sunsoft||clockSel)?8.0:16.0))/(double)(MAX(1,off*chan[i].freq));
|
chan[i].dac.rate=((double)rate*((sunsoft||clockSel)?8.0:16.0))/(double)(MAX(1,off*chan[i].freq));
|
||||||
|
|
|
@ -341,7 +341,7 @@ void DivPlatformAY8930::tick(bool sysTick) {
|
||||||
if (s->centerRate<1) {
|
if (s->centerRate<1) {
|
||||||
off=1.0;
|
off=1.0;
|
||||||
} else {
|
} else {
|
||||||
off=8363.0/(double)s->centerRate;
|
off=parent->getCenterRate()/(double)s->centerRate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
chan[i].dac.rate=((double)chipClock*4.0)/(double)(MAX(1,off*chan[i].freq));
|
chan[i].dac.rate=((double)chipClock*4.0)/(double)(MAX(1,off*chan[i].freq));
|
||||||
|
|
|
@ -214,7 +214,7 @@ void DivPlatformC140::tick(bool sysTick) {
|
||||||
if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) {
|
if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) {
|
||||||
DivSample* s=parent->getSample(chan[i].sample);
|
DivSample* s=parent->getSample(chan[i].sample);
|
||||||
unsigned char ctrl=0;
|
unsigned char ctrl=0;
|
||||||
double off=(s->centerRate>=1)?((double)s->centerRate/8363.0):1.0;
|
double off=(s->centerRate>=1)?((double)s->centerRate/parent->getCenterRate()):1.0;
|
||||||
chan[i].freq=(int)(off*parent->calcFreq(chan[i].baseFreq,chan[i].pitch,chan[i].fixedArp?chan[i].baseNoteOverride:chan[i].arpOff,chan[i].fixedArp,false,2,chan[i].pitch2,chipClock,CHIP_FREQBASE));
|
chan[i].freq=(int)(off*parent->calcFreq(chan[i].baseFreq,chan[i].pitch,chan[i].fixedArp?chan[i].baseNoteOverride:chan[i].arpOff,chan[i].fixedArp,false,2,chan[i].pitch2,chipClock,CHIP_FREQBASE));
|
||||||
if (chan[i].freq<0) chan[i].freq=0;
|
if (chan[i].freq<0) chan[i].freq=0;
|
||||||
if (chan[i].freq>65535) chan[i].freq=65535;
|
if (chan[i].freq>65535) chan[i].freq=65535;
|
||||||
|
|
|
@ -373,7 +373,7 @@ void DivPlatformC64::tick(bool sysTick) {
|
||||||
if (s->centerRate<1) {
|
if (s->centerRate<1) {
|
||||||
off=1.0;
|
off=1.0;
|
||||||
} else {
|
} else {
|
||||||
off=(double)s->centerRate/8363.0;
|
off=(double)s->centerRate/parent->getCenterRate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
chan[i].pcmRate=off*parent->calcFreq(chan[i].baseFreq,chan[i].pitch,chan[i].fixedArp?chan[i].baseNoteOverride:chan[i].arpOff,chan[i].fixedArp,false,2,chan[i].pitch2,2,1);
|
chan[i].pcmRate=off*parent->calcFreq(chan[i].baseFreq,chan[i].pitch,chan[i].fixedArp?chan[i].baseNoteOverride:chan[i].arpOff,chan[i].fixedArp,false,2,chan[i].pitch2,2,1);
|
||||||
|
|
|
@ -239,7 +239,7 @@ void DivPlatformDave::tick(bool sysTick) {
|
||||||
double off=1.0;
|
double off=1.0;
|
||||||
if (chan[i].dacSample>=0 && chan[i].dacSample<parent->song.sampleLen) {
|
if (chan[i].dacSample>=0 && chan[i].dacSample<parent->song.sampleLen) {
|
||||||
DivSample* s=parent->getSample(chan[i].dacSample);
|
DivSample* s=parent->getSample(chan[i].dacSample);
|
||||||
off=(double)s->centerRate/8363.0;
|
off=(double)s->centerRate/parent->getCenterRate();
|
||||||
}
|
}
|
||||||
chan[i].dacRate=chan[i].freq*off;
|
chan[i].dacRate=chan[i].freq*off;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -490,7 +490,7 @@ void DivPlatformES5506::tick(bool sysTick) {
|
||||||
if (center<1) {
|
if (center<1) {
|
||||||
off=1.0;
|
off=1.0;
|
||||||
} else {
|
} else {
|
||||||
off=(double)center/8363.0;
|
off=(double)center/parent->getCenterRate();
|
||||||
}
|
}
|
||||||
if (ins->amiga.useNoteMap) {
|
if (ins->amiga.useNoteMap) {
|
||||||
//chan[i].pcm.note=next;
|
//chan[i].pcm.note=next;
|
||||||
|
@ -654,7 +654,7 @@ void DivPlatformES5506::tick(bool sysTick) {
|
||||||
if (center<1) {
|
if (center<1) {
|
||||||
off=1.0;
|
off=1.0;
|
||||||
} else {
|
} else {
|
||||||
off=(double)center/8363.0;
|
off=(double)center/parent->getCenterRate();
|
||||||
}
|
}
|
||||||
chan[i].pcm.loopStart=(chan[i].pcm.start+(s->loopStart<<11))&0xfffff800;
|
chan[i].pcm.loopStart=(chan[i].pcm.start+(s->loopStart<<11))&0xfffff800;
|
||||||
chan[i].pcm.loopEnd=(chan[i].pcm.start+((s->loopEnd)<<11))&0xffffff80;
|
chan[i].pcm.loopEnd=(chan[i].pcm.start+((s->loopEnd)<<11))&0xffffff80;
|
||||||
|
|
|
@ -145,7 +145,7 @@ void DivPlatformGA20::tick(bool sysTick) {
|
||||||
if (s->centerRate<1) {
|
if (s->centerRate<1) {
|
||||||
off=1.0;
|
off=1.0;
|
||||||
} else {
|
} else {
|
||||||
off=8363.0/s->centerRate;
|
off=parent->getCenterRate()/s->centerRate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DivSample* s=parent->getSample(chan[i].sample);
|
DivSample* s=parent->getSample(chan[i].sample);
|
||||||
|
|
|
@ -159,7 +159,7 @@ void DivPlatformGBADMA::tick(bool sysTick) {
|
||||||
double off=1.0;
|
double off=1.0;
|
||||||
if (!chan[i].useWave && chan[i].sample>=0 && chan[i].sample<parent->song.sampleLen) {
|
if (!chan[i].useWave && chan[i].sample>=0 && chan[i].sample<parent->song.sampleLen) {
|
||||||
DivSample* s=parent->getSample(chan[i].sample);
|
DivSample* s=parent->getSample(chan[i].sample);
|
||||||
off=(s->centerRate>=1)?(8363.0/(double)s->centerRate):1.0;
|
off=(s->centerRate>=1)?(parent->getCenterRate()/(double)s->centerRate):1.0;
|
||||||
}
|
}
|
||||||
chan[i].freq=off*parent->calcFreq(chan[i].baseFreq,chan[i].pitch,chan[i].fixedArp?chan[i].baseNoteOverride:chan[i].arpOff,chan[i].fixedArp,true,0,chan[i].pitch2,chipClock,CHIP_DIVIDER);
|
chan[i].freq=off*parent->calcFreq(chan[i].baseFreq,chan[i].pitch,chan[i].fixedArp?chan[i].baseNoteOverride:chan[i].arpOff,chan[i].fixedArp,true,0,chan[i].pitch2,chipClock,CHIP_DIVIDER);
|
||||||
|
|
||||||
|
|
|
@ -295,7 +295,7 @@ void DivPlatformGBAMinMod::tick(bool sysTick) {
|
||||||
}
|
}
|
||||||
if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) {
|
if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) {
|
||||||
DivSample* s=parent->getSample(chan[i].sample);
|
DivSample* s=parent->getSample(chan[i].sample);
|
||||||
double off=(s->centerRate>=1)?((double)s->centerRate/8363.0):1.0;
|
double off=(s->centerRate>=1)?((double)s->centerRate/parent->getCenterRate()):1.0;
|
||||||
chan[i].freq=(int)(off*parent->calcFreq(chan[i].baseFreq,chan[i].pitch,chan[i].fixedArp?chan[i].baseNoteOverride:chan[i].arpOff,chan[i].fixedArp,false,2,chan[i].pitch2,chipClock,CHIP_FREQBASE));
|
chan[i].freq=(int)(off*parent->calcFreq(chan[i].baseFreq,chan[i].pitch,chan[i].fixedArp?chan[i].baseNoteOverride:chan[i].arpOff,chan[i].fixedArp,false,2,chan[i].pitch2,chipClock,CHIP_FREQBASE));
|
||||||
if (chan[i].keyOn) {
|
if (chan[i].keyOn) {
|
||||||
unsigned int start, end, loop;
|
unsigned int start, end, loop;
|
||||||
|
|
|
@ -865,7 +865,7 @@ void DivPlatformGenesis::tick(bool sysTick) {
|
||||||
if (s->centerRate<1) {
|
if (s->centerRate<1) {
|
||||||
off=1.0;
|
off=1.0;
|
||||||
} else {
|
} else {
|
||||||
off=(double)s->centerRate/8363.0;
|
off=(double)s->centerRate/parent->getCenterRate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,chan[i].fixedArp?chan[i].baseNoteOverride:chan[i].arpOff,chan[i].fixedArp,false,2,chan[i].pitch2,1,1);
|
chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,chan[i].fixedArp?chan[i].baseNoteOverride:chan[i].arpOff,chan[i].fixedArp,false,2,chan[i].pitch2,1,1);
|
||||||
|
|
|
@ -187,7 +187,7 @@ void DivPlatformK007232::tick(bool sysTick) {
|
||||||
if (s->centerRate<1) {
|
if (s->centerRate<1) {
|
||||||
off=1.0;
|
off=1.0;
|
||||||
} else {
|
} else {
|
||||||
off=8363.0/s->centerRate;
|
off=parent->getCenterRate()/s->centerRate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DivSample* s=parent->getSample(chan[i].sample);
|
DivSample* s=parent->getSample(chan[i].sample);
|
||||||
|
|
|
@ -142,7 +142,7 @@ void DivPlatformK053260::tick(bool sysTick) {
|
||||||
if (s->centerRate<1) {
|
if (s->centerRate<1) {
|
||||||
off=1.0;
|
off=1.0;
|
||||||
} else {
|
} else {
|
||||||
off=8363.0/s->centerRate;
|
off=parent->getCenterRate()/s->centerRate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
chan[i].freq=0x1000-(int)(off*parent->calcFreq(chan[i].baseFreq,chan[i].pitch,chan[i].fixedArp?chan[i].baseNoteOverride:chan[i].arpOff,chan[i].fixedArp,true,0,chan[i].pitch2,chipClock,CHIP_DIVIDER));
|
chan[i].freq=0x1000-(int)(off*parent->calcFreq(chan[i].baseFreq,chan[i].pitch,chan[i].fixedArp?chan[i].baseNoteOverride:chan[i].arpOff,chan[i].fixedArp,true,0,chan[i].pitch2,chipClock,CHIP_DIVIDER));
|
||||||
|
|
|
@ -257,7 +257,7 @@ void DivPlatformLynx::tick(bool sysTick) {
|
||||||
if (s->centerRate<1) {
|
if (s->centerRate<1) {
|
||||||
off=1.0;
|
off=1.0;
|
||||||
} else {
|
} else {
|
||||||
off=(double)s->centerRate/8363.0;
|
off=(double)s->centerRate/parent->getCenterRate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
chan[i].sampleFreq=off*parent->calcFreq(chan[i].sampleBaseFreq,chan[i].pitch,chan[i].fixedArp?chan[i].baseNoteOverride:chan[i].arpOff,chan[i].fixedArp,false,2,chan[i].pitch2,chipClock,CHIP_FREQBASE);
|
chan[i].sampleFreq=off*parent->calcFreq(chan[i].sampleBaseFreq,chan[i].pitch,chan[i].fixedArp?chan[i].baseNoteOverride:chan[i].arpOff,chan[i].fixedArp,false,2,chan[i].pitch2,chipClock,CHIP_FREQBASE);
|
||||||
|
|
|
@ -161,7 +161,7 @@ void DivPlatformMMC5::tick(bool sysTick) {
|
||||||
double off=1.0;
|
double off=1.0;
|
||||||
if (dacSample>=0 && dacSample<parent->song.sampleLen) {
|
if (dacSample>=0 && dacSample<parent->song.sampleLen) {
|
||||||
DivSample* s=parent->getSample(dacSample);
|
DivSample* s=parent->getSample(dacSample);
|
||||||
off=(double)s->centerRate/8363.0;
|
off=(double)s->centerRate/parent->getCenterRate();
|
||||||
}
|
}
|
||||||
dacRate=MIN(chan[2].freq*off,32000);
|
dacRate=MIN(chan[2].freq*off,32000);
|
||||||
if (dumpWrites) addWrite(0xffff0001,dacRate);
|
if (dumpWrites) addWrite(0xffff0001,dacRate);
|
||||||
|
|
|
@ -160,7 +160,7 @@ void DivPlatformNDS::tick(bool sysTick) {
|
||||||
case DIV_SAMPLE_DEPTH_16BIT: ctrl=0x20; break;
|
case DIV_SAMPLE_DEPTH_16BIT: ctrl=0x20; break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
double off=(s->centerRate>=1)?(8363.0/(double)s->centerRate):1.0;
|
double off=(s->centerRate>=1)?(parent->getCenterRate()/(double)s->centerRate):1.0;
|
||||||
chan[i].freq=0x10000-(off*parent->calcFreq(chan[i].baseFreq,chan[i].pitch,chan[i].fixedArp?chan[i].baseNoteOverride:chan[i].arpOff,chan[i].fixedArp,true,0,chan[i].pitch2,chipClock,CHIP_DIVIDER));
|
chan[i].freq=0x10000-(off*parent->calcFreq(chan[i].baseFreq,chan[i].pitch,chan[i].fixedArp?chan[i].baseNoteOverride:chan[i].arpOff,chan[i].fixedArp,true,0,chan[i].pitch2,chipClock,CHIP_DIVIDER));
|
||||||
if (chan[i].freq<0) chan[i].freq=0;
|
if (chan[i].freq<0) chan[i].freq=0;
|
||||||
if (chan[i].freq>65535) chan[i].freq=65535;
|
if (chan[i].freq>65535) chan[i].freq=65535;
|
||||||
|
|
|
@ -391,7 +391,7 @@ void DivPlatformNES::tick(bool sysTick) {
|
||||||
double off=1.0;
|
double off=1.0;
|
||||||
if (dacSample>=0 && dacSample<parent->song.sampleLen) {
|
if (dacSample>=0 && dacSample<parent->song.sampleLen) {
|
||||||
DivSample* s=parent->getSample(dacSample);
|
DivSample* s=parent->getSample(dacSample);
|
||||||
off=(double)s->centerRate/8363.0;
|
off=(double)s->centerRate/parent->getCenterRate();
|
||||||
}
|
}
|
||||||
dacRate=MIN(chan[4].freq*off,32000);
|
dacRate=MIN(chan[4].freq*off,32000);
|
||||||
if (chan[4].keyOn) {
|
if (chan[4].keyOn) {
|
||||||
|
|
|
@ -1004,7 +1004,7 @@ void DivPlatformOPL::acquire(short** buf, size_t len) {
|
||||||
double DivPlatformOPL::NOTE_ADPCMB(int note) {
|
double DivPlatformOPL::NOTE_ADPCMB(int note) {
|
||||||
if (adpcmChan<0) return 0;
|
if (adpcmChan<0) return 0;
|
||||||
if (chan[adpcmChan].sample>=0 && chan[adpcmChan].sample<parent->song.sampleLen) {
|
if (chan[adpcmChan].sample>=0 && chan[adpcmChan].sample<parent->song.sampleLen) {
|
||||||
double off=65535.0*(double)(parent->getSample(chan[adpcmChan].sample)->centerRate)/8363.0;
|
double off=65535.0*(double)(parent->getSample(chan[adpcmChan].sample)->centerRate)/parent->getCenterRate();
|
||||||
return parent->calcBaseFreq((double)chipClock/(compatYPitch?144:72),off,note,false);
|
return parent->calcBaseFreq((double)chipClock/(compatYPitch?144:72),off,note,false);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1334,7 +1334,7 @@ void DivPlatformOPL::tick(bool sysTick) {
|
||||||
}
|
}
|
||||||
if (chan[adpcmChan].freqChanged || chan[adpcmChan].keyOn || chan[adpcmChan].keyOff) {
|
if (chan[adpcmChan].freqChanged || chan[adpcmChan].keyOn || chan[adpcmChan].keyOff) {
|
||||||
if (chan[adpcmChan].sample>=0 && chan[adpcmChan].sample<parent->song.sampleLen) {
|
if (chan[adpcmChan].sample>=0 && chan[adpcmChan].sample<parent->song.sampleLen) {
|
||||||
double off=65535.0*(double)(parent->getSample(chan[adpcmChan].sample)->centerRate)/8363.0;
|
double off=65535.0*(double)(parent->getSample(chan[adpcmChan].sample)->centerRate)/parent->getCenterRate();
|
||||||
chan[adpcmChan].freq=parent->calcFreq(chan[adpcmChan].baseFreq,chan[adpcmChan].pitch,chan[adpcmChan].fixedArp?chan[adpcmChan].baseNoteOverride:chan[adpcmChan].arpOff,chan[adpcmChan].fixedArp,false,4,chan[adpcmChan].pitch2,(double)chipClock/(compatYPitch?144:72),off);
|
chan[adpcmChan].freq=parent->calcFreq(chan[adpcmChan].baseFreq,chan[adpcmChan].pitch,chan[adpcmChan].fixedArp?chan[adpcmChan].baseNoteOverride:chan[adpcmChan].arpOff,chan[adpcmChan].fixedArp,false,4,chan[adpcmChan].pitch2,(double)chipClock/(compatYPitch?144:72),off);
|
||||||
} else {
|
} else {
|
||||||
chan[adpcmChan].freq=0;
|
chan[adpcmChan].freq=0;
|
||||||
|
@ -1384,7 +1384,7 @@ void DivPlatformOPL::tick(bool sysTick) {
|
||||||
if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) {
|
if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) {
|
||||||
DivSample* s=parent->getSample(chan[i].sample);
|
DivSample* s=parent->getSample(chan[i].sample);
|
||||||
unsigned char ctrl=0;
|
unsigned char ctrl=0;
|
||||||
double off=(s->centerRate>=1)?((double)s->centerRate/8363.0):1.0;
|
double off=(s->centerRate>=1)?((double)s->centerRate/parent->getCenterRate()):1.0;
|
||||||
chan[i].freq=(int)(off*parent->calcFreq(chan[i].baseFreq,chan[i].pitch,chan[i].fixedArp?chan[i].baseNoteOverride:chan[i].arpOff,chan[i].fixedArp,false,2,chan[i].pitch2,chipClock,(524288*768)));
|
chan[i].freq=(int)(off*parent->calcFreq(chan[i].baseFreq,chan[i].pitch,chan[i].fixedArp?chan[i].baseNoteOverride:chan[i].arpOff,chan[i].fixedArp,false,2,chan[i].pitch2,chipClock,(524288*768)));
|
||||||
if (chan[i].freq<0x400) chan[i].freq=0x400;
|
if (chan[i].freq<0x400) chan[i].freq=0x400;
|
||||||
chan[i].freqH=0;
|
chan[i].freqH=0;
|
||||||
|
|
|
@ -233,7 +233,7 @@ void DivPlatformPCE::tick(bool sysTick) {
|
||||||
if (s->centerRate<1) {
|
if (s->centerRate<1) {
|
||||||
off=1.0;
|
off=1.0;
|
||||||
} else {
|
} else {
|
||||||
off=8363.0/(double)s->centerRate;
|
off=parent->getCenterRate()/(double)s->centerRate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
chan[i].dacRate=((double)chipClock/2)/MAX(1,off*chan[i].freq);
|
chan[i].dacRate=((double)chipClock/2)/MAX(1,off*chan[i].freq);
|
||||||
|
|
|
@ -292,7 +292,7 @@ void DivPlatformPCMDAC::tick(bool sysTick) {
|
||||||
double off=1.0;
|
double off=1.0;
|
||||||
if (!chan[0].useWave && chan[0].sample>=0 && chan[0].sample<parent->song.sampleLen) {
|
if (!chan[0].useWave && chan[0].sample>=0 && chan[0].sample<parent->song.sampleLen) {
|
||||||
DivSample* s=parent->getSample(chan[0].sample);
|
DivSample* s=parent->getSample(chan[0].sample);
|
||||||
off=(s->centerRate>=1)?((double)s->centerRate/8363.0):1.0;
|
off=(s->centerRate>=1)?((double)s->centerRate/parent->getCenterRate()):1.0;
|
||||||
}
|
}
|
||||||
chan[0].freq=off*parent->calcFreq(chan[0].baseFreq,chan[0].pitch,chan[0].fixedArp?chan[0].baseNoteOverride:chan[0].arpOff,chan[0].fixedArp,false,2,chan[0].pitch2,chipClock,CHIP_FREQBASE);
|
chan[0].freq=off*parent->calcFreq(chan[0].baseFreq,chan[0].pitch,chan[0].fixedArp?chan[0].baseNoteOverride:chan[0].arpOff,chan[0].fixedArp,false,2,chan[0].pitch2,chipClock,CHIP_FREQBASE);
|
||||||
if (chan[0].freq>16777215) chan[0].freq=16777215;
|
if (chan[0].freq>16777215) chan[0].freq=16777215;
|
||||||
|
|
|
@ -135,7 +135,7 @@ void DivPlatformRF5C68::tick(bool sysTick) {
|
||||||
unsigned char keyon=regPool[8]&~(1<<i);
|
unsigned char keyon=regPool[8]&~(1<<i);
|
||||||
unsigned char keyoff=keyon|(1<<i);
|
unsigned char keyoff=keyon|(1<<i);
|
||||||
DivSample* s=parent->getSample(chan[i].sample);
|
DivSample* s=parent->getSample(chan[i].sample);
|
||||||
double off=(s->centerRate>=1)?((double)s->centerRate/8363.0):1.0;
|
double off=(s->centerRate>=1)?((double)s->centerRate/parent->getCenterRate()):1.0;
|
||||||
chan[i].freq=(int)(off*parent->calcFreq(chan[i].baseFreq,chan[i].pitch,chan[i].fixedArp?chan[i].baseNoteOverride:chan[i].arpOff,chan[i].fixedArp,false,2,chan[i].pitch2,chipClock,CHIP_FREQBASE));
|
chan[i].freq=(int)(off*parent->calcFreq(chan[i].baseFreq,chan[i].pitch,chan[i].fixedArp?chan[i].baseNoteOverride:chan[i].arpOff,chan[i].fixedArp,false,2,chan[i].pitch2,chipClock,CHIP_FREQBASE));
|
||||||
if (chan[i].freq>65535) chan[i].freq=65535;
|
if (chan[i].freq>65535) chan[i].freq=65535;
|
||||||
if (chan[i].keyOn) {
|
if (chan[i].keyOn) {
|
||||||
|
|
|
@ -119,7 +119,7 @@ void DivPlatformSegaPCM::tick(bool sysTick) {
|
||||||
double off=1.0;
|
double off=1.0;
|
||||||
if (chan[i].pcm.sample>=0 && chan[i].pcm.sample<parent->song.sampleLen) {
|
if (chan[i].pcm.sample>=0 && chan[i].pcm.sample<parent->song.sampleLen) {
|
||||||
DivSample* s=parent->getSample(chan[i].pcm.sample);
|
DivSample* s=parent->getSample(chan[i].pcm.sample);
|
||||||
off=(double)s->centerRate/8363.0;
|
off=(double)s->centerRate/parent->getCenterRate();
|
||||||
}
|
}
|
||||||
chan[i].pcm.freq=MIN(255,((rate*0.5)+(off*parent->song.tuning*pow(2.0,double(chan[i].freq+512)/(128.0*12.0)))*255)/rate)+(oldSlides?chan[i].pitch2:0);
|
chan[i].pcm.freq=MIN(255,((rate*0.5)+(off*parent->song.tuning*pow(2.0,double(chan[i].freq+512)/(128.0*12.0)))*255)/rate)+(oldSlides?chan[i].pitch2:0);
|
||||||
rWrite(7+(i<<3),chan[i].pcm.freq);
|
rWrite(7+(i<<3),chan[i].pcm.freq);
|
||||||
|
|
|
@ -716,7 +716,7 @@ void DivPlatformSID3::tick(bool sysTick)
|
||||||
if (s->centerRate<1) {
|
if (s->centerRate<1) {
|
||||||
off=1.0;
|
off=1.0;
|
||||||
} else {
|
} else {
|
||||||
off=(double)s->centerRate/8363.0;
|
off=(double)s->centerRate/parent->getCenterRate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
chan[i].dacRate=chan[i].freq*(off / 32.0)*(double)chipClock/1000000.0;
|
chan[i].dacRate=chan[i].freq*(off / 32.0)*(double)chipClock/1000000.0;
|
||||||
|
|
|
@ -208,7 +208,7 @@ void DivPlatformSNES::tick(bool sysTick) {
|
||||||
// TODO: if wavetable length is higher than 32, we lose precision!
|
// TODO: if wavetable length is higher than 32, we lose precision!
|
||||||
if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) {
|
if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) {
|
||||||
DivSample* s=parent->getSample(chan[i].sample);
|
DivSample* s=parent->getSample(chan[i].sample);
|
||||||
double off=(s->centerRate>=1)?((double)s->centerRate/8363.0):1.0;
|
double off=(s->centerRate>=1)?((double)s->centerRate/parent->getCenterRate()):1.0;
|
||||||
if (chan[i].useWave) off=(double)chan[i].wtLen/32.0;
|
if (chan[i].useWave) off=(double)chan[i].wtLen/32.0;
|
||||||
chan[i].freq=(unsigned int)(off*parent->calcFreq(chan[i].baseFreq,chan[i].pitch,chan[i].fixedArp?chan[i].baseNoteOverride:chan[i].arpOff,chan[i].fixedArp,false,2,chan[i].pitch2,chipClock,CHIP_FREQBASE));
|
chan[i].freq=(unsigned int)(off*parent->calcFreq(chan[i].baseFreq,chan[i].pitch,chan[i].fixedArp?chan[i].baseNoteOverride:chan[i].arpOff,chan[i].fixedArp,false,2,chan[i].pitch2,chipClock,CHIP_FREQBASE));
|
||||||
if (chan[i].freq>16383) chan[i].freq=16383;
|
if (chan[i].freq>16383) chan[i].freq=16383;
|
||||||
|
|
|
@ -234,7 +234,7 @@ void DivPlatformSoundUnit::tick(bool sysTick) {
|
||||||
if (sample->centerRate<1) {
|
if (sample->centerRate<1) {
|
||||||
off=0.25;
|
off=0.25;
|
||||||
} else {
|
} else {
|
||||||
off=(double)sample->centerRate/(8363.0*4.0);
|
off=(double)sample->centerRate/(parent->getCenterRate()*4.0);
|
||||||
}
|
}
|
||||||
chan[i].freq=(double)chan[i].freq*off;
|
chan[i].freq=(double)chan[i].freq*off;
|
||||||
}
|
}
|
||||||
|
|
|
@ -185,7 +185,7 @@ void DivPlatformSwan::tick(bool sysTick) {
|
||||||
if (s->centerRate<1) {
|
if (s->centerRate<1) {
|
||||||
off=1.0;
|
off=1.0;
|
||||||
} else {
|
} else {
|
||||||
off=8363.0/(double)s->centerRate;
|
off=parent->getCenterRate()/(double)s->centerRate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dacRate=((double)chipClock/2)/MAX(1,off*chan[i].freq);
|
dacRate=((double)chipClock/2)/MAX(1,off*chan[i].freq);
|
||||||
|
|
|
@ -158,7 +158,7 @@ int DivPlatformVERA::calcNoteFreq(int ch, int note) {
|
||||||
if (s->centerRate<1) {
|
if (s->centerRate<1) {
|
||||||
off=65536.0;
|
off=65536.0;
|
||||||
} else {
|
} else {
|
||||||
off=65536.0*(s->centerRate/8363.0);
|
off=65536.0*(s->centerRate/parent->getCenterRate());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (int)(parent->calcBaseFreq(chipClock,off,note,false));
|
return (int)(parent->calcBaseFreq(chipClock,off,note,false));
|
||||||
|
@ -230,10 +230,10 @@ void DivPlatformVERA::tick(bool sysTick) {
|
||||||
DivSample* s=parent->getSample(chan[16].pcm.sample);
|
DivSample* s=parent->getSample(chan[16].pcm.sample);
|
||||||
lastCenterRate=s->centerRate;
|
lastCenterRate=s->centerRate;
|
||||||
if (s->centerRate>=1) {
|
if (s->centerRate>=1) {
|
||||||
off=65536.0*(s->centerRate/8363.0);
|
off=65536.0*(s->centerRate/parent->getCenterRate());
|
||||||
}
|
}
|
||||||
} else if (lastCenterRate>=1) {
|
} else if (lastCenterRate>=1) {
|
||||||
off=65536.0*(lastCenterRate/8363.0);
|
off=65536.0*(lastCenterRate/parent->getCenterRate());
|
||||||
}
|
}
|
||||||
chan[16].freq=parent->calcFreq(chan[16].baseFreq,chan[16].pitch,chan[16].fixedArp?chan[16].baseNoteOverride:chan[16].arpOff,chan[16].fixedArp,false,8,chan[16].pitch2,chipClock,off);
|
chan[16].freq=parent->calcFreq(chan[16].baseFreq,chan[16].pitch,chan[16].fixedArp?chan[16].baseNoteOverride:chan[16].arpOff,chan[16].fixedArp,false,8,chan[16].pitch2,chipClock,off);
|
||||||
if (chan[16].freq>128) chan[16].freq=128;
|
if (chan[16].freq>128) chan[16].freq=128;
|
||||||
|
|
|
@ -208,7 +208,7 @@ void DivPlatformVRC6::tick(bool sysTick) {
|
||||||
if (s->centerRate<1) {
|
if (s->centerRate<1) {
|
||||||
off=1.0;
|
off=1.0;
|
||||||
} else {
|
} else {
|
||||||
off=8363.0/(double)s->centerRate;
|
off=parent->getCenterRate()/(double)s->centerRate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
chan[i].dacRate=((double)chipClock)/MAX(1,off*chan[i].freq);
|
chan[i].dacRate=((double)chipClock)/MAX(1,off*chan[i].freq);
|
||||||
|
|
|
@ -249,7 +249,7 @@ double DivPlatformX1_010::NoteX1_010(int ch, int note) {
|
||||||
if (s->centerRate<1) {
|
if (s->centerRate<1) {
|
||||||
off=8192.0;
|
off=8192.0;
|
||||||
} else {
|
} else {
|
||||||
off=8192.0*(s->centerRate/8363.0);
|
off=8192.0*(s->centerRate/parent->getCenterRate());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return parent->calcBaseFreq(chipClock,off,note,false);
|
return parent->calcBaseFreq(chipClock,off,note,false);
|
||||||
|
@ -474,7 +474,7 @@ void DivPlatformX1_010::tick(bool sysTick) {
|
||||||
if (s->centerRate<1) {
|
if (s->centerRate<1) {
|
||||||
off=8192.0;
|
off=8192.0;
|
||||||
} else {
|
} else {
|
||||||
off=8192.0*(s->centerRate/8363.0);
|
off=8192.0*(s->centerRate/parent->getCenterRate());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -289,7 +289,7 @@ double DivPlatformYM2608::NOTE_OPNB(int ch, int note) {
|
||||||
|
|
||||||
double DivPlatformYM2608::NOTE_ADPCMB(int note) {
|
double DivPlatformYM2608::NOTE_ADPCMB(int note) {
|
||||||
if (chan[15+isCSM].sample>=0 && chan[15+isCSM].sample<parent->song.sampleLen) {
|
if (chan[15+isCSM].sample>=0 && chan[15+isCSM].sample<parent->song.sampleLen) {
|
||||||
double off=65535.0*(double)(parent->getSample(chan[15+isCSM].sample)->centerRate)/8363.0;
|
double off=65535.0*(double)(parent->getSample(chan[15+isCSM].sample)->centerRate)/parent->getCenterRate();
|
||||||
return parent->calcBaseFreq((double)chipClock/144,off,note,false);
|
return parent->calcBaseFreq((double)chipClock/144,off,note,false);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -982,7 +982,7 @@ void DivPlatformYM2608::tick(bool sysTick) {
|
||||||
if (chan[(15+isCSM)].freqChanged || chan[(15+isCSM)].keyOn || chan[(15+isCSM)].keyOff) {
|
if (chan[(15+isCSM)].freqChanged || chan[(15+isCSM)].keyOn || chan[(15+isCSM)].keyOff) {
|
||||||
if (chan[(15+isCSM)].furnacePCM) {
|
if (chan[(15+isCSM)].furnacePCM) {
|
||||||
if (chan[(15+isCSM)].sample>=0 && chan[(15+isCSM)].sample<parent->song.sampleLen) {
|
if (chan[(15+isCSM)].sample>=0 && chan[(15+isCSM)].sample<parent->song.sampleLen) {
|
||||||
double off=65535.0*(double)(parent->getSample(chan[(15+isCSM)].sample)->centerRate)/8363.0;
|
double off=65535.0*(double)(parent->getSample(chan[(15+isCSM)].sample)->centerRate)/parent->getCenterRate();
|
||||||
chan[(15+isCSM)].freq=parent->calcFreq(chan[(15+isCSM)].baseFreq,chan[(15+isCSM)].pitch,chan[(15+isCSM)].fixedArp?chan[(15+isCSM)].baseNoteOverride:chan[(15+isCSM)].arpOff,chan[(15+isCSM)].fixedArp,false,4,chan[(15+isCSM)].pitch2,(double)chipClock/144,off);
|
chan[(15+isCSM)].freq=parent->calcFreq(chan[(15+isCSM)].baseFreq,chan[(15+isCSM)].pitch,chan[(15+isCSM)].fixedArp?chan[(15+isCSM)].baseNoteOverride:chan[(15+isCSM)].arpOff,chan[(15+isCSM)].fixedArp,false,4,chan[(15+isCSM)].pitch2,(double)chipClock/144,off);
|
||||||
} else {
|
} else {
|
||||||
chan[(15+isCSM)].freq=0;
|
chan[(15+isCSM)].freq=0;
|
||||||
|
|
|
@ -912,7 +912,7 @@ void DivPlatformYM2610::tick(bool sysTick) {
|
||||||
if (chan[adpcmBChanOffs].freqChanged || chan[adpcmBChanOffs].keyOn || chan[adpcmBChanOffs].keyOff) {
|
if (chan[adpcmBChanOffs].freqChanged || chan[adpcmBChanOffs].keyOn || chan[adpcmBChanOffs].keyOff) {
|
||||||
if (chan[adpcmBChanOffs].furnacePCM) {
|
if (chan[adpcmBChanOffs].furnacePCM) {
|
||||||
if (chan[adpcmBChanOffs].sample>=0 && chan[adpcmBChanOffs].sample<parent->song.sampleLen) {
|
if (chan[adpcmBChanOffs].sample>=0 && chan[adpcmBChanOffs].sample<parent->song.sampleLen) {
|
||||||
double off=65535.0*(double)(parent->getSample(chan[adpcmBChanOffs].sample)->centerRate)/8363.0;
|
double off=65535.0*(double)(parent->getSample(chan[adpcmBChanOffs].sample)->centerRate)/parent->getCenterRate();
|
||||||
chan[adpcmBChanOffs].freq=parent->calcFreq(chan[adpcmBChanOffs].baseFreq,chan[adpcmBChanOffs].pitch,chan[adpcmBChanOffs].fixedArp?chan[adpcmBChanOffs].baseNoteOverride:chan[adpcmBChanOffs].arpOff,chan[adpcmBChanOffs].fixedArp,false,4,chan[adpcmBChanOffs].pitch2,(double)chipClock/144,off);
|
chan[adpcmBChanOffs].freq=parent->calcFreq(chan[adpcmBChanOffs].baseFreq,chan[adpcmBChanOffs].pitch,chan[adpcmBChanOffs].fixedArp?chan[adpcmBChanOffs].baseNoteOverride:chan[adpcmBChanOffs].arpOff,chan[adpcmBChanOffs].fixedArp,false,4,chan[adpcmBChanOffs].pitch2,(double)chipClock/144,off);
|
||||||
} else {
|
} else {
|
||||||
chan[adpcmBChanOffs].freq=0;
|
chan[adpcmBChanOffs].freq=0;
|
||||||
|
|
|
@ -980,7 +980,7 @@ void DivPlatformYM2610B::tick(bool sysTick) {
|
||||||
if (chan[adpcmBChanOffs].freqChanged || chan[adpcmBChanOffs].keyOn || chan[adpcmBChanOffs].keyOff) {
|
if (chan[adpcmBChanOffs].freqChanged || chan[adpcmBChanOffs].keyOn || chan[adpcmBChanOffs].keyOff) {
|
||||||
if (chan[adpcmBChanOffs].furnacePCM) {
|
if (chan[adpcmBChanOffs].furnacePCM) {
|
||||||
if (chan[adpcmBChanOffs].sample>=0 && chan[adpcmBChanOffs].sample<parent->song.sampleLen) {
|
if (chan[adpcmBChanOffs].sample>=0 && chan[adpcmBChanOffs].sample<parent->song.sampleLen) {
|
||||||
double off=65535.0*(double)(parent->getSample(chan[adpcmBChanOffs].sample)->centerRate)/8363.0;
|
double off=65535.0*(double)(parent->getSample(chan[adpcmBChanOffs].sample)->centerRate)/parent->getCenterRate();
|
||||||
chan[adpcmBChanOffs].freq=parent->calcFreq(chan[adpcmBChanOffs].baseFreq,chan[adpcmBChanOffs].pitch,chan[adpcmBChanOffs].fixedArp?chan[adpcmBChanOffs].baseNoteOverride:chan[adpcmBChanOffs].arpOff,chan[adpcmBChanOffs].fixedArp,false,4,chan[adpcmBChanOffs].pitch2,(double)chipClock/144,off);
|
chan[adpcmBChanOffs].freq=parent->calcFreq(chan[adpcmBChanOffs].baseFreq,chan[adpcmBChanOffs].pitch,chan[adpcmBChanOffs].fixedArp?chan[adpcmBChanOffs].baseNoteOverride:chan[adpcmBChanOffs].arpOff,chan[adpcmBChanOffs].fixedArp,false,4,chan[adpcmBChanOffs].pitch2,(double)chipClock/144,off);
|
||||||
} else {
|
} else {
|
||||||
chan[adpcmBChanOffs].freq=0;
|
chan[adpcmBChanOffs].freq=0;
|
||||||
|
|
|
@ -101,7 +101,7 @@ class DivPlatformYM2610Base: public DivPlatformOPN {
|
||||||
}
|
}
|
||||||
double NOTE_ADPCMB(int note) {
|
double NOTE_ADPCMB(int note) {
|
||||||
if (chan[adpcmBChanOffs].sample>=0 && chan[adpcmBChanOffs].sample<parent->song.sampleLen) {
|
if (chan[adpcmBChanOffs].sample>=0 && chan[adpcmBChanOffs].sample<parent->song.sampleLen) {
|
||||||
double off=65535.0*(double)(parent->getSample(chan[adpcmBChanOffs].sample)->centerRate)/8363.0;
|
double off=65535.0*(double)(parent->getSample(chan[adpcmBChanOffs].sample)->centerRate)/parent->getCenterRate();
|
||||||
return parent->calcBaseFreq((double)chipClock/144,off,note,false);
|
return parent->calcBaseFreq((double)chipClock/144,off,note,false);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -139,7 +139,7 @@ void DivPlatformYMZ280B::tick(bool sysTick) {
|
||||||
case DIV_SAMPLE_DEPTH_16BIT: ctrl=0x60; break;
|
case DIV_SAMPLE_DEPTH_16BIT: ctrl=0x60; break;
|
||||||
default: ctrl=0;
|
default: ctrl=0;
|
||||||
}
|
}
|
||||||
double off=(s->centerRate>=1)?((double)s->centerRate/8363.0):1.0;
|
double off=(s->centerRate>=1)?((double)s->centerRate/parent->getCenterRate()):1.0;
|
||||||
chan[i].freq=(int)round(off*parent->calcFreq(chan[i].baseFreq,chan[i].pitch,chan[i].fixedArp?chan[i].baseNoteOverride:chan[i].arpOff,chan[i].fixedArp,false,2,chan[i].pitch2,chipClock,CHIP_FREQBASE)/256.0)-1;
|
chan[i].freq=(int)round(off*parent->calcFreq(chan[i].baseFreq,chan[i].pitch,chan[i].fixedArp?chan[i].baseNoteOverride:chan[i].arpOff,chan[i].fixedArp,false,2,chan[i].pitch2,chipClock,CHIP_FREQBASE)/256.0)-1;
|
||||||
if (chan[i].freq<0) chan[i].freq=0;
|
if (chan[i].freq<0) chan[i].freq=0;
|
||||||
if (chan[i].freq>511) chan[i].freq=511;
|
if (chan[i].freq>511) chan[i].freq=511;
|
||||||
|
|
|
@ -154,7 +154,7 @@ void DivPlatformZXBeeperQuadTone::tick(bool sysTick) {
|
||||||
double off=CHIP_DIVIDER;
|
double off=CHIP_DIVIDER;
|
||||||
if (curSample>=0 && curSample<parent->song.sampleLen) {
|
if (curSample>=0 && curSample<parent->song.sampleLen) {
|
||||||
DivSample* s=parent->getSample(curSample);
|
DivSample* s=parent->getSample(curSample);
|
||||||
off=(s->centerRate>=1)?(CHIP_DIVIDER*(double)s->centerRate/8363.0):CHIP_DIVIDER;
|
off=(s->centerRate>=1)?(CHIP_DIVIDER*(double)s->centerRate/parent->getCenterRate()):CHIP_DIVIDER;
|
||||||
}
|
}
|
||||||
chan[4].freq=parent->calcFreq(chan[4].baseFreq,chan[4].pitch,chan[4].fixedArp?chan[4].baseNoteOverride:chan[4].arpOff,chan[4].fixedArp,true,2,chan[4].pitch2,chipClock,off);
|
chan[4].freq=parent->calcFreq(chan[4].baseFreq,chan[4].pitch,chan[4].fixedArp?chan[4].baseNoteOverride:chan[4].arpOff,chan[4].fixedArp,true,2,chan[4].pitch2,chipClock,off);
|
||||||
if (chan[4].freq>258) chan[4].freq=258;
|
if (chan[4].freq>258) chan[4].freq=258;
|
||||||
|
|
|
@ -352,6 +352,8 @@ struct DivSong {
|
||||||
bool ceilVolumeScaling;
|
bool ceilVolumeScaling;
|
||||||
bool oldAlwaysSetVolume;
|
bool oldAlwaysSetVolume;
|
||||||
bool oldSampleOffset;
|
bool oldSampleOffset;
|
||||||
|
// TODO: this flag is not saved to the file yet.
|
||||||
|
bool oldCenterRate;
|
||||||
|
|
||||||
std::vector<DivInstrument*> ins;
|
std::vector<DivInstrument*> ins;
|
||||||
std::vector<DivWavetable*> wave;
|
std::vector<DivWavetable*> wave;
|
||||||
|
@ -481,7 +483,8 @@ struct DivSong {
|
||||||
resetArpPhaseOnNewNote(false),
|
resetArpPhaseOnNewNote(false),
|
||||||
ceilVolumeScaling(false),
|
ceilVolumeScaling(false),
|
||||||
oldAlwaysSetVolume(false),
|
oldAlwaysSetVolume(false),
|
||||||
oldSampleOffset(false) {
|
oldSampleOffset(false),
|
||||||
|
oldCenterRate(true) {
|
||||||
for (int i=0; i<DIV_MAX_CHIPS; i++) {
|
for (int i=0; i<DIV_MAX_CHIPS; i++) {
|
||||||
system[i]=DIV_SYSTEM_NULL;
|
system[i]=DIV_SYSTEM_NULL;
|
||||||
systemVol[i]=1.0;
|
systemVol[i]=1.0;
|
||||||
|
|
|
@ -598,7 +598,7 @@ void FurnaceGUI::drawSampleEdit() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int sampleNote=round(64.0+(128.0*12.0*log((double)targetRate/8363.0)/log(2.0)));
|
int sampleNote=round(64.0+(128.0*12.0*log((double)targetRate/e->getCenterRate())/log(2.0)));
|
||||||
int sampleNoteCoarse=60+(sampleNote>>7);
|
int sampleNoteCoarse=60+(sampleNote>>7);
|
||||||
int sampleNoteFine=(sampleNote&127)-64;
|
int sampleNoteFine=(sampleNote&127)-64;
|
||||||
|
|
||||||
|
@ -662,7 +662,7 @@ void FurnaceGUI::drawSampleEdit() {
|
||||||
if (coarseChanged) { MARK_MODIFIED
|
if (coarseChanged) { MARK_MODIFIED
|
||||||
sampleNote=((sampleNoteCoarse-60)<<7)+sampleNoteFine;
|
sampleNote=((sampleNoteCoarse-60)<<7)+sampleNoteFine;
|
||||||
|
|
||||||
targetRate=8363.0*pow(2.0,(double)sampleNote/(128.0*12.0));
|
targetRate=e->getCenterRate()*pow(2.0,(double)sampleNote/(128.0*12.0));
|
||||||
if (targetRate<100) targetRate=100;
|
if (targetRate<100) targetRate=100;
|
||||||
if (targetRate>384000) targetRate=384000;
|
if (targetRate>384000) targetRate=384000;
|
||||||
|
|
||||||
|
@ -685,7 +685,7 @@ void FurnaceGUI::drawSampleEdit() {
|
||||||
|
|
||||||
sampleNote=((sampleNoteCoarse-60)<<7)+sampleNoteFine;
|
sampleNote=((sampleNoteCoarse-60)<<7)+sampleNoteFine;
|
||||||
|
|
||||||
targetRate=round(8363.0*pow(2.0,(double)sampleNote/(128.0*12.0)));
|
targetRate=round(e->getCenterRate()*pow(2.0,(double)sampleNote/(128.0*12.0)));
|
||||||
|
|
||||||
if (targetRate==prevSampleRate) {
|
if (targetRate==prevSampleRate) {
|
||||||
if (prevFine==sampleNoteFine) {
|
if (prevFine==sampleNoteFine) {
|
||||||
|
|
Loading…
Reference in a new issue