better global pitch effect

still work in progress
This commit is contained in:
tildearrow 2021-12-27 16:15:11 -05:00
parent 11478fbdfe
commit 1605f4f3c0
3 changed files with 6 additions and 3 deletions

View file

@ -121,7 +121,7 @@ void DivPlatformNES::tick() {
if (i==3) { // noise if (i==3) { // noise
chan[i].freq=noiseTable[chan[i].baseFreq]; chan[i].freq=noiseTable[chan[i].baseFreq];
} else { } else {
chan[i].freq=(chan[i].baseFreq*(ONE_SEMITONE-chan[i].pitch))/ONE_SEMITONE; chan[i].freq=(chan[i].baseFreq*pow(2,(double)-chan[i].pitch/(12.0*128.0)));
if (chan[i].freq>2047) chan[i].freq=2047; if (chan[i].freq>2047) chan[i].freq=2047;
} }
if (chan[i].keyOn) { if (chan[i].keyOn) {

View file

@ -522,10 +522,14 @@ void DivEngine::processRow(int i, bool afterDelay) {
extValuePresent=true; extValuePresent=true;
break; break;
case 0xef: // global pitch case 0xef: // global pitch
globalPitch+=(signed char)(effectVal-0x80)*120; for (int i=0; i<chans; i++) {
chan[i].pitch-=globalPitch;
}
globalPitch+=(signed char)(effectVal-0x80)*(120-globalPitch/28);
printf("setting global pitch to %d\n",globalPitch); printf("setting global pitch to %d\n",globalPitch);
for (int i=0; i<chans; i++) { for (int i=0; i<chans; i++) {
chan[i].pitch+=globalPitch; chan[i].pitch+=globalPitch;
dispatchCmd(DivCommand(DIV_CMD_PITCH,i,chan[i].pitch+(((chan[i].vibratoDepth*vibTable[chan[i].vibratoPos]*chan[i].vibratoFine)>>4)/15)));
} }
break; break;
} }

View file

@ -1985,7 +1985,6 @@ void FurnaceGUI::doUndo() {
updateScroll(cursor.y); updateScroll(cursor.y);
e->setOrder(us.order); e->setOrder(us.order);
} }
break; break;
} }