diff --git a/src/engine/platform/gbadma.cpp b/src/engine/platform/gbadma.cpp index af61fa543..cf28a6c62 100644 --- a/src/engine/platform/gbadma.cpp +++ b/src/engine/platform/gbadma.cpp @@ -478,9 +478,9 @@ void DivPlatformGBADMA::renderSamples(int sysID) { break; } sampleLoaded[i]=true; + romMemCompo.entries.push_back(DivMemoryEntry(DIV_MEMORY_SAMPLE,"PCM",i,sampleOff[i],memPos)); // pad to multiple of 16 bytes memPos=(memPos+15)&~15; - romMemCompo.entries.push_back(DivMemoryEntry(DIV_MEMORY_SAMPLE,"PCM",i,sampleOff[i],memPos)); } sampleMemLen=memPos; romMemCompo.used=sampleMemLen; @@ -500,6 +500,13 @@ int DivPlatformGBADMA::init(DivEngine* p, int channels, int sugRate, const DivCo parent=p; dumpWrites=false; skipRegisterWrites=false; + for (int i=0; i<2; i++) { + isMuted[i]=false; + oscBuf[i]=new DivDispatchOscBuffer; + wtMemCompo.entries.push_back(DivMemoryEntry(DIV_MEMORY_WAVE_RAM, fmt::sprintf("Channel %d",i),-1,i*256,i*256)); + } + sampleMem=new signed char[getSampleMemCapacity()]; + sampleMemLen=0; romMemCompo=DivMemoryComposition(); romMemCompo.name="Sample ROM"; wtMemCompo=DivMemoryComposition(); @@ -508,13 +515,6 @@ int DivPlatformGBADMA::init(DivEngine* p, int channels, int sugRate, const DivCo wtMemCompo.capacity=256*2; wtMemCompo.memory=(unsigned char*)wtMem; wtMemCompo.waveformView=DIV_MEMORY_WAVE_8BIT_SIGNED; - for (int i=0; i<2; i++) { - isMuted[i]=false; - oscBuf[i]=new DivDispatchOscBuffer; - wtMemCompo.entries.push_back(DivMemoryEntry(DIV_MEMORY_WAVE_RAM, fmt::sprintf("Channel %d",i),-1,i*256,i*256)); - } - sampleMem=new signed char[getSampleMemCapacity()]; - sampleMemLen=0; setFlags(flags); reset(); return 2; diff --git a/src/engine/platform/gbaminmod.cpp b/src/engine/platform/gbaminmod.cpp index 1fb66ddd2..14b7717ec 100644 --- a/src/engine/platform/gbaminmod.cpp +++ b/src/engine/platform/gbaminmod.cpp @@ -700,6 +700,7 @@ void DivPlatformGBAMinMod::renderSamples(int sysID) { sampleOff[i]=memPos; memcpy(&sampleMem[memPos],s->data8,actualLength); memPos+=actualLength; + romMemCompo.entries.push_back(DivMemoryEntry(DIV_MEMORY_SAMPLE,"PCM",i,sampleOff[i],memPos)); // if it's one-shot, add 16 silent samples for looping area // this should be enough for most cases even though the // frequency register can make position jump by up to 256 samples @@ -708,7 +709,6 @@ void DivPlatformGBAMinMod::renderSamples(int sysID) { memset(&sampleMem[memPos],0,oneShotLen); memPos+=oneShotLen; } - romMemCompo.entries.push_back(DivMemoryEntry(DIV_MEMORY_SAMPLE,"PCM",i,sampleOff[i],memPos)); } if (actualLength