diff --git a/src/engine/platform/k007232.cpp b/src/engine/platform/k007232.cpp index 7097f186..b4501df7 100644 --- a/src/engine/platform/k007232.cpp +++ b/src/engine/platform/k007232.cpp @@ -146,9 +146,10 @@ void DivPlatformK007232::tick(bool sysTick) { } } if (chan[i].volumeChanged) { + chan[i].resVol=isMuted[i]?0:chan[i].outVol&0xf; if (stereo) { - chan[i].lvol=isMuted[i]?0:(((chan[i].outVol&0xf)*((chan[i].panning>>0)&0xf))/15); - chan[i].rvol=isMuted[i]?0:(((chan[i].outVol&0xf)*((chan[i].panning>>4)&0xf))/15); + chan[i].lvol=((chan[i].resVol&0xf)*((chan[i].panning>>0)&0xf))/15; + chan[i].rvol=((chan[i].resVol&0xf)*((chan[i].panning>>4)&0xf))/15; const int newPan=(chan[i].lvol&0xf)|((chan[i].rvol&0xf)<<4); if (chan[i].prevPan!=newPan) { rWrite(0x10+i,(chan[i].lvol&0xf)|((chan[i].rvol&0xf)<<4)); @@ -156,9 +157,8 @@ void DivPlatformK007232::tick(bool sysTick) { } } else { - chan[i].lvol=chan[i].rvol=isMuted[i]?0:chan[i].outVol&0xf; const unsigned char prevVolume=lastVolume; - lastVolume=(lastVolume&~(0xf<<(i<<2)))|((chan[i].lvol&0xf)<<(i<<2)); + lastVolume=(lastVolume&~(0xf<<(i<<2)))|((chan[i].resVol&0xf)<<(i<<2)); if (prevVolume!=lastVolume) { rWrite(0xc,lastVolume); } diff --git a/src/engine/platform/k007232.h b/src/engine/platform/k007232.h index 4bd6d4f7..ef035946 100644 --- a/src/engine/platform/k007232.h +++ b/src/engine/platform/k007232.h @@ -34,7 +34,7 @@ class DivPlatformK007232: public DivDispatch, public k007232_intf { int note; int panning, prevPan; bool active, insChanged, volumeChanged, freqChanged, keyOn, keyOff, inPorta, setPos; - int vol, outVol, lvol, rvol; + int vol, outVol, resVol, lvol, rvol; int macroVolMul; DivMacroInt std; void macroInit(DivInstrument* which) { @@ -64,6 +64,7 @@ class DivPlatformK007232: public DivDispatch, public k007232_intf { setPos(false), vol(15), outVol(15), + resVol(15), lvol(15), rvol(15), macroVolMul(64) {} diff --git a/src/gui/debug.cpp b/src/gui/debug.cpp index d62fcd5d..165eb390 100644 --- a/src/gui/debug.cpp +++ b/src/gui/debug.cpp @@ -1144,6 +1144,7 @@ void putDispatchChan(void* data, int chanNum, int type) { ImGui::Text(" - prev: %d",ch->prevPan); ImGui::Text("- vol: %.2x",ch->vol); ImGui::Text("- outVol: %.2x",ch->outVol); + ImGui::Text("- resVol: %.2x",ch->resVol); ImGui::Text("- lvol: %.2x",ch->lvol); ImGui::Text("- rvol: %.2x",ch->rvol); ImGui::Text("- macroVolMul: %.2x",ch->macroVolMul);