add a full linear pitch mode, part 7

fix full linear pitch on OPL, OPLL, SAA1099 and Sound Unit
This commit is contained in:
tildearrow 2022-05-11 00:26:28 -05:00
parent ea118db499
commit 1c6e9c2cca
4 changed files with 9 additions and 9 deletions

View file

@ -800,19 +800,19 @@ int DivPlatformOPL::dispatch(DivCommand c) {
int newFreq; int newFreq;
bool return2=false; bool return2=false;
if (destFreq>chan[c.chan].baseFreq) { 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) { if (newFreq>=destFreq) {
newFreq=destFreq; newFreq=destFreq;
return2=true; return2=true;
} }
} else { } 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) { if (newFreq<=destFreq) {
newFreq=destFreq; newFreq=destFreq;
return2=true; return2=true;
} }
} }
if (!chan[c.chan].portaPause) { if (!chan[c.chan].portaPause && parent->song.linearPitch!=2) {
if (octave(chan[c.chan].baseFreq)!=octave(newFreq)) { if (octave(chan[c.chan].baseFreq)!=octave(newFreq)) {
chan[c.chan].portaPause=true; chan[c.chan].portaPause=true;
break; break;

View file

@ -578,13 +578,13 @@ int DivPlatformOPLL::dispatch(DivCommand c) {
int newFreq; int newFreq;
bool return2=false; bool return2=false;
if (destFreq>chan[c.chan].baseFreq) { 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) { if (newFreq>=destFreq) {
newFreq=destFreq; newFreq=destFreq;
return2=true; return2=true;
} }
} else { } 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) { if (newFreq<=destFreq) {
newFreq=destFreq; newFreq=destFreq;
return2=true; return2=true;

View file

@ -311,13 +311,13 @@ int DivPlatformSAA1099::dispatch(DivCommand c) {
int destFreq=NOTE_PERIODIC(c.value2); int destFreq=NOTE_PERIODIC(c.value2);
bool return2=false; bool return2=false;
if (destFreq>chan[c.chan].baseFreq) { 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) { if (chan[c.chan].baseFreq>=destFreq) {
chan[c.chan].baseFreq=destFreq; chan[c.chan].baseFreq=destFreq;
return2=true; return2=true;
} }
} else { } 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) { if (chan[c.chan].baseFreq<=destFreq) {
chan[c.chan].baseFreq=destFreq; chan[c.chan].baseFreq=destFreq;
return2=true; return2=true;

View file

@ -298,13 +298,13 @@ int DivPlatformSoundUnit::dispatch(DivCommand c) {
int destFreq=NOTE_FREQUENCY(c.value2); int destFreq=NOTE_FREQUENCY(c.value2);
bool return2=false; bool return2=false;
if (destFreq>chan[c.chan].baseFreq) { 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) { if (chan[c.chan].baseFreq>=destFreq) {
chan[c.chan].baseFreq=destFreq; chan[c.chan].baseFreq=destFreq;
return2=true; return2=true;
} }
} else { } 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) { if (chan[c.chan].baseFreq<=destFreq) {
chan[c.chan].baseFreq=destFreq; chan[c.chan].baseFreq=destFreq;
return2=true; return2=true;