move lastCenterRate=-1 from constructor to reset(), set lastCenterRate even if OOB

This commit is contained in:
MooingLemur 2023-12-06 00:50:57 -07:00 committed by tildearrow
parent 69363b4db9
commit 2938a9b8af

View file

@ -144,6 +144,7 @@ void DivPlatformVERA::reset() {
}
chan[16].vol=15;
chan[16].pan=3;
lastCenterRate=-1;
}
int DivPlatformVERA::calcNoteFreq(int ch, int note) {
@ -226,9 +227,9 @@ void DivPlatformVERA::tick(bool sysTick) {
double off=65536.0;
if (chan[16].pcm.sample>=0 && chan[16].pcm.sample<parent->song.sampleLen) {
DivSample* s=parent->getSample(chan[16].pcm.sample);
lastCenterRate=s->centerRate;
if (s->centerRate>=1) {
off=65536.0*(s->centerRate/8363.0);
lastCenterRate=s->centerRate;
}
} else if (lastCenterRate>=1) {
off=65536.0*(lastCenterRate/8363.0);
@ -530,7 +531,6 @@ int DivPlatformVERA::init(DivEngine* p, int channels, int sugRate, const DivConf
pcm=new struct VERA_PCM;
dumpWrites=false;
skipRegisterWrites=false;
lastCenterRate=-1;
setFlags(flags);
reset();
return 17;