ES5506: I am blowing up now

This commit is contained in:
tildearrow 2023-02-12 02:02:22 -05:00
parent c9eb4482b0
commit 11154923b0
2 changed files with 17 additions and 16 deletions

View file

@ -190,7 +190,8 @@ void DivPlatformES5506::tick(bool sysTick) {
signed int k1=chan[i].k1Prev,k2=chan[i].k2Prev;
// volume/panning macros
if (chan[i].std.vol.had) {
const unsigned int nextVol=VOL_SCALE_LOG((0xfff*chan[i].vol)/0xff,(0xfff*(unsigned int)chan[i].std.vol.val)/chan[i].volMacroMax,0xfff);
const int nextVol=VOL_SCALE_LOG((0xfff*chan[i].vol)/0xff,(0xfff*chan[i].std.vol.val)/chan[i].volMacroMax,0xfff);
logV("nextVol[%d]: %d (%d,%d,%d)",i,nextVol,chan[i].vol,chan[i].std.vol.val,chan[i].volMacroMax);
if (chan[i].outVol!=nextVol) {
chan[i].outVol=nextVol;
chan[i].volChanged.lVol=1;
@ -198,14 +199,14 @@ void DivPlatformES5506::tick(bool sysTick) {
}
}
if (chan[i].std.panL.had) {
const unsigned int nextLVol=VOL_SCALE_LOG((0xfff*chan[i].lVol)/0xff,(0xfff*(unsigned int)chan[i].std.panL.val)/chan[i].panMacroMax,0xfff);
const int nextLVol=VOL_SCALE_LOG((0xfff*chan[i].lVol)/0xff,(0xfff*chan[i].std.panL.val)/chan[i].panMacroMax,0xfff);
if (chan[i].outLVol!=nextLVol) {
chan[i].outLVol=nextLVol;
chan[i].volChanged.lVol=1;
}
}
if (chan[i].std.panR.had) {
const unsigned int nextRVol=VOL_SCALE_LOG((0xfff*chan[i].rVol)/0xff,(0xfff*(unsigned int)chan[i].std.panR.val)/chan[i].panMacroMax,0xfff);
const int nextRVol=VOL_SCALE_LOG((0xfff*chan[i].rVol)/0xff,(0xfff*chan[i].std.panR.val)/chan[i].panMacroMax,0xfff);
if (chan[i].outRVol!=nextRVol) {
chan[i].outRVol=nextRVol;
chan[i].volChanged.rVol=1;
@ -790,7 +791,7 @@ int DivPlatformES5506::dispatch(DivCommand c) {
}
break;
case DIV_CMD_VOLUME:
if (chan[c.chan].vol!=(unsigned int)(c.value)) {
if (chan[c.chan].vol!=c.value) {
chan[c.chan].vol=c.value;
if (!chan[c.chan].std.vol.has) {
chan[c.chan].outVol=(0xfff*c.value)/0xff;
@ -807,7 +808,7 @@ int DivPlatformES5506::dispatch(DivCommand c) {
chan[c.chan].volChanged.ca=1;
}
// Left volume
if (chan[c.chan].lVol!=(unsigned int)(c.value)) {
if (chan[c.chan].lVol!=c.value) {
chan[c.chan].lVol=c.value;
if (!chan[c.chan].std.panL.has) {
chan[c.chan].outLVol=(0xfff*c.value)/0xff;
@ -815,7 +816,7 @@ int DivPlatformES5506::dispatch(DivCommand c) {
}
}
// Right volume
if (chan[c.chan].rVol!=(unsigned int)(c.value2)) {
if (chan[c.chan].rVol!=c.value2) {
chan[c.chan].rVol=c.value2;
if (!chan[c.chan].std.panR.has) {
chan[c.chan].outRVol=(0xfff*c.value2)/0xff;
@ -832,20 +833,20 @@ int DivPlatformES5506::dispatch(DivCommand c) {
}
if ((c.value&1)==0) {
// Left volume
if (chan[c.chan].lVol!=(unsigned int)(c.value2)) {
if (chan[c.chan].lVol!=c.value2) {
chan[c.chan].lVol=c.value2;
if (!chan[c.chan].std.panL.has) {
chan[c.chan].outLVol=(0xffff*c.value2)/0xff;
chan[c.chan].outLVol=(0xfff*c.value2)/0xff;
chan[c.chan].volChanged.lVol=1;
}
}
}
else if ((c.value&1)==1) {
// Right volume
if (chan[c.chan].rVol!=(unsigned int)(c.value2)) {
if (chan[c.chan].rVol!=c.value2) {
chan[c.chan].rVol=c.value2;
if (!chan[c.chan].std.panR.has) {
chan[c.chan].outRVol=(0xffff*c.value2)/0xff;
chan[c.chan].outRVol=(0xfff*c.value2)/0xff;
chan[c.chan].volChanged.rVol=1;
}
}