OPLL: more fixes

issue #289
This commit is contained in:
tildearrow 2023-08-09 23:32:29 -05:00
parent e46fa7d88e
commit 805c3ba7ac
2 changed files with 34 additions and 4 deletions

View file

@ -267,6 +267,20 @@ void DivPlatformOPLL::tick(bool sysTick) {
if (i>=6 && properDrums && (i<9 || !noTopHatFreq)) { if (i>=6 && properDrums && (i<9 || !noTopHatFreq)) {
immWrite(0x10+drumSlot[i],freqt&0xff); immWrite(0x10+drumSlot[i],freqt&0xff);
immWrite(0x20+drumSlot[i],freqt>>8); immWrite(0x20+drumSlot[i],freqt>>8);
switch (i) {
case 7:
lastFreqSH=0;
break;
case 8:
lastFreqTT=0;
break;
case 9:
lastFreqTT=1;
break;
case 19:
lastFreqSH=1;
break;
}
} else if (i<6 || !crapDrums) { } else if (i<6 || !crapDrums) {
if (i<9) { if (i<9) {
immWrite(0x10+i,freqt&0xff); immWrite(0x10+i,freqt&0xff);
@ -892,11 +906,19 @@ void DivPlatformOPLL::forceIns() {
rWrite(0x37,DRUM_VOL(1)|(DRUM_VOL(4)<<4)); rWrite(0x37,DRUM_VOL(1)|(DRUM_VOL(4)<<4));
rWrite(0x38,DRUM_VOL(3)|(DRUM_VOL(2)<<4)); rWrite(0x38,DRUM_VOL(3)|(DRUM_VOL(2)<<4));
if (lastFreqSH==0) {
chan[7].freqChanged=true;
} else if (lastFreqSH==1) {
chan[10].freqChanged=true;
}
if (lastFreqTT==0) {
chan[8].freqChanged=true;
} else if (lastFreqTT==1) {
chan[9].freqChanged=true;
}
chan[6].freqChanged=true; chan[6].freqChanged=true;
chan[7].freqChanged=true;
chan[8].freqChanged=true;
chan[9].freqChanged=true;
chan[10].freqChanged=true;
} }
drumState=0; drumState=0;
} }
@ -986,6 +1008,9 @@ void DivPlatformOPLL::reset() {
crapDrums=false; crapDrums=false;
properDrums=properDrumsSys; properDrums=properDrumsSys;
lastFreqSH=-1;
lastFreqTT=-1;
if (properDrums) { if (properDrums) {
immWrite(0x0e,0x20); immWrite(0x0e,0x20);
} }

View file

@ -61,6 +61,11 @@ class DivPlatformOPLL: public DivDispatch {
unsigned char drumVol[5]; unsigned char drumVol[5];
bool drumActivated[5]; bool drumActivated[5];
// -1: undefined
// 0: snare/tom
// 1: hi-hat/top
signed char lastFreqSH, lastFreqTT;
unsigned char regPool[256]; unsigned char regPool[256];
bool useYMFM; bool useYMFM;