From 745d1d6c760c3e10964e6f42f2eb41b001746c7d Mon Sep 17 00:00:00 2001 From: tildearrow Date: Fri, 2 Feb 2024 02:13:09 -0500 Subject: [PATCH] fix sample issues, part 3 --- src/engine/platform/k007232.cpp | 2 ++ src/engine/platform/k053260.cpp | 2 ++ src/engine/platform/lynx.cpp | 2 ++ src/engine/platform/mmc5.cpp | 2 ++ src/engine/platform/nes.cpp | 2 ++ src/engine/platform/pce.cpp | 2 ++ src/engine/platform/pcmdac.cpp | 2 ++ src/engine/platform/qsound.cpp | 2 ++ src/engine/platform/rf5c68.cpp | 2 ++ src/engine/platform/segapcm.cpp | 2 ++ src/engine/platform/snes.cpp | 2 ++ src/engine/platform/su.cpp | 2 ++ src/engine/platform/swan.cpp | 2 ++ src/engine/platform/vera.cpp | 2 ++ src/engine/platform/vrc6.cpp | 2 ++ src/engine/platform/x1_010.cpp | 2 ++ src/engine/platform/ym2608.cpp | 2 ++ src/engine/platform/ym2610.cpp | 2 ++ src/engine/platform/ym2610b.cpp | 2 ++ src/engine/platform/ymz280b.cpp | 2 ++ src/engine/platform/zxbeeperquadtone.cpp | 2 ++ 21 files changed, 42 insertions(+) diff --git a/src/engine/platform/k007232.cpp b/src/engine/platform/k007232.cpp index eb2157e05..5edac177b 100644 --- a/src/engine/platform/k007232.cpp +++ b/src/engine/platform/k007232.cpp @@ -281,7 +281,9 @@ int DivPlatformK007232::dispatch(DivCommand c) { chan[c.chan].macroVolMul=ins->type==DIV_INS_AMIGA?64:15; if (c.value!=DIV_NOTE_NULL) { chan[c.chan].sample=ins->amiga.getSample(c.value); + chan[c.chan].sampleNote=c.value; c.value=ins->amiga.getFreq(c.value); + chan[c.chan].sampleNoteDelta=c.value-chan[c.chan].sampleNote; } if (c.value!=DIV_NOTE_NULL) { chan[c.chan].baseFreq=NOTE_PERIODIC(c.value); diff --git a/src/engine/platform/k053260.cpp b/src/engine/platform/k053260.cpp index b084f3a23..968ab6981 100644 --- a/src/engine/platform/k053260.cpp +++ b/src/engine/platform/k053260.cpp @@ -230,7 +230,9 @@ int DivPlatformK053260::dispatch(DivCommand c) { chan[c.chan].macroVolMul=ins->type==DIV_INS_AMIGA?64:127; if (c.value!=DIV_NOTE_NULL) { chan[c.chan].sample=ins->amiga.getSample(c.value); + chan[c.chan].sampleNote=c.value; c.value=ins->amiga.getFreq(c.value); + chan[c.chan].sampleNoteDelta=c.value-chan[c.chan].sampleNote; } if (c.value!=DIV_NOTE_NULL) { chan[c.chan].baseFreq=NOTE_PERIODIC(c.value); diff --git a/src/engine/platform/lynx.cpp b/src/engine/platform/lynx.cpp index 68f3ac762..885dc1fa5 100644 --- a/src/engine/platform/lynx.cpp +++ b/src/engine/platform/lynx.cpp @@ -236,7 +236,9 @@ int DivPlatformLynx::dispatch(DivCommand c) { if (c.value!=DIV_NOTE_NULL) { if (chan[c.chan].pcm) { chan[c.chan].sample=ins->amiga.getSample(c.value); + chan[c.chan].sampleNote=c.value; c.value=ins->amiga.getFreq(c.value); + chan[c.chan].sampleNoteDelta=c.value-chan[c.chan].sampleNote; chan[c.chan].sampleBaseFreq=NOTE_FREQUENCY(c.value); chan[c.chan].sampleAccum=0; chan[c.chan].samplePos=0; diff --git a/src/engine/platform/mmc5.cpp b/src/engine/platform/mmc5.cpp index 899bf7d8a..c3af7d952 100644 --- a/src/engine/platform/mmc5.cpp +++ b/src/engine/platform/mmc5.cpp @@ -178,7 +178,9 @@ int DivPlatformMMC5::dispatch(DivCommand c) { if (ins->type==DIV_INS_AMIGA) { if (c.value!=DIV_NOTE_NULL) { dacSample=ins->amiga.getSample(c.value); + chan[c.chan].sampleNote=c.value; c.value=ins->amiga.getFreq(c.value); + chan[c.chan].sampleNoteDelta=c.value-chan[c.chan].sampleNote; } if (dacSample<0 || dacSample>=parent->song.sampleLen) { dacSample=-1; diff --git a/src/engine/platform/nes.cpp b/src/engine/platform/nes.cpp index 6abdf1dc9..ac9db5f90 100644 --- a/src/engine/platform/nes.cpp +++ b/src/engine/platform/nes.cpp @@ -407,7 +407,9 @@ int DivPlatformNES::dispatch(DivCommand c) { if (c.value!=DIV_NOTE_NULL) { dacSample=ins->amiga.getSample(c.value); if (ins->type==DIV_INS_AMIGA) { + chan[c.chan].sampleNote=c.value; c.value=ins->amiga.getFreq(c.value); + chan[c.chan].sampleNoteDelta=c.value-chan[c.chan].sampleNote; } } if (dacSample<0 || dacSample>=parent->song.sampleLen) { diff --git a/src/engine/platform/pce.cpp b/src/engine/platform/pce.cpp index d8be4dd21..c9a21a67a 100644 --- a/src/engine/platform/pce.cpp +++ b/src/engine/platform/pce.cpp @@ -285,7 +285,9 @@ int DivPlatformPCE::dispatch(DivCommand c) { if (skipRegisterWrites) break; if (c.value!=DIV_NOTE_NULL) { chan[c.chan].dacSample=ins->amiga.getSample(c.value); + chan[c.chan].sampleNote=c.value; c.value=ins->amiga.getFreq(c.value); + chan[c.chan].sampleNoteDelta=c.value-chan[c.chan].sampleNote; } if (chan[c.chan].dacSample<0 || chan[c.chan].dacSample>=parent->song.sampleLen) { chan[c.chan].dacSample=-1; diff --git a/src/engine/platform/pcmdac.cpp b/src/engine/platform/pcmdac.cpp index eebcd3860..3efb0f410 100644 --- a/src/engine/platform/pcmdac.cpp +++ b/src/engine/platform/pcmdac.cpp @@ -326,7 +326,9 @@ int DivPlatformPCMDAC::dispatch(DivCommand c) { } else { if (c.value!=DIV_NOTE_NULL) { chan[0].sample=ins->amiga.getSample(c.value); + chan[c.chan].sampleNote=c.value; c.value=ins->amiga.getFreq(c.value); + chan[c.chan].sampleNoteDelta=c.value-chan[c.chan].sampleNote; } chan[0].useWave=false; } diff --git a/src/engine/platform/qsound.cpp b/src/engine/platform/qsound.cpp index 4709fb668..0854443ad 100644 --- a/src/engine/platform/qsound.cpp +++ b/src/engine/platform/qsound.cpp @@ -451,7 +451,9 @@ int DivPlatformQSound::dispatch(DivCommand c) { chan[c.chan].isNewQSound=(ins->type==DIV_INS_QSOUND); if (c.value!=DIV_NOTE_NULL) { chan[c.chan].sample=ins->amiga.getSample(c.value); + chan[c.chan].sampleNote=c.value; c.value=ins->amiga.getFreq(c.value); + chan[c.chan].sampleNoteDelta=c.value-chan[c.chan].sampleNote; } if (c.value!=DIV_NOTE_NULL) { chan[c.chan].baseFreq=QS_NOTE_FREQUENCY(c.value); diff --git a/src/engine/platform/rf5c68.cpp b/src/engine/platform/rf5c68.cpp index 06f9ab53e..a96eb114a 100644 --- a/src/engine/platform/rf5c68.cpp +++ b/src/engine/platform/rf5c68.cpp @@ -184,7 +184,9 @@ int DivPlatformRF5C68::dispatch(DivCommand c) { chan[c.chan].macroVolMul=ins->type==DIV_INS_AMIGA?64:255; if (c.value!=DIV_NOTE_NULL) { chan[c.chan].sample=ins->amiga.getSample(c.value); + chan[c.chan].sampleNote=c.value; c.value=ins->amiga.getFreq(c.value); + chan[c.chan].sampleNoteDelta=c.value-chan[c.chan].sampleNote; } if (c.value!=DIV_NOTE_NULL) { chan[c.chan].baseFreq=NOTE_FREQUENCY(c.value); diff --git a/src/engine/platform/segapcm.cpp b/src/engine/platform/segapcm.cpp index 5c5170186..b0fcc41ab 100644 --- a/src/engine/platform/segapcm.cpp +++ b/src/engine/platform/segapcm.cpp @@ -189,7 +189,9 @@ int DivPlatformSegaPCM::dispatch(DivCommand c) { chan[c.chan].isNewSegaPCM=(ins->type==DIV_INS_SEGAPCM); if (c.value!=DIV_NOTE_NULL) { chan[c.chan].pcm.sample=ins->amiga.getSample(c.value); + chan[c.chan].sampleNote=c.value; c.value=ins->amiga.getFreq(c.value); + chan[c.chan].sampleNoteDelta=c.value-chan[c.chan].sampleNote; } if (chan[c.chan].pcm.sample<0 || chan[c.chan].pcm.sample>=parent->song.sampleLen) { chan[c.chan].pcm.sample=-1; diff --git a/src/engine/platform/snes.cpp b/src/engine/platform/snes.cpp index 8cc205a16..cbc1feea7 100644 --- a/src/engine/platform/snes.cpp +++ b/src/engine/platform/snes.cpp @@ -345,7 +345,9 @@ int DivPlatformSNES::dispatch(DivCommand c) { } else { if (c.value!=DIV_NOTE_NULL) { chan[c.chan].sample=ins->amiga.getSample(c.value); + chan[c.chan].sampleNote=c.value; c.value=ins->amiga.getFreq(c.value); + chan[c.chan].sampleNoteDelta=c.value-chan[c.chan].sampleNote; } chan[c.chan].useWave=false; } diff --git a/src/engine/platform/su.cpp b/src/engine/platform/su.cpp index 5ac95d3cd..8338f7c9d 100644 --- a/src/engine/platform/su.cpp +++ b/src/engine/platform/su.cpp @@ -282,7 +282,9 @@ int DivPlatformSoundUnit::dispatch(DivCommand c) { if (chan[c.chan].pcm) { if (c.value!=DIV_NOTE_NULL) { chan[c.chan].sample=ins->amiga.getSample(c.value); + chan[c.chan].sampleNote=c.value; c.value=ins->amiga.getFreq(c.value); + chan[c.chan].sampleNoteDelta=c.value-chan[c.chan].sampleNote; } } if (c.value!=DIV_NOTE_NULL) { diff --git a/src/engine/platform/swan.cpp b/src/engine/platform/swan.cpp index 484151595..3c66170ec 100644 --- a/src/engine/platform/swan.cpp +++ b/src/engine/platform/swan.cpp @@ -265,7 +265,9 @@ int DivPlatformSwan::dispatch(DivCommand c) { if (ins->type==DIV_INS_AMIGA || ins->amiga.useSample) { if (c.value!=DIV_NOTE_NULL) { dacSample=ins->amiga.getSample(c.value); + chan[c.chan].sampleNote=c.value; c.value=ins->amiga.getFreq(c.value); + chan[c.chan].sampleNoteDelta=c.value-chan[c.chan].sampleNote; } if (dacSample<0 || dacSample>=parent->song.sampleLen) { dacSample=-1; diff --git a/src/engine/platform/vera.cpp b/src/engine/platform/vera.cpp index 7c48dc108..c3b90f080 100644 --- a/src/engine/platform/vera.cpp +++ b/src/engine/platform/vera.cpp @@ -302,7 +302,9 @@ int DivPlatformVERA::dispatch(DivCommand c) { if (c.value!=DIV_NOTE_NULL) { DivInstrument* ins=parent->getIns(chan[16].ins,DIV_INS_VERA); chan[16].pcm.sample=ins->amiga.getSample(c.value); + chan[16].sampleNote=c.value; c.value=ins->amiga.getFreq(c.value); + chan[16].sampleNoteDelta=c.value-chan[c.chan].sampleNote; } if (chan[16].pcm.sample<0 || chan[16].pcm.sample>=parent->song.sampleLen) { chan[16].pcm.sample=-1; diff --git a/src/engine/platform/vrc6.cpp b/src/engine/platform/vrc6.cpp index f5f7371d6..0f52a82a4 100644 --- a/src/engine/platform/vrc6.cpp +++ b/src/engine/platform/vrc6.cpp @@ -242,7 +242,9 @@ int DivPlatformVRC6::dispatch(DivCommand c) { if (ins->type==DIV_INS_AMIGA || ins->amiga.useSample) { if (c.value!=DIV_NOTE_NULL) { chan[c.chan].dacSample=ins->amiga.getSample(c.value); + chan[c.chan].sampleNote=c.value; c.value=ins->amiga.getFreq(c.value); + chan[c.chan].sampleNoteDelta=c.value-chan[c.chan].sampleNote; } if (chan[c.chan].dacSample<0 || chan[c.chan].dacSample>=parent->song.sampleLen) { chan[c.chan].dacSample=-1; diff --git a/src/engine/platform/x1_010.cpp b/src/engine/platform/x1_010.cpp index 9600cc09b..e4a699d1a 100644 --- a/src/engine/platform/x1_010.cpp +++ b/src/engine/platform/x1_010.cpp @@ -543,7 +543,9 @@ int DivPlatformX1_010::dispatch(DivCommand c) { chan[c.chan].macroInit(ins); if (c.value!=DIV_NOTE_NULL) { chan[c.chan].sample=ins->amiga.getSample(c.value); + chan[c.chan].sampleNote=c.value; c.value=ins->amiga.getFreq(c.value); + chan[c.chan].sampleNoteDelta=c.value-chan[c.chan].sampleNote; } if (chan[c.chan].sample>=0 && chan[c.chan].samplesong.sampleLen) { DivSample* s=parent->getSample(chan[c.chan].sample); diff --git a/src/engine/platform/ym2608.cpp b/src/engine/platform/ym2608.cpp index 4d3986b2d..7688d0907 100644 --- a/src/engine/platform/ym2608.cpp +++ b/src/engine/platform/ym2608.cpp @@ -919,7 +919,9 @@ int DivPlatformYM2608::dispatch(DivCommand c) { } if (c.value!=DIV_NOTE_NULL) { chan[c.chan].sample=ins->amiga.getSample(c.value); + chan[c.chan].sampleNote=c.value; c.value=ins->amiga.getFreq(c.value); + chan[c.chan].sampleNoteDelta=c.value-chan[c.chan].sampleNote; } if (chan[c.chan].sample>=0 && chan[c.chan].samplesong.sampleLen) { DivSample* s=parent->getSample(chan[c.chan].sample); diff --git a/src/engine/platform/ym2610.cpp b/src/engine/platform/ym2610.cpp index f30ce9082..f524b560f 100644 --- a/src/engine/platform/ym2610.cpp +++ b/src/engine/platform/ym2610.cpp @@ -850,7 +850,9 @@ int DivPlatformYM2610::dispatch(DivCommand c) { } if (c.value!=DIV_NOTE_NULL) { chan[c.chan].sample=ins->amiga.getSample(c.value); + chan[c.chan].sampleNote=c.value; c.value=ins->amiga.getFreq(c.value); + chan[c.chan].sampleNoteDelta=c.value-chan[c.chan].sampleNote; } if (chan[c.chan].sample>=0 && chan[c.chan].samplesong.sampleLen) { DivSample* s=parent->getSample(chan[c.chan].sample); diff --git a/src/engine/platform/ym2610b.cpp b/src/engine/platform/ym2610b.cpp index e588bea94..c423b9bba 100644 --- a/src/engine/platform/ym2610b.cpp +++ b/src/engine/platform/ym2610b.cpp @@ -917,7 +917,9 @@ int DivPlatformYM2610B::dispatch(DivCommand c) { } if (c.value!=DIV_NOTE_NULL) { chan[c.chan].sample=ins->amiga.getSample(c.value); + chan[c.chan].sampleNote=c.value; c.value=ins->amiga.getFreq(c.value); + chan[c.chan].sampleNoteDelta=c.value-chan[c.chan].sampleNote; } if (chan[c.chan].sample>=0 && chan[c.chan].samplesong.sampleLen) { DivSample* s=parent->getSample(chan[c.chan].sample); diff --git a/src/engine/platform/ymz280b.cpp b/src/engine/platform/ymz280b.cpp index 395d1524e..76711a3eb 100644 --- a/src/engine/platform/ymz280b.cpp +++ b/src/engine/platform/ymz280b.cpp @@ -213,7 +213,9 @@ int DivPlatformYMZ280B::dispatch(DivCommand c) { chan[c.chan].macroVolMul=ins->type==DIV_INS_AMIGA?64:255; if (c.value!=DIV_NOTE_NULL) { chan[c.chan].sample=ins->amiga.getSample(c.value); + chan[c.chan].sampleNote=c.value; c.value=ins->amiga.getFreq(c.value); + chan[c.chan].sampleNoteDelta=c.value-chan[c.chan].sampleNote; } if (c.value!=DIV_NOTE_NULL) { chan[c.chan].baseFreq=NOTE_FREQUENCY(c.value); diff --git a/src/engine/platform/zxbeeperquadtone.cpp b/src/engine/platform/zxbeeperquadtone.cpp index bc3fc884d..547c80819 100644 --- a/src/engine/platform/zxbeeperquadtone.cpp +++ b/src/engine/platform/zxbeeperquadtone.cpp @@ -187,7 +187,9 @@ int DivPlatformZXBeeperQuadTone::dispatch(DivCommand c) { DivInstrument* ins=parent->getIns(chan[c.chan].ins,DIV_INS_AMIGA); if (c.value!=DIV_NOTE_NULL) { curSample=ins->amiga.getSample(c.value); + chan[c.chan].sampleNote=c.value; c.value=ins->amiga.getFreq(c.value); + chan[c.chan].sampleNoteDelta=c.value-chan[c.chan].sampleNote; chan[c.chan].baseFreq=NOTE_PERIODIC(c.value); chan[c.chan].freqChanged=true; chan[c.chan].note=c.value;