VIC-20: add on/off macro

This commit is contained in:
tildearrow 2023-03-17 16:50:42 -05:00
parent 49c47087e5
commit de2a6c418b
3 changed files with 24 additions and 3 deletions

View file

@ -79,7 +79,7 @@ void DivPlatformVIC20::calcAndWriteOutVol(int ch, int env) {
}
void DivPlatformVIC20::writeOutVol(int ch) {
if (!isMuted[ch] && chan[ch].active) {
if (chan[ch].active) {
rWrite(14,chan[ch].outVol);
}
}
@ -99,6 +99,20 @@ void DivPlatformVIC20::tick(bool sysTick) {
}
chan[i].freqChanged=true;
}
if (chan[i].std.duty.had) {
if (chan[i].onOff!=chan[i].std.duty.val) {
chan[i].onOff=chan[i].std.duty.val;
if (chan[i].active) {
if (chan[i].onOff) {
chan[i].keyOn=true;
chan[i].keyOff=false;
} else {
chan[i].keyOn=false;
chan[i].keyOff=true;
}
}
}
}
if (chan[i].std.wave.had) {
if (chan[i].wave!=chan[i].std.wave.val) {
chan[i].wave=chan[i].std.wave.val&0x0f;
@ -156,6 +170,7 @@ int DivPlatformVIC20::dispatch(DivCommand c) {
chan[c.chan].freqChanged=true;
chan[c.chan].note=c.value;
}
chan[c.chan].onOff=true;
chan[c.chan].active=true;
chan[c.chan].keyOn=true;
chan[c.chan].macroInit(ins);

View file

@ -27,10 +27,12 @@
class DivPlatformVIC20: public DivDispatch {
struct Channel: public SharedChannel<int> {
int wave, waveWriteCycle;
bool onOff;
Channel():
SharedChannel<int>(15),
wave(0),
waveWriteCycle(-1) {}
waveWriteCycle(-1),
onOff(true) {}
};
Channel chan[4];
DivDispatchOscBuffer* oscBuf[4];

View file

@ -5125,7 +5125,7 @@ void FurnaceGUI::drawInsEdit() {
dutyMax=ins->amiga.useSample?0:255;
}
if (ins->type==DIV_INS_TIA || ins->type==DIV_INS_AMIGA || ins->type==DIV_INS_SCC ||
ins->type==DIV_INS_PET || ins->type==DIV_INS_VIC || ins->type==DIV_INS_SEGAPCM ||
ins->type==DIV_INS_PET || ins->type==DIV_INS_SEGAPCM ||
ins->type==DIV_INS_FM || ins->type==DIV_INS_K007232 || ins->type==DIV_INS_GA20 ||
ins->type==DIV_INS_SM8521 || ins->type==DIV_INS_PV1000) {
dutyMax=0;
@ -5142,6 +5142,10 @@ void FurnaceGUI::drawInsEdit() {
dutyLabel="Noise";
dutyMax=1;
}
if (ins->type==DIV_INS_VIC) {
dutyLabel="On/Off";
dutyMax=1;
}
if (ins->type==DIV_INS_SWAN) {
dutyLabel="Noise";
dutyMax=ins->amiga.useSample?0:8;