Reduce duplication
This commit is contained in:
parent
ed779f443a
commit
2339dfe2aa
|
@ -146,9 +146,10 @@ void DivPlatformK007232::tick(bool sysTick) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (chan[i].volumeChanged) {
|
if (chan[i].volumeChanged) {
|
||||||
|
chan[i].resVol=isMuted[i]?0:chan[i].outVol&0xf;
|
||||||
if (stereo) {
|
if (stereo) {
|
||||||
chan[i].lvol=isMuted[i]?0:(((chan[i].outVol&0xf)*((chan[i].panning>>0)&0xf))/15);
|
chan[i].lvol=((chan[i].resVol&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].rvol=((chan[i].resVol&0xf)*((chan[i].panning>>4)&0xf))/15;
|
||||||
const int newPan=(chan[i].lvol&0xf)|((chan[i].rvol&0xf)<<4);
|
const int newPan=(chan[i].lvol&0xf)|((chan[i].rvol&0xf)<<4);
|
||||||
if (chan[i].prevPan!=newPan) {
|
if (chan[i].prevPan!=newPan) {
|
||||||
rWrite(0x10+i,(chan[i].lvol&0xf)|((chan[i].rvol&0xf)<<4));
|
rWrite(0x10+i,(chan[i].lvol&0xf)|((chan[i].rvol&0xf)<<4));
|
||||||
|
@ -156,9 +157,8 @@ void DivPlatformK007232::tick(bool sysTick) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
chan[i].lvol=chan[i].rvol=isMuted[i]?0:chan[i].outVol&0xf;
|
|
||||||
const unsigned char prevVolume=lastVolume;
|
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) {
|
if (prevVolume!=lastVolume) {
|
||||||
rWrite(0xc,lastVolume);
|
rWrite(0xc,lastVolume);
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ class DivPlatformK007232: public DivDispatch, public k007232_intf {
|
||||||
int note;
|
int note;
|
||||||
int panning, prevPan;
|
int panning, prevPan;
|
||||||
bool active, insChanged, volumeChanged, freqChanged, keyOn, keyOff, inPorta, setPos;
|
bool active, insChanged, volumeChanged, freqChanged, keyOn, keyOff, inPorta, setPos;
|
||||||
int vol, outVol, lvol, rvol;
|
int vol, outVol, resVol, lvol, rvol;
|
||||||
int macroVolMul;
|
int macroVolMul;
|
||||||
DivMacroInt std;
|
DivMacroInt std;
|
||||||
void macroInit(DivInstrument* which) {
|
void macroInit(DivInstrument* which) {
|
||||||
|
@ -64,6 +64,7 @@ class DivPlatformK007232: public DivDispatch, public k007232_intf {
|
||||||
setPos(false),
|
setPos(false),
|
||||||
vol(15),
|
vol(15),
|
||||||
outVol(15),
|
outVol(15),
|
||||||
|
resVol(15),
|
||||||
lvol(15),
|
lvol(15),
|
||||||
rvol(15),
|
rvol(15),
|
||||||
macroVolMul(64) {}
|
macroVolMul(64) {}
|
||||||
|
|
|
@ -1144,6 +1144,7 @@ void putDispatchChan(void* data, int chanNum, int type) {
|
||||||
ImGui::Text(" - prev: %d",ch->prevPan);
|
ImGui::Text(" - prev: %d",ch->prevPan);
|
||||||
ImGui::Text("- vol: %.2x",ch->vol);
|
ImGui::Text("- vol: %.2x",ch->vol);
|
||||||
ImGui::Text("- outVol: %.2x",ch->outVol);
|
ImGui::Text("- outVol: %.2x",ch->outVol);
|
||||||
|
ImGui::Text("- resVol: %.2x",ch->resVol);
|
||||||
ImGui::Text("- lvol: %.2x",ch->lvol);
|
ImGui::Text("- lvol: %.2x",ch->lvol);
|
||||||
ImGui::Text("- rvol: %.2x",ch->rvol);
|
ImGui::Text("- rvol: %.2x",ch->rvol);
|
||||||
ImGui::Text("- macroVolMul: %.2x",ch->macroVolMul);
|
ImGui::Text("- macroVolMul: %.2x",ch->macroVolMul);
|
||||||
|
|
Loading…
Reference in a new issue