Fix hard reset handling; add detune effect; change some labels

This commit is contained in:
Kagamiin~ 2023-10-24 14:29:37 -03:00
parent 39f29f49c3
commit 23b1c4107e
3 changed files with 32 additions and 5 deletions

View file

@ -265,6 +265,7 @@ void DivPlatformESFM::tick(bool sysTick) {
}
}
int hardResetElapsed=0;
bool mustHardReset=false;
for (int i=0; i<18; i++) {
@ -285,6 +286,7 @@ void DivPlatformESFM::tick(bool sysTick) {
for (int o=0; o<4; o++) {
unsigned short baseAddr=i*32+o*8;
immWrite(baseAddr+OFFSET_SL_RR,0x0f);
hardResetElapsed++;
}
}
}
@ -313,6 +315,7 @@ void DivPlatformESFM::tick(bool sysTick) {
}
immWrite(baseAddr+OFFSET_FREQL,chan[i].freqL[o]);
immWrite(baseAddr+OFFSET_FREQH_BLOCK_DELAY,chan[i].freqH[o]|(opE.delay<<5));
hardResetElapsed+=2;
}
chan[i].freqChanged=false;
}
@ -330,6 +333,9 @@ void DivPlatformESFM::tick(bool sysTick) {
}
if (mustHardReset) {
for (unsigned int i=hardResetElapsed; i<128; i++) {
immWrite(0x25f, i&0xff);
}
for (int i=0; i<18; i++) {
if (chan[i].hardReset && chan[i].keyOn) {
// logI("chan[%d] hard reset key on, writing original slrr back", i);
@ -890,6 +896,15 @@ int DivPlatformESFM::dispatch(DivCommand c) {
}
break;
}
case DIV_CMD_FM_DT: {
unsigned int o=c.value;
if (o >= 4) break;
DivInstrumentESFM::Operator& opE=chan[c.chan].state.esfm.op[o];
if (opE.fixed) break;
opE.dt=c.value2;
chan[c.chan].freqChanged=true;
break;
}
case DIV_CMD_FM_HARD_RESET:
chan[c.chan].hardReset=c.value;
break;