OPN[A/B/2]?: implement 18xx effect

This commit is contained in:
tildearrow 2022-06-28 01:16:46 -05:00
parent e2449d91f1
commit f483292a88
11 changed files with 92 additions and 5 deletions

View file

@ -34,6 +34,10 @@ int DivPlatformYM2610Ext::dispatch(DivCommand c) {
}
int ch=c.chan-1;
int ordch=orderedOps[ch];
if (!extMode) {
c.chan=2;
return DivPlatformYM2610::dispatch(c);
}
switch (c.cmd) {
case DIV_CMD_NOTE_ON: {
DivInstrument* ins=parent->getIns(opChan[ch].ins,DIV_INS_FM);
@ -151,6 +155,11 @@ int DivPlatformYM2610Ext::dispatch(DivCommand c) {
opChan[ch].freqChanged=true;
break;
}
case DIV_CMD_FM_EXTCH: {
extMode=c.value;
immWrite(0x27,extMode?0x40:0);
break;
}
case DIV_CMD_FM_LFO: {
rWrite(0x22,(c.value&7)|((c.value>>4)<<3));
break;
@ -427,7 +436,7 @@ void DivPlatformYM2610Ext::forceIns() {
for (int j=0; j<4; j++) {
unsigned short baseAddr=chanOffs[i]|opOffs[j];
DivInstrumentFM::Operator& op=chan[i].state.op[j];
if (i==1) { // extended channel
if (i==1 && extMode) { // extended channel
if (isOpMuted[j]) {
rWrite(baseAddr+0x40,127);
} else if (isOutput[chan[i].state.alg][j]) {
@ -528,6 +537,7 @@ int DivPlatformYM2610Ext::init(DivEngine* parent, int channels, int sugRate, uns
for (int i=0; i<4; i++) {
isOpMuted[i]=false;
}
extSys=true;
reset();
return 17;