implement panning macro

except for QSound
This commit is contained in:
tildearrow 2022-04-17 14:15:57 -05:00
parent 5e7a4eae16
commit fc8a130c71
13 changed files with 121 additions and 5 deletions

View file

@ -192,6 +192,11 @@ void DivPlatformGB::tick(bool sysTick) {
if (!chan[i].keyOff) chan[i].keyOn=true; if (!chan[i].keyOff) chan[i].keyOn=true;
} }
} }
if (chan[i].std.panL.had) {
lastPan&=~(0x11<<i);
lastPan|=((chan[i].std.panL.val&1)<<i)|((chan[i].std.panL.val&2)<<(i+3));
rWrite(0x25,procMute());
}
if (chan[i].std.pitch.had) { if (chan[i].std.pitch.had) {
chan[i].freqChanged=true; chan[i].freqChanged=true;
} }

View file

@ -258,6 +258,11 @@ void DivPlatformGenesis::tick(bool sysTick) {
} }
} }
if (chan[i].std.panL.had) {
chan[i].pan=chan[i].std.panL.val&3;
rWrite(chanOffs[i]+ADDR_LRAF,(isMuted[i]?0:(chan[i].pan<<6))|(chan[i].state.fms&7)|((chan[i].state.ams&3)<<4));
}
if (chan[i].std.pitch.had) { if (chan[i].std.pitch.had) {
chan[i].freqChanged=true; chan[i].freqChanged=true;
} }

View file

@ -171,6 +171,20 @@ void DivPlatformLynx::tick(bool sysTick) {
} }
} }
if (chan[i].std.panL.had) {
chan[i].pan&=0x0f;
chan[i].pan|=(chan[i].std.panL.val&15)<<4;
}
if (chan[i].std.panR.had) {
chan[i].pan&=0xf0;
chan[i].pan|=chan[i].std.panR.val&15;
}
if (chan[i].std.panL.had || chan[i].std.panR.had) {
WRITE_ATTEN(i,chan[i].pan);
}
if (chan[i].std.pitch.had) { if (chan[i].std.pitch.had) {
chan[i].freqChanged=true; chan[i].freqChanged=true;
} }

View file

@ -269,6 +269,10 @@ void DivPlatformOPL::tick(bool sysTick) {
} }
} }
if (oplType==3 && chan[i].std.panL.had) {
chan[i].pan=((chan[i].std.panL.val&1)<<1)|((chan[i].std.panL.val&2)>>1);
}
if (chan[i].std.pitch.had) { if (chan[i].std.pitch.had) {
chan[i].freqChanged=true; chan[i].freqChanged=true;
} }
@ -286,7 +290,7 @@ void DivPlatformOPL::tick(bool sysTick) {
chan[i].state.fb=chan[i].std.fb.val; chan[i].state.fb=chan[i].std.fb.val;
} }
if (chan[i].std.alg.had || chan[i].std.fb.had) { if (chan[i].std.alg.had || chan[i].std.fb.had || (oplType==3 && chan[i].std.panL.had)) {
if (isMuted[i]) { if (isMuted[i]) {
rWrite(chanMap[i]+ADDR_LR_FB_ALG,(chan[i].state.alg&1)|(chan[i].state.fb<<1)); rWrite(chanMap[i]+ADDR_LR_FB_ALG,(chan[i].state.alg&1)|(chan[i].state.fb<<1));
if (ops==4) { if (ops==4) {

View file

@ -196,6 +196,17 @@ void DivPlatformPCE::tick(bool sysTick) {
if (!chan[i].keyOff) chan[i].keyOn=true; if (!chan[i].keyOff) chan[i].keyOn=true;
} }
} }
if (chan[i].std.panL.had) {
chan[i].pan&=0x0f;
chan[i].pan|=(chan[i].std.panL.val&15)<<4;
}
if (chan[i].std.panR.had) {
chan[i].pan&=0xf0;
chan[i].pan|=chan[i].std.panR.val&15;
}
if (chan[i].std.panL.had || chan[i].std.panR.had) {
chWrite(i,0x05,isMuted[i]?0:chan[i].pan);
}
if (chan[i].std.pitch.had) { if (chan[i].std.pitch.had) {
chan[i].freqChanged=true; chan[i].freqChanged=true;
} }

View file

@ -166,6 +166,26 @@ void DivPlatformSAA1099::tick(bool sysTick) {
if (chan[i].std.wave.had) { if (chan[i].std.wave.had) {
chan[i].psgMode=chan[i].std.wave.val&3; chan[i].psgMode=chan[i].std.wave.val&3;
} }
if (chan[i].std.panL.had) {
chan[i].pan&=0x0f;
chan[i].pan|=(chan[i].std.panL.val&15)<<4;
}
if (chan[i].std.panR.had) {
chan[i].pan&=0xf0;
chan[i].pan|=chan[i].std.panR.val&15;
}
if (chan[i].std.panL.had || chan[i].std.panR.had) {
if (isMuted[i]) {
rWrite(i,0);
} else {
if (chan[i].std.vol.had) {
if (chan[i].active) rWrite(i,applyPan(chan[i].outVol&15,chan[i].pan));
} else {
if (chan[i].active) rWrite(i,applyPan(chan[i].vol&15,chan[i].pan));
}
}
}
if (chan[i].std.pitch.had) { if (chan[i].std.pitch.had) {
chan[i].freqChanged=true; chan[i].freqChanged=true;
} }

View file

@ -80,9 +80,10 @@ void DivPlatformSegaPCM::tick(bool sysTick) {
for (int i=0; i<16; i++) { for (int i=0; i<16; i++) {
chan[i].std.next(); chan[i].std.next();
if (chan[i].std.vol.had) { // TODO: fix
/*if (chan[i].std.vol.had) {
chan[i].outVol=(chan[i].vol*MIN(127,chan[i].std.vol.val))/127; chan[i].outVol=(chan[i].vol*MIN(127,chan[i].std.vol.val))/127;
} }*/
if (chan[i].std.arp.had) { if (chan[i].std.arp.had) {
if (!chan[i].inPorta) { if (!chan[i].inPorta) {
@ -100,6 +101,20 @@ void DivPlatformSegaPCM::tick(bool sysTick) {
} }
} }
if (chan[i].std.panL.had) {
chan[i].chVolL=chan[i].std.panL.val&127;
if (dumpWrites) {
addWrite(0x10002+(i<<3),chan[i].chVolL);
}
}
if (chan[i].std.panR.had) {
chan[i].chVolR=chan[i].std.panR.val&127;
if (dumpWrites) {
addWrite(0x10003+(i<<3),chan[i].chVolR);
}
}
if (chan[i].std.pitch.had) { if (chan[i].std.pitch.had) {
chan[i].freqChanged=true; chan[i].freqChanged=true;
} }
@ -143,14 +158,17 @@ int DivPlatformSegaPCM::dispatch(DivCommand c) {
if (dumpWrites) { if (dumpWrites) {
addWrite(0x10086+(c.chan<<3),3); addWrite(0x10086+(c.chan<<3),3);
} }
chan[c.chan].std.init(NULL);
break; break;
} }
chan[c.chan].pcm.pos=0; chan[c.chan].pcm.pos=0;
if (c.value!=DIV_NOTE_NULL) { if (c.value!=DIV_NOTE_NULL) {
chan[c.chan].note=c.value;
chan[c.chan].baseFreq=(c.value<<6); chan[c.chan].baseFreq=(c.value<<6);
chan[c.chan].freqChanged=true; chan[c.chan].freqChanged=true;
} }
chan[c.chan].furnacePCM=true; chan[c.chan].furnacePCM=true;
chan[c.chan].std.init(ins);
if (dumpWrites) { // Sega PCM writes if (dumpWrites) { // Sega PCM writes
DivSample* s=parent->getSample(chan[c.chan].pcm.sample); DivSample* s=parent->getSample(chan[c.chan].pcm.sample);
addWrite(0x10086+(c.chan<<3),3+((s->offSegaPCM>>16)<<3)); addWrite(0x10086+(c.chan<<3),3+((s->offSegaPCM>>16)<<3));
@ -167,6 +185,7 @@ int DivPlatformSegaPCM::dispatch(DivCommand c) {
} }
} }
} else { } else {
chan[c.chan].std.init(NULL);
if (c.value!=DIV_NOTE_NULL) { if (c.value!=DIV_NOTE_NULL) {
chan[c.chan].note=c.value; chan[c.chan].note=c.value;
} }
@ -208,6 +227,7 @@ int DivPlatformSegaPCM::dispatch(DivCommand c) {
chan[c.chan].keyOff=true; chan[c.chan].keyOff=true;
chan[c.chan].keyOn=false; chan[c.chan].keyOn=false;
chan[c.chan].active=false; chan[c.chan].active=false;
chan[c.chan].std.init(NULL);
break; break;
case DIV_CMD_NOTE_OFF_ENV: case DIV_CMD_NOTE_OFF_ENV:
chan[c.chan].keyOff=true; chan[c.chan].keyOff=true;

View file

@ -173,6 +173,17 @@ void DivPlatformSwan::tick(bool sysTick) {
chan[i].ws.changeWave1(chan[i].wave); chan[i].ws.changeWave1(chan[i].wave);
} }
} }
if (chan[i].std.panL.had) {
chan[i].pan&=0x0f;
chan[i].pan|=(chan[i].std.panL.val&15)<<4;
}
if (chan[i].std.panR.had) {
chan[i].pan&=0xf0;
chan[i].pan|=chan[i].std.panR.val&15;
}
if (chan[i].std.panL.had || chan[i].std.panR.had) {
calcAndWriteOutVol(i,chan[i].std.vol.will?chan[i].std.vol.val:15);
}
if (chan[i].std.pitch.had) { if (chan[i].std.pitch.had) {
chan[i].freqChanged=true; chan[i].freqChanged=true;
} }

View file

@ -184,6 +184,12 @@ void DivPlatformVERA::tick(bool sysTick) {
if (chan[i].std.wave.had) { if (chan[i].std.wave.had) {
rWriteHi(i,3,chan[i].std.wave.val); rWriteHi(i,3,chan[i].std.wave.val);
} }
if (i<16) {
if (chan[i].std.panL.had) {
chan[i].pan=chan[i].std.panL.val&3;
rWriteHi(i,2,isMuted[i]?0:chan[i].pan);
}
}
if (chan[i].std.pitch.had) { if (chan[i].std.pitch.had) {
chan[i].freqChanged=true; chan[i].freqChanged=true;
} }

View file

@ -372,6 +372,16 @@ void DivPlatformX1_010::tick(bool sysTick) {
} }
} }
} }
if (chan[i].std.panL.had) {
chan[i].pan&=0x0f;
chan[i].pan|=(chan[i].std.panL.val&15)<<4;
chan[i].envChanged=true;
}
if (chan[i].std.panR.had) {
chan[i].pan&=0xf0;
chan[i].pan|=chan[i].std.panR.val&15;
chan[i].envChanged=true;
}
if (chan[i].std.pitch.had) { if (chan[i].std.pitch.had) {
chan[i].freqChanged=true; chan[i].freqChanged=true;
} }

View file

@ -408,6 +408,11 @@ void DivPlatformYM2610::tick(bool sysTick) {
} }
} }
if (chan[i].std.panL.had) {
chan[i].pan=chan[i].std.panL.val&3;
rWrite(chanOffs[i]+ADDR_LRAF,(isMuted[i]?0:(chan[i].pan<<6))|(chan[i].state.fms&7)|((chan[i].state.ams&3)<<4));
}
if (chan[i].std.pitch.had) { if (chan[i].std.pitch.had) {
chan[i].freqChanged=true; chan[i].freqChanged=true;
} }

View file

@ -472,6 +472,11 @@ void DivPlatformYM2610B::tick(bool sysTick) {
} }
} }
if (chan[i].std.panL.had) {
chan[i].pan=chan[i].std.panL.val&3;
rWrite(chanOffs[i]+ADDR_LRAF,(isMuted[i]?0:(chan[i].pan<<6))|(chan[i].state.fms&7)|((chan[i].state.ams&3)<<4));
}
if (chan[i].std.pitch.had) { if (chan[i].std.pitch.had) {
chan[i].freqChanged=true; chan[i].freqChanged=true;
} }

View file

@ -176,7 +176,7 @@ const char* n163UpdateBits[8]={
}; };
const char* panBits[3]={ const char* panBits[3]={
"left", "right", NULL "right", "left", NULL
}; };
const char* oneBit[2]={ const char* oneBit[2]={
@ -2826,7 +2826,7 @@ void FurnaceGUI::drawInsEdit() {
if (ins->type==DIV_INS_AMIGA) { if (ins->type==DIV_INS_AMIGA) {
panMax=127; panMax=127;
} }
if (ins->type==DIV_INS_X1_010 || ins->type==DIV_INS_PCE) { if (ins->type==DIV_INS_X1_010 || ins->type==DIV_INS_PCE || ins->type==DIV_INS_MIKEY || ins->type==DIV_INS_SAA1099) {
panMax=15; panMax=15;
} }