Implement getSampleMemOffset for further optimize VGM logging (specifically OPL4 PCM)

This commit is contained in:
cam900 2025-06-04 21:16:27 +09:00
parent 9d1c10fcea
commit a5148a3441
9 changed files with 60 additions and 25 deletions

View file

@ -468,6 +468,10 @@ size_t DivPlatformK053260::getSampleMemUsage(int index) {
return index == 0 ? sampleMemLen : 0;
}
size_t DivPlatformK053260::getSampleMemOffset(int index) {
return index == 0 ? 1 : 0;
}
bool DivPlatformK053260::isSampleLoaded(int index, int sample) {
if (index!=0) return false;
if (sample<0 || sample>255) return false;
@ -487,7 +491,7 @@ void DivPlatformK053260::renderSamples(int sysID) {
memCompo=DivMemoryComposition();
memCompo.name="Sample ROM";
size_t memPos=1; // for avoid silence
size_t memPos=getSampleMemOffset(); // for avoid silence
for (int i=0; i<parent->song.sampleLen; i++) {
DivSample* s=parent->song.sample[i];
if (!s->renderOn[0][sysID]) {
@ -499,10 +503,10 @@ void DivPlatformK053260::renderSamples(int sysID) {
if (s->depth==DIV_SAMPLE_DEPTH_ADPCM_K) {
length=MIN(65535,s->getEndPosition(DIV_SAMPLE_DEPTH_ADPCM_K));
actualLength=MIN((int)(getSampleMemCapacity()-memPos-1),length);
actualLength=MIN((int)(getSampleMemCapacity()-memPos-getSampleMemOffset()),length);
if (actualLength>0) {
sampleOffK053260[i]=memPos-1;
memCompo.entries.push_back(DivMemoryEntry(DIV_MEMORY_SAMPLE,"Sample",i,memPos,memPos+actualLength+1));
sampleOffK053260[i]=memPos-getSampleMemOffset();
memCompo.entries.push_back(DivMemoryEntry(DIV_MEMORY_SAMPLE,"Sample",i,memPos,memPos+actualLength+getSampleMemOffset()));
for (int j=0; j<actualLength; j++) {
sampleMem[memPos++]=s->dataK[j];
}
@ -510,10 +514,10 @@ void DivPlatformK053260::renderSamples(int sysID) {
}
} else {
length=MIN(65535,s->getEndPosition(DIV_SAMPLE_DEPTH_8BIT));
actualLength=MIN((int)(getSampleMemCapacity()-memPos-1),length);
actualLength=MIN((int)(getSampleMemCapacity()-memPos-getSampleMemOffset()),length);
if (actualLength>0) {
sampleOffK053260[i]=memPos-1;
memCompo.entries.push_back(DivMemoryEntry(DIV_MEMORY_SAMPLE,"Sample",i,memPos,memPos+actualLength+1));
sampleOffK053260[i]=memPos-getSampleMemOffset();
memCompo.entries.push_back(DivMemoryEntry(DIV_MEMORY_SAMPLE,"Sample",i,memPos,memPos+actualLength+getSampleMemOffset()));
for (int j=0; j<actualLength; j++) {
sampleMem[memPos++]=s->data8[j];
}