memory composition, part 4

This commit is contained in:
tildearrow 2024-03-05 19:19:18 -05:00
parent 92ec6f6651
commit 6763aa44a9
2 changed files with 15 additions and 1 deletions

View file

@ -1213,6 +1213,9 @@ void DivPlatformES5506::renderSamples(int sysID) {
memset(sampleOffES5506,0,256*sizeof(unsigned int)); memset(sampleOffES5506,0,256*sizeof(unsigned int));
memset(sampleLoaded,0,256*sizeof(bool)); memset(sampleLoaded,0,256*sizeof(bool));
memCompo=DivMemoryComposition();
memCompo.name="Sample Memory";
size_t memPos=128; // add silent at begin and end of each bank for reverse playback size_t memPos=128; // add silent at begin and end of each bank for reverse playback
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];
@ -1241,9 +1244,13 @@ void DivPlatformES5506::renderSamples(int sysID) {
} }
sampleOffES5506[i]=memPos; sampleOffES5506[i]=memPos;
sampleLoaded[i]=true; sampleLoaded[i]=true;
memCompo.entries.push_back(DivMemoryEntry(DIV_MEMORY_SAMPLE,"Sample",i,memPos,memPos+length));
memPos+=length; memPos+=length;
} }
sampleMemLen=memPos+256; sampleMemLen=memPos+256;
memCompo.used=sampleMemLen;
memCompo.capacity=16777216;
} }
int DivPlatformES5506::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) { int DivPlatformES5506::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) {

View file

@ -451,6 +451,9 @@ void DivPlatformGA20::renderSamples(int sysID) {
memset(sampleOffGA20,0,256*sizeof(unsigned int)); memset(sampleOffGA20,0,256*sizeof(unsigned int));
memset(sampleLoaded,0,256*sizeof(bool)); memset(sampleLoaded,0,256*sizeof(bool));
memCompo=DivMemoryComposition();
memCompo.name="Sample ROM";
size_t memPos=0; size_t memPos=0;
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];
@ -463,6 +466,7 @@ void DivPlatformGA20::renderSamples(int sysID) {
int actualLength=MIN((int)(getSampleMemCapacity()-memPos)-1,length); int actualLength=MIN((int)(getSampleMemCapacity()-memPos)-1,length);
if (actualLength>0) { if (actualLength>0) {
sampleOffGA20[i]=memPos; sampleOffGA20[i]=memPos;
memCompo.entries.push_back(DivMemoryEntry(DIV_MEMORY_SAMPLE,"Sample",i,memPos,memPos+actualLength+1));
for (int j=0; j<actualLength; j++) { for (int j=0; j<actualLength; j++) {
// convert to 8 bit unsigned // convert to 8 bit unsigned
unsigned char val=((unsigned char)(s->data8[j]))^0x80; unsigned char val=((unsigned char)(s->data8[j]))^0x80;
@ -478,10 +482,13 @@ void DivPlatformGA20::renderSamples(int sysID) {
} else { } else {
sampleLoaded[i]=true; sampleLoaded[i]=true;
} }
// allign to 16 byte // align to 16 byte
memPos=(memPos+0xf)&~0xf; memPos=(memPos+0xf)&~0xf;
} }
sampleMemLen=memPos; sampleMemLen=memPos;
memCompo.used=sampleMemLen;
memCompo.capacity=1048576;
} }
int DivPlatformGA20::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) { int DivPlatformGA20::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) {