implement pitch macro

TODO: test!
This commit is contained in:
tildearrow 2022-04-15 03:37:16 -05:00
parent c743a9e96a
commit d47a59f5f0
33 changed files with 44 additions and 39 deletions

View file

@ -2,7 +2,6 @@
- panning macro - panning macro
- pitch macro - pitch macro
- phase reset macro
- piano/input pad - piano/input pad
- note input via piano - note input via piano
- input pad - input pad
@ -41,7 +40,6 @@
- add ability to select a column by double clicking - add ability to select a column by double clicking
- add ability to move selection by dragging - add ability to move selection by dragging
- NSFPlay core for NES - NSFPlay core for NES
- option for standard waveform names in OPL
- settings: OK/Cancel buttons should be always visible - settings: OK/Cancel buttons should be always visible
- Apply button in settings - Apply button in settings
- better FM chip names (number and codename) - better FM chip names (number and codename)

View file

@ -31,6 +31,8 @@ struct DivMacroStruct {
void init() { void init() {
pos=mode=0; pos=mode=0;
has=had=will=false; has=had=will=false;
// TODO: test whether this breaks anything?
val=0;
} }
void prepare(DivInstrumentMacro& source) { void prepare(DivInstrumentMacro& source) {
has=had=will=true; has=had=will=true;

View file

@ -195,6 +195,9 @@ void DivPlatformAmiga::tick() {
if (chan[i].useWave && chan[i].active) { if (chan[i].useWave && chan[i].active) {
chan[i].ws.tick(); chan[i].ws.tick();
} }
if (chan[i].std.pitch.had) {
chan[i].freqChanged=true;
}
if (chan[i].std.phaseReset.had) { if (chan[i].std.phaseReset.had) {
if (chan[i].std.phaseReset.val==1) { if (chan[i].std.phaseReset.val==1) {
chan[i].audPos=0; chan[i].audPos=0;
@ -202,8 +205,9 @@ void DivPlatformAmiga::tick() {
} }
if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) { if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) {
//DivInstrument* ins=parent->getIns(chan[i].ins); //DivInstrument* ins=parent->getIns(chan[i].ins);
chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,true); chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,true)+chan[i].std.pitch.val;
if (chan[i].freq>4095) chan[i].freq=4095; if (chan[i].freq>4095) chan[i].freq=4095;
if (chan[i].freq<0) chan[i].freq=0;
if (chan[i].keyOn) { if (chan[i].keyOn) {
} }
if (chan[i].keyOff) { if (chan[i].keyOff) {

View file

@ -406,7 +406,7 @@ void DivPlatformArcade::tick() {
for (int i=0; i<8; i++) { for (int i=0; i<8; i++) {
if (chan[i].freqChanged) { if (chan[i].freqChanged) {
chan[i].freq=chan[i].baseFreq+(chan[i].pitch>>1)-64; chan[i].freq=chan[i].baseFreq+(chan[i].pitch>>1)-64+chan[i].std.pitch.val;
if (chan[i].freq<0) chan[i].freq=0; if (chan[i].freq<0) chan[i].freq=0;
if (chan[i].freq>=(95<<6)) chan[i].freq=(95<<6)-1; if (chan[i].freq>=(95<<6)) chan[i].freq=(95<<6)-1;
immWrite(i+0x28,hScale(chan[i].freq>>6)); immWrite(i+0x28,hScale(chan[i].freq>>6));

View file

@ -236,7 +236,7 @@ void DivPlatformAY8910::tick() {
if (!chan[i].std.ex3.will) chan[i].autoEnvNum=1; if (!chan[i].std.ex3.will) chan[i].autoEnvNum=1;
} }
if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) { if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) {
chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,true); chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,true)+chan[i].std.pitch.val;
if (chan[i].freq>4095) chan[i].freq=4095; if (chan[i].freq>4095) chan[i].freq=4095;
if (chan[i].keyOn) { if (chan[i].keyOn) {
//rWrite(16+i*5+1,((chan[i].duty&3)<<6)|(63-(ins->gb.soundLen&63))); //rWrite(16+i*5+1,((chan[i].duty&3)<<6)|(63-(ins->gb.soundLen&63)));

View file

@ -258,7 +258,7 @@ void DivPlatformAY8930::tick() {
immWrite(0x1a,ayNoiseOr); immWrite(0x1a,ayNoiseOr);
} }
if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) { if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) {
chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,true); chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,true)+chan[i].std.pitch.val;
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) {
if (chan[i].insChanged) { if (chan[i].insChanged) {

View file

@ -117,7 +117,7 @@ void DivPlatformBubSysWSG::tick() {
} }
if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) { if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) {
//DivInstrument* ins=parent->getIns(chan[i].ins); //DivInstrument* ins=parent->getIns(chan[i].ins);
chan[i].freq=0x1000-parent->calcFreq(chan[i].baseFreq,chan[i].pitch,true); chan[i].freq=0x1000-parent->calcFreq(chan[i].baseFreq,chan[i].pitch,true)+chan[i].std.pitch.val;
if (chan[i].freq<0) chan[i].freq=0; if (chan[i].freq<0) chan[i].freq=0;
if (chan[i].freq>4095) chan[i].freq=4095; if (chan[i].freq>4095) chan[i].freq=4095;
k005289->load(i,chan[i].freq); k005289->load(i,chan[i].freq);

View file

@ -194,7 +194,7 @@ void DivPlatformC64::tick() {
} }
if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) { if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) {
chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,false,8); chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,false,8)+chan[i].std.pitch.val;
if (chan[i].freq>0xffff) chan[i].freq=0xffff; if (chan[i].freq>0xffff) chan[i].freq=0xffff;
if (chan[i].keyOn) { if (chan[i].keyOn) {
rWrite(i*7+5,(chan[i].attack<<4)|(chan[i].decay)); rWrite(i*7+5,(chan[i].attack<<4)|(chan[i].decay));

View file

@ -184,7 +184,7 @@ void DivPlatformFDS::tick() {
} }
} }
if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) { if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) {
chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,false); chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,false)+chan[i].std.pitch.val;
if (chan[i].freq>4095) chan[i].freq=4095; if (chan[i].freq>4095) chan[i].freq=4095;
if (chan[i].freq<0) chan[i].freq=0; if (chan[i].freq<0) chan[i].freq=0;
if (chan[i].keyOn) { if (chan[i].keyOn) {
@ -439,7 +439,7 @@ void DivPlatformFDS::setFlags(unsigned int flags) {
} }
void DivPlatformFDS::notifyInsDeletion(void* ins) { void DivPlatformFDS::notifyInsDeletion(void* ins) {
for (int i=0; i<5; i++) { for (int i=0; i<1; i++) {
chan[i].std.notifyInsDeletion((DivInstrument*)ins); chan[i].std.notifyInsDeletion((DivInstrument*)ins);
} }
} }

View file

@ -219,8 +219,9 @@ void DivPlatformGB::tick() {
if (ntPos>255) ntPos=255; if (ntPos>255) ntPos=255;
chan[i].freq=noiseTable[ntPos]; chan[i].freq=noiseTable[ntPos];
} else { } else {
chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,true); chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,true)+chan[i].std.pitch.val;
if (chan[i].freq>2047) chan[i].freq=2047; if (chan[i].freq>2047) chan[i].freq=2047;
if (chan[i].freq<0) chan[i].freq=0;
} }
if (chan[i].keyOn) { if (chan[i].keyOn) {
if (i==2) { // wave if (i==2) { // wave

View file

@ -387,7 +387,7 @@ void DivPlatformGenesis::tick() {
if (chan[i].freqChanged) { if (chan[i].freqChanged) {
chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,false,octave(chan[i].baseFreq)); chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,false,octave(chan[i].baseFreq));
if (chan[i].freq>262143) chan[i].freq=262143; if (chan[i].freq>262143) chan[i].freq=262143;
int freqt=toFreq(chan[i].freq); int freqt=toFreq(chan[i].freq)+chan[i].std.pitch.val;
immWrite(chanOffs[i]+ADDR_FREQH,freqt>>8); immWrite(chanOffs[i]+ADDR_FREQH,freqt>>8);
immWrite(chanOffs[i]+ADDR_FREQ,freqt&0xff); immWrite(chanOffs[i]+ADDR_FREQ,freqt&0xff);
if (chan[i].furnaceDac && dacMode) { if (chan[i].furnaceDac && dacMode) {

View file

@ -177,7 +177,7 @@ void DivPlatformLynx::tick() {
WRITE_OTHER(i, ((chan[i].lfsr&0xf00)>>4)); WRITE_OTHER(i, ((chan[i].lfsr&0xf00)>>4));
chan[i].lfsr=-1; chan[i].lfsr=-1;
} }
chan[i].fd=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,true); chan[i].fd=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,true)+chan[i].std.pitch.val;
if (chan[i].std.duty.had) { if (chan[i].std.duty.had) {
chan[i].duty=chan[i].std.duty.val; chan[i].duty=chan[i].std.duty.val;
WRITE_FEEDBACK(i, chan[i].duty.feedback); WRITE_FEEDBACK(i, chan[i].duty.feedback);

View file

@ -130,7 +130,7 @@ void DivPlatformMMC5::tick() {
} }
} }
if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) { if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) {
chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,true)-1; chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,true)-1+chan[i].std.pitch.val;
if (chan[i].freq>2047) chan[i].freq=2047; if (chan[i].freq>2047) chan[i].freq=2047;
if (chan[i].freq<0) chan[i].freq=0; if (chan[i].freq<0) chan[i].freq=0;
if (chan[i].keyOn) { if (chan[i].keyOn) {

View file

@ -344,7 +344,7 @@ void DivPlatformN163::tick() {
chan[i].waveUpdated=false; chan[i].waveUpdated=false;
} }
if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) { if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) {
chan[i].freq=parent->calcFreq((((chan[i].baseFreq*chan[i].waveLen)*(chanMax+1))/16),chan[i].pitch,false,0); chan[i].freq=parent->calcFreq((((chan[i].baseFreq*chan[i].waveLen)*(chanMax+1))/16),chan[i].pitch,false,0)+chan[i].std.pitch.val;
if (chan[i].freq<0) chan[i].freq=0; if (chan[i].freq<0) chan[i].freq=0;
if (chan[i].freq>0x3ffff) chan[i].freq=0x3ffff; if (chan[i].freq>0x3ffff) chan[i].freq=0x3ffff;
if (chan[i].keyOn) { if (chan[i].keyOn) {

View file

@ -214,7 +214,7 @@ void DivPlatformNES::tick() {
if (ntPos>252) ntPos=252; if (ntPos>252) ntPos=252;
chan[i].freq=(parent->song.properNoiseLayout)?(15-(chan[i].baseFreq&15)):(noiseTable[ntPos]); chan[i].freq=(parent->song.properNoiseLayout)?(15-(chan[i].baseFreq&15)):(noiseTable[ntPos]);
} else { } else {
chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,true)-1; chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,true)-1+chan[i].std.pitch.val;
if (chan[i].freq>2047) chan[i].freq=2047; if (chan[i].freq>2047) chan[i].freq=2047;
if (chan[i].freq<0) chan[i].freq=0; if (chan[i].freq<0) chan[i].freq=0;
} }

View file

@ -411,7 +411,7 @@ void DivPlatformOPL::tick() {
if (chan[i].freqChanged) { if (chan[i].freqChanged) {
chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,false,octave(chan[i].baseFreq)); chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,false,octave(chan[i].baseFreq));
if (chan[i].freq>131071) chan[i].freq=131071; if (chan[i].freq>131071) chan[i].freq=131071;
int freqt=toFreq(chan[i].freq); int freqt=toFreq(chan[i].freq)+chan[i].std.pitch.val;
chan[i].freqH=freqt>>8; chan[i].freqH=freqt>>8;
chan[i].freqL=freqt&0xff; chan[i].freqL=freqt&0xff;
immWrite(chanMap[i]+ADDR_FREQ,chan[i].freqL); immWrite(chanMap[i]+ADDR_FREQ,chan[i].freqL);

View file

@ -259,7 +259,7 @@ void DivPlatformOPLL::tick() {
if (chan[i].freqChanged) { if (chan[i].freqChanged) {
chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,false,octave(chan[i].baseFreq)); chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,false,octave(chan[i].baseFreq));
if (chan[i].freq>262143) chan[i].freq=262143; if (chan[i].freq>262143) chan[i].freq=262143;
int freqt=toFreq(chan[i].freq); int freqt=toFreq(chan[i].freq)+chan[i].std.pitch.val;
chan[i].freqL=freqt&0xff; chan[i].freqL=freqt&0xff;
if (i>=6 && properDrums) { if (i>=6 && properDrums) {
immWrite(0x10+drumSlot[i],freqt&0xff); immWrite(0x10+drumSlot[i],freqt&0xff);

View file

@ -203,7 +203,7 @@ void DivPlatformPCE::tick() {
} }
if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) { if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) {
//DivInstrument* ins=parent->getIns(chan[i].ins); //DivInstrument* ins=parent->getIns(chan[i].ins);
chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,true); chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,true)+chan[i].std.pitch.val;
if (chan[i].furnaceDac) { if (chan[i].furnaceDac) {
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) {

View file

@ -187,7 +187,7 @@ void DivPlatformPCSpeaker::tick() {
} }
} }
if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) { if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) {
chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,true)-1; chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,true)-1+chan[i].std.pitch.val;
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;
if (chan[i].keyOn) { if (chan[i].keyOn) {

View file

@ -113,7 +113,7 @@ void DivPlatformPET::tick() {
} }
} }
if (chan.freqChanged || chan.keyOn || chan.keyOff) { if (chan.freqChanged || chan.keyOn || chan.keyOff) {
chan.freq=parent->calcFreq(chan.baseFreq,chan.pitch,true); chan.freq=parent->calcFreq(chan.baseFreq,chan.pitch,true)+chan.std.pitch.val;
if (chan.freq>257) chan.freq=257; if (chan.freq>257) chan.freq=257;
if (chan.freq<2) chan.freq=2; if (chan.freq<2) chan.freq=2;
rWrite(8,chan.freq-2); rWrite(8,chan.freq-2);

View file

@ -328,7 +328,7 @@ void DivPlatformQSound::tick() {
} }
if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) { if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) {
//DivInstrument* ins=parent->getIns(chan[i].ins); //DivInstrument* ins=parent->getIns(chan[i].ins);
chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,false); chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,false)+chan[i].std.pitch.val;
if (chan[i].freq>0xffff) chan[i].freq=0xffff; if (chan[i].freq>0xffff) chan[i].freq=0xffff;
if (chan[i].keyOn) { if (chan[i].keyOn) {
rWrite(q1_reg_map[Q1V_BANK][i], qsound_bank); rWrite(q1_reg_map[Q1V_BANK][i], qsound_bank);

View file

@ -171,7 +171,7 @@ void DivPlatformSAA1099::tick() {
rWrite(0x18+(i/3),saaEnv[i/3]); rWrite(0x18+(i/3),saaEnv[i/3]);
} }
if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) { if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) {
chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,true); chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,true)+chan[i].std.pitch.val;
if (chan[i].freq>65535) chan[i].freq=65535; if (chan[i].freq>65535) chan[i].freq=65535;
if (chan[i].freq>=32768) { if (chan[i].freq>=32768) {
chan[i].freqH=7; chan[i].freqH=7;

View file

@ -113,7 +113,7 @@ void DivPlatformSegaPCM::tick() {
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/8363.0;
} }
chan[i].pcm.freq=MIN(255,(15625+(off*parent->song.tuning*pow(2.0,double(chan[i].freq+256)/(64.0*12.0)))*255)/31250); chan[i].pcm.freq=MIN(255,(15625+(off*parent->song.tuning*pow(2.0,double(chan[i].freq+256)/(64.0*12.0)))*255)/31250)+chan[i].std.pitch.val;
if (dumpWrites) { if (dumpWrites) {
addWrite(0x10007+(i<<3),chan[i].pcm.freq); addWrite(0x10007+(i<<3),chan[i].pcm.freq);
} }

View file

@ -101,7 +101,7 @@ void DivPlatformSMS::tick() {
} }
for (int i=0; i<3; i++) { for (int i=0; i<3; i++) {
if (chan[i].freqChanged) { if (chan[i].freqChanged) {
chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,true); chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,true)+chan[i].std.pitch.val;
if (chan[i].freq>1023) chan[i].freq=1023; if (chan[i].freq>1023) chan[i].freq=1023;
if (chan[i].freq<8) chan[i].freq=1; if (chan[i].freq<8) chan[i].freq=1;
//if (chan[i].actualNote>0x5d) chan[i].freq=0x01; //if (chan[i].actualNote>0x5d) chan[i].freq=0x01;
@ -117,7 +117,7 @@ void DivPlatformSMS::tick() {
} }
if (chan[3].freqChanged || updateSNMode) { if (chan[3].freqChanged || updateSNMode) {
// seems arbitrary huh? // seems arbitrary huh?
chan[3].freq=parent->calcFreq(chan[3].baseFreq,chan[3].pitch-1-(isRealSN?127:0),true); chan[3].freq=parent->calcFreq(chan[3].baseFreq,chan[3].pitch-1-(isRealSN?127:0),true)+chan[3].std.pitch.val;
if (chan[3].freq>1023) chan[3].freq=1023; if (chan[3].freq>1023) chan[3].freq=1023;
if (chan[3].actualNote>0x5d) chan[3].freq=0x01; if (chan[3].actualNote>0x5d) chan[3].freq=0x01;
if (snNoiseMode&2) { // take period from channel 3 if (snNoiseMode&2) { // take period from channel 3

View file

@ -180,7 +180,7 @@ void DivPlatformSwan::tick() {
} }
} }
if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) { if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) {
chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,true); chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,true)+chan[i].std.pitch.val;
if (i==1 && pcm && furnaceDac) { if (i==1 && pcm && furnaceDac) {
double off=1.0; double off=1.0;
if (dacSample>=0 && dacSample<parent->song.sampleLen) { if (dacSample>=0 && dacSample<parent->song.sampleLen) {

View file

@ -124,14 +124,14 @@ void DivPlatformTIA::tick() {
} }
chan[i].insChanged=false; chan[i].insChanged=false;
} }
chan[i].freq=dealWithFreq(chan[i].shape,chan[i].baseFreq,chan[i].pitch); chan[i].freq=dealWithFreq(chan[i].shape,chan[i].baseFreq,chan[i].pitch)+chan[i].std.pitch.val;
if ((chan[i].shape==4 || chan[i].shape==5) && !(chan[i].baseFreq&0x80000000 && ((chan[i].baseFreq&0x7fffffff)<32))) { if ((chan[i].shape==4 || chan[i].shape==5) && !(chan[i].baseFreq&0x80000000 && ((chan[i].baseFreq&0x7fffffff)<32))) {
if (chan[i].baseFreq<39*256) { if (chan[i].baseFreq<39*256) {
rWrite(0x15+i,6); rWrite(0x15+i,6);
chan[i].freq=dealWithFreq(6,chan[i].baseFreq,chan[i].pitch); chan[i].freq=dealWithFreq(6,chan[i].baseFreq,chan[i].pitch)+chan[i].std.pitch.val;
} else if (chan[i].baseFreq<59*256) { } else if (chan[i].baseFreq<59*256) {
rWrite(0x15+i,12); rWrite(0x15+i,12);
chan[i].freq=dealWithFreq(12,chan[i].baseFreq,chan[i].pitch); chan[i].freq=dealWithFreq(12,chan[i].baseFreq,chan[i].pitch)+chan[i].std.pitch.val;
} else { } else {
rWrite(0x15+i,chan[i].shape); rWrite(0x15+i,chan[i].shape);
} }

View file

@ -387,7 +387,7 @@ void DivPlatformTX81Z::tick() {
for (int i=0; i<8; i++) { for (int i=0; i<8; i++) {
if (chan[i].freqChanged) { if (chan[i].freqChanged) {
chan[i].freq=chan[i].baseFreq+(chan[i].pitch>>1)-64; chan[i].freq=chan[i].baseFreq+(chan[i].pitch>>1)-64+chan[i].std.pitch.val;
if (chan[i].freq<0) chan[i].freq=0; if (chan[i].freq<0) chan[i].freq=0;
if (chan[i].freq>=(95<<6)) chan[i].freq=(95<<6)-1; if (chan[i].freq>=(95<<6)) chan[i].freq=(95<<6)-1;
immWrite(i+0x28,hScale(chan[i].freq>>6)); immWrite(i+0x28,hScale(chan[i].freq>>6));

View file

@ -184,7 +184,7 @@ void DivPlatformVERA::tick() {
rWriteHi(i,3,chan[i].std.wave.val); rWriteHi(i,3,chan[i].std.wave.val);
} }
if (chan[i].freqChanged) { if (chan[i].freqChanged) {
chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,false,8); chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,false,8)+chan[i].std.pitch.val;
if (chan[i].freq>65535) chan[i].freq=65535; if (chan[i].freq>65535) chan[i].freq=65535;
rWrite(i,0,chan[i].freq&0xff); rWrite(i,0,chan[i].freq&0xff);
rWrite(i,1,(chan[i].freq>>8)&0xff); rWrite(i,1,(chan[i].freq>>8)&0xff);
@ -213,7 +213,7 @@ void DivPlatformVERA::tick() {
} }
} }
if (chan[16].freqChanged) { if (chan[16].freqChanged) {
chan[16].freq=parent->calcFreq(chan[16].baseFreq,chan[16].pitch,false,8); chan[16].freq=parent->calcFreq(chan[16].baseFreq,chan[16].pitch,false,8)+chan[16].std.pitch.val;
if (chan[16].freq>128) chan[16].freq=128; if (chan[16].freq>128) chan[16].freq=128;
rWritePCMRate(chan[16].freq&0xff); rWritePCMRate(chan[16].freq&0xff);
chan[16].freqChanged=false; chan[16].freqChanged=false;

View file

@ -120,7 +120,7 @@ void DivPlatformVIC20::tick() {
} }
} }
if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) { if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) {
chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,true); chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,true)+chan[i].std.pitch.val;
if (i<3) { if (i<3) {
chan[i].freq>>=(2-i); chan[i].freq>>=(2-i);
} else { } else {

View file

@ -180,9 +180,9 @@ void DivPlatformVRC6::tick() {
} }
if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) { if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) {
if (i==2) { // sawtooth if (i==2) { // sawtooth
chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,true)-1; chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,true)-1+chan[i].std.pitch.val;
} else { // pulse } else { // pulse
chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,true)-1; chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,true)-1+chan[i].std.pitch.val;
if (chan[i].furnaceDac) { if (chan[i].furnaceDac) {
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) {

View file

@ -463,7 +463,7 @@ void DivPlatformX1_010::tick() {
chan[i].envChanged=false; chan[i].envChanged=false;
} }
if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) { if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) {
chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,false); chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,false)+chan[i].std.pitch.val;
if (chan[i].pcm) { if (chan[i].pcm) {
if (chan[i].freq<1) chan[i].freq=1; if (chan[i].freq<1) chan[i].freq=1;
if (chan[i].freq>255) chan[i].freq=255; if (chan[i].freq>255) chan[i].freq=255;

View file

@ -565,7 +565,7 @@ void DivPlatformYM2610::tick() {
if (chan[i].freqChanged) { if (chan[i].freqChanged) {
chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,false,octave(chan[i].baseFreq)); chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,false,octave(chan[i].baseFreq));
if (chan[i].freq>262143) chan[i].freq=262143; if (chan[i].freq>262143) chan[i].freq=262143;
int freqt=toFreq(chan[i].freq); int freqt=toFreq(chan[i].freq)+chan[i].std.pitch.val;
immWrite(chanOffs[i]+ADDR_FREQH,freqt>>8); immWrite(chanOffs[i]+ADDR_FREQH,freqt>>8);
immWrite(chanOffs[i]+ADDR_FREQ,freqt&0xff); immWrite(chanOffs[i]+ADDR_FREQ,freqt&0xff);
chan[i].freqChanged=false; chan[i].freqChanged=false;

View file

@ -628,7 +628,7 @@ void DivPlatformYM2610B::tick() {
if (chan[i].freqChanged) { if (chan[i].freqChanged) {
chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,false,octave(chan[i].baseFreq)); chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,false,octave(chan[i].baseFreq));
if (chan[i].freq>262143) chan[i].freq=262143; if (chan[i].freq>262143) chan[i].freq=262143;
int freqt=toFreq(chan[i].freq); int freqt=toFreq(chan[i].freq)+chan[i].std.pitch.val;
immWrite(chanOffs[i]+ADDR_FREQH,freqt>>8); immWrite(chanOffs[i]+ADDR_FREQH,freqt>>8);
immWrite(chanOffs[i]+ADDR_FREQ,freqt&0xff); immWrite(chanOffs[i]+ADDR_FREQ,freqt&0xff);
chan[i].freqChanged=false; chan[i].freqChanged=false;