fix issue #1371
This commit is contained in:
parent
31335b95c9
commit
d240066df8
|
@ -1279,6 +1279,11 @@ DivChannelState* DivEngine::getChanState(int ch) {
|
||||||
return &chan[ch];
|
return &chan[ch];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned short DivEngine::getChanPan(int ch) {
|
||||||
|
if (ch<0 || ch>=chans) return 0;
|
||||||
|
return disCont[dispatchOfChan[ch]].dispatch->getPan(dispatchChanOfChan[ch]);
|
||||||
|
}
|
||||||
|
|
||||||
void* DivEngine::getDispatchChanState(int ch) {
|
void* DivEngine::getDispatchChanState(int ch) {
|
||||||
if (ch<0 || ch>=chans) return NULL;
|
if (ch<0 || ch>=chans) return NULL;
|
||||||
return disCont[dispatchOfChan[ch]].dispatch->getChanState(dispatchChanOfChan[ch]);
|
return disCont[dispatchOfChan[ch]].dispatch->getChanState(dispatchChanOfChan[ch]);
|
||||||
|
|
|
@ -976,6 +976,9 @@ class DivEngine {
|
||||||
// get macro interpreter
|
// get macro interpreter
|
||||||
DivMacroInt* getMacroInt(int chan);
|
DivMacroInt* getMacroInt(int chan);
|
||||||
|
|
||||||
|
// get channel panning
|
||||||
|
unsigned short getChanPan(int chan);
|
||||||
|
|
||||||
// get sample position
|
// get sample position
|
||||||
DivSamplePos getSamplePos(int chan);
|
DivSamplePos getSamplePos(int chan);
|
||||||
|
|
||||||
|
|
|
@ -155,6 +155,7 @@ class DivPlatformOPN: public DivPlatformFMBase {
|
||||||
unsigned int ayDiv;
|
unsigned int ayDiv;
|
||||||
unsigned char csmChan;
|
unsigned char csmChan;
|
||||||
unsigned char lfoValue;
|
unsigned char lfoValue;
|
||||||
|
unsigned char lastExtChPan;
|
||||||
unsigned short ssgVol;
|
unsigned short ssgVol;
|
||||||
unsigned short fmVol;
|
unsigned short fmVol;
|
||||||
bool extSys, useCombo, fbAllOps;
|
bool extSys, useCombo, fbAllOps;
|
||||||
|
@ -175,6 +176,7 @@ class DivPlatformOPN: public DivPlatformFMBase {
|
||||||
ayDiv(a),
|
ayDiv(a),
|
||||||
csmChan(cc),
|
csmChan(cc),
|
||||||
lfoValue(0),
|
lfoValue(0),
|
||||||
|
lastExtChPan(3),
|
||||||
ssgVol(128),
|
ssgVol(128),
|
||||||
fmVol(256),
|
fmVol(256),
|
||||||
extSys(isExtSys),
|
extSys(isExtSys),
|
||||||
|
|
|
@ -1276,7 +1276,7 @@ DivMacroInt* DivPlatformGenesis::getChanMacroInt(int ch) {
|
||||||
|
|
||||||
unsigned short DivPlatformGenesis::getPan(int ch) {
|
unsigned short DivPlatformGenesis::getPan(int ch) {
|
||||||
if (ch>5) ch=5;
|
if (ch>5) ch=5;
|
||||||
return ((chan[ch].pan<<7)&1)|(chan[ch].pan&1);
|
return ((chan[ch].pan&2)<<7)|(chan[ch].pan&1);
|
||||||
}
|
}
|
||||||
|
|
||||||
DivSamplePos DivPlatformGenesis::getSamplePos(int ch) {
|
DivSamplePos DivPlatformGenesis::getSamplePos(int ch) {
|
||||||
|
|
|
@ -159,6 +159,7 @@ int DivPlatformGenesisExt::dispatch(DivCommand c) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rWrite(chanOffs[2]+0xb4,(IS_EXTCH_MUTED?0:(opChan[ch].pan<<6))|(chan[2].state.fms&7)|((chan[2].state.ams&3)<<4));
|
rWrite(chanOffs[2]+0xb4,(IS_EXTCH_MUTED?0:(opChan[ch].pan<<6))|(chan[2].state.fms&7)|((chan[2].state.ams&3)<<4));
|
||||||
|
lastExtChPan=opChan[ch].pan;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DIV_CMD_PITCH: {
|
case DIV_CMD_PITCH: {
|
||||||
|
@ -756,7 +757,7 @@ void DivPlatformGenesisExt::forceIns() {
|
||||||
}
|
}
|
||||||
rWrite(chanOffs[i]+ADDR_FB_ALG,(chan[i].state.alg&7)|(chan[i].state.fb<<3));
|
rWrite(chanOffs[i]+ADDR_FB_ALG,(chan[i].state.alg&7)|(chan[i].state.fb<<3));
|
||||||
if (i==2) {
|
if (i==2) {
|
||||||
rWrite(chanOffs[i]+ADDR_LRAF,(IS_EXTCH_MUTED?0:(opChan[0].pan<<6))|(chan[i].state.fms&7)|((chan[i].state.ams&3)<<4));
|
rWrite(chanOffs[i]+ADDR_LRAF,(IS_EXTCH_MUTED?0:(lastExtChPan<<6))|(chan[i].state.fms&7)|((chan[i].state.ams&3)<<4));
|
||||||
} else {
|
} else {
|
||||||
rWrite(chanOffs[i]+ADDR_LRAF,(IS_REALLY_MUTED(i)?0:(chan[i].pan<<6))|(chan[i].state.fms&7)|((chan[i].state.ams&3)<<4));
|
rWrite(chanOffs[i]+ADDR_LRAF,(IS_REALLY_MUTED(i)?0:(chan[i].pan<<6))|(chan[i].state.fms&7)|((chan[i].state.ams&3)<<4));
|
||||||
}
|
}
|
||||||
|
@ -803,7 +804,13 @@ DivMacroInt* DivPlatformGenesisExt::getChanMacroInt(int ch) {
|
||||||
unsigned short DivPlatformGenesisExt::getPan(int ch) {
|
unsigned short DivPlatformGenesisExt::getPan(int ch) {
|
||||||
if (ch==csmChan) return 0;
|
if (ch==csmChan) return 0;
|
||||||
if (ch>=4+extChanOffs) return DivPlatformGenesis::getPan(ch-3);
|
if (ch>=4+extChanOffs) return DivPlatformGenesis::getPan(ch-3);
|
||||||
if (ch>=extChanOffs) return ((opChan[0].pan<<7)&1)|(opChan[0].pan&1);
|
if (ch>=extChanOffs) {
|
||||||
|
if (extMode) {
|
||||||
|
return ((lastExtChPan&2)<<7)|(lastExtChPan&1);
|
||||||
|
} else {
|
||||||
|
return DivPlatformGenesis::getPan(extChanOffs);
|
||||||
|
}
|
||||||
|
}
|
||||||
return DivPlatformGenesis::getPan(ch);
|
return DivPlatformGenesis::getPan(ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -823,6 +830,8 @@ void DivPlatformGenesisExt::reset() {
|
||||||
opChan[i].outVol=127;
|
opChan[i].outVol=127;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lastExtChPan=3;
|
||||||
|
|
||||||
// channel 3 mode
|
// channel 3 mode
|
||||||
immWrite(0x27,0x40);
|
immWrite(0x27,0x40);
|
||||||
extMode=true;
|
extMode=true;
|
||||||
|
|
|
@ -1566,14 +1566,14 @@ DivMacroInt* DivPlatformOPL::getChanMacroInt(int ch) {
|
||||||
|
|
||||||
unsigned short DivPlatformOPL::getPan(int ch) {
|
unsigned short DivPlatformOPL::getPan(int ch) {
|
||||||
if (totalOutputs<=1) return 0;
|
if (totalOutputs<=1) return 0;
|
||||||
if (chan[ch&(~1)].fourOp) {
|
/*if (chan[ch&(~1)].fourOp) {
|
||||||
if (ch&1) {
|
if (ch&1) {
|
||||||
return ((chan[ch-1].pan<<7)&1)|(chan[ch-1].pan&1);
|
return ((chan[ch-1].pan&2)<<7)|(chan[ch-1].pan&1);
|
||||||
} else {
|
} else {
|
||||||
return ((chan[ch+1].pan<<7)&1)|(chan[ch+1].pan&1);
|
return ((chan[ch+1].pan&2)<<7)|(chan[ch+1].pan&1);
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
return ((chan[ch].pan<<7)&1)|(chan[ch].pan&1);
|
return ((chan[ch].pan&1)<<8)|((chan[ch].pan&2)>>1);
|
||||||
}
|
}
|
||||||
|
|
||||||
DivDispatchOscBuffer* DivPlatformOPL::getOscBuffer(int ch) {
|
DivDispatchOscBuffer* DivPlatformOPL::getOscBuffer(int ch) {
|
||||||
|
|
|
@ -1463,7 +1463,7 @@ DivMacroInt* DivPlatformYM2608::getChanMacroInt(int ch) {
|
||||||
|
|
||||||
unsigned short DivPlatformYM2608::getPan(int ch) {
|
unsigned short DivPlatformYM2608::getPan(int ch) {
|
||||||
if (ch>=psgChanOffs && ch<adpcmAChanOffs) return 0;
|
if (ch>=psgChanOffs && ch<adpcmAChanOffs) return 0;
|
||||||
return ((chan[ch].pan<<7)&1)|(chan[ch].pan&1);
|
return ((chan[ch].pan&2)<<7)|(chan[ch].pan&1);
|
||||||
}
|
}
|
||||||
|
|
||||||
DivDispatchOscBuffer* DivPlatformYM2608::getOscBuffer(int ch) {
|
DivDispatchOscBuffer* DivPlatformYM2608::getOscBuffer(int ch) {
|
||||||
|
|
|
@ -156,6 +156,7 @@ int DivPlatformYM2608Ext::dispatch(DivCommand c) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rWrite(chanOffs[2]+0xb4,(IS_EXTCH_MUTED?0:(opChan[ch].pan<<6))|(chan[2].state.fms&7)|((chan[2].state.ams&3)<<4));
|
rWrite(chanOffs[2]+0xb4,(IS_EXTCH_MUTED?0:(opChan[ch].pan<<6))|(chan[2].state.fms&7)|((chan[2].state.ams&3)<<4));
|
||||||
|
lastExtChPan=opChan[ch].pan;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DIV_CMD_PITCH: {
|
case DIV_CMD_PITCH: {
|
||||||
|
@ -752,7 +753,13 @@ DivMacroInt* DivPlatformYM2608Ext::getChanMacroInt(int ch) {
|
||||||
|
|
||||||
unsigned short DivPlatformYM2608Ext::getPan(int ch) {
|
unsigned short DivPlatformYM2608Ext::getPan(int ch) {
|
||||||
if (ch>=4+extChanOffs) return DivPlatformYM2608::getPan(ch-3);
|
if (ch>=4+extChanOffs) return DivPlatformYM2608::getPan(ch-3);
|
||||||
if (ch>=extChanOffs) return ((opChan[0].pan<<7)&1)|(opChan[0].pan&1);
|
if (ch>=extChanOffs) {
|
||||||
|
if (extMode) {
|
||||||
|
return ((lastExtChPan&2)<<7)|(lastExtChPan&1);
|
||||||
|
} else {
|
||||||
|
return DivPlatformYM2608::getPan(extChanOffs);
|
||||||
|
}
|
||||||
|
}
|
||||||
return DivPlatformYM2608::getPan(ch);
|
return DivPlatformYM2608::getPan(ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -772,7 +779,9 @@ void DivPlatformYM2608Ext::reset() {
|
||||||
opChan[i].outVol=127;
|
opChan[i].outVol=127;
|
||||||
}
|
}
|
||||||
|
|
||||||
// channel 2 mode
|
lastExtChPan=3;
|
||||||
|
|
||||||
|
// channel 3 mode
|
||||||
immWrite(0x27,0x40);
|
immWrite(0x27,0x40);
|
||||||
extMode=true;
|
extMode=true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1423,7 +1423,7 @@ DivMacroInt* DivPlatformYM2610::getChanMacroInt(int ch) {
|
||||||
|
|
||||||
unsigned short DivPlatformYM2610::getPan(int ch) {
|
unsigned short DivPlatformYM2610::getPan(int ch) {
|
||||||
if (ch>=psgChanOffs && ch<adpcmAChanOffs) return 0;
|
if (ch>=psgChanOffs && ch<adpcmAChanOffs) return 0;
|
||||||
return ((chan[ch].pan<<7)&1)|(chan[ch].pan&1);
|
return ((chan[ch].pan&2)<<7)|(chan[ch].pan&1);
|
||||||
}
|
}
|
||||||
|
|
||||||
DivDispatchOscBuffer* DivPlatformYM2610::getOscBuffer(int ch) {
|
DivDispatchOscBuffer* DivPlatformYM2610::getOscBuffer(int ch) {
|
||||||
|
|
|
@ -1490,7 +1490,7 @@ DivMacroInt* DivPlatformYM2610B::getChanMacroInt(int ch) {
|
||||||
|
|
||||||
unsigned short DivPlatformYM2610B::getPan(int ch) {
|
unsigned short DivPlatformYM2610B::getPan(int ch) {
|
||||||
if (ch>=psgChanOffs && ch<adpcmAChanOffs) return 0;
|
if (ch>=psgChanOffs && ch<adpcmAChanOffs) return 0;
|
||||||
return ((chan[ch].pan<<7)&1)|(chan[ch].pan&1);
|
return ((chan[ch].pan&2)<<7)|(chan[ch].pan&1);
|
||||||
}
|
}
|
||||||
|
|
||||||
DivDispatchOscBuffer* DivPlatformYM2610B::getOscBuffer(int ch) {
|
DivDispatchOscBuffer* DivPlatformYM2610B::getOscBuffer(int ch) {
|
||||||
|
|
|
@ -152,6 +152,7 @@ int DivPlatformYM2610BExt::dispatch(DivCommand c) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rWrite(chanOffs[extChanOffs]+0xb4,(IS_EXTCH_MUTED?0:(opChan[ch].pan<<6))|(chan[extChanOffs].state.fms&7)|((chan[extChanOffs].state.ams&3)<<4));
|
rWrite(chanOffs[extChanOffs]+0xb4,(IS_EXTCH_MUTED?0:(opChan[ch].pan<<6))|(chan[extChanOffs].state.fms&7)|((chan[extChanOffs].state.ams&3)<<4));
|
||||||
|
lastExtChPan=opChan[ch].pan;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DIV_CMD_PITCH: {
|
case DIV_CMD_PITCH: {
|
||||||
|
@ -695,7 +696,7 @@ void DivPlatformYM2610BExt::forceIns() {
|
||||||
}
|
}
|
||||||
rWrite(chanOffs[i]+ADDR_FB_ALG,(chan[i].state.alg&7)|(chan[i].state.fb<<3));
|
rWrite(chanOffs[i]+ADDR_FB_ALG,(chan[i].state.alg&7)|(chan[i].state.fb<<3));
|
||||||
if (i==extChanOffs) {
|
if (i==extChanOffs) {
|
||||||
rWrite(chanOffs[i]+ADDR_LRAF,(IS_EXTCH_MUTED?0:(opChan[0].pan<<6))|(chan[i].state.fms&7)|((chan[i].state.ams&3)<<4));
|
rWrite(chanOffs[i]+ADDR_LRAF,(IS_EXTCH_MUTED?0:(lastExtChPan<<6))|(chan[i].state.fms&7)|((chan[i].state.ams&3)<<4));
|
||||||
} else {
|
} else {
|
||||||
rWrite(chanOffs[i]+ADDR_LRAF,(isMuted[i]?0:(chan[i].pan<<6))|(chan[i].state.fms&7)|((chan[i].state.ams&3)<<4));
|
rWrite(chanOffs[i]+ADDR_LRAF,(isMuted[i]?0:(chan[i].pan<<6))|(chan[i].state.fms&7)|((chan[i].state.ams&3)<<4));
|
||||||
}
|
}
|
||||||
|
@ -742,7 +743,13 @@ DivMacroInt* DivPlatformYM2610BExt::getChanMacroInt(int ch) {
|
||||||
|
|
||||||
unsigned short DivPlatformYM2610BExt::getPan(int ch) {
|
unsigned short DivPlatformYM2610BExt::getPan(int ch) {
|
||||||
if (ch>=4+extChanOffs) return DivPlatformYM2610B::getPan(ch-3);
|
if (ch>=4+extChanOffs) return DivPlatformYM2610B::getPan(ch-3);
|
||||||
if (ch>=extChanOffs) return ((opChan[0].pan<<7)&1)|(opChan[0].pan&1);
|
if (ch>=extChanOffs) {
|
||||||
|
if (extMode) {
|
||||||
|
return ((lastExtChPan&2)<<7)|(lastExtChPan&1);
|
||||||
|
} else {
|
||||||
|
return DivPlatformYM2610B::getPan(extChanOffs);
|
||||||
|
}
|
||||||
|
}
|
||||||
return DivPlatformYM2610B::getPan(ch);
|
return DivPlatformYM2610B::getPan(ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -762,7 +769,9 @@ void DivPlatformYM2610BExt::reset() {
|
||||||
opChan[i].outVol=127;
|
opChan[i].outVol=127;
|
||||||
}
|
}
|
||||||
|
|
||||||
// channel 2 mode
|
lastExtChPan=3;
|
||||||
|
|
||||||
|
// channel 3 mode
|
||||||
immWrite(0x27,0x40);
|
immWrite(0x27,0x40);
|
||||||
extMode=true;
|
extMode=true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -152,6 +152,7 @@ int DivPlatformYM2610Ext::dispatch(DivCommand c) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rWrite(chanOffs[extChanOffs]+0xb4,(IS_EXTCH_MUTED?0:(opChan[ch].pan<<6))|(chan[extChanOffs].state.fms&7)|((chan[extChanOffs].state.ams&3)<<4));
|
rWrite(chanOffs[extChanOffs]+0xb4,(IS_EXTCH_MUTED?0:(opChan[ch].pan<<6))|(chan[extChanOffs].state.fms&7)|((chan[extChanOffs].state.ams&3)<<4));
|
||||||
|
lastExtChPan=opChan[ch].pan;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DIV_CMD_PITCH: {
|
case DIV_CMD_PITCH: {
|
||||||
|
@ -695,7 +696,7 @@ void DivPlatformYM2610Ext::forceIns() {
|
||||||
}
|
}
|
||||||
rWrite(chanOffs[i]+ADDR_FB_ALG,(chan[i].state.alg&7)|(chan[i].state.fb<<3));
|
rWrite(chanOffs[i]+ADDR_FB_ALG,(chan[i].state.alg&7)|(chan[i].state.fb<<3));
|
||||||
if (i==extChanOffs) {
|
if (i==extChanOffs) {
|
||||||
rWrite(chanOffs[i]+ADDR_LRAF,(IS_EXTCH_MUTED?0:(opChan[0].pan<<6))|(chan[i].state.fms&7)|((chan[i].state.ams&3)<<4));
|
rWrite(chanOffs[i]+ADDR_LRAF,(IS_EXTCH_MUTED?0:(lastExtChPan<<6))|(chan[i].state.fms&7)|((chan[i].state.ams&3)<<4));
|
||||||
} else {
|
} else {
|
||||||
rWrite(chanOffs[i]+ADDR_LRAF,(isMuted[i]?0:(chan[i].pan<<6))|(chan[i].state.fms&7)|((chan[i].state.ams&3)<<4));
|
rWrite(chanOffs[i]+ADDR_LRAF,(isMuted[i]?0:(chan[i].pan<<6))|(chan[i].state.fms&7)|((chan[i].state.ams&3)<<4));
|
||||||
}
|
}
|
||||||
|
@ -742,7 +743,13 @@ DivMacroInt* DivPlatformYM2610Ext::getChanMacroInt(int ch) {
|
||||||
|
|
||||||
unsigned short DivPlatformYM2610Ext::getPan(int ch) {
|
unsigned short DivPlatformYM2610Ext::getPan(int ch) {
|
||||||
if (ch>=4+extChanOffs) return DivPlatformYM2610::getPan(ch-3);
|
if (ch>=4+extChanOffs) return DivPlatformYM2610::getPan(ch-3);
|
||||||
if (ch>=extChanOffs) return ((opChan[0].pan<<7)&1)|(opChan[0].pan&1);
|
if (ch>=extChanOffs) {
|
||||||
|
if (extMode) {
|
||||||
|
return ((lastExtChPan&2)<<7)|(lastExtChPan&1);
|
||||||
|
} else {
|
||||||
|
return DivPlatformYM2610::getPan(extChanOffs);
|
||||||
|
}
|
||||||
|
}
|
||||||
return DivPlatformYM2610::getPan(ch);
|
return DivPlatformYM2610::getPan(ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -762,6 +769,8 @@ void DivPlatformYM2610Ext::reset() {
|
||||||
opChan[i].outVol=127;
|
opChan[i].outVol=127;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lastExtChPan=3;
|
||||||
|
|
||||||
// channel 2 mode
|
// channel 2 mode
|
||||||
immWrite(0x27,0x40);
|
immWrite(0x27,0x40);
|
||||||
extMode=true;
|
extMode=true;
|
||||||
|
|
|
@ -800,13 +800,14 @@ void FurnaceGUI::drawPattern() {
|
||||||
|
|
||||||
if (e->isRunning()) {
|
if (e->isRunning()) {
|
||||||
DivChannelState* cs=e->getChanState(i);
|
DivChannelState* cs=e->getChanState(i);
|
||||||
float stereoPan=(float)(e->convertPanSplitToLinearLR(cs->panL,cs->panR,256)-128)/128.0;
|
unsigned short chanPan=e->getChanPan(i);
|
||||||
|
float stereoPan=(float)(e->convertPanSplitToLinear(chanPan,8,256)-128)/128.0;
|
||||||
switch (settings.channelVolStyle) {
|
switch (settings.channelVolStyle) {
|
||||||
case 1: // simple
|
case 1: // simple
|
||||||
xRight=((float)(e->getChanState(i)->volume>>8)/(float)e->getMaxVolumeChan(i))*0.9+(keyHit1[i]*0.1f);
|
xRight=((float)(cs->volume>>8)/(float)e->getMaxVolumeChan(i))*0.9+(keyHit1[i]*0.1f);
|
||||||
break;
|
break;
|
||||||
case 2: { // stereo
|
case 2: { // stereo
|
||||||
float amount=((float)(e->getChanState(i)->volume>>8)/(float)e->getMaxVolumeChan(i))*0.4+(keyHit1[i]*0.1f);
|
float amount=((float)(cs->volume>>8)/(float)e->getMaxVolumeChan(i))*0.4+(keyHit1[i]*0.1f);
|
||||||
xRight=0.5+amount*(1.0+MIN(0.0,stereoPan));
|
xRight=0.5+amount*(1.0+MIN(0.0,stereoPan));
|
||||||
xLeft=0.5-amount*(1.0-MAX(0.0,stereoPan));
|
xLeft=0.5-amount*(1.0-MAX(0.0,stereoPan));
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue