Prepare to add hasSamplePtrHeader and hasSampleInstHeader in dispatch (WIP)

for refresh sample memory when loop/end pointer and instrument parameter changed. Also, this PR has minor code style fixes and add warning in MultiPCM sample map usage.
This commit is contained in:
cam900 2025-08-27 22:52:19 +09:00
parent 4ed40d37d6
commit bd8d9a56a0
10 changed files with 141 additions and 28 deletions

View file

@ -213,6 +213,14 @@ size_t DivDispatch::getSampleMemUsage(int index) {
return 0;
}
bool DivDispatch::hasSamplePtrHeader(int index) {
return false;
}
bool DivDispatch::hasSampleInstHeader(int index) {
return false;
}
const DivMemoryComposition* DivDispatch::getMemCompo(int index) {
return NULL;
}

View file

@ -3244,6 +3244,14 @@ size_t DivPlatformOPL::getSampleMemUsage(int index) {
(index==0 && adpcmChan>=0)?adpcmBMemLen:0;
}
bool DivPlatformOPL::hasSamplePtrHeader(int index) {
return (index==0 && pcmChanOffs>=0);
}
bool DivPlatformOPL::hasSampleInstHeader(int index) {
return (index==0 && pcmChanOffs>=0);
}
bool DivPlatformOPL::isSampleLoaded(int index, int sample) {
if (index!=0) return false;
if (sample<0 || sample>32767) return false;

View file

@ -218,6 +218,8 @@ class DivPlatformOPL: public DivDispatch {
const void* getSampleMem(int index);
size_t getSampleMemCapacity(int index);
size_t getSampleMemUsage(int index);
bool hasSamplePtrHeader(int index=0);
bool hasSampleInstHeader(int index=0);
bool isSampleLoaded(int index, int sample);
const DivMemoryComposition* getMemCompo(int index);
void renderSamples(int chipID);

View file

@ -964,6 +964,10 @@ size_t DivPlatformSNES::getSampleMemUsage(int index) {
return index == 0 ? sampleMemLen : 0;
}
bool DivPlatformSNES::hasSamplePtrHeader(int index) {
return true;
}
bool DivPlatformSNES::isSampleLoaded(int index, int sample) {
if (index!=0) return false;
if (sample<0 || sample>32767) return false;

View file

@ -124,9 +124,10 @@ class DivPlatformSNES: public DivDispatch {
void poke(unsigned int addr, unsigned short val);
void poke(std::vector<DivRegWrite>& wlist);
const char** getRegisterSheet();
const void* getSampleMem(int index = 0);
size_t getSampleMemCapacity(int index = 0);
size_t getSampleMemUsage(int index = 0);
const void* getSampleMem(int index=0);
size_t getSampleMemCapacity(int index=0);
size_t getSampleMemUsage(int index=0);
bool hasSamplePtrHeader(int index=0);
bool isSampleLoaded(int index, int sample);
const DivMemoryComposition* getMemCompo(int index);
void renderSamples(int chipID);