Virtual Boy: instrument mod table and sweep

This commit is contained in:
tildearrow 2022-10-10 22:24:07 -05:00
parent 0407fa2d3e
commit 4ec5ee20e8
2 changed files with 21 additions and 1 deletions

View file

@ -212,6 +212,12 @@ int DivPlatformVB::dispatch(DivCommand c) {
chan[c.chan].active=true; chan[c.chan].active=true;
chan[c.chan].keyOn=true; chan[c.chan].keyOn=true;
chan[c.chan].macroInit(ins); chan[c.chan].macroInit(ins);
if (chan[c.chan].insChanged && ins->fds.initModTableWithFirstWave) {
for (int i=0; i<32; i++) {
modTable[i]=ins->fds.modTable[i];
rWrite(0x280+(i<<2),modTable[i]);
}
}
if (!parent->song.brokenOutVol && !chan[c.chan].std.vol.will) { if (!parent->song.brokenOutVol && !chan[c.chan].std.vol.will) {
chan[c.chan].outVol=chan[c.chan].vol; chan[c.chan].outVol=chan[c.chan].vol;
writeEnv(c.chan); writeEnv(c.chan);
@ -303,6 +309,7 @@ int DivPlatformVB::dispatch(DivCommand c) {
case DIV_CMD_FDS_MOD_DEPTH: // set modulation case DIV_CMD_FDS_MOD_DEPTH: // set modulation
if (c.chan!=4) break; if (c.chan!=4) break;
modulation=c.value; modulation=c.value;
modType=true;
chWrite(4,0x07,modulation); chWrite(4,0x07,modulation);
if (modulation!=0) { if (modulation!=0) {
chan[c.chan].envHigh|=0x70; chan[c.chan].envHigh|=0x70;
@ -310,7 +317,18 @@ int DivPlatformVB::dispatch(DivCommand c) {
chan[c.chan].envHigh&=~0x70; chan[c.chan].envHigh&=~0x70;
} }
writeEnv(4); writeEnv(4);
chWrite(c.chan,0x00,0x80); break;
case DIV_CMD_GB_SWEEP_TIME: // set sweep
if (c.chan!=4) break;
modulation=c.value;
modType=false;
chWrite(4,0x07,modulation);
if (modulation!=0) {
chan[c.chan].envHigh|=0x10;
} else {
chan[c.chan].envHigh&=~0x10;
}
writeEnv(4);
break; break;
case DIV_CMD_FDS_MOD_WAVE: { // set modulation wave case DIV_CMD_FDS_MOD_WAVE: { // set modulation wave
if (c.chan!=4) break; if (c.chan!=4) break;
@ -414,6 +432,7 @@ void DivPlatformVB::reset() {
cycles=0; cycles=0;
curChan=-1; curChan=-1;
modulation=0; modulation=0;
modType=false;
memset(modTable,0,32); memset(modTable,0,32);
// set per-channel initial values // set per-channel initial values
for (int i=0; i<6; i++) { for (int i=0; i<6; i++) {

View file

@ -76,6 +76,7 @@ class DivPlatformVB: public DivDispatch {
int tempL; int tempL;
int tempR; int tempR;
unsigned char modulation; unsigned char modulation;
bool modType;
signed char modTable[32]; signed char modTable[32];
VSU* vb; VSU* vb;
unsigned char regPool[0x600]; unsigned char regPool[0x600];