SNES: scale frequency to wavetable length

This commit is contained in:
tildearrow 2022-09-25 02:39:25 -05:00
parent 023bdf2f9a
commit eb6708ab23

View file

@ -167,6 +167,7 @@ void DivPlatformSNES::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/8363.0):1.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,false,2,chan[i].pitch2,chipClock,CHIP_FREQBASE)); chan[i].freq=(unsigned int)(off*parent->calcFreq(chan[i].baseFreq,chan[i].pitch,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;
if (chan[i].keyOn) { if (chan[i].keyOn) {