From 1c6e9c2ccaea50c1eb17a3ab03f575894e872abf Mon Sep 17 00:00:00 2001 From: tildearrow Date: Wed, 11 May 2022 00:26:28 -0500 Subject: [PATCH] add a full linear pitch mode, part 7 fix full linear pitch on OPL, OPLL, SAA1099 and Sound Unit --- src/engine/platform/opl.cpp | 6 +++--- src/engine/platform/opll.cpp | 4 ++-- src/engine/platform/saa.cpp | 4 ++-- src/engine/platform/su.cpp | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/engine/platform/opl.cpp b/src/engine/platform/opl.cpp index b95b42edd..0933934c8 100644 --- a/src/engine/platform/opl.cpp +++ b/src/engine/platform/opl.cpp @@ -800,19 +800,19 @@ int DivPlatformOPL::dispatch(DivCommand c) { int newFreq; bool return2=false; if (destFreq>chan[c.chan].baseFreq) { - newFreq=chan[c.chan].baseFreq+c.value*octave(chan[c.chan].baseFreq); + newFreq=chan[c.chan].baseFreq+c.value*((parent->song.linearPitch==2)?1:octave(chan[c.chan].baseFreq)); if (newFreq>=destFreq) { newFreq=destFreq; return2=true; } } else { - newFreq=chan[c.chan].baseFreq-c.value*octave(chan[c.chan].baseFreq); + newFreq=chan[c.chan].baseFreq-c.value*((parent->song.linearPitch==2)?1:octave(chan[c.chan].baseFreq)); if (newFreq<=destFreq) { newFreq=destFreq; return2=true; } } - if (!chan[c.chan].portaPause) { + if (!chan[c.chan].portaPause && parent->song.linearPitch!=2) { if (octave(chan[c.chan].baseFreq)!=octave(newFreq)) { chan[c.chan].portaPause=true; break; diff --git a/src/engine/platform/opll.cpp b/src/engine/platform/opll.cpp index 89b413179..50eab344f 100644 --- a/src/engine/platform/opll.cpp +++ b/src/engine/platform/opll.cpp @@ -578,13 +578,13 @@ int DivPlatformOPLL::dispatch(DivCommand c) { int newFreq; bool return2=false; if (destFreq>chan[c.chan].baseFreq) { - newFreq=chan[c.chan].baseFreq+c.value*octave(chan[c.chan].baseFreq); + newFreq=chan[c.chan].baseFreq+c.value*((parent->song.linearPitch==2)?1:octave(chan[c.chan].baseFreq)); if (newFreq>=destFreq) { newFreq=destFreq; return2=true; } } else { - newFreq=chan[c.chan].baseFreq-c.value*octave(chan[c.chan].baseFreq); + newFreq=chan[c.chan].baseFreq-c.value*((parent->song.linearPitch==2)?1:octave(chan[c.chan].baseFreq)); if (newFreq<=destFreq) { newFreq=destFreq; return2=true; diff --git a/src/engine/platform/saa.cpp b/src/engine/platform/saa.cpp index b662b1e35..ec5f4f6de 100644 --- a/src/engine/platform/saa.cpp +++ b/src/engine/platform/saa.cpp @@ -311,13 +311,13 @@ int DivPlatformSAA1099::dispatch(DivCommand c) { int destFreq=NOTE_PERIODIC(c.value2); bool return2=false; if (destFreq>chan[c.chan].baseFreq) { - chan[c.chan].baseFreq+=c.value*(8-chan[c.chan].freqH); + chan[c.chan].baseFreq+=c.value*((parent->song.linearPitch==2)?1:(8-chan[c.chan].freqH)); if (chan[c.chan].baseFreq>=destFreq) { chan[c.chan].baseFreq=destFreq; return2=true; } } else { - chan[c.chan].baseFreq-=c.value*(8-chan[c.chan].freqH); + chan[c.chan].baseFreq-=c.value*((parent->song.linearPitch==2)?1:(8-chan[c.chan].freqH)); if (chan[c.chan].baseFreq<=destFreq) { chan[c.chan].baseFreq=destFreq; return2=true; diff --git a/src/engine/platform/su.cpp b/src/engine/platform/su.cpp index 4630f90e6..4af605547 100644 --- a/src/engine/platform/su.cpp +++ b/src/engine/platform/su.cpp @@ -298,13 +298,13 @@ int DivPlatformSoundUnit::dispatch(DivCommand c) { int destFreq=NOTE_FREQUENCY(c.value2); bool return2=false; if (destFreq>chan[c.chan].baseFreq) { - chan[c.chan].baseFreq+=c.value*(1+(chan[c.chan].baseFreq>>9)); + chan[c.chan].baseFreq+=c.value*((parent->song.linearPitch==2)?1:(1+(chan[c.chan].baseFreq>>9))); if (chan[c.chan].baseFreq>=destFreq) { chan[c.chan].baseFreq=destFreq; return2=true; } } else { - chan[c.chan].baseFreq-=c.value*(1+(chan[c.chan].baseFreq>>9)); + chan[c.chan].baseFreq-=c.value*((parent->song.linearPitch==2)?1:(1+(chan[c.chan].baseFreq>>9))); if (chan[c.chan].baseFreq<=destFreq) { chan[c.chan].baseFreq=destFreq; return2=true;