From 4137650bdb98a56252c849e90859b227a9a8d911 Mon Sep 17 00:00:00 2001 From: cam900 Date: Tue, 7 Feb 2023 11:14:32 +0900 Subject: [PATCH] Partially fix frequency with note map --- src/engine/platform/es5506.cpp | 5 ++--- src/gui/debug.cpp | 1 + 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/engine/platform/es5506.cpp b/src/engine/platform/es5506.cpp index 6016dfc9..11ce2843 100644 --- a/src/engine/platform/es5506.cpp +++ b/src/engine/platform/es5506.cpp @@ -649,7 +649,6 @@ void DivPlatformES5506::tick(bool sysTick) { if (chan[i].pcm.index>=0 && chan[i].pcm.indexsong.sampleLen) { const int ind=chan[i].pcm.index; DivSample* s=parent->getSample(ind); - DivInstrumentAmiga::SampleMap& noteMapind=ins->amiga.noteMap[ind]; // get frequency offset double off=1.0; double center=(double)s->centerRate; @@ -659,8 +658,8 @@ void DivPlatformES5506::tick(bool sysTick) { off=(double)center/8363.0; } if (ins->amiga.useNoteMap) { - off*=(double)noteMapind.freq/((double)MAX(1,center)*pow(2.0,((double)ind-48.0)/12.0)); - chan[i].pcm.note=ind; + DivInstrumentAmiga::SampleMap& noteMapind=ins->amiga.noteMap[chan[i].pcm.note]; + off*=(double)noteMapind.freq/((double)MAX(1,center)*pow(2.0,((double)chan[i].pcm.note-48.0)/12.0)); } chan[i].pcm.loopStart=(chan[i].pcm.start+(s->loopStart<<11))&0xfffff800; chan[i].pcm.loopEnd=(chan[i].pcm.start+((s->loopEnd-1)<<11))&0xffffff80; diff --git a/src/gui/debug.cpp b/src/gui/debug.cpp index ddb1bb01..966ea911 100644 --- a/src/gui/debug.cpp +++ b/src/gui/debug.cpp @@ -955,6 +955,7 @@ void putDispatchChan(void* data, int chanNum, int type) { ImGui::TextColored(ch->pcmChanged.position?colorOn:colorOff,">> PCMPositionChanged"); ImGui::TextColored(ch->pcmChanged.loopBank?colorOn:colorOff,">> PCMLoopBankChanged"); ImGui::TextColored(ch->isReverseLoop?colorOn:colorOff,">> IsReverseLoop"); + ImGui::TextColored(ch->pcm.isNoteMap?colorOn:colorOff,">> PCMIsNoteMap"); ImGui::TextColored(ch->pcm.pause?colorOn:colorOff,">> PCMPause"); ImGui::TextColored(ch->pcm.direction?colorOn:colorOff,">> PCMDirection"); ImGui::TextColored(ch->envelope.k1Slow?colorOn:colorOff,">> EnvK1Slow");