Merge branch 'master' of https://github.com/tildearrow/furnace into es5506_alt

This commit is contained in:
cam900 2023-02-06 08:56:14 +09:00
commit 03e0c8d8ee
30 changed files with 673 additions and 142 deletions

View file

@ -154,6 +154,8 @@ class DivPlatformOPN: public DivPlatformFMBase {
unsigned int ayDiv;
unsigned char csmChan;
unsigned char lfoValue;
unsigned short ssgVol;
unsigned short fmVol;
bool extSys, useCombo, fbAllOps;
DivConfig ayFlags;
@ -172,6 +174,8 @@ class DivPlatformOPN: public DivPlatformFMBase {
ayDiv(a),
csmChan(cc),
lfoValue(0),
ssgVol(128),
fmVol(256),
extSys(isExtSys),
useCombo(false),
fbAllOps(false) {}

View file

@ -30,17 +30,26 @@
void DivYM2612Interface::ymfm_set_timer(uint32_t tnum, int32_t duration_in_clocks) {
if (tnum==1) {
countB=duration_in_clocks;
setB=duration_in_clocks;
} else if (tnum==0) {
countA=duration_in_clocks;
setA=duration_in_clocks;
}
//logV("ymfm_set_timer(%d,%d)",tnum,duration_in_clocks);
}
void DivYM2612Interface::clock() {
if (countA>=0) {
if (setA>=0) {
countA-=144;
if (countA<0) m_engine->engine_timer_expired(0);
if (countA<0) {
m_engine->engine_timer_expired(0);
countA+=setA;
}
}
if (setB>=0) {
countB-=144;
if (countB<0) {
m_engine->engine_timer_expired(1);
countB+=setB;
}
}
}

View file

@ -25,6 +25,7 @@
class DivYM2612Interface: public ymfm::ymfm_interface {
int setA, setB;
int countA, countB;
public:
@ -32,8 +33,8 @@ class DivYM2612Interface: public ymfm::ymfm_interface {
void ymfm_set_timer(uint32_t tnum, int32_t duration_in_clocks);
DivYM2612Interface():
ymfm::ymfm_interface(),
countA(-1),
countB(-1) {}
countA(0),
countB(0) {}
};
class DivPlatformGenesis: public DivPlatformOPN {

View file

@ -589,6 +589,7 @@ void DivPlatformGenesisExt::tick(bool sysTick) {
if (opChan[i].freq>0x3fff) opChan[i].freq=0x3fff;
immWrite(opChanOffsH[i],opChan[i].freq>>8);
immWrite(opChanOffsL[i],opChan[i].freq&0xff);
opChan[i].freqChanged=false;
}
writeMask|=(unsigned char)(opChan[i].mask && opChan[i].active)<<(4+i);
if (opChan[i].keyOn) {

View file

@ -431,6 +431,12 @@ bool fm_operator<RegisterType>::prepare()
// clock the key state
clock_keystate(uint32_t(m_keyon_live != 0));
if (m_keyon_live & (1<<KEYON_CSM)) {
if (!(m_keyon_live & (1<<KEYON_NORMAL))) {
clock_keystate(0);
} else {
}
}
m_keyon_live &= ~(1 << KEYON_CSM);
// we're active until we're quiet after the release

View file

@ -135,22 +135,27 @@ void DivPlatformTIA::tick(bool sysTick) {
int bf=chan[i].baseFreq;
if (!parent->song.oldArpStrategy) {
if (!chan[i].fixedArp) {
bf+=chan[i].arpOff;
bf+=chan[i].arpOff<<8;
}
}
chan[i].freq=dealWithFreq(chan[i].shape,bf,chan[i].pitch+chan[i].pitch2);
if ((chan[i].shape==4 || chan[i].shape==5) && !(chan[i].baseFreq&0x80000000 && ((chan[i].baseFreq&0x7fffffff)<32))) {
if (bf<39*256) {
rWrite(0x15+i,6);
chan[i].freq=dealWithFreq(6,bf,chan[i].pitch+chan[i].pitch2);
} else if (bf<59*256) {
rWrite(0x15+i,12);
chan[i].freq=dealWithFreq(12,bf,chan[i].pitch+chan[i].pitch2);
} else {
rWrite(0x15+i,chan[i].shape);
if (chan[i].fixedArp) {
chan[i].freq=chan[i].baseNoteOverride&31;
} else {
chan[i].freq=dealWithFreq(chan[i].shape,bf,chan[i].pitch+chan[i].pitch2);
if ((chan[i].shape==4 || chan[i].shape==5) && !(chan[i].baseFreq&0x80000000 && ((chan[i].baseFreq&0x7fffffff)<32))) {
if (bf<39*256) {
rWrite(0x15+i,6);
chan[i].freq=dealWithFreq(6,bf,chan[i].pitch+chan[i].pitch2);
} else if (bf<59*256) {
rWrite(0x15+i,12);
chan[i].freq=dealWithFreq(12,bf,chan[i].pitch+chan[i].pitch2);
} else {
rWrite(0x15+i,chan[i].shape);
}
}
if (chan[i].freq>31) chan[i].freq=31;
}
if (chan[i].freq>31) chan[i].freq=31;
if (chan[i].keyOff) {
rWrite(0x19+i,0);
}

View file

@ -210,11 +210,12 @@ void DivPlatformYM2203::acquire_combo(short** buf, size_t len) {
);
os&=~3;
os=(os*fmVol)>>8;
// ymfm part
fm->generate(&fmout);
os+=((fmout.data[1]+fmout.data[2]+fmout.data[3])>>1);
os+=((fmout.data[1]+fmout.data[2]+fmout.data[3])*ssgVol)>>8;
if (os<-32768) os=-32768;
if (os>32767) os=32767;
@ -255,7 +256,7 @@ void DivPlatformYM2203::acquire_ymfm(short** buf, size_t len) {
fm->generate(&fmout);
os=fmout.data[0]+((fmout.data[1]+fmout.data[2]+fmout.data[3])>>1);
os=((fmout.data[0]*fmVol)>>8)+(((fmout.data[1]+fmout.data[2]+fmout.data[3])*ssgVol)>>8);
if (os<-32768) os=-32768;
if (os>32767) os=32767;
@ -1074,6 +1075,8 @@ void DivPlatformYM2203::setFlags(const DivConfig& flags) {
CHECK_CUSTOM_CLOCK;
noExtMacros=flags.getBool("noExtMacros",false);
fbAllOps=flags.getBool("fbAllOps",false);
ssgVol=flags.getInt("ssgVol",128);
fmVol=flags.getInt("fmVol",256);
rate=fm->sample_rate(chipClock);
for (int i=0; i<6; i++) {
oscBuf[i]->rate=rate;

View file

@ -374,15 +374,17 @@ void DivPlatformYM2608::acquire_combo(short** buf, size_t len) {
os[0]>>=1;
os[1]>>=1;
os[0]=(os[0]*fmVol)>>8;
os[1]=(os[1]*fmVol)>>8;
// ymfm part
fm->generate(&fmout);
os[0]+=fmout.data[0]+(fmout.data[2]>>1);
os[0]+=((fmout.data[0]*fmVol)>>8)+((fmout.data[2]*ssgVol)>>8);
if (os[0]<-32768) os[0]=-32768;
if (os[0]>32767) os[0]=32767;
os[1]+=fmout.data[1]+(fmout.data[2]>>1);
os[1]+=((fmout.data[1]*fmVol)>>8)+((fmout.data[2]*ssgVol)>>8);
if (os[1]<-32768) os[1]=-32768;
if (os[1]>32767) os[1]=32767;
@ -439,11 +441,11 @@ void DivPlatformYM2608::acquire_ymfm(short** buf, size_t len) {
fm->generate(&fmout);
os[0]=fmout.data[0]+(fmout.data[2]>>1);
os[0]=((fmout.data[0]*fmVol)>>8)+((fmout.data[2]*ssgVol)>>8);
if (os[0]<-32768) os[0]=-32768;
if (os[0]>32767) os[0]=32767;
os[1]=fmout.data[1]+(fmout.data[2]>>1);
os[1]=((fmout.data[1]*fmVol)>>8)+((fmout.data[2]*ssgVol)>>8);
if (os[1]<-32768) os[1]=-32768;
if (os[1]>32767) os[1]=32767;
@ -1603,6 +1605,8 @@ void DivPlatformYM2608::setFlags(const DivConfig& flags) {
CHECK_CUSTOM_CLOCK;
noExtMacros=flags.getBool("noExtMacros",false);
fbAllOps=flags.getBool("fbAllOps",false);
ssgVol=flags.getInt("ssgVol",128);
fmVol=flags.getInt("fmVol",256);
rate=fm->sample_rate(chipClock);
for (int i=0; i<16; i++) {
oscBuf[i]->rate=rate;

View file

@ -305,15 +305,17 @@ void DivPlatformYM2610::acquire_combo(short** buf, size_t len) {
os[0]>>=1;
os[1]>>=1;
os[0]=(os[0]*fmVol)>>8;
os[1]=(os[1]*fmVol)>>8;
// ymfm part
fm->generate(&fmout);
os[0]+=fmout.data[0]+(fmout.data[2]>>1);
os[0]+=((fmout.data[0]*fmVol)>>8)+((fmout.data[2]*ssgVol)>>8);
if (os[0]<-32768) os[0]=-32768;
if (os[0]>32767) os[0]=32767;
os[1]+=fmout.data[1]+(fmout.data[2]>>1);
os[1]+=((fmout.data[1]*fmVol)>>8)+((fmout.data[2]*ssgVol)>>8);
if (os[1]<-32768) os[1]=-32768;
if (os[1]>32767) os[1]=32767;
@ -372,11 +374,11 @@ void DivPlatformYM2610::acquire_ymfm(short** buf, size_t len) {
fm->generate(&fmout);
os[0]=fmout.data[0]+(fmout.data[2]>>1);
os[0]+=((fmout.data[0]*fmVol)>>8)+((fmout.data[2]*ssgVol)>>8);
if (os[0]<-32768) os[0]=-32768;
if (os[0]>32767) os[0]=32767;
os[1]=fmout.data[1]+(fmout.data[2]>>1);
os[1]+=((fmout.data[1]*fmVol)>>8)+((fmout.data[2]*ssgVol)>>8);
if (os[1]<-32768) os[1]=-32768;
if (os[1]>32767) os[1]=32767;

View file

@ -373,15 +373,17 @@ void DivPlatformYM2610B::acquire_combo(short** buf, size_t len) {
os[0]>>=1;
os[1]>>=1;
os[0]=(os[0]*fmVol)>>8;
os[1]=(os[1]*fmVol)>>8;
// ymfm part
fm->generate(&fmout);
os[0]+=fmout.data[0]+(fmout.data[2]>>1);
os[0]+=((fmout.data[0]*fmVol)>>8)+((fmout.data[2]*ssgVol)>>8);
if (os[0]<-32768) os[0]=-32768;
if (os[0]>32767) os[0]=32767;
os[1]+=fmout.data[1]+(fmout.data[2]>>1);
os[1]+=((fmout.data[1]*fmVol)>>8)+((fmout.data[2]*ssgVol)>>8);
if (os[1]<-32768) os[1]=-32768;
if (os[1]>32767) os[1]=32767;
@ -438,11 +440,11 @@ void DivPlatformYM2610B::acquire_ymfm(short** buf, size_t len) {
fm->generate(&fmout);
os[0]=fmout.data[0]+(fmout.data[2]>>1);
os[0]+=((fmout.data[0]*fmVol)>>8)+((fmout.data[2]*ssgVol)>>8);
if (os[0]<-32768) os[0]=-32768;
if (os[0]>32767) os[0]=32767;
os[1]=fmout.data[1]+(fmout.data[2]>>1);
os[1]+=((fmout.data[1]*fmVol)>>8)+((fmout.data[2]*ssgVol)>>8);
if (os[1]<-32768) os[1]=-32768;
if (os[1]>32767) os[1]=32767;

View file

@ -222,6 +222,8 @@ class DivPlatformYM2610Base: public DivPlatformOPN {
CHECK_CUSTOM_CLOCK;
noExtMacros=flags.getBool("noExtMacros",false);
fbAllOps=flags.getBool("fbAllOps",false);
ssgVol=flags.getInt("ssgVol",128);
fmVol=flags.getInt("fmVol",256);
rate=fm->sample_rate(chipClock);
for (int i=0; i<16; i++) {
oscBuf[i]->rate=rate;