Partially fix frequency with note map

This commit is contained in:
cam900 2023-02-07 11:14:32 +09:00
parent 575fc03b2e
commit 4137650bdb
2 changed files with 3 additions and 3 deletions

View file

@ -649,7 +649,6 @@ void DivPlatformES5506::tick(bool sysTick) {
if (chan[i].pcm.index>=0 && chan[i].pcm.index<parent->song.sampleLen) { if (chan[i].pcm.index>=0 && chan[i].pcm.index<parent->song.sampleLen) {
const int ind=chan[i].pcm.index; const int ind=chan[i].pcm.index;
DivSample* s=parent->getSample(ind); DivSample* s=parent->getSample(ind);
DivInstrumentAmiga::SampleMap& noteMapind=ins->amiga.noteMap[ind];
// get frequency offset // get frequency offset
double off=1.0; double off=1.0;
double center=(double)s->centerRate; double center=(double)s->centerRate;
@ -659,8 +658,8 @@ void DivPlatformES5506::tick(bool sysTick) {
off=(double)center/8363.0; off=(double)center/8363.0;
} }
if (ins->amiga.useNoteMap) { if (ins->amiga.useNoteMap) {
off*=(double)noteMapind.freq/((double)MAX(1,center)*pow(2.0,((double)ind-48.0)/12.0)); DivInstrumentAmiga::SampleMap& noteMapind=ins->amiga.noteMap[chan[i].pcm.note];
chan[i].pcm.note=ind; 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.loopStart=(chan[i].pcm.start+(s->loopStart<<11))&0xfffff800;
chan[i].pcm.loopEnd=(chan[i].pcm.start+((s->loopEnd-1)<<11))&0xffffff80; chan[i].pcm.loopEnd=(chan[i].pcm.start+((s->loopEnd-1)<<11))&0xffffff80;

View file

@ -955,6 +955,7 @@ void putDispatchChan(void* data, int chanNum, int type) {
ImGui::TextColored(ch->pcmChanged.position?colorOn:colorOff,">> PCMPositionChanged"); ImGui::TextColored(ch->pcmChanged.position?colorOn:colorOff,">> PCMPositionChanged");
ImGui::TextColored(ch->pcmChanged.loopBank?colorOn:colorOff,">> PCMLoopBankChanged"); ImGui::TextColored(ch->pcmChanged.loopBank?colorOn:colorOff,">> PCMLoopBankChanged");
ImGui::TextColored(ch->isReverseLoop?colorOn:colorOff,">> IsReverseLoop"); 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.pause?colorOn:colorOff,">> PCMPause");
ImGui::TextColored(ch->pcm.direction?colorOn:colorOff,">> PCMDirection"); ImGui::TextColored(ch->pcm.direction?colorOn:colorOff,">> PCMDirection");
ImGui::TextColored(ch->envelope.k1Slow?colorOn:colorOff,">> EnvK1Slow"); ImGui::TextColored(ch->envelope.k1Slow?colorOn:colorOff,">> EnvK1Slow");