dev114 - operator muting for OPN/OPM

This commit is contained in:
tildearrow 2022-09-12 00:37:25 -05:00
parent d4867c5050
commit 7b1713758b
16 changed files with 108 additions and 30 deletions

View file

@ -46,8 +46,8 @@
#define BUSY_BEGIN_SOFT softLocked=true; isBusy.lock();
#define BUSY_END isBusy.unlock(); softLocked=false;
#define DIV_VERSION "dev113"
#define DIV_ENGINE_VERSION 113
#define DIV_VERSION "dev114"
#define DIV_ENGINE_VERSION 114
// for imports
#define DIV_VERSION_MOD 0xff01
#define DIV_VERSION_FC 0xff02

View file

@ -71,8 +71,10 @@ void DivInstrument::putInsData(SafeWriter* w) {
w->writeC(op.ws);
w->writeC(op.ksr);
w->writeC(op.enable);
// reserved
for (int k=0; k<12; k++) {
for (int k=0; k<11; k++) {
w->writeC(0);
}
}
@ -716,8 +718,14 @@ DivDataErrors DivInstrument::readInsData(SafeReader& reader, short version) {
op.ws=reader.readC();
op.ksr=reader.readC();
if (version>=114) {
op.enable=reader.readC();
} else {
reader.readC();
}
// reserved
for (int k=0; k<12; k++) reader.readC();
for (int k=0; k<11; k++) reader.readC();
}
// GB

View file

@ -348,7 +348,7 @@ void DivPlatformArcade::tick(bool sysTick) {
chan[i].freqChanged=false;
}
if (chan[i].keyOn) {
immWrite(0x08,0x78|i);
immWrite(0x08,(chan[i].opMask<<3)|i);
chan[i].keyOn=false;
}
}
@ -370,6 +370,11 @@ int DivPlatformArcade::dispatch(DivCommand c) {
if (chan[c.chan].insChanged) {
chan[c.chan].state=ins->fm;
chan[c.chan].opMask=
(chan[c.chan].state.op[0].enable?1:0)|
(chan[c.chan].state.op[2].enable?2:0)|
(chan[c.chan].state.op[1].enable?4:0)|
(chan[c.chan].state.op[3].enable?8:0);
}
chan[c.chan].macroInit(ins);

View file

@ -45,7 +45,7 @@ class DivPlatformArcade: public DivPlatformOPM {
signed char konCycles;
bool active, insChanged, freqChanged, keyOn, keyOff, inPorta, portaPause, furnacePCM, hardReset;
int vol, outVol;
unsigned char chVolL, chVolR;
unsigned char chVolL, chVolR, opMask;
void macroInit(DivInstrument* which) {
std.init(which);
pitch2=0;
@ -71,7 +71,8 @@ class DivPlatformArcade: public DivPlatformOPM {
vol(0),
outVol(0),
chVolL(127),
chVolR(127) {}
chVolR(127),
opMask(15) {}
};
Channel chan[8];
DivDispatchOscBuffer* oscBuf[8];

View file

@ -480,7 +480,7 @@ void DivPlatformGenesis::tick(bool sysTick) {
chan[i].freqChanged=false;
}
if (chan[i].keyOn) {
if (i<6) immWrite(0x28,0xf0|konOffs[i]);
if (i<6) immWrite(0x28,(chan[i].opMask<<4)|konOffs[i]);
chan[i].keyOn=false;
}
}
@ -591,6 +591,11 @@ int DivPlatformGenesis::dispatch(DivCommand c) {
if (chan[c.chan].insChanged) {
chan[c.chan].state=ins->fm;
chan[c.chan].opMask=
(chan[c.chan].state.op[0].enable?1:0)|
(chan[c.chan].state.op[2].enable?2:0)|
(chan[c.chan].state.op[1].enable?4:0)|
(chan[c.chan].state.op[3].enable?8:0);
}
chan[c.chan].macroInit(ins);

View file

@ -47,7 +47,7 @@ class DivPlatformGenesis: public DivPlatformOPN {
int ins;
bool active, insChanged, freqChanged, keyOn, keyOff, portaPause, furnaceDac, inPorta, hardReset;
int vol, outVol;
unsigned char pan;
unsigned char pan, opMask;
bool dacMode;
int dacPeriod;
@ -85,6 +85,7 @@ class DivPlatformGenesis: public DivPlatformOPN {
vol(0),
outVol(0),
pan(3),
opMask(15),
dacMode(false),
dacPeriod(0),
dacRate(0),

View file

@ -386,7 +386,7 @@ void DivPlatformYM2203::tick(bool sysTick) {
chan[i].freqChanged=false;
}
if (chan[i].keyOn) {
immWrite(0x28,0xf0|konOffs[i]);
immWrite(0x28,(chan[i].opMask<<4)|konOffs[i]);
chan[i].keyOn=false;
}
}
@ -409,6 +409,11 @@ int DivPlatformYM2203::dispatch(DivCommand c) {
if (chan[c.chan].insChanged) {
chan[c.chan].state=ins->fm;
chan[c.chan].opMask=
(chan[c.chan].state.op[0].enable?1:0)|
(chan[c.chan].state.op[2].enable?2:0)|
(chan[c.chan].state.op[1].enable?4:0)|
(chan[c.chan].state.op[3].enable?8:0);
}
for (int i=0; i<4; i++) {

View file

@ -43,7 +43,7 @@ class DivPlatformYM2203: public DivPlatformOPN {
DivInstrumentFM state;
unsigned char freqH, freqL;
int freq, baseFreq, pitch, pitch2, portaPauseFreq, note, ins;
unsigned char psgMode, autoEnvNum, autoEnvDen;
unsigned char psgMode, autoEnvNum, autoEnvDen, opMask;
signed char konCycles;
bool active, insChanged, freqChanged, keyOn, keyOff, portaPause, inPorta, furnacePCM, hardReset;
int vol, outVol;
@ -66,6 +66,7 @@ class DivPlatformYM2203: public DivPlatformOPN {
psgMode(1),
autoEnvNum(0),
autoEnvDen(0),
opMask(15),
active(false),
insChanged(true),
freqChanged(false),

View file

@ -582,7 +582,7 @@ void DivPlatformYM2608::tick(bool sysTick) {
chan[i].freqChanged=false;
}
if (chan[i].keyOn) {
immWrite(0x28,0xf0|konOffs[i]);
immWrite(0x28,(chan[i].opMask<<4)|konOffs[i]);
chan[i].keyOn=false;
}
}
@ -683,6 +683,11 @@ int DivPlatformYM2608::dispatch(DivCommand c) {
if (chan[c.chan].insChanged) {
chan[c.chan].state=ins->fm;
chan[c.chan].opMask=
(chan[c.chan].state.op[0].enable?1:0)|
(chan[c.chan].state.op[2].enable?2:0)|
(chan[c.chan].state.op[1].enable?4:0)|
(chan[c.chan].state.op[3].enable?8:0);
}
for (int i=0; i<4; i++) {

View file

@ -48,7 +48,7 @@ class DivPlatformYM2608: public DivPlatformOPN {
DivInstrumentFM state;
unsigned char freqH, freqL;
int freq, baseFreq, pitch, pitch2, portaPauseFreq, note, ins;
unsigned char psgMode, autoEnvNum, autoEnvDen;
unsigned char psgMode, autoEnvNum, autoEnvDen, opMask;
signed char konCycles;
bool active, insChanged, freqChanged, keyOn, keyOff, portaPause, inPorta, furnacePCM, hardReset;
int vol, outVol;
@ -72,6 +72,7 @@ class DivPlatformYM2608: public DivPlatformOPN {
psgMode(1),
autoEnvNum(0),
autoEnvDen(0),
opMask(15),
active(false),
insChanged(true),
freqChanged(false),

View file

@ -619,7 +619,7 @@ void DivPlatformYM2610::tick(bool sysTick) {
chan[i].freqChanged=false;
}
if (chan[i].keyOn) {
immWrite(0x28,0xf0|konOffs[i]);
immWrite(0x28,(chan[i].opMask<<4)|konOffs[i]);
chan[i].keyOn=false;
}
}
@ -727,6 +727,11 @@ int DivPlatformYM2610::dispatch(DivCommand c) {
if (chan[c.chan].insChanged) {
chan[c.chan].state=ins->fm;
chan[c.chan].opMask=
(chan[c.chan].state.op[0].enable?1:0)|
(chan[c.chan].state.op[2].enable?2:0)|
(chan[c.chan].state.op[1].enable?4:0)|
(chan[c.chan].state.op[3].enable?8:0);
}
for (int i=0; i<4; i++) {

View file

@ -76,7 +76,7 @@ class DivPlatformYM2610: public DivPlatformYM2610Base {
bool active, insChanged, freqChanged, keyOn, keyOff, portaPause, inPorta, furnacePCM, hardReset;
int vol, outVol;
int sample;
unsigned char pan;
unsigned char pan, opMask;
DivMacroInt std;
void macroInit(DivInstrument* which) {
std.init(which);
@ -107,7 +107,8 @@ class DivPlatformYM2610: public DivPlatformYM2610Base {
vol(0),
outVol(15),
sample(-1),
pan(3) {}
pan(3),
opMask(15) {}
};
Channel chan[14];
DivDispatchOscBuffer* oscBuf[14];

View file

@ -601,7 +601,7 @@ void DivPlatformYM2610B::tick(bool sysTick) {
chan[i].freqChanged=false;
}
if (chan[i].keyOn) {
immWrite(0x28,0xf0|konOffs[i]);
immWrite(0x28,(chan[i].opMask<<4)|konOffs[i]);
chan[i].keyOn=false;
}
}
@ -709,6 +709,11 @@ int DivPlatformYM2610B::dispatch(DivCommand c) {
if (chan[c.chan].insChanged) {
chan[c.chan].state=ins->fm;
chan[c.chan].opMask=
(chan[c.chan].state.op[0].enable?1:0)|
(chan[c.chan].state.op[2].enable?2:0)|
(chan[c.chan].state.op[1].enable?4:0)|
(chan[c.chan].state.op[3].enable?8:0);
}
for (int i=0; i<4; i++) {

View file

@ -43,7 +43,7 @@ class DivPlatformYM2610B: public DivPlatformYM2610Base {
bool active, insChanged, freqChanged, keyOn, keyOff, portaPause, inPorta, furnacePCM, hardReset;
int vol, outVol;
int sample;
unsigned char pan;
unsigned char pan, opMask;
DivMacroInt std;
void macroInit(DivInstrument* which) {
std.init(which);
@ -74,7 +74,8 @@ class DivPlatformYM2610B: public DivPlatformYM2610Base {
vol(0),
outVol(15),
sample(-1),
pan(3) {}
pan(3),
opMask(15) {}
};
Channel chan[16];
DivDispatchOscBuffer* oscBuf[16];