Some refactoring
This commit is contained in:
parent
dde56c0cfc
commit
64baa7c97f
|
|
@ -2632,7 +2632,7 @@ void DivInstrument::readFeatureEF(SafeReader& reader, short version) {
|
|||
READ_FEAT_BEGIN;
|
||||
|
||||
unsigned char next=reader.readC();
|
||||
esfm.noise = next&3;
|
||||
esfm.noise=next&3;
|
||||
|
||||
for (int i=0; i<4; i++) {
|
||||
DivInstrumentESFM::Operator& op=esfm.op[i];
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@
|
|||
#define OFFSET_DAM_DVB_LEFT_RIGHT_MODIN 0x06
|
||||
#define OFFSET_OUTLVL_NOISE_WS 0x07
|
||||
|
||||
#define KEY_ON_REGS_START (18 * 8 * 4)
|
||||
#define KEY_ON_REGS_START (18*8*4)
|
||||
|
||||
void DivPlatformESFM::acquire(short** buf, size_t len) {
|
||||
thread_local short o[2];
|
||||
|
|
@ -66,7 +66,7 @@ void DivPlatformESFM::tick(bool sysTick) {
|
|||
if (chan[i].std.vol.had) {
|
||||
chan[i].outVol=VOL_SCALE_LOG_BROKEN(chan[i].vol,MIN(63,chan[i].std.vol.val),63);
|
||||
for (int o=0; o<4; o++) {
|
||||
unsigned short baseAddr=i*32 + o*8;
|
||||
unsigned short baseAddr=i*32+o*8;
|
||||
DivInstrumentFM::Operator& op=chan[i].state.fm.op[o];
|
||||
DivInstrumentESFM::Operator& opE=chan[i].state.esfm.op[o];
|
||||
unsigned char noise=chan[i].state.esfm.noise&3;
|
||||
|
|
@ -96,7 +96,7 @@ void DivPlatformESFM::tick(bool sysTick) {
|
|||
if (chan[i].std.panL.had) {
|
||||
chan[i].globalPan=((chan[i].std.panL.val&1)<<1)|((chan[i].std.panL.val&2)>>1);
|
||||
for (int o=0; o<4; o++) {
|
||||
unsigned short baseAddr=i*32 + o*8;
|
||||
unsigned short baseAddr=i*32+o*8;
|
||||
DivInstrumentFM::Operator& op=chan[i].state.fm.op[o];
|
||||
DivInstrumentESFM::Operator& opE=chan[i].state.esfm.op[o];
|
||||
rWrite(baseAddr+OFFSET_DAM_DVB_LEFT_RIGHT_MODIN,((opE.modIn&7)<<1)|(((opE.left&chan[i].globalPan)&1)<<4)|(((opE.right&(chan[i].globalPan>>1))&1)<<5)|((op.dvb&1)<<6)|(op.dam<<7));
|
||||
|
|
@ -121,7 +121,7 @@ void DivPlatformESFM::tick(bool sysTick) {
|
|||
|
||||
if (chan[i].std.duty.had) {
|
||||
int o=3;
|
||||
unsigned short baseAddr=i*32 + o*8;
|
||||
unsigned short baseAddr=i*32+o*8;
|
||||
DivInstrumentESFM& ins=chan[i].state.esfm;
|
||||
DivInstrumentFM::Operator& op=chan[i].state.fm.op[o];
|
||||
DivInstrumentESFM::Operator& opE=chan[i].state.esfm.op[o];
|
||||
|
|
@ -135,7 +135,7 @@ void DivPlatformESFM::tick(bool sysTick) {
|
|||
}
|
||||
|
||||
for (int o=0; o<4; o++) {
|
||||
unsigned short baseAddr=i*32 + o*8;
|
||||
unsigned short baseAddr=i*32+o*8;
|
||||
DivInstrumentFM::Operator& op=chan[i].state.fm.op[o];
|
||||
DivInstrumentESFM::Operator& opE=chan[i].state.esfm.op[o];
|
||||
DivMacroInt::IntOp& m=chan[i].std.op[o];
|
||||
|
|
@ -283,7 +283,7 @@ void DivPlatformESFM::tick(bool sysTick) {
|
|||
mustHardReset=true;
|
||||
// logI("chan[%d] hard reset, slrr := 0x0f", i);
|
||||
for (int o=0; o<4; o++) {
|
||||
unsigned short baseAddr=i*32 + o*8;
|
||||
unsigned short baseAddr=i*32+o*8;
|
||||
immWrite(baseAddr+OFFSET_SL_RR,0x0f);
|
||||
}
|
||||
}
|
||||
|
|
@ -296,7 +296,7 @@ void DivPlatformESFM::tick(bool sysTick) {
|
|||
if (chan[i].freq>131071) chan[i].freq=131071;
|
||||
|
||||
for (int o=0; o<4; o++) {
|
||||
unsigned short baseAddr=i*32 + o*8;
|
||||
unsigned short baseAddr=i*32+o*8;
|
||||
DivInstrumentESFM::Operator& opE=chan[i].state.esfm.op[o];
|
||||
int ct=(int)opE.ct;
|
||||
int dt=(int)opE.dt;
|
||||
|
|
@ -334,7 +334,7 @@ void DivPlatformESFM::tick(bool sysTick) {
|
|||
if (chan[i].hardReset && chan[i].keyOn) {
|
||||
// logI("chan[%d] hard reset key on, writing original slrr back", i);
|
||||
for (int o=0; o<4; o++) {
|
||||
unsigned short baseAddr=i*32 + o*8;
|
||||
unsigned short baseAddr=i*32+o*8;
|
||||
DivInstrumentFM::Operator& op=chan[i].state.fm.op[o];
|
||||
immWrite(baseAddr+OFFSET_SL_RR,(op.sl<<4)|(op.rr&0xf));
|
||||
}
|
||||
|
|
@ -371,13 +371,13 @@ int DivPlatformESFM::toFreq(int freq) {
|
|||
|
||||
void DivPlatformESFM::muteChannel(int ch, bool mute) {
|
||||
isMuted[ch]=mute;
|
||||
|
||||
|
||||
for (int o=0; o<4; o++) {
|
||||
unsigned short baseAddr=ch*32 + o*8;
|
||||
unsigned short baseAddr=ch*32+o*8;
|
||||
DivInstrumentFM::Operator& op=chan[ch].state.fm.op[o];
|
||||
DivInstrumentESFM::Operator& opE=chan[ch].state.esfm.op[o];
|
||||
unsigned char noise=chan[ch].state.esfm.noise&3;
|
||||
|
||||
|
||||
if (isMuted[ch]) {
|
||||
rWrite(baseAddr+OFFSET_OUTLVL_NOISE_WS,(op.ws&7)|((o==3?noise:0)<<3)|0);
|
||||
} else {
|
||||
|
|
@ -396,7 +396,7 @@ void DivPlatformESFM::commitState(int ch, DivInstrument* ins) {
|
|||
chan[ch].state.fm=ins->fm;
|
||||
chan[ch].state.esfm=ins->esfm;
|
||||
for (int o=0; o<4; o++) {
|
||||
unsigned short baseAddr=ch*32 + o*8;
|
||||
unsigned short baseAddr=ch*32+o*8;
|
||||
DivInstrumentFM::Operator& op=chan[ch].state.fm.op[o];
|
||||
DivInstrumentESFM::Operator& opE=chan[ch].state.esfm.op[o];
|
||||
unsigned char noise=chan[ch].state.esfm.noise&3;
|
||||
|
|
@ -463,7 +463,7 @@ int DivPlatformESFM::dispatch(DivCommand c) {
|
|||
chan[c.chan].outVol=c.value;
|
||||
}
|
||||
for (int o=0; o<4; o++) {
|
||||
unsigned short baseAddr=c.chan*32 + o*8;
|
||||
unsigned short baseAddr=c.chan*32+o*8;
|
||||
DivInstrumentFM::Operator& op=chan[c.chan].state.fm.op[o];
|
||||
if (KVS(c.chan, o)) {
|
||||
rWrite(baseAddr+OFFSET_KSL_TL,(63-VOL_SCALE_LOG_BROKEN(63-op.tl,chan[c.chan].outVol&0x3f,63))|(op.ksl<<6));
|
||||
|
|
@ -485,7 +485,7 @@ int DivPlatformESFM::dispatch(DivCommand c) {
|
|||
case DIV_CMD_PANNING: {
|
||||
chan[c.chan].globalPan=(c.value>0)|((c.value2>0)<<1);
|
||||
for (int o=0; o<4; o++) {
|
||||
unsigned short baseAddr=c.chan*32 + o*8;
|
||||
unsigned short baseAddr=c.chan*32+o*8;
|
||||
DivInstrumentFM::Operator& op=chan[c.chan].state.fm.op[o];
|
||||
DivInstrumentESFM::Operator& opE=chan[c.chan].state.esfm.op[o];
|
||||
rWrite(baseAddr+OFFSET_DAM_DVB_LEFT_RIGHT_MODIN,((opE.modIn&7)<<1)|(((opE.left&chan[c.chan].globalPan)&1)<<4)|(((opE.right&(chan[c.chan].globalPan>>1))&1)<<5)|((op.dvb&1)<<6)|(op.dam<<7));
|
||||
|
|
@ -540,18 +540,18 @@ int DivPlatformESFM::dispatch(DivCommand c) {
|
|||
break;
|
||||
}
|
||||
case DIV_CMD_FM_MULT: {
|
||||
unsigned int o = c.value;
|
||||
unsigned int o=c.value;
|
||||
if (o >= 4) break;
|
||||
unsigned short baseAddr=c.chan*32 + o*8;
|
||||
unsigned short baseAddr=c.chan*32+o*8;
|
||||
DivInstrumentFM::Operator& op=chan[c.chan].state.fm.op[o];
|
||||
op.mult=c.value2&15;
|
||||
rWrite(baseAddr+OFFSET_AM_VIB_SUS_KSR_MULT,((op.am&1)<<7)|((op.vib&1)<<6)|((op.sus&1)<<5)|((op.ksr&1)<<4)|(op.mult&0xf));
|
||||
break;
|
||||
}
|
||||
case DIV_CMD_FM_TL: {
|
||||
unsigned int o = c.value;
|
||||
unsigned int o=c.value;
|
||||
if (o >= 4) break;
|
||||
unsigned short baseAddr=c.chan*32 + o*8;
|
||||
unsigned short baseAddr=c.chan*32+o*8;
|
||||
DivInstrumentFM::Operator& op=chan[c.chan].state.fm.op[o];
|
||||
op.tl=c.value2&63;
|
||||
if (KVS(c.chan, o)) {
|
||||
|
|
@ -564,15 +564,15 @@ int DivPlatformESFM::dispatch(DivCommand c) {
|
|||
case DIV_CMD_FM_AR: {
|
||||
if (c.value<0) {
|
||||
for (int o=0; o<4; o++) {
|
||||
unsigned short baseAddr=c.chan*32 + o*8;
|
||||
unsigned short baseAddr=c.chan*32+o*8;
|
||||
DivInstrumentFM::Operator& op=chan[c.chan].state.fm.op[o];
|
||||
op.ar=c.value2&15;
|
||||
rWrite(baseAddr+OFFSET_AR_DR,(op.ar<<4)|(op.dr&0xf));
|
||||
}
|
||||
} else {
|
||||
unsigned int o = c.value;
|
||||
unsigned int o=c.value;
|
||||
if (o >= 4) break;
|
||||
unsigned short baseAddr=c.chan*32 + o*8;
|
||||
unsigned short baseAddr=c.chan*32+o*8;
|
||||
DivInstrumentFM::Operator& op=chan[c.chan].state.fm.op[o];
|
||||
op.ar=c.value2&15;
|
||||
rWrite(baseAddr+OFFSET_AR_DR,(op.ar<<4)|(op.dr&0xf));
|
||||
|
|
@ -582,15 +582,15 @@ int DivPlatformESFM::dispatch(DivCommand c) {
|
|||
case DIV_CMD_FM_DR: {
|
||||
if (c.value<0) {
|
||||
for (int o=0; o<4; o++) {
|
||||
unsigned short baseAddr=c.chan*32 + o*8;
|
||||
unsigned short baseAddr=c.chan*32+o*8;
|
||||
DivInstrumentFM::Operator& op=chan[c.chan].state.fm.op[o];
|
||||
op.dr=c.value2&15;
|
||||
rWrite(baseAddr+OFFSET_AR_DR,(op.ar<<4)|(op.dr&0xf));
|
||||
}
|
||||
} else {
|
||||
unsigned int o = c.value;
|
||||
unsigned int o=c.value;
|
||||
if (o >= 4) break;
|
||||
unsigned short baseAddr=c.chan*32 + o*8;
|
||||
unsigned short baseAddr=c.chan*32+o*8;
|
||||
DivInstrumentFM::Operator& op=chan[c.chan].state.fm.op[o];
|
||||
op.dr=c.value2&15;
|
||||
rWrite(baseAddr+OFFSET_AR_DR,(op.ar<<4)|(op.dr&0xf));
|
||||
|
|
@ -600,15 +600,15 @@ int DivPlatformESFM::dispatch(DivCommand c) {
|
|||
case DIV_CMD_FM_SL: {
|
||||
if (c.value<0) {
|
||||
for (int o=0; o<4; o++) {
|
||||
unsigned short baseAddr=c.chan*32 + o*8;
|
||||
unsigned short baseAddr=c.chan*32+o*8;
|
||||
DivInstrumentFM::Operator& op=chan[c.chan].state.fm.op[o];
|
||||
op.sl=c.value2&15;
|
||||
rWrite(baseAddr+OFFSET_SL_RR,(op.sl<<4)|(op.rr&0xf));
|
||||
}
|
||||
} else {
|
||||
unsigned int o = c.value;
|
||||
unsigned int o=c.value;
|
||||
if (o >= 4) break;
|
||||
unsigned short baseAddr=c.chan*32 + o*8;
|
||||
unsigned short baseAddr=c.chan*32+o*8;
|
||||
DivInstrumentFM::Operator& op=chan[c.chan].state.fm.op[o];
|
||||
op.sl=c.value2&15;
|
||||
rWrite(baseAddr+OFFSET_SL_RR,(op.sl<<4)|(op.rr&0xf));
|
||||
|
|
@ -618,15 +618,15 @@ int DivPlatformESFM::dispatch(DivCommand c) {
|
|||
case DIV_CMD_FM_RR: {
|
||||
if (c.value<0) {
|
||||
for (int o=0; o<4; o++) {
|
||||
unsigned short baseAddr=c.chan*32 + o*8;
|
||||
unsigned short baseAddr=c.chan*32+o*8;
|
||||
DivInstrumentFM::Operator& op=chan[c.chan].state.fm.op[o];
|
||||
op.rr=c.value2&15;
|
||||
rWrite(baseAddr+OFFSET_SL_RR,(op.sl<<4)|(op.rr&0xf));
|
||||
}
|
||||
} else {
|
||||
unsigned int o = c.value;
|
||||
unsigned int o=c.value;
|
||||
if (o >= 4) break;
|
||||
unsigned short baseAddr=c.chan*32 + o*8;
|
||||
unsigned short baseAddr=c.chan*32+o*8;
|
||||
DivInstrumentFM::Operator& op=chan[c.chan].state.fm.op[o];
|
||||
op.rr=c.value2&15;
|
||||
rWrite(baseAddr+OFFSET_SL_RR,(op.sl<<4)|(op.rr&0xf));
|
||||
|
|
@ -636,15 +636,15 @@ int DivPlatformESFM::dispatch(DivCommand c) {
|
|||
case DIV_CMD_FM_AM: {
|
||||
if (c.value<0) {
|
||||
for (int o=0; o<4; o++) {
|
||||
unsigned short baseAddr=c.chan*32 + o*8;
|
||||
unsigned short baseAddr=c.chan*32+o*8;
|
||||
DivInstrumentFM::Operator& op=chan[c.chan].state.fm.op[o];
|
||||
op.am=c.value2&1;
|
||||
rWrite(baseAddr+OFFSET_AM_VIB_SUS_KSR_MULT,((op.am&1)<<7)|((op.vib&1)<<6)|((op.sus&1)<<5)|((op.ksr&1)<<4)|(op.mult&0xf));
|
||||
}
|
||||
} else {
|
||||
unsigned int o = c.value;
|
||||
unsigned int o=c.value;
|
||||
if (o >= 4) break;
|
||||
unsigned short baseAddr=c.chan*32 + o*8;
|
||||
unsigned short baseAddr=c.chan*32+o*8;
|
||||
DivInstrumentFM::Operator& op=chan[c.chan].state.fm.op[o];
|
||||
op.am=c.value2&1;
|
||||
rWrite(baseAddr+OFFSET_AM_VIB_SUS_KSR_MULT,((op.am&1)<<7)|((op.vib&1)<<6)|((op.sus&1)<<5)|((op.ksr&1)<<4)|(op.mult&0xf));
|
||||
|
|
@ -654,15 +654,15 @@ int DivPlatformESFM::dispatch(DivCommand c) {
|
|||
case DIV_CMD_FM_VIB: {
|
||||
if (c.value<0) {
|
||||
for (int o=0; o<4; o++) {
|
||||
unsigned short baseAddr=c.chan*32 + o*8;
|
||||
unsigned short baseAddr=c.chan*32+o*8;
|
||||
DivInstrumentFM::Operator& op=chan[c.chan].state.fm.op[o];
|
||||
op.vib=c.value2&1;
|
||||
rWrite(baseAddr+OFFSET_AM_VIB_SUS_KSR_MULT,((op.am&1)<<7)|((op.vib&1)<<6)|((op.sus&1)<<5)|((op.ksr&1)<<4)|(op.mult&0xf));
|
||||
}
|
||||
} else {
|
||||
unsigned int o = c.value;
|
||||
unsigned int o=c.value;
|
||||
if (o >= 4) break;
|
||||
unsigned short baseAddr=c.chan*32 + o*8;
|
||||
unsigned short baseAddr=c.chan*32+o*8;
|
||||
DivInstrumentFM::Operator& op=chan[c.chan].state.fm.op[o];
|
||||
op.vib=c.value2&1;
|
||||
rWrite(baseAddr+OFFSET_AM_VIB_SUS_KSR_MULT,((op.am&1)<<7)|((op.vib&1)<<6)|((op.sus&1)<<5)|((op.ksr&1)<<4)|(op.mult&0xf));
|
||||
|
|
@ -672,15 +672,15 @@ int DivPlatformESFM::dispatch(DivCommand c) {
|
|||
case DIV_CMD_FM_SUS: {
|
||||
if (c.value<0) {
|
||||
for (int o=0; o<4; o++) {
|
||||
unsigned short baseAddr=c.chan*32 + o*8;
|
||||
unsigned short baseAddr=c.chan*32+o*8;
|
||||
DivInstrumentFM::Operator& op=chan[c.chan].state.fm.op[o];
|
||||
op.sus=c.value2&1;
|
||||
rWrite(baseAddr+OFFSET_AM_VIB_SUS_KSR_MULT,((op.am&1)<<7)|((op.vib&1)<<6)|((op.sus&1)<<5)|((op.ksr&1)<<4)|(op.mult&0xf));
|
||||
}
|
||||
} else {
|
||||
unsigned int o = c.value;
|
||||
unsigned int o=c.value;
|
||||
if (o >= 4) break;
|
||||
unsigned short baseAddr=c.chan*32 + o*8;
|
||||
unsigned short baseAddr=c.chan*32+o*8;
|
||||
DivInstrumentFM::Operator& op=chan[c.chan].state.fm.op[o];
|
||||
op.sus=c.value2&1;
|
||||
rWrite(baseAddr+OFFSET_AM_VIB_SUS_KSR_MULT,((op.am&1)<<7)|((op.vib&1)<<6)|((op.sus&1)<<5)|((op.ksr&1)<<4)|(op.mult&0xf));
|
||||
|
|
@ -690,15 +690,15 @@ int DivPlatformESFM::dispatch(DivCommand c) {
|
|||
case DIV_CMD_FM_KSR: {
|
||||
if (c.value<0) {
|
||||
for (int o=0; o<4; o++) {
|
||||
unsigned short baseAddr=c.chan*32 + o*8;
|
||||
unsigned short baseAddr=c.chan*32+o*8;
|
||||
DivInstrumentFM::Operator& op=chan[c.chan].state.fm.op[o];
|
||||
op.ksr=c.value2&1;
|
||||
rWrite(baseAddr+OFFSET_AM_VIB_SUS_KSR_MULT,((op.am&1)<<7)|((op.vib&1)<<6)|((op.sus&1)<<5)|((op.ksr&1)<<4)|(op.mult&0xf));
|
||||
}
|
||||
} else {
|
||||
unsigned int o = c.value;
|
||||
unsigned int o=c.value;
|
||||
if (o >= 4) break;
|
||||
unsigned short baseAddr=c.chan*32 + o*8;
|
||||
unsigned short baseAddr=c.chan*32+o*8;
|
||||
DivInstrumentFM::Operator& op=chan[c.chan].state.fm.op[o];
|
||||
op.ksr=c.value2&1;
|
||||
rWrite(baseAddr+OFFSET_AM_VIB_SUS_KSR_MULT,((op.am&1)<<7)|((op.vib&1)<<6)|((op.sus&1)<<5)|((op.ksr&1)<<4)|(op.mult&0xf));
|
||||
|
|
@ -708,7 +708,7 @@ int DivPlatformESFM::dispatch(DivCommand c) {
|
|||
case DIV_CMD_FM_WS: {
|
||||
if (c.value<0) {
|
||||
for (int o=0; o<4; o++) {
|
||||
unsigned short baseAddr=c.chan*32 + o*8;
|
||||
unsigned short baseAddr=c.chan*32+o*8;
|
||||
DivInstrumentFM::Operator& op=chan[c.chan].state.fm.op[o];
|
||||
DivInstrumentESFM::Operator& opE=chan[c.chan].state.esfm.op[o];
|
||||
unsigned char noise=chan[c.chan].state.esfm.noise&3;
|
||||
|
|
@ -720,9 +720,9 @@ int DivPlatformESFM::dispatch(DivCommand c) {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
unsigned int o = c.value;
|
||||
unsigned int o=c.value;
|
||||
if (o >= 4) break;
|
||||
unsigned short baseAddr=c.chan*32 + o*8;
|
||||
unsigned short baseAddr=c.chan*32+o*8;
|
||||
DivInstrumentFM::Operator& op=chan[c.chan].state.fm.op[o];
|
||||
DivInstrumentESFM::Operator& opE=chan[c.chan].state.esfm.op[o];
|
||||
unsigned char noise=chan[c.chan].state.esfm.noise&3;
|
||||
|
|
@ -739,7 +739,7 @@ int DivPlatformESFM::dispatch(DivCommand c) {
|
|||
case DIV_CMD_FM_RS: {
|
||||
if (c.value<0) {
|
||||
for (int o=0; o<4; o++) {
|
||||
unsigned short baseAddr=c.chan*32 + o*8;
|
||||
unsigned short baseAddr=c.chan*32+o*8;
|
||||
DivInstrumentFM::Operator& op=chan[c.chan].state.fm.op[o];
|
||||
op.ksl=c.value2&3;
|
||||
if (KVS(c.chan, o)) {
|
||||
|
|
@ -749,9 +749,9 @@ int DivPlatformESFM::dispatch(DivCommand c) {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
unsigned int o = c.value;
|
||||
unsigned int o=c.value;
|
||||
if (o >= 4) break;
|
||||
unsigned short baseAddr=c.chan*32 + o*8;
|
||||
unsigned short baseAddr=c.chan*32+o*8;
|
||||
DivInstrumentFM::Operator& op=chan[c.chan].state.fm.op[o];
|
||||
op.ksl=c.value2&3;
|
||||
if (KVS(c.chan, o)) {
|
||||
|
|
@ -763,9 +763,9 @@ int DivPlatformESFM::dispatch(DivCommand c) {
|
|||
break;
|
||||
}
|
||||
case DIV_CMD_FM_AM_DEPTH: {
|
||||
unsigned int o = c.value;
|
||||
unsigned int o=c.value;
|
||||
if (o >= 4) break;
|
||||
unsigned short baseAddr=c.chan*32 + o*8;
|
||||
unsigned short baseAddr=c.chan*32+o*8;
|
||||
DivInstrumentFM::Operator& op=chan[c.chan].state.fm.op[o];
|
||||
DivInstrumentESFM::Operator& opE=chan[c.chan].state.esfm.op[o];
|
||||
op.dam=c.value2&1;
|
||||
|
|
@ -773,9 +773,9 @@ int DivPlatformESFM::dispatch(DivCommand c) {
|
|||
break;
|
||||
}
|
||||
case DIV_CMD_FM_PM_DEPTH: {
|
||||
unsigned int o = c.value;
|
||||
unsigned int o=c.value;
|
||||
if (o >= 4) break;
|
||||
unsigned short baseAddr=c.chan*32 + o*8;
|
||||
unsigned short baseAddr=c.chan*32+o*8;
|
||||
DivInstrumentFM::Operator& op=chan[c.chan].state.fm.op[o];
|
||||
DivInstrumentESFM::Operator& opE=chan[c.chan].state.esfm.op[o];
|
||||
op.dvb=c.value2&1;
|
||||
|
|
@ -800,7 +800,7 @@ int DivPlatformESFM::dispatch(DivCommand c) {
|
|||
case DIV_CMD_ESFM_OP_PANNING: {
|
||||
unsigned int o=c.value;
|
||||
if (o >= 4) break;
|
||||
unsigned short baseAddr=c.chan*32 + o*8;
|
||||
unsigned short baseAddr=c.chan*32+o*8;
|
||||
DivInstrumentFM::Operator& op=chan[c.chan].state.fm.op[o];
|
||||
DivInstrumentESFM::Operator& opE=chan[c.chan].state.esfm.op[o];
|
||||
opE.left=c.value2&1;
|
||||
|
|
@ -811,7 +811,7 @@ int DivPlatformESFM::dispatch(DivCommand c) {
|
|||
case DIV_CMD_ESFM_OUTLVL: {
|
||||
if (c.value<0) {
|
||||
for (int o=0; o<4; o++) {
|
||||
unsigned short baseAddr=c.chan*32 + o*8;
|
||||
unsigned short baseAddr=c.chan*32+o*8;
|
||||
DivInstrumentFM::Operator& op=chan[c.chan].state.fm.op[o];
|
||||
DivInstrumentESFM::Operator& opE=chan[c.chan].state.esfm.op[o];
|
||||
unsigned char noise=chan[c.chan].state.esfm.noise&3;
|
||||
|
|
@ -823,9 +823,9 @@ int DivPlatformESFM::dispatch(DivCommand c) {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
unsigned int o = c.value;
|
||||
unsigned int o=c.value;
|
||||
if (o >= 4) break;
|
||||
unsigned short baseAddr=c.chan*32 + o*8;
|
||||
unsigned short baseAddr=c.chan*32+o*8;
|
||||
DivInstrumentFM::Operator& op=chan[c.chan].state.fm.op[o];
|
||||
DivInstrumentESFM::Operator& opE=chan[c.chan].state.esfm.op[o];
|
||||
unsigned char noise=chan[c.chan].state.esfm.noise&3;
|
||||
|
|
@ -841,16 +841,16 @@ int DivPlatformESFM::dispatch(DivCommand c) {
|
|||
case DIV_CMD_ESFM_MODIN: {
|
||||
if (c.value<0) {
|
||||
for (int o=0; o<4; o++) {
|
||||
unsigned short baseAddr=c.chan*32 + o*8;
|
||||
unsigned short baseAddr=c.chan*32+o*8;
|
||||
DivInstrumentFM::Operator& op=chan[c.chan].state.fm.op[o];
|
||||
DivInstrumentESFM::Operator& opE=chan[c.chan].state.esfm.op[o];
|
||||
opE.modIn=c.value2&7;
|
||||
rWrite(baseAddr+OFFSET_DAM_DVB_LEFT_RIGHT_MODIN,((opE.modIn&7)<<1)|(((opE.left&chan[c.chan].globalPan)&1)<<4)|(((opE.right&(chan[c.chan].globalPan>>1))&1)<<5)|((op.dvb&1)<<6)|(op.dam<<7));
|
||||
}
|
||||
} else {
|
||||
unsigned int o = c.value;
|
||||
unsigned int o=c.value;
|
||||
if (o >= 4) break;
|
||||
unsigned short baseAddr=c.chan*32 + o*8;
|
||||
unsigned short baseAddr=c.chan*32+o*8;
|
||||
DivInstrumentFM::Operator& op=chan[c.chan].state.fm.op[o];
|
||||
DivInstrumentESFM::Operator& opE=chan[c.chan].state.esfm.op[o];
|
||||
opE.modIn=c.value2&7;
|
||||
|
|
@ -861,15 +861,15 @@ int DivPlatformESFM::dispatch(DivCommand c) {
|
|||
case DIV_CMD_ESFM_ENV_DELAY: {
|
||||
if (c.value<0) {
|
||||
for (int o=0; o<4; o++) {
|
||||
unsigned short baseAddr=c.chan*32 + o*8;
|
||||
unsigned short baseAddr=c.chan*32+o*8;
|
||||
DivInstrumentESFM::Operator& opE=chan[c.chan].state.esfm.op[o];
|
||||
opE.delay=c.value2&7;
|
||||
rWrite(baseAddr+OFFSET_FREQH_BLOCK_DELAY,chan[c.chan].freqH[o]|(opE.delay<<5));
|
||||
}
|
||||
} else {
|
||||
unsigned int o = c.value;
|
||||
unsigned int o=c.value;
|
||||
if (o >= 4) break;
|
||||
unsigned short baseAddr=c.chan*32 + o*8;
|
||||
unsigned short baseAddr=c.chan*32+o*8;
|
||||
DivInstrumentESFM::Operator& opE=chan[c.chan].state.esfm.op[o];
|
||||
opE.delay=c.value2&7;
|
||||
rWrite(baseAddr+OFFSET_FREQH_BLOCK_DELAY,chan[c.chan].freqH[o]|(opE.delay<<5));
|
||||
|
|
@ -878,7 +878,7 @@ int DivPlatformESFM::dispatch(DivCommand c) {
|
|||
}
|
||||
case DIV_CMD_STD_NOISE_MODE: {
|
||||
unsigned int o=3;
|
||||
unsigned short baseAddr=c.chan*32 + o*8;
|
||||
unsigned short baseAddr=c.chan*32+o*8;
|
||||
DivInstrumentFM::Operator& op=chan[c.chan].state.fm.op[o];
|
||||
DivInstrumentESFM::Operator& opE=chan[c.chan].state.esfm.op[o];
|
||||
DivInstrumentESFM insE=chan[c.chan].state.esfm;
|
||||
|
|
@ -969,9 +969,9 @@ void DivPlatformESFM::reset() {
|
|||
ESFM_write_reg(&chip, 0x408, 0x00);
|
||||
|
||||
for (int i=0; i<ESFM_REG_POOL_SIZE; i++) {
|
||||
regPool[i] = ESFM_readback_reg(&chip, i);
|
||||
oldWrites[i] = -1;
|
||||
pendingWrites[i] = -1;
|
||||
regPool[i]=ESFM_readback_reg(&chip, i);
|
||||
oldWrites[i]=-1;
|
||||
pendingWrites[i]=-1;
|
||||
}
|
||||
|
||||
for (int i=0; i<18; i++) {
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ class DivPlatformESFM: public DivDispatch {
|
|||
* or op[o].outLvl > 0 and op[o + 1].modIn == 0.
|
||||
*/
|
||||
inline bool KVS(int c, int o) {
|
||||
if (c < 0 || c >= 18 || o < 0 || o >= 4) return false;
|
||||
if (c<0 || c>=18 || o<0 || o>=4) return false;
|
||||
|
||||
if (chan[c].state.fm.op[o].kvs==1) return true;
|
||||
|
||||
|
|
@ -106,7 +106,7 @@ class DivPlatformESFM: public DivDispatch {
|
|||
if (chan[c].state.esfm.op[o].outLvl==7) return true;
|
||||
else if (chan[c].state.esfm.op[o].outLvl>0) {
|
||||
if (o==3) return true;
|
||||
else if ((chan[c].state.esfm.op[o].outLvl-chan[c].state.esfm.op[o+1].modIn) >= 2) {
|
||||
else if ((chan[c].state.esfm.op[o].outLvl-chan[c].state.esfm.op[o+1].modIn)>=2) {
|
||||
return true;
|
||||
}
|
||||
else if (chan[c].state.esfm.op[o+1].modIn==0) {
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ const char* oplDrumNames[4]={
|
|||
};
|
||||
|
||||
const char* esfmNoiseModeNames[4]={
|
||||
"Noise disabled", "Snare (square + noise)", "HiHat (ringmod from OP3, + noise)", "Top (ringmod from OP3)"
|
||||
"Noise disabled", "Snare (square + noise)", "HiHat (ringmod from OP3, + noise)", "Top (ringmod from OP3)\nWARNING - not emulated properly! Will change in future versions."
|
||||
};
|
||||
|
||||
const bool opIsOutput[8][4]={
|
||||
|
|
@ -1198,7 +1198,7 @@ void FurnaceGUI::drawESFMAlgorithm(DivInstrumentESFM& esfm, const ImVec2& size)
|
|||
int out4 = esfm.op[3].outLvl&7;
|
||||
bool isMod[4];
|
||||
for (int i=0; i<4; i++) {
|
||||
DivInstrumentESFM::Operator& opE = esfm.op[i];
|
||||
DivInstrumentESFM::Operator& opE=esfm.op[i];
|
||||
isMod[i]=true;
|
||||
if (opE.outLvl==7) isMod[i]=false;
|
||||
else if (opE.outLvl>0) {
|
||||
|
|
@ -1206,7 +1206,7 @@ void FurnaceGUI::drawESFMAlgorithm(DivInstrumentESFM& esfm, const ImVec2& size)
|
|||
else {
|
||||
DivInstrumentESFM::Operator& opENext=esfm.op[i+1];
|
||||
if (opENext.modIn==0) isMod[i]=false;
|
||||
else if ((opE.outLvl-opENext.modIn) >= 2) isMod[i]=false;
|
||||
else if ((opE.outLvl-opENext.modIn)>=2) isMod[i]=false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3137,182 +3137,168 @@ void FurnaceGUI::drawInsEdit() {
|
|||
}
|
||||
}
|
||||
|
||||
if (ins->type!=DIV_INS_ESFM) {
|
||||
if (ImGui::BeginTable("fmDetails",3,ImGuiTableFlags_SizingStretchSame)) {
|
||||
ImGui::TableSetupColumn("c0",ImGuiTableColumnFlags_WidthStretch,0.0);
|
||||
ImGui::TableSetupColumn("c1",ImGuiTableColumnFlags_WidthStretch,0.0);
|
||||
ImGui::TableSetupColumn("c2",ImGuiTableColumnFlags_WidthStretch,0.0);
|
||||
if (ImGui::BeginTable("fmDetails",3,(ins->type==DIV_INS_ESFM)?ImGuiTableFlags_SizingStretchProp:ImGuiTableFlags_SizingStretchSame)) {
|
||||
ImGui::TableSetupColumn("c0",ImGuiTableColumnFlags_WidthStretch,((ins->type==DIV_INS_ESFM)?0.50f:0.0f));
|
||||
ImGui::TableSetupColumn("c1",ImGuiTableColumnFlags_WidthStretch,((ins->type==DIV_INS_ESFM)?0.15f:0.0f));
|
||||
ImGui::TableSetupColumn("c2",ImGuiTableColumnFlags_WidthStretch,((ins->type==DIV_INS_ESFM)?0.35f:0.0f));
|
||||
|
||||
ImGui::TableNextRow();
|
||||
switch (ins->type) {
|
||||
case DIV_INS_FM:
|
||||
case DIV_INS_OPM:
|
||||
ImGui::TableNextColumn();
|
||||
P(CWSliderScalar(FM_NAME(FM_FB),ImGuiDataType_U8,&ins->fm.fb,&_ZERO,&_SEVEN)); rightClickable
|
||||
P(CWSliderScalar(FM_NAME(FM_FMS),ImGuiDataType_U8,&ins->fm.fms,&_ZERO,&_SEVEN)); rightClickable
|
||||
ImGui::TableNextColumn();
|
||||
P(CWSliderScalar(FM_NAME(FM_ALG),ImGuiDataType_U8,&ins->fm.alg,&_ZERO,&_SEVEN)); rightClickable
|
||||
P(CWSliderScalar(FM_NAME(FM_AMS),ImGuiDataType_U8,&ins->fm.ams,&_ZERO,&_THREE)); rightClickable
|
||||
ImGui::TableNextColumn();
|
||||
if (fmPreviewOn) {
|
||||
drawFMPreview(ImVec2(ImGui::GetContentRegionAvail().x,48.0*dpiScale));
|
||||
if (!fmPreviewPaused) {
|
||||
renderFMPreview(ins,1);
|
||||
WAKE_UP;
|
||||
}
|
||||
} else {
|
||||
drawAlgorithm(ins->fm.alg,FM_ALGS_4OP,ImVec2(ImGui::GetContentRegionAvail().x,48.0*dpiScale));
|
||||
ImGui::TableNextRow();
|
||||
switch (ins->type) {
|
||||
case DIV_INS_FM:
|
||||
case DIV_INS_OPM:
|
||||
ImGui::TableNextColumn();
|
||||
P(CWSliderScalar(FM_NAME(FM_FB),ImGuiDataType_U8,&ins->fm.fb,&_ZERO,&_SEVEN)); rightClickable
|
||||
P(CWSliderScalar(FM_NAME(FM_FMS),ImGuiDataType_U8,&ins->fm.fms,&_ZERO,&_SEVEN)); rightClickable
|
||||
ImGui::TableNextColumn();
|
||||
P(CWSliderScalar(FM_NAME(FM_ALG),ImGuiDataType_U8,&ins->fm.alg,&_ZERO,&_SEVEN)); rightClickable
|
||||
P(CWSliderScalar(FM_NAME(FM_AMS),ImGuiDataType_U8,&ins->fm.ams,&_ZERO,&_THREE)); rightClickable
|
||||
ImGui::TableNextColumn();
|
||||
if (fmPreviewOn) {
|
||||
drawFMPreview(ImVec2(ImGui::GetContentRegionAvail().x,48.0*dpiScale));
|
||||
if (!fmPreviewPaused) {
|
||||
renderFMPreview(ins,1);
|
||||
WAKE_UP;
|
||||
}
|
||||
kvsConfig(ins);
|
||||
break;
|
||||
case DIV_INS_OPZ:
|
||||
ImGui::TableNextColumn();
|
||||
P(CWSliderScalar(FM_NAME(FM_FB),ImGuiDataType_U8,&ins->fm.fb,&_ZERO,&_SEVEN)); rightClickable
|
||||
P(CWSliderScalar(FM_NAME(FM_FMS),ImGuiDataType_U8,&ins->fm.fms,&_ZERO,&_SEVEN)); rightClickable
|
||||
P(CWSliderScalar(FM_NAME(FM_FMS2),ImGuiDataType_U8,&ins->fm.fms2,&_ZERO,&_SEVEN)); rightClickable
|
||||
ImGui::TableNextColumn();
|
||||
P(CWSliderScalar(FM_NAME(FM_ALG),ImGuiDataType_U8,&ins->fm.alg,&_ZERO,&_SEVEN)); rightClickable
|
||||
P(CWSliderScalar(FM_NAME(FM_AMS),ImGuiDataType_U8,&ins->fm.ams,&_ZERO,&_THREE)); rightClickable
|
||||
P(CWSliderScalar(FM_NAME(FM_AMS2),ImGuiDataType_U8,&ins->fm.ams2,&_ZERO,&_THREE)); rightClickable
|
||||
ImGui::TableNextColumn();
|
||||
if (fmPreviewOn) {
|
||||
drawFMPreview(ImVec2(ImGui::GetContentRegionAvail().x,48.0*dpiScale));
|
||||
if (!fmPreviewPaused) {
|
||||
renderFMPreview(ins,1);
|
||||
WAKE_UP;
|
||||
}
|
||||
} else {
|
||||
drawAlgorithm(ins->fm.alg,FM_ALGS_4OP,ImVec2(ImGui::GetContentRegionAvail().x,48.0*dpiScale));
|
||||
}
|
||||
kvsConfig(ins);
|
||||
|
||||
if (ImGui::Button("Request from TX81Z")) {
|
||||
doAction(GUI_ACTION_TX81Z_REQUEST);
|
||||
}
|
||||
/*
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("Send to TX81Z")) {
|
||||
showError("Coming soon!");
|
||||
}
|
||||
*/
|
||||
break;
|
||||
case DIV_INS_OPL:
|
||||
case DIV_INS_OPL_DRUMS: {
|
||||
bool fourOp=(ins->fm.ops==4 || ins->type==DIV_INS_OPL_DRUMS);
|
||||
bool drums=ins->fm.opllPreset==16;
|
||||
int algMax=fourOp?3:1;
|
||||
ImGui::TableNextColumn();
|
||||
ins->fm.alg&=algMax;
|
||||
P(CWSliderScalar(FM_NAME(FM_FB),ImGuiDataType_U8,&ins->fm.fb,&_ZERO,&_SEVEN)); rightClickable
|
||||
if (ins->type==DIV_INS_OPL) {
|
||||
ImGui::BeginDisabled(ins->fm.opllPreset==16);
|
||||
if (ImGui::Checkbox("4-op",&fourOp)) { PARAMETER
|
||||
ins->fm.ops=fourOp?4:2;
|
||||
}
|
||||
ImGui::EndDisabled();
|
||||
}
|
||||
ImGui::TableNextColumn();
|
||||
P(CWSliderScalar(FM_NAME(FM_ALG),ImGuiDataType_U8,&ins->fm.alg,&_ZERO,&algMax)); rightClickable
|
||||
if (ins->type==DIV_INS_OPL) {
|
||||
if (ImGui::Checkbox("Drums",&drums)) { PARAMETER
|
||||
ins->fm.opllPreset=drums?16:0;
|
||||
}
|
||||
}
|
||||
ImGui::TableNextColumn();
|
||||
if (fmPreviewOn) {
|
||||
drawFMPreview(ImVec2(ImGui::GetContentRegionAvail().x,48.0*dpiScale));
|
||||
if (!fmPreviewPaused) {
|
||||
renderFMPreview(ins,1);
|
||||
WAKE_UP;
|
||||
}
|
||||
} else {
|
||||
drawAlgorithm(ins->fm.alg&algMax,fourOp?FM_ALGS_4OP_OPL:FM_ALGS_2OP_OPL,ImVec2(ImGui::GetContentRegionAvail().x,48.0*dpiScale));
|
||||
}
|
||||
kvsConfig(ins);
|
||||
break;
|
||||
} else {
|
||||
drawAlgorithm(ins->fm.alg,FM_ALGS_4OP,ImVec2(ImGui::GetContentRegionAvail().x,48.0*dpiScale));
|
||||
}
|
||||
case DIV_INS_OPLL: {
|
||||
bool dc=fmOrigin.fms;
|
||||
bool dm=fmOrigin.ams;
|
||||
bool sus=ins->fm.alg;
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::BeginDisabled(ins->fm.opllPreset!=0);
|
||||
P(CWSliderScalar(FM_NAME(FM_FB),ImGuiDataType_U8,&fmOrigin.fb,&_ZERO,&_SEVEN)); rightClickable
|
||||
if (ImGui::Checkbox(FM_NAME(FM_DC),&dc)) { PARAMETER
|
||||
fmOrigin.fms=dc;
|
||||
kvsConfig(ins);
|
||||
break;
|
||||
case DIV_INS_OPZ:
|
||||
ImGui::TableNextColumn();
|
||||
P(CWSliderScalar(FM_NAME(FM_FB),ImGuiDataType_U8,&ins->fm.fb,&_ZERO,&_SEVEN)); rightClickable
|
||||
P(CWSliderScalar(FM_NAME(FM_FMS),ImGuiDataType_U8,&ins->fm.fms,&_ZERO,&_SEVEN)); rightClickable
|
||||
P(CWSliderScalar(FM_NAME(FM_FMS2),ImGuiDataType_U8,&ins->fm.fms2,&_ZERO,&_SEVEN)); rightClickable
|
||||
ImGui::TableNextColumn();
|
||||
P(CWSliderScalar(FM_NAME(FM_ALG),ImGuiDataType_U8,&ins->fm.alg,&_ZERO,&_SEVEN)); rightClickable
|
||||
P(CWSliderScalar(FM_NAME(FM_AMS),ImGuiDataType_U8,&ins->fm.ams,&_ZERO,&_THREE)); rightClickable
|
||||
P(CWSliderScalar(FM_NAME(FM_AMS2),ImGuiDataType_U8,&ins->fm.ams2,&_ZERO,&_THREE)); rightClickable
|
||||
ImGui::TableNextColumn();
|
||||
if (fmPreviewOn) {
|
||||
drawFMPreview(ImVec2(ImGui::GetContentRegionAvail().x,48.0*dpiScale));
|
||||
if (!fmPreviewPaused) {
|
||||
renderFMPreview(ins,1);
|
||||
WAKE_UP;
|
||||
}
|
||||
} else {
|
||||
drawAlgorithm(ins->fm.alg,FM_ALGS_4OP,ImVec2(ImGui::GetContentRegionAvail().x,48.0*dpiScale));
|
||||
}
|
||||
kvsConfig(ins);
|
||||
|
||||
if (ImGui::Button("Request from TX81Z")) {
|
||||
doAction(GUI_ACTION_TX81Z_REQUEST);
|
||||
}
|
||||
/*
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("Send to TX81Z")) {
|
||||
showError("Coming soon!");
|
||||
}
|
||||
*/
|
||||
break;
|
||||
case DIV_INS_OPL:
|
||||
case DIV_INS_OPL_DRUMS: {
|
||||
bool fourOp=(ins->fm.ops==4 || ins->type==DIV_INS_OPL_DRUMS);
|
||||
bool drums=ins->fm.opllPreset==16;
|
||||
int algMax=fourOp?3:1;
|
||||
ImGui::TableNextColumn();
|
||||
ins->fm.alg&=algMax;
|
||||
P(CWSliderScalar(FM_NAME(FM_FB),ImGuiDataType_U8,&ins->fm.fb,&_ZERO,&_SEVEN)); rightClickable
|
||||
if (ins->type==DIV_INS_OPL) {
|
||||
ImGui::BeginDisabled(ins->fm.opllPreset==16);
|
||||
if (ImGui::Checkbox("4-op",&fourOp)) { PARAMETER
|
||||
ins->fm.ops=fourOp?4:2;
|
||||
}
|
||||
ImGui::EndDisabled();
|
||||
ImGui::TableNextColumn();
|
||||
if (ImGui::Checkbox(FM_NAME(FM_SUS),&sus)) { PARAMETER
|
||||
ins->fm.alg=sus;
|
||||
}
|
||||
ImGui::BeginDisabled(ins->fm.opllPreset!=0);
|
||||
if (ImGui::Checkbox(FM_NAME(FM_DM),&dm)) { PARAMETER
|
||||
fmOrigin.ams=dm;
|
||||
}
|
||||
ImGui::EndDisabled();
|
||||
ImGui::TableNextColumn();
|
||||
if (fmPreviewOn) {
|
||||
drawFMPreview(ImVec2(ImGui::GetContentRegionAvail().x,24.0*dpiScale));
|
||||
if (!fmPreviewPaused) {
|
||||
renderFMPreview(ins,1);
|
||||
WAKE_UP;
|
||||
}
|
||||
} else {
|
||||
drawAlgorithm(0,FM_ALGS_2OP_OPL,ImVec2(ImGui::GetContentRegionAvail().x,24.0*dpiScale));
|
||||
}
|
||||
kvsConfig(ins,false);
|
||||
|
||||
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
|
||||
|
||||
if (ImGui::BeginCombo("##LLPreset",opllInsNames[presentWhich][ins->fm.opllPreset])) {
|
||||
if (isPresentCount>1) {
|
||||
if (ImGui::BeginTable("LLPresetList",isPresentCount)) {
|
||||
ImGui::TableNextRow(ImGuiTableRowFlags_Headers);
|
||||
for (int i=0; i<4; i++) {
|
||||
if (!isPresent[i]) continue;
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::Text("%s name",opllVariants[i]);
|
||||
}
|
||||
for (int i=0; i<17; i++) {
|
||||
ImGui::TableNextRow();
|
||||
for (int j=0; j<4; j++) {
|
||||
if (!isPresent[j]) continue;
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::PushID(j*17+i);
|
||||
if (ImGui::Selectable(opllInsNames[j][i])) {
|
||||
ins->fm.opllPreset=i;
|
||||
}
|
||||
ImGui::PopID();
|
||||
}
|
||||
}
|
||||
ImGui::EndTable();
|
||||
}
|
||||
} else {
|
||||
for (int i=0; i<17; i++) {
|
||||
if (ImGui::Selectable(opllInsNames[presentWhich][i])) {
|
||||
ins->fm.opllPreset=i;
|
||||
}
|
||||
}
|
||||
}
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
ImGui::TableNextColumn();
|
||||
P(CWSliderScalar(FM_NAME(FM_ALG),ImGuiDataType_U8,&ins->fm.alg,&_ZERO,&algMax)); rightClickable
|
||||
if (ins->type==DIV_INS_OPL) {
|
||||
if (ImGui::Checkbox("Drums",&drums)) { PARAMETER
|
||||
ins->fm.opllPreset=drums?16:0;
|
||||
}
|
||||
}
|
||||
ImGui::TableNextColumn();
|
||||
if (fmPreviewOn) {
|
||||
drawFMPreview(ImVec2(ImGui::GetContentRegionAvail().x,48.0*dpiScale));
|
||||
if (!fmPreviewPaused) {
|
||||
renderFMPreview(ins,1);
|
||||
WAKE_UP;
|
||||
}
|
||||
} else {
|
||||
drawAlgorithm(ins->fm.alg&algMax,fourOp?FM_ALGS_4OP_OPL:FM_ALGS_2OP_OPL,ImVec2(ImGui::GetContentRegionAvail().x,48.0*dpiScale));
|
||||
}
|
||||
kvsConfig(ins);
|
||||
break;
|
||||
}
|
||||
ImGui::EndTable();
|
||||
}
|
||||
} else {
|
||||
// ESFM
|
||||
if (ImGui::BeginTable("fmDetails",3,ImGuiTableFlags_SizingStretchProp)) {
|
||||
ImGui::TableSetupColumn("c0",ImGuiTableColumnFlags_WidthStretch,0.50f);
|
||||
ImGui::TableSetupColumn("c1",ImGuiTableColumnFlags_WidthStretch,0.15f);
|
||||
ImGui::TableSetupColumn("c2",ImGuiTableColumnFlags_WidthStretch,0.35f);
|
||||
|
||||
ImGui::TableNextRow();
|
||||
{
|
||||
case DIV_INS_OPLL: {
|
||||
bool dc=fmOrigin.fms;
|
||||
bool dm=fmOrigin.ams;
|
||||
bool sus=ins->fm.alg;
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::BeginDisabled(ins->fm.opllPreset!=0);
|
||||
P(CWSliderScalar(FM_NAME(FM_FB),ImGuiDataType_U8,&fmOrigin.fb,&_ZERO,&_SEVEN)); rightClickable
|
||||
if (ImGui::Checkbox(FM_NAME(FM_DC),&dc)) { PARAMETER
|
||||
fmOrigin.fms=dc;
|
||||
}
|
||||
ImGui::EndDisabled();
|
||||
ImGui::TableNextColumn();
|
||||
if (ImGui::Checkbox(FM_NAME(FM_SUS),&sus)) { PARAMETER
|
||||
ins->fm.alg=sus;
|
||||
}
|
||||
ImGui::BeginDisabled(ins->fm.opllPreset!=0);
|
||||
if (ImGui::Checkbox(FM_NAME(FM_DM),&dm)) { PARAMETER
|
||||
fmOrigin.ams=dm;
|
||||
}
|
||||
ImGui::EndDisabled();
|
||||
ImGui::TableNextColumn();
|
||||
if (fmPreviewOn) {
|
||||
drawFMPreview(ImVec2(ImGui::GetContentRegionAvail().x,24.0*dpiScale));
|
||||
if (!fmPreviewPaused) {
|
||||
renderFMPreview(ins,1);
|
||||
WAKE_UP;
|
||||
}
|
||||
} else {
|
||||
drawAlgorithm(0,FM_ALGS_2OP_OPL,ImVec2(ImGui::GetContentRegionAvail().x,24.0*dpiScale));
|
||||
}
|
||||
kvsConfig(ins,false);
|
||||
|
||||
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
|
||||
|
||||
if (ImGui::BeginCombo("##LLPreset",opllInsNames[presentWhich][ins->fm.opllPreset])) {
|
||||
if (isPresentCount>1) {
|
||||
if (ImGui::BeginTable("LLPresetList",isPresentCount)) {
|
||||
ImGui::TableNextRow(ImGuiTableRowFlags_Headers);
|
||||
for (int i=0; i<4; i++) {
|
||||
if (!isPresent[i]) continue;
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::Text("%s name",opllVariants[i]);
|
||||
}
|
||||
for (int i=0; i<17; i++) {
|
||||
ImGui::TableNextRow();
|
||||
for (int j=0; j<4; j++) {
|
||||
if (!isPresent[j]) continue;
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::PushID(j*17+i);
|
||||
if (ImGui::Selectable(opllInsNames[j][i])) {
|
||||
ins->fm.opllPreset=i;
|
||||
}
|
||||
ImGui::PopID();
|
||||
}
|
||||
}
|
||||
ImGui::EndTable();
|
||||
}
|
||||
} else {
|
||||
for (int i=0; i<17; i++) {
|
||||
if (ImGui::Selectable(opllInsNames[presentWhich][i])) {
|
||||
ins->fm.opllPreset=i;
|
||||
}
|
||||
}
|
||||
}
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case DIV_INS_ESFM: {
|
||||
ImGui::TableNextColumn();
|
||||
P(CWSliderScalar(ESFM_LONG_NAME(ESFM_NOISE),ImGuiDataType_U8,&ins->esfm.noise,&_ZERO,&_THREE)); rightClickable
|
||||
ImGui::TextUnformatted(esfmNoiseModeNames[ins->esfm.noise&3]);
|
||||
|
|
@ -3329,8 +3315,10 @@ void FurnaceGUI::drawInsEdit() {
|
|||
}
|
||||
kvsConfig(ins);
|
||||
}
|
||||
ImGui::EndTable();
|
||||
default:
|
||||
break;
|
||||
}
|
||||
ImGui::EndTable();
|
||||
}
|
||||
|
||||
if (((ins->type==DIV_INS_OPLL || ins->type==DIV_INS_OPL) && ins->fm.opllPreset==16) || ins->type==DIV_INS_OPL_DRUMS) {
|
||||
|
|
@ -3621,7 +3609,7 @@ void FurnaceGUI::drawInsEdit() {
|
|||
else {
|
||||
DivInstrumentESFM::Operator& opENext=ins->esfm.op[i+1];
|
||||
if (opENext.modIn==0) mod=false;
|
||||
else if ((opE.outLvl-opENext.modIn) >= 2) mod=false;
|
||||
else if ((opE.outLvl-opENext.modIn)>=2) mod=false;
|
||||
}
|
||||
}
|
||||
} else if (opCount==4) {
|
||||
|
|
@ -3707,7 +3695,7 @@ void FurnaceGUI::drawInsEdit() {
|
|||
bool susOn=op.sus;
|
||||
bool fixedOn=opE.fixed;
|
||||
unsigned char ssgEnv=op.ssgEnv&7;
|
||||
|
||||
|
||||
if (ins->type==DIV_INS_ESFM) {
|
||||
ImGui::TableNextColumn();
|
||||
CENTER_VSLIDER;
|
||||
|
|
@ -4086,7 +4074,7 @@ void FurnaceGUI::drawInsEdit() {
|
|||
else {
|
||||
DivInstrumentESFM::Operator& opENext=ins->esfm.op[i+1];
|
||||
if (opENext.modIn==0) mod=false;
|
||||
else if ((opE.outLvl-opENext.modIn) >= 2) mod=false;
|
||||
else if ((opE.outLvl-opENext.modIn)>=2) mod=false;
|
||||
}
|
||||
}
|
||||
} else if (opCount==4) {
|
||||
|
|
@ -4519,7 +4507,7 @@ void FurnaceGUI::drawInsEdit() {
|
|||
if (block>7) block=7;
|
||||
opE.ct=(opE.ct&(~(7<<2)))|(block<<2);
|
||||
}
|
||||
|
||||
|
||||
ImGui::Text("F");
|
||||
if (ImGui::IsItemHovered()) {
|
||||
ImGui::SetTooltip("Frequency (F-Num)");
|
||||
|
|
@ -4784,7 +4772,7 @@ void FurnaceGUI::drawInsEdit() {
|
|||
else {
|
||||
DivInstrumentESFM::Operator& opENext=ins->esfm.op[i+1];
|
||||
if (opENext.modIn==0) mod=false;
|
||||
else if ((opE.outLvl-opENext.modIn) >= 2) mod=false;
|
||||
else if ((opE.outLvl-opENext.modIn)>=2) mod=false;
|
||||
}
|
||||
}
|
||||
} else if (opCount==4) {
|
||||
|
|
|
|||
|
|
@ -2215,6 +2215,27 @@ bool FurnaceGUI::drawSysConf(int chan, int sysPos, DivSystem type, DivConfig& fl
|
|||
}
|
||||
break;
|
||||
}
|
||||
case DIV_SYSTEM_ESFM: {
|
||||
supportsCustomRate=false;
|
||||
|
||||
// TODO: Remove the text below and uncomment the rest when overflow emulation is added to ESFMu
|
||||
// (still under research)
|
||||
ImGui::Text("nothing to configure");
|
||||
|
||||
// bool emulateOverflow=flags.getBool("emulateOverflow", false);
|
||||
//
|
||||
// if (ImGui::Checkbox("Enable overflow emulation", &emulateOverflow)) {
|
||||
// altered=true;
|
||||
// mustRender=true;
|
||||
// }
|
||||
//
|
||||
// if (altered) {
|
||||
// e->lockSave([&]() {
|
||||
// flags.set("emulateOverflow", emulateOverflow);
|
||||
// });
|
||||
// }
|
||||
break;
|
||||
}
|
||||
case DIV_SYSTEM_SWAN:
|
||||
case DIV_SYSTEM_BUBSYS_WSG:
|
||||
case DIV_SYSTEM_PET:
|
||||
|
|
@ -2225,7 +2246,6 @@ bool FurnaceGUI::drawSysConf(int chan, int sysPos, DivSystem type, DivConfig& fl
|
|||
case DIV_SYSTEM_C219:
|
||||
break;
|
||||
case DIV_SYSTEM_YMU759:
|
||||
case DIV_SYSTEM_ESFM:
|
||||
supportsCustomRate=false;
|
||||
ImGui::Text("nothing to configure");
|
||||
break;
|
||||
|
|
|
|||
Loading…
Reference in a new issue