ES5506: fix loop end

This commit is contained in:
tildearrow 2024-06-16 18:30:37 -05:00
parent bd7077de3c
commit 4e40eea0b0
2 changed files with 5 additions and 5 deletions

View file

@ -1,11 +1,11 @@
# to-do for 0.6.4 # to-do for 0.6.4
- revamp audio export dialog
- fix possible issues when moving selection - fix possible issues when moving selection
- fix Metal intro crash - fix Metal intro crash
# to-do long term # to-do long term
- CSM macros
- finish auto-clone - finish auto-clone
- new pattern renderer - performance improvements - new pattern renderer - performance improvements
- new info header - new info header

View file

@ -451,7 +451,7 @@ void DivPlatformES5506::tick(bool sysTick) {
DivSample* s=parent->getSample(chan[i].pcm.index); DivSample* s=parent->getSample(chan[i].pcm.index);
const unsigned int start=sampleOffES5506[chan[i].pcm.index]<<10; const unsigned int start=sampleOffES5506[chan[i].pcm.index]<<10;
const unsigned int nextLoopStart=(start+(s->loopStart<<11))&0xfffff800; const unsigned int nextLoopStart=(start+(s->loopStart<<11))&0xfffff800;
const unsigned int nextLoopEnd=(start+((s->loopEnd-1)<<11))&0xffffff80; const unsigned int nextLoopEnd=(start+((s->loopEnd)<<11))&0xffffff80;
if ((chan[i].pcm.loopStart!=nextLoopStart) || (chan[i].pcm.loopEnd!=nextLoopEnd)) { if ((chan[i].pcm.loopStart!=nextLoopStart) || (chan[i].pcm.loopEnd!=nextLoopEnd)) {
chan[i].pcm.loopStart=nextLoopStart; chan[i].pcm.loopStart=nextLoopStart;
chan[i].pcm.loopEnd=nextLoopEnd; chan[i].pcm.loopEnd=nextLoopEnd;
@ -596,7 +596,7 @@ void DivPlatformES5506::tick(bool sysTick) {
off=(double)center/8363.0; off=(double)center/8363.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)<<11))&0xffffff80;
chan[i].pcm.freqOffs=PITCH_OFFSET*off; chan[i].pcm.freqOffs=PITCH_OFFSET*off;
unsigned int startPos=chan[i].pcm.direction?chan[i].pcm.end:chan[i].pcm.start; unsigned int startPos=chan[i].pcm.direction?chan[i].pcm.end:chan[i].pcm.start;
if (chan[i].pcm.nextPos) { if (chan[i].pcm.nextPos) {
@ -1216,7 +1216,7 @@ void DivPlatformES5506::renderSamples(int sysID) {
memCompo=DivMemoryComposition(); memCompo=DivMemoryComposition();
memCompo.name="Sample Memory"; memCompo.name="Sample Memory";
size_t memPos=128; // add silent at begin and end of each bank for reverse playback size_t memPos=129; // add silent at begin and end of each bank for reverse playback and add 1 for loop
for (int i=0; i<parent->song.sampleLen; i++) { for (int i=0; i<parent->song.sampleLen; i++) {
DivSample* s=parent->song.sample[i]; DivSample* s=parent->song.sample[i];
if (!s->renderOn[0][sysID]) { if (!s->renderOn[0][sysID]) {
@ -1242,7 +1242,7 @@ void DivPlatformES5506::renderSamples(int sysID) {
} else { } else {
memcpy(sampleMem+(memPos/sizeof(short)),s->data16,length); memcpy(sampleMem+(memPos/sizeof(short)),s->data16,length);
} }
sampleOffES5506[i]=memPos; sampleOffES5506[i]=memPos-1;
sampleLoaded[i]=true; sampleLoaded[i]=true;
memCompo.entries.push_back(DivMemoryEntry(DIV_MEMORY_SAMPLE,"Sample",i,memPos,memPos+length)); memCompo.entries.push_back(DivMemoryEntry(DIV_MEMORY_SAMPLE,"Sample",i,memPos,memPos+length));
memPos+=length; memPos+=length;