QSound: implement panning macro - PLEASE READ

the panning strategy for QSound has changed!
it's now 08xy where x is left and y is right (muting is not possible though!)
this makes it consistent with other chips, plus QSound's pan range was
32 anyway

in order to toggle the QSound effect use effect 12xx
This commit is contained in:
tildearrow 2022-04-28 23:58:11 -05:00
parent 2ac0e8af42
commit 5567746e0b
10 changed files with 87 additions and 11 deletions

View file

@ -257,6 +257,9 @@ const char* DivPlatformQSound::getEffectName(unsigned char effect) {
case 0x11:
return "11xx: Set channel echo level (00 to FF)";
break;
case 0x12:
return "12xx: Toggle QSound algorithm (0: disabled; 1: enabled)";
break;
default:
if ((effect & 0xf0) == 0x30) {
return "3xxx: Set echo delay buffer length (000 to AA5)";
@ -335,6 +338,15 @@ void DivPlatformQSound::tick(bool sysTick) {
}
chan[i].freqChanged=true;
}
if (chan[i].std.panL.had) { // panning
chan[i].panning=chan[i].std.panL.val+16;
}
if (chan[i].std.panR.had) { // surround
chan[i].surround=chan[i].std.panR.val;
}
if (chan[i].std.panL.had || chan[i].std.panR.had) {
immWrite(Q1_PAN+i,chan[i].panning+0x110+(chan[i].surround?0:0x30));
}
if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) {
//DivInstrument* ins=parent->getIns(chan[i].ins,DIV_INS_AMIGA);
chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,false,2,chan[i].pitch2);
@ -429,7 +441,8 @@ int DivPlatformQSound::dispatch(DivCommand c) {
return chan[c.chan].outVol;
break;
case DIV_CMD_PANNING:
immWrite(Q1_PAN+c.chan, c.value + 0x110);
chan[c.chan].panning=parent->convertPanSplitToLinear(c.value,4,32);
immWrite(Q1_PAN+c.chan,chan[c.chan].panning+0x110+(chan[c.chan].surround?0:0x30));
break;
case DIV_CMD_QSOUND_ECHO_LEVEL:
immWrite(Q1_ECHO+c.chan, c.value << 7);
@ -440,6 +453,10 @@ int DivPlatformQSound::dispatch(DivCommand c) {
case DIV_CMD_QSOUND_ECHO_DELAY:
immWrite(Q1_ECHO_LENGTH, (c.value > 2725 ? 0xfff : 0xfff - (2725 - c.value)));
break;
case DIV_CMD_QSOUND_SURROUND:
chan[c.chan].surround=c.value;
immWrite(Q1_PAN+c.chan,chan[c.chan].panning+0x110+(chan[c.chan].surround?0:0x30));
break;
case DIV_CMD_PITCH:
chan[c.chan].pitch=c.value;
chan[c.chan].freqChanged=true;