diff --git a/src/engine/engine.cpp b/src/engine/engine.cpp index f629ad53..de4a6ea4 100644 --- a/src/engine/engine.cpp +++ b/src/engine/engine.cpp @@ -820,13 +820,19 @@ bool DivEngine::init(String outName) { if (dispatch->isStereo()) { for (int i=0; i16383) bbOut[0][i]=16383; + ilBuffer[i<<1]=bbOut[0][i]*2; + if (bbOut[1][i]<-16384) bbOut[1][i]=-16384; + if (bbOut[1][i]>16383) bbOut[1][i]=16383; + ilBuffer[1+(i<<1)]=bbOut[1][i]*2; } } else { for (int i=0; i16383) bbOut[0][i]=16383; + ilBuffer[i<<1]=bbOut[0][i]*2; + ilBuffer[1+(i<<1)]=bbOut[0][i]*2; } } diff --git a/src/engine/macroInt.cpp b/src/engine/macroInt.cpp index c401656d..9aae5a1d 100644 --- a/src/engine/macroInt.cpp +++ b/src/engine/macroInt.cpp @@ -89,18 +89,22 @@ void DivMacroInt::init(DivInstrument* which) { if (ins->std.volMacroLen>0) { hadVol=true; hasVol=true; + willVol=true; } if (ins->std.arpMacroLen>0) { hadArp=true; hasArp=true; + willArp=true; } if (ins->std.dutyMacroLen>0) { hadDuty=true; hasDuty=true; + willDuty=true; } if (ins->std.waveMacroLen>0) { hadWave=true; hasWave=true; + willWave=true; } if (ins->std.arpMacroMode) { diff --git a/src/engine/macroInt.h b/src/engine/macroInt.h index 2b8d41a7..89412c69 100644 --- a/src/engine/macroInt.h +++ b/src/engine/macroInt.h @@ -11,6 +11,7 @@ class DivMacroInt { bool hasVol, hasArp, hasDuty, hasWave; bool hadVol, hadArp, hadDuty, hadWave; bool finishedVol, finishedArp, finishedDuty, finishedWave; + bool willVol, willArp, willDuty, willWave; bool arpMode; void next(); void init(DivInstrument* which); @@ -36,6 +37,10 @@ class DivMacroInt { finishedArp(false), finishedDuty(false), finishedWave(false), + willVol(false), + willArp(false), + willDuty(false), + willWave(false), arpMode(false) {} }; diff --git a/src/engine/platform/c64.cpp b/src/engine/platform/c64.cpp index 3216be2d..458c28fd 100644 --- a/src/engine/platform/c64.cpp +++ b/src/engine/platform/c64.cpp @@ -190,7 +190,7 @@ int DivPlatformC64::dispatch(DivCommand c) { sid.write(c.chan*7+4,(chan[c.chan].wave<<4)|(chan[c.chan].ring<<2)|(chan[c.chan].sync<<1)|chan[c.chan].active); break; case DIV_CMD_LEGATO: - chan[c.chan].baseFreq=round(FREQ_BASE*pow(2.0f,((float)(c.value+((!chan[c.chan].std.arpMode)?(chan[c.chan].std.arp-12):(0)))/12.0f))); + chan[c.chan].baseFreq=round(FREQ_BASE*pow(2.0f,((float)(c.value+((chan[c.chan].std.willArp && !chan[c.chan].std.arpMode)?(chan[c.chan].std.arp-12):(0)))/12.0f))); chan[c.chan].freqChanged=true; chan[c.chan].note=c.value; break; diff --git a/src/engine/platform/gb.cpp b/src/engine/platform/gb.cpp index b04b1a33..a0f1349e 100644 --- a/src/engine/platform/gb.cpp +++ b/src/engine/platform/gb.cpp @@ -238,7 +238,7 @@ int DivPlatformGB::dispatch(DivCommand c) { } case DIV_CMD_LEGATO: if (c.chan==3) break; - chan[c.chan].baseFreq=round(FREQ_BASE/pow(2.0f,((float)(c.value+((!chan[c.chan].std.arpMode)?(chan[c.chan].std.arp-12):(0)))/12.0f))); + chan[c.chan].baseFreq=round(FREQ_BASE/pow(2.0f,((float)(c.value+((chan[c.chan].std.willArp && !chan[c.chan].std.arpMode)?(chan[c.chan].std.arp-12):(0)))/12.0f))); chan[c.chan].freqChanged=true; chan[c.chan].note=c.value; break; diff --git a/src/engine/platform/nes.cpp b/src/engine/platform/nes.cpp index a978ae9b..a91f7827 100644 --- a/src/engine/platform/nes.cpp +++ b/src/engine/platform/nes.cpp @@ -250,7 +250,7 @@ int DivPlatformNES::dispatch(DivCommand c) { } case DIV_CMD_LEGATO: if (c.chan==3) break; - chan[c.chan].baseFreq=round(FREQ_BASE/pow(2.0f,((float)(c.value+((!chan[c.chan].std.arpMode)?(chan[c.chan].std.arp-12):(0)))/12.0f))); + chan[c.chan].baseFreq=round(FREQ_BASE/pow(2.0f,((float)(c.value+((chan[c.chan].std.willArp && !chan[c.chan].std.arpMode)?(chan[c.chan].std.arp-12):(0)))/12.0f))); chan[c.chan].freqChanged=true; chan[c.chan].note=c.value; break; diff --git a/src/engine/platform/pce.cpp b/src/engine/platform/pce.cpp index 2f5c1ab8..f0a07ce2 100644 --- a/src/engine/platform/pce.cpp +++ b/src/engine/platform/pce.cpp @@ -235,7 +235,7 @@ int DivPlatformPCE::dispatch(DivCommand c) { break; } case DIV_CMD_LEGATO: - chan[c.chan].baseFreq=round(FREQ_BASE/pow(2.0f,((float)(c.value+((!chan[c.chan].std.arpMode)?(chan[c.chan].std.arp-12):(0)))/12.0f))); + chan[c.chan].baseFreq=round(FREQ_BASE/pow(2.0f,((float)(c.value+((chan[c.chan].std.willArp && !chan[c.chan].std.arpMode)?(chan[c.chan].std.arp-12):(0)))/12.0f))); chan[c.chan].freqChanged=true; chan[c.chan].note=c.value; break; diff --git a/src/engine/platform/sms.cpp b/src/engine/platform/sms.cpp index 94ffdcc8..5d69a78b 100644 --- a/src/engine/platform/sms.cpp +++ b/src/engine/platform/sms.cpp @@ -140,7 +140,7 @@ int DivPlatformSMS::dispatch(DivCommand c) { updateSNMode=true; break; case DIV_CMD_LEGATO: - chan[c.chan].baseFreq=round(1712.0f/pow(2.0f,((float)(c.value+((!chan[c.chan].std.arpMode)?(chan[c.chan].std.arp-12):(0)))/12.0f))); + chan[c.chan].baseFreq=round(1712.0f/pow(2.0f,((float)(c.value+((chan[c.chan].std.willArp && !chan[c.chan].std.arpMode)?(chan[c.chan].std.arp-12):(0)))/12.0f))); chan[c.chan].freqChanged=true; chan[c.chan].note=c.value; break;