mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-23 13:05:11 +00:00
OPZ: fix muting
This commit is contained in:
parent
6380876b9a
commit
34f7750c27
1 changed files with 64 additions and 50 deletions
|
@ -198,6 +198,9 @@ void DivPlatformTX81Z::tick(bool sysTick) {
|
||||||
for (int j=0; j<4; j++) {
|
for (int j=0; j<4; j++) {
|
||||||
unsigned short baseAddr=chanOffs[i]|opOffs[j];
|
unsigned short baseAddr=chanOffs[i]|opOffs[j];
|
||||||
DivInstrumentFM::Operator& op=chan[i].state.op[j];
|
DivInstrumentFM::Operator& op=chan[i].state.op[j];
|
||||||
|
if (isMuted[i]) {
|
||||||
|
rWrite(baseAddr+ADDR_TL,127);
|
||||||
|
} else {
|
||||||
if (isOutput[chan[i].state.alg][j]) {
|
if (isOutput[chan[i].state.alg][j]) {
|
||||||
rWrite(baseAddr+ADDR_TL,127-(((127-op.tl)*(chan[i].outVol&0x7f))/127));
|
rWrite(baseAddr+ADDR_TL,127-(((127-op.tl)*(chan[i].outVol&0x7f))/127));
|
||||||
} else {
|
} else {
|
||||||
|
@ -205,6 +208,7 @@ void DivPlatformTX81Z::tick(bool sysTick) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (chan[i].std.arp.had) {
|
if (chan[i].std.arp.had) {
|
||||||
if (!chan[i].inPorta) {
|
if (!chan[i].inPorta) {
|
||||||
|
@ -266,11 +270,7 @@ void DivPlatformTX81Z::tick(bool sysTick) {
|
||||||
|
|
||||||
if (chan[i].std.alg.had) {
|
if (chan[i].std.alg.had) {
|
||||||
chan[i].state.alg=chan[i].std.alg.val;
|
chan[i].state.alg=chan[i].std.alg.val;
|
||||||
if (isMuted[i]) {
|
|
||||||
immWrite(chanOffs[i]+ADDR_LR_FB_ALG,(chan[i].state.alg&7)|(chan[i].state.fb<<3)|0x40);
|
|
||||||
} else {
|
|
||||||
immWrite(chanOffs[i]+ADDR_LR_FB_ALG,(chan[i].state.alg&7)|(chan[i].state.fb<<3)|(chan[i].active?0:0x40)|(chan[i].chVolR<<7));
|
immWrite(chanOffs[i]+ADDR_LR_FB_ALG,(chan[i].state.alg&7)|(chan[i].state.fb<<3)|(chan[i].active?0:0x40)|(chan[i].chVolR<<7));
|
||||||
}
|
|
||||||
if (!parent->song.algMacroBehavior) for (int j=0; j<4; j++) {
|
if (!parent->song.algMacroBehavior) for (int j=0; j<4; j++) {
|
||||||
unsigned short baseAddr=chanOffs[i]|opOffs[j];
|
unsigned short baseAddr=chanOffs[i]|opOffs[j];
|
||||||
DivInstrumentFM::Operator& op=chan[i].state.op[j];
|
DivInstrumentFM::Operator& op=chan[i].state.op[j];
|
||||||
|
@ -287,12 +287,8 @@ void DivPlatformTX81Z::tick(bool sysTick) {
|
||||||
}
|
}
|
||||||
if (chan[i].std.fb.had) {
|
if (chan[i].std.fb.had) {
|
||||||
chan[i].state.fb=chan[i].std.fb.val;
|
chan[i].state.fb=chan[i].std.fb.val;
|
||||||
if (isMuted[i]) {
|
|
||||||
immWrite(chanOffs[i]+ADDR_LR_FB_ALG,(chan[i].state.alg&7)|(chan[i].state.fb<<3)|0x40);
|
|
||||||
} else {
|
|
||||||
immWrite(chanOffs[i]+ADDR_LR_FB_ALG,(chan[i].state.alg&7)|(chan[i].state.fb<<3)|(chan[i].active?0:0x40)|(chan[i].chVolR<<7));
|
immWrite(chanOffs[i]+ADDR_LR_FB_ALG,(chan[i].state.alg&7)|(chan[i].state.fb<<3)|(chan[i].active?0:0x40)|(chan[i].chVolR<<7));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (chan[i].std.fms.had) {
|
if (chan[i].std.fms.had) {
|
||||||
chan[i].state.fms=chan[i].std.fms.val;
|
chan[i].state.fms=chan[i].std.fms.val;
|
||||||
rWrite(chanOffs[i]+ADDR_FMS_AMS,((chan[i].state.fms&7)<<4)|(chan[i].state.ams&3));
|
rWrite(chanOffs[i]+ADDR_FMS_AMS,((chan[i].state.fms&7)<<4)|(chan[i].state.ams&3));
|
||||||
|
@ -331,12 +327,16 @@ void DivPlatformTX81Z::tick(bool sysTick) {
|
||||||
}
|
}
|
||||||
if (m.tl.had) {
|
if (m.tl.had) {
|
||||||
op.tl=127-m.tl.val;
|
op.tl=127-m.tl.val;
|
||||||
|
if (isMuted[i]) {
|
||||||
|
rWrite(baseAddr+ADDR_TL,127);
|
||||||
|
} else {
|
||||||
if (isOutput[chan[i].state.alg][j]) {
|
if (isOutput[chan[i].state.alg][j]) {
|
||||||
rWrite(baseAddr+ADDR_TL,127-(((127-op.tl)*(chan[i].outVol&0x7f))/127));
|
rWrite(baseAddr+ADDR_TL,127-(((127-op.tl)*(chan[i].outVol&0x7f))/127));
|
||||||
} else {
|
} else {
|
||||||
rWrite(baseAddr+ADDR_TL,op.tl);
|
rWrite(baseAddr+ADDR_TL,op.tl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (m.rs.had) {
|
if (m.rs.had) {
|
||||||
op.rs=m.rs.val;
|
op.rs=m.rs.val;
|
||||||
rWrite(baseAddr+ADDR_RS_AR,(op.ar&31)|(op.egt<<5)|(op.rs<<6));
|
rWrite(baseAddr+ADDR_RS_AR,(op.ar&31)|(op.egt<<5)|(op.rs<<6));
|
||||||
|
@ -364,12 +364,8 @@ void DivPlatformTX81Z::tick(bool sysTick) {
|
||||||
oldWrites[baseAddr+ADDR_TL]=-1;
|
oldWrites[baseAddr+ADDR_TL]=-1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isMuted[i]) {
|
|
||||||
immWrite(chanOffs[i]+ADDR_LR_FB_ALG,(chan[i].state.alg&7)|(chan[i].state.fb<<3)|0x00);
|
|
||||||
} else {
|
|
||||||
//if (chan[i].keyOn) immWrite(0x08,i);
|
//if (chan[i].keyOn) immWrite(0x08,i);
|
||||||
immWrite(chanOffs[i]+ADDR_LR_FB_ALG,(chan[i].state.alg&7)|(chan[i].state.fb<<3)|0x00|(chan[i].chVolR<<7));
|
immWrite(chanOffs[i]+ADDR_LR_FB_ALG,(chan[i].state.alg&7)|(chan[i].state.fb<<3)|0x00|(chan[i].chVolR<<7));
|
||||||
}
|
|
||||||
if (chan[i].hardReset && chan[i].keyOn) {
|
if (chan[i].hardReset && chan[i].keyOn) {
|
||||||
for (int j=0; j<4; j++) {
|
for (int j=0; j<4; j++) {
|
||||||
unsigned short baseAddr=chanOffs[i]|opOffs[j];
|
unsigned short baseAddr=chanOffs[i]|opOffs[j];
|
||||||
|
@ -411,12 +407,8 @@ void DivPlatformTX81Z::tick(bool sysTick) {
|
||||||
chan[i].freqChanged=false;
|
chan[i].freqChanged=false;
|
||||||
}
|
}
|
||||||
if (chan[i].keyOn) {
|
if (chan[i].keyOn) {
|
||||||
if (isMuted[i]) {
|
|
||||||
immWrite(chanOffs[i]+ADDR_LR_FB_ALG,(chan[i].state.alg&7)|(chan[i].state.fb<<3));
|
|
||||||
} else {
|
|
||||||
//immWrite(0x08,i);
|
//immWrite(0x08,i);
|
||||||
immWrite(chanOffs[i]+ADDR_LR_FB_ALG,(chan[i].state.alg&7)|(chan[i].state.fb<<3)|0x40|(chan[i].chVolR<<7));
|
immWrite(chanOffs[i]+ADDR_LR_FB_ALG,(chan[i].state.alg&7)|(chan[i].state.fb<<3)|0x40|(chan[i].chVolR<<7));
|
||||||
}
|
|
||||||
chan[i].keyOn=false;
|
chan[i].keyOn=false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -424,13 +416,19 @@ void DivPlatformTX81Z::tick(bool sysTick) {
|
||||||
|
|
||||||
void DivPlatformTX81Z::muteChannel(int ch, bool mute) {
|
void DivPlatformTX81Z::muteChannel(int ch, bool mute) {
|
||||||
isMuted[ch]=mute;
|
isMuted[ch]=mute;
|
||||||
// TODO: use volume registers!
|
for (int i=0; i<4; i++) {
|
||||||
/*
|
unsigned short baseAddr=chanOffs[ch]|opOffs[i];
|
||||||
|
DivInstrumentFM::Operator op=chan[ch].state.op[i];
|
||||||
if (isMuted[ch]) {
|
if (isMuted[ch]) {
|
||||||
immWrite(chanOffs[ch]+ADDR_LR_FB_ALG,(chan[ch].state.alg&7)|(chan[ch].state.fb<<3));
|
rWrite(baseAddr+ADDR_TL,127);
|
||||||
} else {
|
} else {
|
||||||
immWrite(chanOffs[ch]+ADDR_LR_FB_ALG,(chan[ch].state.alg&7)|(chan[ch].state.fb<<3)|((chan[ch].chVolL&1)<<6)|((chan[ch].chVolR&1)<<7));
|
if (isOutput[chan[ch].state.alg][i]) {
|
||||||
}*/
|
rWrite(baseAddr+ADDR_TL,127-(((127-op.tl)*(chan[ch].outVol&0x7f))/127));
|
||||||
|
} else {
|
||||||
|
rWrite(baseAddr+ADDR_TL,op.tl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int DivPlatformTX81Z::dispatch(DivCommand c) {
|
int DivPlatformTX81Z::dispatch(DivCommand c) {
|
||||||
|
@ -450,6 +448,9 @@ int DivPlatformTX81Z::dispatch(DivCommand c) {
|
||||||
for (int i=0; i<4; i++) {
|
for (int i=0; i<4; i++) {
|
||||||
unsigned short baseAddr=chanOffs[c.chan]|opOffs[i];
|
unsigned short baseAddr=chanOffs[c.chan]|opOffs[i];
|
||||||
DivInstrumentFM::Operator op=chan[c.chan].state.op[i];
|
DivInstrumentFM::Operator op=chan[c.chan].state.op[i];
|
||||||
|
if (isMuted[c.chan]) {
|
||||||
|
rWrite(baseAddr+ADDR_TL,127);
|
||||||
|
} else {
|
||||||
if (isOutput[chan[c.chan].state.alg][i]) {
|
if (isOutput[chan[c.chan].state.alg][i]) {
|
||||||
if (!chan[c.chan].active || chan[c.chan].insChanged) {
|
if (!chan[c.chan].active || chan[c.chan].insChanged) {
|
||||||
rWrite(baseAddr+ADDR_TL,127-(((127-op.tl)*(chan[c.chan].outVol&0x7f))/127));
|
rWrite(baseAddr+ADDR_TL,127-(((127-op.tl)*(chan[c.chan].outVol&0x7f))/127));
|
||||||
|
@ -459,6 +460,7 @@ int DivPlatformTX81Z::dispatch(DivCommand c) {
|
||||||
rWrite(baseAddr+ADDR_TL,op.tl);
|
rWrite(baseAddr+ADDR_TL,op.tl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (chan[c.chan].insChanged) {
|
if (chan[c.chan].insChanged) {
|
||||||
rWrite(baseAddr+ADDR_MULT_DT,(op.mult&15)|(dtTable[op.dt&7]<<4));
|
rWrite(baseAddr+ADDR_MULT_DT,(op.mult&15)|(dtTable[op.dt&7]<<4));
|
||||||
rWrite(baseAddr+ADDR_RS_AR,(op.ar&31)|(op.egt<<5)|(op.rs<<6));
|
rWrite(baseAddr+ADDR_RS_AR,(op.ar&31)|(op.egt<<5)|(op.rs<<6));
|
||||||
|
@ -512,12 +514,16 @@ int DivPlatformTX81Z::dispatch(DivCommand c) {
|
||||||
for (int i=0; i<4; i++) {
|
for (int i=0; i<4; i++) {
|
||||||
unsigned short baseAddr=chanOffs[c.chan]|opOffs[i];
|
unsigned short baseAddr=chanOffs[c.chan]|opOffs[i];
|
||||||
DivInstrumentFM::Operator& op=chan[c.chan].state.op[i];
|
DivInstrumentFM::Operator& op=chan[c.chan].state.op[i];
|
||||||
|
if (isMuted[c.chan]) {
|
||||||
|
rWrite(baseAddr+ADDR_TL,127);
|
||||||
|
} else {
|
||||||
if (isOutput[chan[c.chan].state.alg][i]) {
|
if (isOutput[chan[c.chan].state.alg][i]) {
|
||||||
rWrite(baseAddr+ADDR_TL,127-(((127-op.tl)*(chan[c.chan].outVol&0x7f))/127));
|
rWrite(baseAddr+ADDR_TL,127-(((127-op.tl)*(chan[c.chan].outVol&0x7f))/127));
|
||||||
} else {
|
} else {
|
||||||
rWrite(baseAddr+ADDR_TL,op.tl);
|
rWrite(baseAddr+ADDR_TL,op.tl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DIV_CMD_GET_VOLUME: {
|
case DIV_CMD_GET_VOLUME: {
|
||||||
|
@ -606,11 +612,15 @@ int DivPlatformTX81Z::dispatch(DivCommand c) {
|
||||||
unsigned short baseAddr=chanOffs[c.chan]|opOffs[orderedOps[c.value]];
|
unsigned short baseAddr=chanOffs[c.chan]|opOffs[orderedOps[c.value]];
|
||||||
DivInstrumentFM::Operator& op=chan[c.chan].state.op[orderedOps[c.value]];
|
DivInstrumentFM::Operator& op=chan[c.chan].state.op[orderedOps[c.value]];
|
||||||
op.tl=c.value2;
|
op.tl=c.value2;
|
||||||
|
if (isMuted[c.chan]) {
|
||||||
|
rWrite(baseAddr+ADDR_TL,127);
|
||||||
|
} else {
|
||||||
if (isOutput[chan[c.chan].state.alg][c.value]) {
|
if (isOutput[chan[c.chan].state.alg][c.value]) {
|
||||||
rWrite(baseAddr+ADDR_TL,127-(((127-op.tl)*(chan[c.chan].outVol&0x7f))/127));
|
rWrite(baseAddr+ADDR_TL,127-(((127-op.tl)*(chan[c.chan].outVol&0x7f))/127));
|
||||||
} else {
|
} else {
|
||||||
rWrite(baseAddr+ADDR_TL,op.tl);
|
rWrite(baseAddr+ADDR_TL,op.tl);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DIV_CMD_FM_AR: {
|
case DIV_CMD_FM_AR: {
|
||||||
|
@ -678,11 +688,15 @@ void DivPlatformTX81Z::forceIns() {
|
||||||
for (int j=0; j<4; j++) {
|
for (int j=0; j<4; j++) {
|
||||||
unsigned short baseAddr=chanOffs[i]|opOffs[j];
|
unsigned short baseAddr=chanOffs[i]|opOffs[j];
|
||||||
DivInstrumentFM::Operator op=chan[i].state.op[j];
|
DivInstrumentFM::Operator op=chan[i].state.op[j];
|
||||||
|
if (isMuted[i]) {
|
||||||
|
rWrite(baseAddr+ADDR_TL,127);
|
||||||
|
} else {
|
||||||
if (isOutput[chan[i].state.alg][j]) {
|
if (isOutput[chan[i].state.alg][j]) {
|
||||||
rWrite(baseAddr+ADDR_TL,127-(((127-op.tl)*(chan[i].outVol&0x7f))/127));
|
rWrite(baseAddr+ADDR_TL,127-(((127-op.tl)*(chan[i].outVol&0x7f))/127));
|
||||||
} else {
|
} else {
|
||||||
rWrite(baseAddr+ADDR_TL,op.tl);
|
rWrite(baseAddr+ADDR_TL,op.tl);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
rWrite(baseAddr+ADDR_MULT_DT,(op.mult&15)|(dtTable[op.dt&7]<<4));
|
rWrite(baseAddr+ADDR_MULT_DT,(op.mult&15)|(dtTable[op.dt&7]<<4));
|
||||||
rWrite(baseAddr+ADDR_RS_AR,(op.ar&31)|(op.egt<<5)|(op.rs<<6));
|
rWrite(baseAddr+ADDR_RS_AR,(op.ar&31)|(op.egt<<5)|(op.rs<<6));
|
||||||
rWrite(baseAddr+ADDR_AM_DR,(op.dr&31)|(op.am<<7));
|
rWrite(baseAddr+ADDR_AM_DR,(op.dr&31)|(op.am<<7));
|
||||||
|
|
Loading…
Reference in a new issue