diff --git a/src/engine/engine.cpp b/src/engine/engine.cpp index d48c57f37..14955140e 100644 --- a/src/engine/engine.cpp +++ b/src/engine/engine.cpp @@ -4748,7 +4748,7 @@ int DivEngine::calcBaseFreq(double clock, double divider, int note, bool period) base*(divider/clock); } -int DivEngine::calcFreq(int base, int pitch, bool period) { +int DivEngine::calcFreq(int base, int pitch, bool period, int octave) { if (song.linearPitch) { return period? int(base*pow(2,-(double)pitch/(12.0*128.0))/(98.0+globalPitch*6.0)*98.0): @@ -4756,7 +4756,7 @@ int DivEngine::calcFreq(int base, int pitch, bool period) { } return period? base-pitch: - base+pitch; + base+((pitch*octave)>>1); } void DivEngine::play() { diff --git a/src/engine/engine.h b/src/engine/engine.h index c1421f773..86e708a78 100644 --- a/src/engine/engine.h +++ b/src/engine/engine.h @@ -266,7 +266,7 @@ class DivEngine { int calcBaseFreq(double clock, double divider, int note, bool period); // calculate frequency/period - int calcFreq(int base, int pitch, bool period=false); + int calcFreq(int base, int pitch, bool period=false, int octave=0); // find song loop position void walkSong(int& loopOrder, int& loopRow, int& loopEnd); diff --git a/src/engine/platform/c64.cpp b/src/engine/platform/c64.cpp index 54259b791..d7f98a2b2 100644 --- a/src/engine/platform/c64.cpp +++ b/src/engine/platform/c64.cpp @@ -111,7 +111,7 @@ void DivPlatformC64::tick() { rWrite(i*7+4,(isMuted[i]?0:(chan[i].wave<<4))|(chan[i].ring<<2)|(chan[i].sync<<1)|chan[i].active); } if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) { - chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch); + chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,false,8); if (chan[i].freq>0xffff) chan[i].freq=0xffff; if (chan[i].keyOn) { rWrite(i*7+5,(chan[i].attack<<4)|(chan[i].decay)); diff --git a/src/engine/platform/genesis.cpp b/src/engine/platform/genesis.cpp index f0f54cd1d..9d58e935f 100644 --- a/src/engine/platform/genesis.cpp +++ b/src/engine/platform/genesis.cpp @@ -294,7 +294,7 @@ void DivPlatformGenesis::tick() { for (int i=0; i<6; i++) { if (i==2 && extMode) continue; if (chan[i].freqChanged) { - chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch); + chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,false,octave(chan[i].baseFreq)); int freqt=toFreq(chan[i].freq); immWrite(chanOffs[i]+ADDR_FREQH,freqt>>8); immWrite(chanOffs[i]+ADDR_FREQ,freqt&0xff); diff --git a/src/engine/platform/ym2610.cpp b/src/engine/platform/ym2610.cpp index e6018bb0f..4e99b4f01 100644 --- a/src/engine/platform/ym2610.cpp +++ b/src/engine/platform/ym2610.cpp @@ -266,7 +266,7 @@ void DivPlatformYM2610::tick() { for (int i=0; i<4; i++) { if (i==1 && extMode) continue; if (chan[i].freqChanged) { - chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch); + chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,false,octave(chan[i].baseFreq)); int freqt=toFreq(chan[i].freq); immWrite(chanOffs[i]+ADDR_FREQH,freqt>>8); immWrite(chanOffs[i]+ADDR_FREQ,freqt&0xff); diff --git a/src/engine/playback.cpp b/src/engine/playback.cpp index a78077359..134252669 100644 --- a/src/engine/playback.cpp +++ b/src/engine/playback.cpp @@ -537,7 +537,7 @@ void DivEngine::processRow(int i, bool afterDelay) { chan[i].portaSpeed=-1; chan[i].inPorta=false; } else { - chan[i].portaNote=0x60; + chan[i].portaNote=song.limitSlides?0x60:255; chan[i].portaSpeed=effectVal; chan[i].portaStop=true; chan[i].nowYouCanStop=false; @@ -552,7 +552,7 @@ void DivEngine::processRow(int i, bool afterDelay) { chan[i].portaSpeed=-1; chan[i].inPorta=false; } else { - chan[i].portaNote=disCont[dispatchOfChan[i]].dispatch->getPortaFloor(dispatchChanOfChan[i]); + chan[i].portaNote=song.limitSlides?disCont[dispatchOfChan[i]].dispatch->getPortaFloor(dispatchChanOfChan[i]):-255; chan[i].portaSpeed=effectVal; chan[i].portaStop=true; chan[i].nowYouCanStop=false;