dev224 - Merge branch 'fixedblock2'
This commit is contained in:
commit
fd176dee84
28 changed files with 278 additions and 249 deletions
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
#include "esfm.h"
|
||||
#include "../engine.h"
|
||||
#include "../bsr.h"
|
||||
#include "../../ta-log.h"
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
|
@ -291,7 +292,12 @@ void DivPlatformESFM::tick(bool sysTick) {
|
|||
|
||||
for (int i=0; i<18; i++) {
|
||||
if (chan[i].freqChanged) {
|
||||
chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,chan[i].fixedArp?chan[i].baseNoteOverride:chan[i].arpOff,chan[i].fixedArp,false,octave(chan[i].baseFreq)*2,chan[i].pitch2,chipClock,CHIP_FREQBASE);
|
||||
int mul=2;
|
||||
int fixedBlock=chan[i].state.fm.block;
|
||||
if (parent->song.linearPitch!=2) {
|
||||
mul=octave(chan[i].baseFreq,fixedBlock)*2;
|
||||
}
|
||||
chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,chan[i].fixedArp?chan[i].baseNoteOverride:chan[i].arpOff,chan[i].fixedArp,false,mul,chan[i].pitch2,chipClock,CHIP_FREQBASE);
|
||||
if (chan[i].freq<0) chan[i].freq=0;
|
||||
if (chan[i].freq>131071) chan[i].freq=131071;
|
||||
|
||||
|
|
@ -314,10 +320,10 @@ void DivPlatformESFM::tick(bool sysTick) {
|
|||
if(chan[i].opsState[o].hasOpPitch) {
|
||||
pitch2=chan[i].opsState[o].pitch2+dt;
|
||||
}
|
||||
int opFreq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,arp,fixedArp,false,octave(chan[i].baseFreq)*2,pitch2,chipClock,CHIP_FREQBASE);
|
||||
int opFreq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,arp,fixedArp,false,mul,pitch2,chipClock,CHIP_FREQBASE);
|
||||
if (opFreq<0) opFreq=0;
|
||||
if (opFreq>131071) opFreq=131071;
|
||||
int freqt=toFreq(opFreq);
|
||||
int freqt=toFreq(opFreq,fixedBlock);
|
||||
chan[i].freqL[o]=freqt&0xff;
|
||||
chan[i].freqH[o]=freqt>>8;
|
||||
}
|
||||
|
|
@ -365,22 +371,27 @@ void DivPlatformESFM::tick(bool sysTick) {
|
|||
}
|
||||
}
|
||||
|
||||
int DivPlatformESFM::octave(int freq) {
|
||||
int result=1;
|
||||
while (freq>0x3ff) {
|
||||
freq>>=1;
|
||||
result<<=1;
|
||||
int DivPlatformESFM::octave(int freq, int fixedBlock) {
|
||||
if (fixedBlock>0) {
|
||||
return 1<<(fixedBlock-1);
|
||||
}
|
||||
return result;
|
||||
if (freq>0x3ff) {
|
||||
return 1<<(bsr32(freq)-10);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int DivPlatformESFM::toFreq(int freq) {
|
||||
int DivPlatformESFM::toFreq(int freq, int fixedBlock) {
|
||||
int block=0;
|
||||
while (freq>0x3ff) {
|
||||
freq>>=1;
|
||||
block++;
|
||||
if (fixedBlock>0) {
|
||||
block=fixedBlock-1;
|
||||
freq>>=block;
|
||||
if (freq>0x3ff) freq=0x3ff;
|
||||
} else if (freq>0x3ff) {
|
||||
block=bsr32(freq)-10;
|
||||
freq>>=block;
|
||||
}
|
||||
return ((block&7)<<10)|(freq&0x3ff);
|
||||
return (block<<10)|(freq&0x3ff);
|
||||
}
|
||||
|
||||
void DivPlatformESFM::muteChannel(int ch, bool mute) {
|
||||
|
|
@ -513,21 +524,27 @@ int DivPlatformESFM::dispatch(DivCommand c) {
|
|||
int destFreq=NOTE_FREQUENCY(c.value2);
|
||||
int newFreq;
|
||||
bool return2=false;
|
||||
int mul=1;
|
||||
int fixedBlock=0;
|
||||
if (parent->song.linearPitch!=2) {
|
||||
fixedBlock=chan[c.chan].state.fm.block;
|
||||
mul=octave(chan[c.chan].baseFreq,fixedBlock);
|
||||
}
|
||||
if (destFreq>chan[c.chan].baseFreq) {
|
||||
newFreq=chan[c.chan].baseFreq+c.value*((parent->song.linearPitch==2)?1:octave(chan[c.chan].baseFreq));
|
||||
newFreq=chan[c.chan].baseFreq+c.value*mul;
|
||||
if (newFreq>=destFreq) {
|
||||
newFreq=destFreq;
|
||||
return2=true;
|
||||
}
|
||||
} else {
|
||||
newFreq=chan[c.chan].baseFreq-c.value*((parent->song.linearPitch==2)?1:octave(chan[c.chan].baseFreq));
|
||||
newFreq=chan[c.chan].baseFreq-c.value*mul;
|
||||
if (newFreq<=destFreq) {
|
||||
newFreq=destFreq;
|
||||
return2=true;
|
||||
}
|
||||
}
|
||||
if (!chan[c.chan].portaPause && parent->song.linearPitch!=2) {
|
||||
if (octave(chan[c.chan].baseFreq)!=octave(newFreq)) {
|
||||
if (mul!=octave(newFreq,fixedBlock)) {
|
||||
chan[c.chan].portaPause=true;
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -126,8 +126,8 @@ class DivPlatformESFM: public DivDispatch {
|
|||
short oldWrites[ESFM_REG_POOL_SIZE];
|
||||
short pendingWrites[ESFM_REG_POOL_SIZE];
|
||||
|
||||
int octave(int freq);
|
||||
int toFreq(int freq);
|
||||
int octave(int freq, int fixedBlock);
|
||||
int toFreq(int freq, int fixedBlock);
|
||||
void commitState(int ch, DivInstrument* ins);
|
||||
|
||||
friend void putDispatchChip(void*,int);
|
||||
|
|
|
|||
|
|
@ -24,10 +24,10 @@
|
|||
#include "../../../extern/opn/ym3438.h"
|
||||
#include "sound/ymfm/ymfm_opn.h"
|
||||
|
||||
#define PLEASE_HELP_ME(_targetChan) \
|
||||
#define PLEASE_HELP_ME(_targetChan,blk) \
|
||||
int boundaryBottom=parent->calcBaseFreq(chipClock,CHIP_FREQBASE,0,false); \
|
||||
int boundaryTop=parent->calcBaseFreq(chipClock,CHIP_FREQBASE,12,false); \
|
||||
int destFreq=NOTE_FNUM_BLOCK(c.value2,11); \
|
||||
int destFreq=NOTE_FNUM_BLOCK(c.value2,11,blk); \
|
||||
int newFreq; \
|
||||
bool return2=false; \
|
||||
if (_targetChan.portaPause) { \
|
||||
|
|
|
|||
|
|
@ -657,7 +657,7 @@ void DivPlatformGenesis::tick(bool sysTick) {
|
|||
chan[i].handleArp();
|
||||
} else if (chan[i].std.arp.had) {
|
||||
if (!chan[i].inPorta) {
|
||||
chan[i].baseFreq=NOTE_FNUM_BLOCK(parent->calcArp(chan[i].note,chan[i].std.arp.val),11);
|
||||
chan[i].baseFreq=NOTE_FNUM_BLOCK(parent->calcArp(chan[i].note,chan[i].std.arp.val),11,chan[i].state.block);
|
||||
}
|
||||
chan[i].freqChanged=true;
|
||||
}
|
||||
|
|
@ -838,7 +838,7 @@ void DivPlatformGenesis::tick(bool sysTick) {
|
|||
if (i==2 && extMode) continue;
|
||||
if (chan[i].freqChanged) {
|
||||
if (parent->song.linearPitch==2) {
|
||||
chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,chan[i].fixedArp?chan[i].baseNoteOverride:chan[i].arpOff,chan[i].fixedArp,false,2,chan[i].pitch2,chipClock,CHIP_FREQBASE,11);
|
||||
chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,chan[i].fixedArp?chan[i].baseNoteOverride:chan[i].arpOff,chan[i].fixedArp,false,2,chan[i].pitch2,chipClock,CHIP_FREQBASE,11,chan[i].state.block);
|
||||
} else {
|
||||
int fNum=parent->calcFreq(chan[i].baseFreq&0x7ff,chan[i].pitch,chan[i].fixedArp?chan[i].baseNoteOverride:chan[i].arpOff,chan[i].fixedArp,false,2,chan[i].pitch2,chipClock,CHIP_FREQBASE,11);
|
||||
int block=(chan[i].baseFreq&0xf800)>>11;
|
||||
|
|
@ -1084,7 +1084,7 @@ int DivPlatformGenesis::dispatch(DivCommand c) {
|
|||
chan[c.chan].insChanged=false;
|
||||
|
||||
if (c.value!=DIV_NOTE_NULL) {
|
||||
chan[c.chan].baseFreq=NOTE_FNUM_BLOCK(c.value,11);
|
||||
chan[c.chan].baseFreq=NOTE_FNUM_BLOCK(c.value,11,chan[c.chan].state.block);
|
||||
chan[c.chan].portaPause=false;
|
||||
chan[c.chan].note=c.value;
|
||||
chan[c.chan].freqChanged=true;
|
||||
|
|
@ -1235,7 +1235,7 @@ int DivPlatformGenesis::dispatch(DivCommand c) {
|
|||
}
|
||||
break;
|
||||
}
|
||||
PLEASE_HELP_ME(chan[c.chan]);
|
||||
PLEASE_HELP_ME(chan[c.chan],chan[c.chan].state.block);
|
||||
break;
|
||||
}
|
||||
case DIV_CMD_SAMPLE_MODE: {
|
||||
|
|
@ -1274,7 +1274,7 @@ int DivPlatformGenesis::dispatch(DivCommand c) {
|
|||
commitState(c.chan,ins);
|
||||
chan[c.chan].insChanged=false;
|
||||
}
|
||||
chan[c.chan].baseFreq=NOTE_FNUM_BLOCK(c.value,11);
|
||||
chan[c.chan].baseFreq=NOTE_FNUM_BLOCK(c.value,11,chan[c.chan].state.block);
|
||||
}
|
||||
chan[c.chan].note=c.value;
|
||||
chan[c.chan].freqChanged=true;
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ int DivPlatformGenesisExt::dispatch(DivCommand c) {
|
|||
opChan[ch].insChanged=false;
|
||||
|
||||
if (c.value!=DIV_NOTE_NULL) {
|
||||
opChan[ch].baseFreq=NOTE_FNUM_BLOCK(c.value,11);
|
||||
opChan[ch].baseFreq=NOTE_FNUM_BLOCK(c.value,11,chan[extChanOffs].state.alg);
|
||||
opChan[ch].portaPause=false;
|
||||
opChan[ch].note=c.value;
|
||||
opChan[ch].freqChanged=true;
|
||||
|
|
@ -191,7 +191,7 @@ int DivPlatformGenesisExt::dispatch(DivCommand c) {
|
|||
}
|
||||
break;
|
||||
}
|
||||
PLEASE_HELP_ME(opChan[ch]);
|
||||
PLEASE_HELP_ME(opChan[ch],chan[extChanOffs].state.block);
|
||||
break;
|
||||
}
|
||||
case DIV_CMD_SAMPLE_MODE: {
|
||||
|
|
@ -216,7 +216,7 @@ int DivPlatformGenesisExt::dispatch(DivCommand c) {
|
|||
commitStateExt(ch,ins);
|
||||
opChan[ch].insChanged=false;
|
||||
}
|
||||
opChan[ch].baseFreq=NOTE_FNUM_BLOCK(c.value,11);
|
||||
opChan[ch].baseFreq=NOTE_FNUM_BLOCK(c.value,11,chan[extChanOffs].state.alg);
|
||||
opChan[ch].freqChanged=true;
|
||||
break;
|
||||
}
|
||||
|
|
@ -517,7 +517,7 @@ void DivPlatformGenesisExt::tick(bool sysTick) {
|
|||
|
||||
if (opChan[i].std.arp.had) {
|
||||
if (!opChan[i].inPorta) {
|
||||
opChan[i].baseFreq=NOTE_FNUM_BLOCK(parent->calcArp(opChan[i].note,opChan[i].std.arp.val),11);
|
||||
opChan[i].baseFreq=NOTE_FNUM_BLOCK(parent->calcArp(opChan[i].note,opChan[i].std.arp.val),11,chan[extChanOffs].state.alg);
|
||||
}
|
||||
opChan[i].freqChanged=true;
|
||||
}
|
||||
|
|
@ -638,7 +638,7 @@ void DivPlatformGenesisExt::tick(bool sysTick) {
|
|||
if (extMode) for (int i=0; i<4; i++) {
|
||||
if (opChan[i].freqChanged) {
|
||||
if (parent->song.linearPitch==2) {
|
||||
opChan[i].freq=parent->calcFreq(opChan[i].baseFreq,opChan[i].pitch,opChan[i].fixedArp?opChan[i].baseNoteOverride:opChan[i].arpOff,opChan[i].fixedArp,false,2,opChan[i].pitch2,chipClock,CHIP_FREQBASE,11);
|
||||
opChan[i].freq=parent->calcFreq(opChan[i].baseFreq,opChan[i].pitch,opChan[i].fixedArp?opChan[i].baseNoteOverride:opChan[i].arpOff,opChan[i].fixedArp,false,2,opChan[i].pitch2,chipClock,CHIP_FREQBASE,11,chan[extChanOffs].state.block);
|
||||
} else {
|
||||
int fNum=parent->calcFreq(opChan[i].baseFreq&0x7ff,opChan[i].pitch,opChan[i].fixedArp?opChan[i].baseNoteOverride:opChan[i].arpOff,opChan[i].fixedArp,false,2,opChan[i].pitch2);
|
||||
int block=(opChan[i].baseFreq&0xf800)>>11;
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
#include "opl.h"
|
||||
#include "../engine.h"
|
||||
#include "../bsr.h"
|
||||
#include "../../ta-log.h"
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
|
@ -1386,39 +1387,12 @@ void DivPlatformOPL::tick(bool sysTick) {
|
|||
double off=(s->centerRate>=1)?((double)s->centerRate/8363.0):1.0;
|
||||
chan[i].freq=(int)(off*parent->calcFreq(chan[i].baseFreq,chan[i].pitch,chan[i].fixedArp?chan[i].baseNoteOverride:chan[i].arpOff,chan[i].fixedArp,false,2,chan[i].pitch2,chipClock,(524288*768)));
|
||||
if (chan[i].freq<0x400) chan[i].freq=0x400;
|
||||
if (chan[i].freq>0x3ffffff) chan[i].freq=0x3ffffff;
|
||||
if (chan[i].freq>=0x2000000) {
|
||||
chan[i].freqH=0;
|
||||
if (chan[i].freq>0x3ffffff) {
|
||||
chan[i].freq=0x3ffffff;
|
||||
chan[i].freqH=15;
|
||||
} else if (chan[i].freq>=0x1000000) {
|
||||
chan[i].freqH=14;
|
||||
} else if (chan[i].freq>=0x800000) {
|
||||
chan[i].freqH=13;
|
||||
} else if (chan[i].freq>=0x400000) {
|
||||
chan[i].freqH=12;
|
||||
} else if (chan[i].freq>=0x200000) {
|
||||
chan[i].freqH=11;
|
||||
} else if (chan[i].freq>=0x100000) {
|
||||
chan[i].freqH=10;
|
||||
} else if (chan[i].freq>=0x80000) {
|
||||
chan[i].freqH=9;
|
||||
} else if (chan[i].freq>=0x40000) {
|
||||
chan[i].freqH=8;
|
||||
} else if (chan[i].freq>=0x20000) {
|
||||
chan[i].freqH=7;
|
||||
} else if (chan[i].freq>=0x10000) {
|
||||
chan[i].freqH=6;
|
||||
} else if (chan[i].freq>=0x8000) {
|
||||
chan[i].freqH=5;
|
||||
} else if (chan[i].freq>=0x4000) {
|
||||
chan[i].freqH=4;
|
||||
} else if (chan[i].freq>=0x2000) {
|
||||
chan[i].freqH=3;
|
||||
} else if (chan[i].freq>=0x1000) {
|
||||
chan[i].freqH=2;
|
||||
} else if (chan[i].freq>=0x800) {
|
||||
chan[i].freqH=1;
|
||||
} else {
|
||||
chan[i].freqH=0;
|
||||
chan[i].freqH=bsr32(chan[i].freq)-11;
|
||||
}
|
||||
chan[i].freqL=(chan[i].freq>>chan[i].freqH)&0x3ff;
|
||||
chan[i].freqH=8^chan[i].freqH;
|
||||
|
|
@ -1459,11 +1433,16 @@ void DivPlatformOPL::tick(bool sysTick) {
|
|||
}
|
||||
} else {
|
||||
if (chan[i].freqChanged) {
|
||||
chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,chan[i].fixedArp?chan[i].baseNoteOverride:chan[i].arpOff,chan[i].fixedArp,false,octave(chan[i].baseFreq)*2,chan[i].pitch2,chipClock,CHIP_FREQBASE);
|
||||
int mul=2;
|
||||
int fixedBlock=chan[i].state.block;
|
||||
if (parent->song.linearPitch!=2) {
|
||||
mul=octave(chan[i].baseFreq,fixedBlock)*2;
|
||||
}
|
||||
chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,chan[i].fixedArp?chan[i].baseNoteOverride:chan[i].arpOff,chan[i].fixedArp,false,mul,chan[i].pitch2,chipClock,CHIP_FREQBASE);
|
||||
if (chan[i].fixedFreq>0) chan[i].freq=chan[i].fixedFreq;
|
||||
if (chan[i].freq<0) chan[i].freq=0;
|
||||
if (chan[i].freq>131071) chan[i].freq=131071;
|
||||
int freqt=toFreq(chan[i].freq);
|
||||
int freqt=toFreq(chan[i].freq,fixedBlock);
|
||||
chan[i].freqH=freqt>>8;
|
||||
chan[i].freqL=freqt&0xff;
|
||||
immWrite(chanMap[i]+ADDR_FREQ,chan[i].freqL);
|
||||
|
|
@ -1527,45 +1506,26 @@ void DivPlatformOPL::tick(bool sysTick) {
|
|||
|
||||
#define OPLL_C_NUM 686
|
||||
|
||||
int DivPlatformOPL::octave(int freq) {
|
||||
if (freq>=OPLL_C_NUM*64) {
|
||||
return 128;
|
||||
} else if (freq>=OPLL_C_NUM*32) {
|
||||
return 64;
|
||||
} else if (freq>=OPLL_C_NUM*16) {
|
||||
return 32;
|
||||
} else if (freq>=OPLL_C_NUM*8) {
|
||||
return 16;
|
||||
} else if (freq>=OPLL_C_NUM*4) {
|
||||
return 8;
|
||||
} else if (freq>=OPLL_C_NUM*2) {
|
||||
return 4;
|
||||
} else if (freq>=OPLL_C_NUM) {
|
||||
return 2;
|
||||
} else {
|
||||
return 1;
|
||||
int DivPlatformOPL::octave(int freq, int fixedBlock) {
|
||||
if (fixedBlock>0) {
|
||||
return 1<<(fixedBlock-1);
|
||||
}
|
||||
return 1;
|
||||
freq/=OPLL_C_NUM;
|
||||
if (freq==0) return 1;
|
||||
return 1<<bsr(freq);
|
||||
}
|
||||
|
||||
int DivPlatformOPL::toFreq(int freq) {
|
||||
if (freq>=OPLL_C_NUM*64) {
|
||||
return 0x1c00|((freq>>7)&0x3ff);
|
||||
} else if (freq>=OPLL_C_NUM*32) {
|
||||
return 0x1800|((freq>>6)&0x3ff);
|
||||
} else if (freq>=OPLL_C_NUM*16) {
|
||||
return 0x1400|((freq>>5)&0x3ff);
|
||||
} else if (freq>=OPLL_C_NUM*8) {
|
||||
return 0x1000|((freq>>4)&0x3ff);
|
||||
} else if (freq>=OPLL_C_NUM*4) {
|
||||
return 0xc00|((freq>>3)&0x3ff);
|
||||
} else if (freq>=OPLL_C_NUM*2) {
|
||||
return 0x800|((freq>>2)&0x3ff);
|
||||
} else if (freq>=OPLL_C_NUM) {
|
||||
return 0x400|((freq>>1)&0x3ff);
|
||||
int DivPlatformOPL::toFreq(int freq, int fixedBlock) {
|
||||
int block=0;
|
||||
if (fixedBlock>0) {
|
||||
block=fixedBlock-1;
|
||||
} else {
|
||||
return freq&0x3ff;
|
||||
block=freq/OPLL_C_NUM;
|
||||
if (block>0) block=bsr(block);
|
||||
}
|
||||
freq>>=block;
|
||||
if (freq>0x3ff) freq=0x3ff;
|
||||
return (block<<10)|freq;
|
||||
}
|
||||
|
||||
void DivPlatformOPL::muteChannel(int ch, bool mute) {
|
||||
|
|
@ -2075,21 +2035,27 @@ int DivPlatformOPL::dispatch(DivCommand c) {
|
|||
int destFreq=(c.chan==adpcmChan)?(NOTE_ADPCMB(c.value2)):(NOTE_FREQUENCY(c.value2));
|
||||
int newFreq;
|
||||
bool return2=false;
|
||||
int mul=1;
|
||||
int fixedBlock=0;
|
||||
if (parent->song.linearPitch!=2) {
|
||||
fixedBlock=chan[c.chan].state.block;
|
||||
mul=octave(chan[c.chan].baseFreq,fixedBlock);
|
||||
}
|
||||
if (destFreq>chan[c.chan].baseFreq) {
|
||||
newFreq=chan[c.chan].baseFreq+c.value*((parent->song.linearPitch==2)?1:octave(chan[c.chan].baseFreq));
|
||||
newFreq=chan[c.chan].baseFreq+c.value*mul;
|
||||
if (newFreq>=destFreq) {
|
||||
newFreq=destFreq;
|
||||
return2=true;
|
||||
}
|
||||
} else {
|
||||
newFreq=chan[c.chan].baseFreq-c.value*((parent->song.linearPitch==2)?1:octave(chan[c.chan].baseFreq));
|
||||
newFreq=chan[c.chan].baseFreq-c.value*mul;
|
||||
if (newFreq<=destFreq) {
|
||||
newFreq=destFreq;
|
||||
return2=true;
|
||||
}
|
||||
}
|
||||
if (!chan[c.chan].portaPause && parent->song.linearPitch!=2) {
|
||||
if (octave(chan[c.chan].baseFreq)!=octave(newFreq)) {
|
||||
if (mul!=octave(newFreq,fixedBlock)) {
|
||||
chan[c.chan].portaPause=true;
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -169,8 +169,8 @@ class DivPlatformOPL: public DivDispatch {
|
|||
|
||||
DivMemoryComposition memCompo;
|
||||
|
||||
int octave(int freq);
|
||||
int toFreq(int freq);
|
||||
int octave(int freq, int fixedBlock);
|
||||
int toFreq(int freq, int fixedBlock);
|
||||
double NOTE_ADPCMB(int note);
|
||||
void commitState(int ch, DivInstrument* ins);
|
||||
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
#include "opll.h"
|
||||
#include "../engine.h"
|
||||
#include "../bsr.h"
|
||||
#include "../../ta-log.h"
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
|
@ -294,11 +295,16 @@ void DivPlatformOPLL::tick(bool sysTick) {
|
|||
|
||||
for (int i=0; i<11; i++) {
|
||||
if (chan[i].freqChanged) {
|
||||
chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,chan[i].fixedArp?chan[i].baseNoteOverride:chan[i].arpOff,chan[i].fixedArp,false,octave(chan[i].baseFreq)*2,chan[i].pitch2,chipClock,CHIP_FREQBASE);
|
||||
int mul=2;
|
||||
int fixedBlock=chan[i].state.block;
|
||||
if (parent->song.linearPitch!=2) {
|
||||
mul=octave(chan[i].baseFreq,fixedBlock)*2;
|
||||
}
|
||||
chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,chan[i].fixedArp?chan[i].baseNoteOverride:chan[i].arpOff,chan[i].fixedArp,false,mul,chan[i].pitch2,chipClock,CHIP_FREQBASE);
|
||||
if (chan[i].fixedFreq>0 && properDrums) chan[i].freq=chan[i].fixedFreq;
|
||||
if (chan[i].freq<0) chan[i].freq=0;
|
||||
if (chan[i].freq>65535) chan[i].freq=65535;
|
||||
int freqt=toFreq(chan[i].freq);
|
||||
int freqt=toFreq(chan[i].freq,fixedBlock);
|
||||
if (freqt>4095) freqt=4095;
|
||||
chan[i].freqL=freqt&0xff;
|
||||
if (i>=6 && properDrums && (i<9 || !noTopHatFreq)) {
|
||||
|
|
@ -351,45 +357,26 @@ void DivPlatformOPLL::tick(bool sysTick) {
|
|||
|
||||
#define OPLL_C_NUM 343
|
||||
|
||||
int DivPlatformOPLL::octave(int freq) {
|
||||
if (freq>=OPLL_C_NUM*64) {
|
||||
return 128;
|
||||
} else if (freq>=OPLL_C_NUM*32) {
|
||||
return 64;
|
||||
} else if (freq>=OPLL_C_NUM*16) {
|
||||
return 32;
|
||||
} else if (freq>=OPLL_C_NUM*8) {
|
||||
return 16;
|
||||
} else if (freq>=OPLL_C_NUM*4) {
|
||||
return 8;
|
||||
} else if (freq>=OPLL_C_NUM*2) {
|
||||
return 4;
|
||||
} else if (freq>=OPLL_C_NUM) {
|
||||
return 2;
|
||||
} else {
|
||||
return 1;
|
||||
int DivPlatformOPLL::octave(int freq, int fixedBlock) {
|
||||
if (fixedBlock>0) {
|
||||
return 1<<(fixedBlock-1);
|
||||
}
|
||||
return 1;
|
||||
freq/=OPLL_C_NUM;
|
||||
if (freq==0) return 1;
|
||||
return 1<<bsr(freq);
|
||||
}
|
||||
|
||||
int DivPlatformOPLL::toFreq(int freq) {
|
||||
if (freq>=OPLL_C_NUM*64) {
|
||||
return 0xe00|((freq>>7)&0x1ff);
|
||||
} else if (freq>=OPLL_C_NUM*32) {
|
||||
return 0xc00|((freq>>6)&0x1ff);
|
||||
} else if (freq>=OPLL_C_NUM*16) {
|
||||
return 0xa00|((freq>>5)&0x1ff);
|
||||
} else if (freq>=OPLL_C_NUM*8) {
|
||||
return 0x800|((freq>>4)&0x1ff);
|
||||
} else if (freq>=OPLL_C_NUM*4) {
|
||||
return 0x600|((freq>>3)&0x1ff);
|
||||
} else if (freq>=OPLL_C_NUM*2) {
|
||||
return 0x400|((freq>>2)&0x1ff);
|
||||
} else if (freq>=OPLL_C_NUM) {
|
||||
return 0x200|((freq>>1)&0x1ff);
|
||||
int DivPlatformOPLL::toFreq(int freq, int fixedBlock) {
|
||||
int block=0;
|
||||
if (fixedBlock>0) {
|
||||
block=fixedBlock-1;
|
||||
} else {
|
||||
return freq&0x1ff;
|
||||
block=freq/OPLL_C_NUM;
|
||||
if (block>0) block=bsr(block);
|
||||
}
|
||||
freq>>=block;
|
||||
if (freq>0x1ff) freq=0x1ff;
|
||||
return (block<<9)|freq;
|
||||
}
|
||||
|
||||
void DivPlatformOPLL::muteChannel(int ch, bool mute) {
|
||||
|
|
@ -650,21 +637,27 @@ int DivPlatformOPLL::dispatch(DivCommand c) {
|
|||
int destFreq=NOTE_FREQUENCY(c.value2);
|
||||
int newFreq;
|
||||
bool return2=false;
|
||||
int mul=1;
|
||||
int fixedBlock=0;
|
||||
if (parent->song.linearPitch!=2) {
|
||||
fixedBlock=chan[c.chan].state.block;
|
||||
mul=octave(chan[c.chan].baseFreq,fixedBlock);
|
||||
}
|
||||
if (destFreq>chan[c.chan].baseFreq) {
|
||||
newFreq=chan[c.chan].baseFreq+c.value*((parent->song.linearPitch==2)?1:octave(chan[c.chan].baseFreq));
|
||||
newFreq=chan[c.chan].baseFreq+c.value*mul;
|
||||
if (newFreq>=destFreq) {
|
||||
newFreq=destFreq;
|
||||
return2=true;
|
||||
}
|
||||
} else {
|
||||
newFreq=chan[c.chan].baseFreq-c.value*((parent->song.linearPitch==2)?1:octave(chan[c.chan].baseFreq));
|
||||
newFreq=chan[c.chan].baseFreq-c.value*mul;
|
||||
if (newFreq<=destFreq) {
|
||||
newFreq=destFreq;
|
||||
return2=true;
|
||||
}
|
||||
}
|
||||
/*if (!chan[c.chan].portaPause) {
|
||||
if (octave(chan[c.chan].baseFreq)!=octave(newFreq)) {
|
||||
if (mul!=octave(newFreq,fixedBlock)) {
|
||||
chan[c.chan].portaPause=true;
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,8 +80,8 @@ class DivPlatformOPLL: public DivDispatch {
|
|||
short oldWrites[256];
|
||||
short pendingWrites[256];
|
||||
|
||||
int octave(int freq);
|
||||
int toFreq(int freq);
|
||||
int octave(int freq, int fixedBlock);
|
||||
int toFreq(int freq, int fixedBlock);
|
||||
void commitState(int ch, DivInstrument* ins);
|
||||
void switchMode(bool mode);
|
||||
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
#include "saa.h"
|
||||
#include "../engine.h"
|
||||
#include "../bsr.h"
|
||||
#include "sound/saa1099.h"
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
|
@ -155,22 +156,9 @@ void DivPlatformSAA1099::tick(bool sysTick) {
|
|||
if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) {
|
||||
chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,chan[i].fixedArp?chan[i].baseNoteOverride:chan[i].arpOff,chan[i].fixedArp,true,0,chan[i].pitch2,chipClock,CHIP_DIVIDER);
|
||||
if (chan[i].freq>65535) chan[i].freq=65535;
|
||||
if (chan[i].freq>=32768) {
|
||||
chan[i].freqH=7;
|
||||
} else if (chan[i].freq>=16384) {
|
||||
chan[i].freqH=6;
|
||||
} else if (chan[i].freq>=8192) {
|
||||
chan[i].freqH=5;
|
||||
} else if (chan[i].freq>=4096) {
|
||||
chan[i].freqH=4;
|
||||
} else if (chan[i].freq>=2048) {
|
||||
chan[i].freqH=3;
|
||||
} else if (chan[i].freq>=1024) {
|
||||
chan[i].freqH=2;
|
||||
} else if (chan[i].freq>=512) {
|
||||
chan[i].freqH=1;
|
||||
} else {
|
||||
chan[i].freqH=0;
|
||||
chan[i].freqH=0;
|
||||
if (chan[i].freq>511) {
|
||||
chan[i].freqH=bsr((unsigned short)chan[i].freq)-9;
|
||||
}
|
||||
chan[i].freqL=0xff-(chan[i].freq>>chan[i].freqH);
|
||||
chan[i].freqH=7-chan[i].freqH;
|
||||
|
|
|
|||
|
|
@ -503,7 +503,7 @@ void DivPlatformYM2203::tick(bool sysTick) {
|
|||
chan[i].handleArp();
|
||||
} else if (chan[i].std.arp.had) {
|
||||
if (!chan[i].inPorta) {
|
||||
chan[i].baseFreq=NOTE_FNUM_BLOCK(parent->calcArp(chan[i].note,chan[i].std.arp.val),11);
|
||||
chan[i].baseFreq=NOTE_FNUM_BLOCK(parent->calcArp(chan[i].note,chan[i].std.arp.val),11,chan[i].state.block);
|
||||
}
|
||||
chan[i].freqChanged=true;
|
||||
}
|
||||
|
|
@ -638,7 +638,7 @@ void DivPlatformYM2203::tick(bool sysTick) {
|
|||
if (i==2 && extMode) continue;
|
||||
if (chan[i].freqChanged) {
|
||||
if (parent->song.linearPitch==2) {
|
||||
chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,chan[i].fixedArp?chan[i].baseNoteOverride:chan[i].arpOff,chan[i].fixedArp,false,4,chan[i].pitch2,chipClock,CHIP_FREQBASE,11);
|
||||
chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,chan[i].fixedArp?chan[i].baseNoteOverride:chan[i].arpOff,chan[i].fixedArp,false,4,chan[i].pitch2,chipClock,CHIP_FREQBASE,11,chan[i].state.block);
|
||||
} else {
|
||||
int fNum=parent->calcFreq(chan[i].baseFreq&0x7ff,chan[i].pitch,chan[i].fixedArp?chan[i].baseNoteOverride:chan[i].arpOff,chan[i].fixedArp,false,4,chan[i].pitch2);
|
||||
int block=(chan[i].baseFreq&0xf800)>>11;
|
||||
|
|
@ -760,7 +760,7 @@ int DivPlatformYM2203::dispatch(DivCommand c) {
|
|||
chan[c.chan].insChanged=false;
|
||||
|
||||
if (c.value!=DIV_NOTE_NULL) {
|
||||
chan[c.chan].baseFreq=NOTE_FNUM_BLOCK(c.value,11);
|
||||
chan[c.chan].baseFreq=NOTE_FNUM_BLOCK(c.value,11,chan[c.chan].state.block);
|
||||
chan[c.chan].portaPause=false;
|
||||
chan[c.chan].freqChanged=true;
|
||||
chan[c.chan].note=c.value;
|
||||
|
|
@ -844,7 +844,7 @@ int DivPlatformYM2203::dispatch(DivCommand c) {
|
|||
break;
|
||||
}
|
||||
if (c.chan>(psgChanOffs-1) || parent->song.linearPitch==2) { // PSG
|
||||
int destFreq=NOTE_FNUM_BLOCK(c.value2,11);
|
||||
int destFreq=NOTE_FNUM_BLOCK(c.value2,11,chan[c.chan].state.block);
|
||||
bool return2=false;
|
||||
if (destFreq>chan[c.chan].baseFreq) {
|
||||
chan[c.chan].baseFreq+=c.value;
|
||||
|
|
@ -866,7 +866,7 @@ int DivPlatformYM2203::dispatch(DivCommand c) {
|
|||
}
|
||||
break;
|
||||
}
|
||||
PLEASE_HELP_ME(chan[c.chan]);
|
||||
PLEASE_HELP_ME(chan[c.chan],chan[c.chan].state.block);
|
||||
break;
|
||||
}
|
||||
case DIV_CMD_LEGATO: {
|
||||
|
|
@ -878,7 +878,7 @@ int DivPlatformYM2203::dispatch(DivCommand c) {
|
|||
commitState(c.chan,ins);
|
||||
chan[c.chan].insChanged=false;
|
||||
}
|
||||
chan[c.chan].baseFreq=NOTE_FNUM_BLOCK(c.value,11);
|
||||
chan[c.chan].baseFreq=NOTE_FNUM_BLOCK(c.value,11,chan[c.chan].state.block);
|
||||
chan[c.chan].freqChanged=true;
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ int DivPlatformYM2203Ext::dispatch(DivCommand c) {
|
|||
opChan[ch].insChanged=false;
|
||||
|
||||
if (c.value!=DIV_NOTE_NULL) {
|
||||
opChan[ch].baseFreq=NOTE_FNUM_BLOCK(c.value,11);
|
||||
opChan[ch].baseFreq=NOTE_FNUM_BLOCK(c.value,11,chan[extChanOffs].state.block);
|
||||
opChan[ch].portaPause=false;
|
||||
opChan[ch].note=c.value;
|
||||
opChan[ch].freqChanged=true;
|
||||
|
|
@ -168,7 +168,7 @@ int DivPlatformYM2203Ext::dispatch(DivCommand c) {
|
|||
}
|
||||
break;
|
||||
}
|
||||
PLEASE_HELP_ME(opChan[ch]);
|
||||
PLEASE_HELP_ME(opChan[ch],chan[extChanOffs].state.block);
|
||||
break;
|
||||
}
|
||||
case DIV_CMD_LEGATO: {
|
||||
|
|
@ -177,7 +177,7 @@ int DivPlatformYM2203Ext::dispatch(DivCommand c) {
|
|||
commitStateExt(ch,ins);
|
||||
opChan[ch].insChanged=false;
|
||||
}
|
||||
opChan[ch].baseFreq=NOTE_FNUM_BLOCK(c.value,11);
|
||||
opChan[ch].baseFreq=NOTE_FNUM_BLOCK(c.value,11,chan[extChanOffs].state.block);
|
||||
opChan[ch].freqChanged=true;
|
||||
break;
|
||||
}
|
||||
|
|
@ -444,7 +444,7 @@ void DivPlatformYM2203Ext::tick(bool sysTick) {
|
|||
|
||||
if (opChan[i].std.arp.had) {
|
||||
if (!opChan[i].inPorta) {
|
||||
opChan[i].baseFreq=NOTE_FNUM_BLOCK(parent->calcArp(opChan[i].note,opChan[i].std.arp.val),11);
|
||||
opChan[i].baseFreq=NOTE_FNUM_BLOCK(parent->calcArp(opChan[i].note,opChan[i].std.arp.val),11,chan[extChanOffs].state.block);
|
||||
}
|
||||
opChan[i].freqChanged=true;
|
||||
}
|
||||
|
|
@ -543,7 +543,7 @@ void DivPlatformYM2203Ext::tick(bool sysTick) {
|
|||
if (extMode) for (int i=0; i<4; i++) {
|
||||
if (opChan[i].freqChanged) {
|
||||
if (parent->song.linearPitch==2) {
|
||||
opChan[i].freq=parent->calcFreq(opChan[i].baseFreq,opChan[i].pitch,opChan[i].fixedArp?opChan[i].baseNoteOverride:opChan[i].arpOff,opChan[i].fixedArp,false,4,opChan[i].pitch2,chipClock,CHIP_FREQBASE,11);
|
||||
opChan[i].freq=parent->calcFreq(opChan[i].baseFreq,opChan[i].pitch,opChan[i].fixedArp?opChan[i].baseNoteOverride:opChan[i].arpOff,opChan[i].fixedArp,false,4,opChan[i].pitch2,chipClock,CHIP_FREQBASE,11,chan[extChanOffs].state.block);
|
||||
} else {
|
||||
int fNum=parent->calcFreq(opChan[i].baseFreq&0x7ff,opChan[i].pitch,opChan[i].fixedArp?opChan[i].baseNoteOverride:opChan[i].arpOff,opChan[i].fixedArp,false,4,opChan[i].pitch2);
|
||||
int block=(opChan[i].baseFreq&0xf800)>>11;
|
||||
|
|
|
|||
|
|
@ -284,7 +284,7 @@ double DivPlatformYM2608::NOTE_OPNB(int ch, int note) {
|
|||
return NOTE_PERIODIC(note);
|
||||
}
|
||||
// FM
|
||||
return NOTE_FNUM_BLOCK(note,11);
|
||||
return NOTE_FNUM_BLOCK(note,11,chan[ch].state.block);
|
||||
}
|
||||
|
||||
double DivPlatformYM2608::NOTE_ADPCMB(int note) {
|
||||
|
|
@ -719,7 +719,7 @@ void DivPlatformYM2608::tick(bool sysTick) {
|
|||
chan[i].handleArp();
|
||||
} else if (chan[i].std.arp.had) {
|
||||
if (!chan[i].inPorta) {
|
||||
chan[i].baseFreq=NOTE_FNUM_BLOCK(parent->calcArp(chan[i].note,chan[i].std.arp.val),11);
|
||||
chan[i].baseFreq=NOTE_FNUM_BLOCK(parent->calcArp(chan[i].note,chan[i].std.arp.val),11,chan[i].state.block);
|
||||
}
|
||||
chan[i].freqChanged=true;
|
||||
}
|
||||
|
|
@ -871,7 +871,7 @@ void DivPlatformYM2608::tick(bool sysTick) {
|
|||
if (i==2 && extMode) continue;
|
||||
if (chan[i].freqChanged) {
|
||||
if (parent->song.linearPitch==2) {
|
||||
chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,chan[i].fixedArp?chan[i].baseNoteOverride:chan[i].arpOff,chan[i].fixedArp,false,4,chan[i].pitch2,chipClock,CHIP_FREQBASE,11);
|
||||
chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,chan[i].fixedArp?chan[i].baseNoteOverride:chan[i].arpOff,chan[i].fixedArp,false,4,chan[i].pitch2,chipClock,CHIP_FREQBASE,11,chan[i].state.block);
|
||||
} else {
|
||||
int fNum=parent->calcFreq(chan[i].baseFreq&0x7ff,chan[i].pitch,chan[i].fixedArp?chan[i].baseNoteOverride:chan[i].arpOff,chan[i].fixedArp,false,4,chan[i].pitch2);
|
||||
int block=(chan[i].baseFreq&0xf800)>>11;
|
||||
|
|
@ -1233,7 +1233,7 @@ int DivPlatformYM2608::dispatch(DivCommand c) {
|
|||
chan[c.chan].insChanged=false;
|
||||
|
||||
if (c.value!=DIV_NOTE_NULL) {
|
||||
chan[c.chan].baseFreq=NOTE_FNUM_BLOCK(c.value,11);
|
||||
chan[c.chan].baseFreq=NOTE_FNUM_BLOCK(c.value,11,chan[c.chan].state.block);
|
||||
chan[c.chan].portaPause=false;
|
||||
chan[c.chan].freqChanged=true;
|
||||
chan[c.chan].note=c.value;
|
||||
|
|
@ -1372,7 +1372,7 @@ int DivPlatformYM2608::dispatch(DivCommand c) {
|
|||
}
|
||||
break;
|
||||
}
|
||||
PLEASE_HELP_ME(chan[c.chan]);
|
||||
PLEASE_HELP_ME(chan[c.chan],chan[c.chan].state.block);
|
||||
break;
|
||||
}
|
||||
case DIV_CMD_SAMPLE_BANK:
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ int DivPlatformYM2608Ext::dispatch(DivCommand c) {
|
|||
opChan[ch].insChanged=false;
|
||||
|
||||
if (c.value!=DIV_NOTE_NULL) {
|
||||
opChan[ch].baseFreq=NOTE_FNUM_BLOCK(c.value,11);
|
||||
opChan[ch].baseFreq=NOTE_FNUM_BLOCK(c.value,11,chan[extChanOffs].state.block);
|
||||
opChan[ch].portaPause=false;
|
||||
opChan[ch].note=c.value;
|
||||
opChan[ch].freqChanged=true;
|
||||
|
|
@ -188,7 +188,7 @@ int DivPlatformYM2608Ext::dispatch(DivCommand c) {
|
|||
}
|
||||
break;
|
||||
}
|
||||
PLEASE_HELP_ME(opChan[ch]);
|
||||
PLEASE_HELP_ME(opChan[ch],chan[extChanOffs].state.block);
|
||||
break;
|
||||
}
|
||||
case DIV_CMD_LEGATO: {
|
||||
|
|
@ -197,7 +197,7 @@ int DivPlatformYM2608Ext::dispatch(DivCommand c) {
|
|||
commitStateExt(ch,ins);
|
||||
opChan[ch].insChanged=false;
|
||||
}
|
||||
opChan[ch].baseFreq=NOTE_FNUM_BLOCK(c.value,11);
|
||||
opChan[ch].baseFreq=NOTE_FNUM_BLOCK(c.value,11,chan[extChanOffs].state.block);
|
||||
opChan[ch].freqChanged=true;
|
||||
break;
|
||||
}
|
||||
|
|
@ -472,7 +472,7 @@ void DivPlatformYM2608Ext::tick(bool sysTick) {
|
|||
|
||||
if (opChan[i].std.arp.had) {
|
||||
if (!opChan[i].inPorta) {
|
||||
opChan[i].baseFreq=NOTE_FNUM_BLOCK(parent->calcArp(opChan[i].note,opChan[i].std.arp.val),11);
|
||||
opChan[i].baseFreq=NOTE_FNUM_BLOCK(parent->calcArp(opChan[i].note,opChan[i].std.arp.val),11,chan[extChanOffs].state.block);
|
||||
}
|
||||
opChan[i].freqChanged=true;
|
||||
}
|
||||
|
|
@ -594,7 +594,7 @@ void DivPlatformYM2608Ext::tick(bool sysTick) {
|
|||
if (extMode) for (int i=0; i<4; i++) {
|
||||
if (opChan[i].freqChanged) {
|
||||
if (parent->song.linearPitch==2) {
|
||||
opChan[i].freq=parent->calcFreq(opChan[i].baseFreq,opChan[i].pitch,opChan[i].fixedArp?opChan[i].baseNoteOverride:opChan[i].arpOff,opChan[i].fixedArp,false,4,opChan[i].pitch2,chipClock,CHIP_FREQBASE,11);
|
||||
opChan[i].freq=parent->calcFreq(opChan[i].baseFreq,opChan[i].pitch,opChan[i].fixedArp?opChan[i].baseNoteOverride:opChan[i].arpOff,opChan[i].fixedArp,false,4,opChan[i].pitch2,chipClock,CHIP_FREQBASE,11,chan[extChanOffs].state.block);
|
||||
} else {
|
||||
int fNum=parent->calcFreq(opChan[i].baseFreq&0x7ff,opChan[i].pitch,opChan[i].fixedArp?opChan[i].baseNoteOverride:opChan[i].arpOff,opChan[i].fixedArp,false,4,opChan[i].pitch2);
|
||||
int block=(opChan[i].baseFreq&0xf800)>>11;
|
||||
|
|
|
|||
|
|
@ -647,7 +647,7 @@ void DivPlatformYM2610::tick(bool sysTick) {
|
|||
chan[i].handleArp();
|
||||
} else if (chan[i].std.arp.had) {
|
||||
if (!chan[i].inPorta) {
|
||||
chan[i].baseFreq=NOTE_FNUM_BLOCK(parent->calcArp(chan[i].note,chan[i].std.arp.val),11);
|
||||
chan[i].baseFreq=NOTE_FNUM_BLOCK(parent->calcArp(chan[i].note,chan[i].std.arp.val),11,chan[i].state.block);
|
||||
}
|
||||
chan[i].freqChanged=true;
|
||||
}
|
||||
|
|
@ -799,7 +799,7 @@ void DivPlatformYM2610::tick(bool sysTick) {
|
|||
if (i==1 && extMode) continue;
|
||||
if (chan[i].freqChanged) {
|
||||
if (parent->song.linearPitch==2) {
|
||||
chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,chan[i].fixedArp?chan[i].baseNoteOverride:chan[i].arpOff,chan[i].fixedArp,false,4,chan[i].pitch2,chipClock,CHIP_FREQBASE,11);
|
||||
chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,chan[i].fixedArp?chan[i].baseNoteOverride:chan[i].arpOff,chan[i].fixedArp,false,4,chan[i].pitch2,chipClock,CHIP_FREQBASE,11,chan[i].state.block);
|
||||
} else {
|
||||
int fNum=parent->calcFreq(chan[i].baseFreq&0x7ff,chan[i].pitch,chan[i].fixedArp?chan[i].baseNoteOverride:chan[i].arpOff,chan[i].fixedArp,false,4,chan[i].pitch2,chipClock,CHIP_FREQBASE,11);
|
||||
int block=(chan[i].baseFreq&0xf800)>>11;
|
||||
|
|
@ -1200,7 +1200,7 @@ int DivPlatformYM2610::dispatch(DivCommand c) {
|
|||
chan[c.chan].insChanged=false;
|
||||
|
||||
if (c.value!=DIV_NOTE_NULL) {
|
||||
chan[c.chan].baseFreq=NOTE_FNUM_BLOCK(c.value,11);
|
||||
chan[c.chan].baseFreq=NOTE_FNUM_BLOCK(c.value,11,chan[c.chan].state.block);
|
||||
chan[c.chan].portaPause=false;
|
||||
chan[c.chan].freqChanged=true;
|
||||
chan[c.chan].note=c.value;
|
||||
|
|
@ -1339,7 +1339,7 @@ int DivPlatformYM2610::dispatch(DivCommand c) {
|
|||
}
|
||||
break;
|
||||
}
|
||||
PLEASE_HELP_ME(chan[c.chan]);
|
||||
PLEASE_HELP_ME(chan[c.chan],chan[c.chan].state.block);
|
||||
break;
|
||||
}
|
||||
case DIV_CMD_SAMPLE_BANK:
|
||||
|
|
|
|||
|
|
@ -715,7 +715,7 @@ void DivPlatformYM2610B::tick(bool sysTick) {
|
|||
chan[i].handleArp();
|
||||
} else if (chan[i].std.arp.had) {
|
||||
if (!chan[i].inPorta) {
|
||||
chan[i].baseFreq=NOTE_FNUM_BLOCK(parent->calcArp(chan[i].note,chan[i].std.arp.val),11);
|
||||
chan[i].baseFreq=NOTE_FNUM_BLOCK(parent->calcArp(chan[i].note,chan[i].std.arp.val),11,chan[i].state.block);
|
||||
}
|
||||
chan[i].freqChanged=true;
|
||||
}
|
||||
|
|
@ -867,7 +867,7 @@ void DivPlatformYM2610B::tick(bool sysTick) {
|
|||
if (i==2 && extMode) continue;
|
||||
if (chan[i].freqChanged) {
|
||||
if (parent->song.linearPitch==2) {
|
||||
chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,chan[i].fixedArp?chan[i].baseNoteOverride:chan[i].arpOff,chan[i].fixedArp,false,4,chan[i].pitch2,chipClock,CHIP_FREQBASE,11);
|
||||
chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,chan[i].fixedArp?chan[i].baseNoteOverride:chan[i].arpOff,chan[i].fixedArp,false,4,chan[i].pitch2,chipClock,CHIP_FREQBASE,11,chan[i].state.block);
|
||||
} else {
|
||||
int fNum=parent->calcFreq(chan[i].baseFreq&0x7ff,chan[i].pitch,chan[i].fixedArp?chan[i].baseNoteOverride:chan[i].arpOff,chan[i].fixedArp,false,4,chan[i].pitch2);
|
||||
int block=(chan[i].baseFreq&0xf800)>>11;
|
||||
|
|
@ -1268,7 +1268,7 @@ int DivPlatformYM2610B::dispatch(DivCommand c) {
|
|||
chan[c.chan].insChanged=false;
|
||||
|
||||
if (c.value!=DIV_NOTE_NULL) {
|
||||
chan[c.chan].baseFreq=NOTE_FNUM_BLOCK(c.value,11);
|
||||
chan[c.chan].baseFreq=NOTE_FNUM_BLOCK(c.value,11,chan[c.chan].state.block);
|
||||
chan[c.chan].portaPause=false;
|
||||
chan[c.chan].freqChanged=true;
|
||||
chan[c.chan].note=c.value;
|
||||
|
|
@ -1407,7 +1407,7 @@ int DivPlatformYM2610B::dispatch(DivCommand c) {
|
|||
}
|
||||
break;
|
||||
}
|
||||
PLEASE_HELP_ME(chan[c.chan]);
|
||||
PLEASE_HELP_ME(chan[c.chan],chan[c.chan].state.block);
|
||||
break;
|
||||
}
|
||||
case DIV_CMD_SAMPLE_BANK:
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ int DivPlatformYM2610BExt::dispatch(DivCommand c) {
|
|||
opChan[ch].insChanged=false;
|
||||
|
||||
if (c.value!=DIV_NOTE_NULL) {
|
||||
opChan[ch].baseFreq=NOTE_FNUM_BLOCK(c.value,11);
|
||||
opChan[ch].baseFreq=NOTE_FNUM_BLOCK(c.value,11,chan[extChanOffs].state.block);
|
||||
opChan[ch].portaPause=false;
|
||||
opChan[ch].note=c.value;
|
||||
opChan[ch].freqChanged=true;
|
||||
|
|
@ -184,7 +184,7 @@ int DivPlatformYM2610BExt::dispatch(DivCommand c) {
|
|||
}
|
||||
break;
|
||||
}
|
||||
PLEASE_HELP_ME(opChan[ch]);
|
||||
PLEASE_HELP_ME(opChan[ch],chan[extChanOffs].state.block);
|
||||
break;
|
||||
}
|
||||
case DIV_CMD_LEGATO: {
|
||||
|
|
@ -193,7 +193,7 @@ int DivPlatformYM2610BExt::dispatch(DivCommand c) {
|
|||
commitStateExt(ch,ins);
|
||||
opChan[ch].insChanged=false;
|
||||
}
|
||||
opChan[ch].baseFreq=NOTE_FNUM_BLOCK(c.value,11);
|
||||
opChan[ch].baseFreq=NOTE_FNUM_BLOCK(c.value,11,chan[extChanOffs].state.block);
|
||||
opChan[ch].freqChanged=true;
|
||||
break;
|
||||
}
|
||||
|
|
@ -465,7 +465,7 @@ void DivPlatformYM2610BExt::tick(bool sysTick) {
|
|||
|
||||
if (opChan[i].std.arp.had) {
|
||||
if (!opChan[i].inPorta) {
|
||||
opChan[i].baseFreq=NOTE_FNUM_BLOCK(parent->calcArp(opChan[i].note,opChan[i].std.arp.val),11);
|
||||
opChan[i].baseFreq=NOTE_FNUM_BLOCK(parent->calcArp(opChan[i].note,opChan[i].std.arp.val),11,chan[extChanOffs].state.block);
|
||||
}
|
||||
opChan[i].freqChanged=true;
|
||||
}
|
||||
|
|
@ -586,7 +586,7 @@ void DivPlatformYM2610BExt::tick(bool sysTick) {
|
|||
if (extMode) for (int i=0; i<4; i++) {
|
||||
if (opChan[i].freqChanged) {
|
||||
if (parent->song.linearPitch==2) {
|
||||
opChan[i].freq=parent->calcFreq(opChan[i].baseFreq,opChan[i].pitch,opChan[i].fixedArp?opChan[i].baseNoteOverride:opChan[i].arpOff,opChan[i].fixedArp,false,4,opChan[i].pitch2,chipClock,CHIP_FREQBASE,11);
|
||||
opChan[i].freq=parent->calcFreq(opChan[i].baseFreq,opChan[i].pitch,opChan[i].fixedArp?opChan[i].baseNoteOverride:opChan[i].arpOff,opChan[i].fixedArp,false,4,opChan[i].pitch2,chipClock,CHIP_FREQBASE,11,chan[extChanOffs].state.block);
|
||||
} else {
|
||||
int fNum=parent->calcFreq(opChan[i].baseFreq&0x7ff,opChan[i].pitch,opChan[i].fixedArp?opChan[i].baseNoteOverride:opChan[i].arpOff,opChan[i].fixedArp,false,4,opChan[i].pitch2);
|
||||
int block=(opChan[i].baseFreq&0xf800)>>11;
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ int DivPlatformYM2610Ext::dispatch(DivCommand c) {
|
|||
opChan[ch].insChanged=false;
|
||||
|
||||
if (c.value!=DIV_NOTE_NULL) {
|
||||
opChan[ch].baseFreq=NOTE_FNUM_BLOCK(c.value,11);
|
||||
opChan[ch].baseFreq=NOTE_FNUM_BLOCK(c.value,11,chan[extChanOffs].state.block);
|
||||
opChan[ch].portaPause=false;
|
||||
opChan[ch].note=c.value;
|
||||
opChan[ch].freqChanged=true;
|
||||
|
|
@ -184,7 +184,7 @@ int DivPlatformYM2610Ext::dispatch(DivCommand c) {
|
|||
}
|
||||
break;
|
||||
}
|
||||
PLEASE_HELP_ME(opChan[ch]);
|
||||
PLEASE_HELP_ME(opChan[ch],chan[extChanOffs].state.block);
|
||||
break;
|
||||
}
|
||||
case DIV_CMD_LEGATO: {
|
||||
|
|
@ -193,7 +193,7 @@ int DivPlatformYM2610Ext::dispatch(DivCommand c) {
|
|||
commitStateExt(ch,ins);
|
||||
opChan[ch].insChanged=false;
|
||||
}
|
||||
opChan[ch].baseFreq=NOTE_FNUM_BLOCK(c.value,11);
|
||||
opChan[ch].baseFreq=NOTE_FNUM_BLOCK(c.value,11,chan[extChanOffs].state.block);
|
||||
opChan[ch].freqChanged=true;
|
||||
break;
|
||||
}
|
||||
|
|
@ -465,7 +465,7 @@ void DivPlatformYM2610Ext::tick(bool sysTick) {
|
|||
|
||||
if (opChan[i].std.arp.had) {
|
||||
if (!opChan[i].inPorta) {
|
||||
opChan[i].baseFreq=NOTE_FNUM_BLOCK(parent->calcArp(opChan[i].note,opChan[i].std.arp.val),11);
|
||||
opChan[i].baseFreq=NOTE_FNUM_BLOCK(parent->calcArp(opChan[i].note,opChan[i].std.arp.val),11,chan[extChanOffs].state.block);
|
||||
}
|
||||
opChan[i].freqChanged=true;
|
||||
}
|
||||
|
|
@ -586,7 +586,7 @@ void DivPlatformYM2610Ext::tick(bool sysTick) {
|
|||
if (extMode) for (int i=0; i<4; i++) {
|
||||
if (opChan[i].freqChanged) {
|
||||
if (parent->song.linearPitch==2) {
|
||||
opChan[i].freq=parent->calcFreq(opChan[i].baseFreq,opChan[i].pitch,opChan[i].fixedArp?opChan[i].baseNoteOverride:opChan[i].arpOff,opChan[i].fixedArp,false,4,opChan[i].pitch2,chipClock,CHIP_FREQBASE,11);
|
||||
opChan[i].freq=parent->calcFreq(opChan[i].baseFreq,opChan[i].pitch,opChan[i].fixedArp?opChan[i].baseNoteOverride:opChan[i].arpOff,opChan[i].fixedArp,false,4,opChan[i].pitch2,chipClock,CHIP_FREQBASE,11,chan[extChanOffs].state.block);
|
||||
} else {
|
||||
int fNum=parent->calcFreq(opChan[i].baseFreq&0x7ff,opChan[i].pitch,opChan[i].fixedArp?opChan[i].baseNoteOverride:opChan[i].arpOff,opChan[i].fixedArp,false,4,opChan[i].pitch2);
|
||||
int block=(opChan[i].baseFreq&0xf800)>>11;
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ class DivPlatformYM2610Base: public DivPlatformOPN {
|
|||
return NOTE_PERIODIC(note);
|
||||
}
|
||||
// FM
|
||||
return NOTE_FNUM_BLOCK(note,11);
|
||||
return NOTE_FNUM_BLOCK(note,11,chan[ch].state.block);
|
||||
}
|
||||
double NOTE_ADPCMB(int note) {
|
||||
if (chan[adpcmBChanOffs].sample>=0 && chan[adpcmBChanOffs].sample<parent->song.sampleLen) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue