breaking the limit, part 2

all dispatches adapted to 32768 samples.
sample limit unlocked.
testing is required.
This commit is contained in:
tildearrow 2025-07-27 20:16:59 -05:00
parent a4da787c1b
commit 387d9e0654
47 changed files with 430 additions and 168 deletions

View file

@ -2905,7 +2905,7 @@ void DivEngine::delWave(int index) {
}
int DivEngine::addSample() {
if (song.sample.size()>=256) {
if (song.sample.size()>=32768) {
lastError=_("too many samples!");
return -1;
}
@ -2928,7 +2928,7 @@ int DivEngine::addSample() {
}
int DivEngine::addSamplePtr(DivSample* which) {
if (song.sample.size()>=256) {
if (song.sample.size()>=32768) {
lastError=_("too many samples!");
delete which;
return -1;

View file

@ -27,7 +27,7 @@
std::vector<DivSample*> DivEngine::sampleFromFile(const char* path) {
std::vector<DivSample*> ret;
if (song.sample.size()>=256) {
if (song.sample.size()>=32768) {
lastError="too many samples!";
return ret;
}
@ -432,7 +432,7 @@ std::vector<DivSample*> DivEngine::sampleFromFile(const char* path) {
}
DivSample* DivEngine::sampleFromFileRaw(const char* path, DivSampleDepth depth, int channels, bool bigEndian, bool unsign, bool swapNibbles, int rate) {
if (song.sample.size()>=256) {
if (song.sample.size()>=32768) {
lastError="too many samples!";
return NULL;
}

View file

@ -995,7 +995,7 @@ size_t DivPlatformAmiga::getSampleMemUsage(int index) {
bool DivPlatformAmiga::isSampleLoaded(int index, int sample) {
if (index!=0) return false;
if (sample<0 || sample>255) return false;
if (sample<0 || sample>32767) return false;
return sampleLoaded[sample];
}
@ -1006,8 +1006,8 @@ const DivMemoryComposition* DivPlatformAmiga::getMemCompo(int index) {
void DivPlatformAmiga::renderSamples(int sysID) {
memset(sampleMem,0,2097152);
memset(sampleOff,0,256*sizeof(unsigned int));
memset(sampleLoaded,0,256*sizeof(bool));
memset(sampleOff,0,32768*sizeof(unsigned int));
memset(sampleLoaded,0,32768*sizeof(bool));
memCompo=DivMemoryComposition();
memCompo.name="Chip Memory";
@ -1082,3 +1082,14 @@ void DivPlatformAmiga::quit() {
delete oscBuf[i];
}
}
// initialization of important arrays
DivPlatformAmiga::DivPlatformAmiga() {
sampleOff=new unsigned int[32768];
sampleLoaded=new bool[32768];
}
DivPlatformAmiga::~DivPlatformAmiga() {
delete[] sampleOff;
delete[] sampleLoaded;
}

View file

@ -109,8 +109,8 @@ class DivPlatformAmiga: public DivDispatch {
unsigned char volTable[64][64];
unsigned int sampleOff[256];
bool sampleLoaded[256];
unsigned int* sampleOff;
bool* sampleLoaded;
unsigned short regPool[256];
@ -171,6 +171,8 @@ class DivPlatformAmiga: public DivDispatch {
const DivMemoryComposition* getMemCompo(int index);
int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit();
DivPlatformAmiga();
~DivPlatformAmiga();
};
#endif

View file

@ -602,7 +602,7 @@ size_t DivPlatformC140::getSampleMemUsage(int index) {
bool DivPlatformC140::isSampleLoaded(int index, int sample) {
if (index!=0) return false;
if (sample<0 || sample>255) return false;
if (sample<0 || sample>32767) return false;
return sampleLoaded[sample];
}
@ -613,8 +613,8 @@ const DivMemoryComposition* DivPlatformC140::getMemCompo(int index) {
void DivPlatformC140::renderSamples(int sysID) {
memset(sampleMem,0,is219?524288:16777216);
memset(sampleOff,0,256*sizeof(unsigned int));
memset(sampleLoaded,0,256*sizeof(bool));
memset(sampleOff,0,32768*sizeof(unsigned int));
memset(sampleLoaded,0,32768*sizeof(bool));
memCompo=DivMemoryComposition();
memCompo.name="Sample ROM";
@ -801,3 +801,14 @@ void DivPlatformC140::quit() {
delete oscBuf[i];
}
}
// initialization of important arrays
DivPlatformC140::DivPlatformC140() {
sampleOff=new unsigned int[32768];
sampleLoaded=new bool[32768];
}
DivPlatformC140::~DivPlatformC140() {
delete[] sampleOff;
delete[] sampleLoaded;
}

View file

@ -55,8 +55,8 @@ class DivPlatformC140: public DivDispatch {
Channel chan[24];
DivDispatchOscBuffer* oscBuf[24];
bool isMuted[24];
unsigned int sampleOff[256];
bool sampleLoaded[256];
unsigned int* sampleOff;
bool* sampleLoaded;
bool is219;
int totalChans;
unsigned char groupBank[4];
@ -117,7 +117,8 @@ class DivPlatformC140: public DivDispatch {
void setFlags(const DivConfig& flags);
int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit();
private:
DivPlatformC140();
~DivPlatformC140();
};
#endif

View file

@ -1435,7 +1435,7 @@ size_t DivPlatformES5506::getSampleMemUsage(int index) {
bool DivPlatformES5506::isSampleLoaded(int index, int sample) {
if (index!=0) return false;
if (sample<0 || sample>255) return false;
if (sample<0 || sample>32767) return false;
return sampleLoaded[sample];
}
@ -1446,8 +1446,8 @@ const DivMemoryComposition* DivPlatformES5506::getMemCompo(int index) {
void DivPlatformES5506::renderSamples(int sysID) {
memset(sampleMem,0,getSampleMemCapacity());
memset(sampleOffES5506,0,256*sizeof(unsigned int));
memset(sampleLoaded,0,256*sizeof(bool));
memset(sampleOffES5506,0,32768*sizeof(unsigned int));
memset(sampleLoaded,0,32768*sizeof(bool));
memCompo=DivMemoryComposition();
memCompo.name="Sample Memory";
@ -1520,3 +1520,17 @@ void DivPlatformES5506::quit() {
delete oscBuf[i];
}
}
// initialization of important arrays
DivPlatformES5506::DivPlatformES5506():
DivDispatch(),
es550x_intf(),
es5506(*this) {
sampleOffES5506=new unsigned int[32768];
sampleLoaded=new bool[32768];
}
DivPlatformES5506::~DivPlatformES5506() {
delete[] sampleOffES5506;
delete[] sampleLoaded;
}

View file

@ -232,8 +232,8 @@ class DivPlatformES5506: public DivDispatch, public es550x_intf {
bool isMuted[32];
signed short* sampleMem; // ES5506 uses 16 bit data bus for samples
size_t sampleMemLen;
unsigned int sampleOffES5506[256];
bool sampleLoaded[256];
unsigned int* sampleOffES5506;
bool* sampleLoaded;
struct QueuedHostIntf {
unsigned char state;
unsigned char step;
@ -323,10 +323,8 @@ class DivPlatformES5506: public DivDispatch, public es550x_intf {
virtual const char** getRegisterSheet() override;
virtual int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags) override;
virtual void quit() override;
DivPlatformES5506():
DivDispatch(),
es550x_intf(),
es5506(*this) {}
DivPlatformES5506();
~DivPlatformES5506();
};
#endif

View file

@ -197,6 +197,7 @@ class DivPlatformOPN: public DivPlatformFMBase {
extSys(isExtSys),
fbAllOps(false),
useCombo(0) {}
virtual ~DivPlatformOPN() {}
public:
void setCombo(unsigned char combo) {
useCombo=combo;

View file

@ -147,6 +147,7 @@ class DivPlatformFMBase: public DivDispatch {
lastBusy(0),
delay(0),
flushFirst(false) {}
virtual ~DivPlatformFMBase() {}
};
#endif

View file

@ -478,7 +478,7 @@ size_t DivPlatformGA20::getSampleMemUsage(int index) {
bool DivPlatformGA20::isSampleLoaded(int index, int sample) {
if (index!=0) return false;
if (sample<0 || sample>255) return false;
if (sample<0 || sample>32767) return false;
return sampleLoaded[sample];
}
@ -489,8 +489,8 @@ const DivMemoryComposition* DivPlatformGA20::getMemCompo(int index) {
void DivPlatformGA20::renderSamples(int sysID) {
memset(sampleMem,0x00,getSampleMemCapacity());
memset(sampleOffGA20,0,256*sizeof(unsigned int));
memset(sampleLoaded,0,256*sizeof(bool));
memset(sampleOffGA20,0,32768*sizeof(unsigned int));
memset(sampleLoaded,0,32768*sizeof(bool));
memCompo=DivMemoryComposition();
memCompo.name="Sample ROM";
@ -558,3 +558,17 @@ void DivPlatformGA20::quit() {
delete oscBuf[i];
}
}
// initialization of important arrays
DivPlatformGA20::DivPlatformGA20():
DivDispatch(),
iremga20_intf(),
ga20(*this) {
sampleOffGA20=new unsigned int[32768];
sampleLoaded=new bool[32768];
}
DivPlatformGA20::~DivPlatformGA20() {
delete[] sampleOffGA20;
delete[] sampleLoaded;
}

View file

@ -55,8 +55,8 @@ class DivPlatformGA20: public DivDispatch, public iremga20_intf {
val(v) {}
};
FixedQueue<QueuedWrite,256> writes;
unsigned int sampleOffGA20[256];
bool sampleLoaded[256];
unsigned int* sampleOffGA20;
bool* sampleLoaded;
int oldOut;
@ -104,10 +104,8 @@ class DivPlatformGA20: public DivDispatch, public iremga20_intf {
virtual void renderSamples(int chipID) override;
virtual int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags) override;
virtual void quit() override;
DivPlatformGA20():
DivDispatch(),
iremga20_intf(),
ga20(*this) {}
DivPlatformGA20();
~DivPlatformGA20();
};
#endif

View file

@ -448,7 +448,7 @@ size_t DivPlatformGBADMA::getSampleMemUsage(int index) {
bool DivPlatformGBADMA::isSampleLoaded(int index, int sample) {
if (index!=0) return false;
if (sample<0 || sample>255) return false;
if (sample<0 || sample>32767) return false;
return sampleLoaded[sample];
}
@ -463,6 +463,8 @@ const DivMemoryComposition* DivPlatformGBADMA::getMemCompo(int index) {
void DivPlatformGBADMA::renderSamples(int sysID) {
size_t maxPos=getSampleMemCapacity();
memset(sampleMem,0,maxPos);
memset(sampleOff,0,32768*sizeof(unsigned int));
memset(sampleLoaded,0,32768*sizeof(bool));
romMemCompo.entries.clear();
romMemCompo.capacity=maxPos;
@ -533,3 +535,14 @@ void DivPlatformGBADMA::quit() {
delete oscBuf[i];
}
}
// initialization of important arrays
DivPlatformGBADMA::DivPlatformGBADMA() {
sampleOff=new unsigned int[32768];
sampleLoaded=new bool[32768];
}
DivPlatformGBADMA::~DivPlatformGBADMA() {
delete[] sampleOff;
delete[] sampleLoaded;
}

View file

@ -54,8 +54,8 @@ class DivPlatformGBADMA: public DivDispatch {
Channel chan[2];
DivDispatchOscBuffer* oscBuf[2];
bool isMuted[2];
unsigned int sampleOff[256];
bool sampleLoaded[256];
unsigned int* sampleOff;
bool* sampleLoaded;
int outDepth;
signed char* sampleMem;
@ -93,6 +93,8 @@ class DivPlatformGBADMA: public DivDispatch {
void renderSamples(int chipID);
int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit();
DivPlatformGBADMA();
~DivPlatformGBADMA();
private:
void updateWave(int ch);

View file

@ -674,7 +674,7 @@ size_t DivPlatformGBAMinMod::getSampleMemUsage(int index) {
bool DivPlatformGBAMinMod::isSampleLoaded(int index, int sample) {
if (index!=0) return false;
if (sample<0 || sample>255) return false;
if (sample<0 || sample>32767) return false;
return sampleLoaded[sample];
}
@ -690,6 +690,8 @@ const DivMemoryComposition* DivPlatformGBAMinMod::getMemCompo(int index) {
void DivPlatformGBAMinMod::renderSamples(int sysID) {
size_t maxPos=getSampleMemCapacity();
memset(sampleMem,0,maxPos);
memset(sampleOff,0,32768*sizeof(unsigned int));
memset(sampleLoaded,0,32768*sizeof(bool));
romMemCompo.entries.clear();
romMemCompo.capacity=maxPos;
@ -788,3 +790,14 @@ void DivPlatformGBAMinMod::quit() {
delete oscBuf[i];
}
}
// initialization of important arrays
DivPlatformGBAMinMod::DivPlatformGBAMinMod() {
sampleOff=new unsigned int[32768];
sampleLoaded=new bool[32768];
}
DivPlatformGBAMinMod::~DivPlatformGBAMinMod() {
delete[] sampleOff;
delete[] sampleLoaded;
}

View file

@ -54,8 +54,8 @@ class DivPlatformGBAMinMod: public DivDispatch {
Channel chan[16];
DivDispatchOscBuffer* oscBuf[16];
bool isMuted[16];
unsigned int sampleOff[256];
bool sampleLoaded[256];
unsigned int* sampleOff;
bool* sampleLoaded;
int volScale;
unsigned char chanMax;
@ -121,6 +121,8 @@ class DivPlatformGBAMinMod: public DivDispatch {
void setFlags(const DivConfig& flags);
int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit();
DivPlatformGBAMinMod();
~DivPlatformGBAMinMod();
float maxCPU;
private:

View file

@ -555,7 +555,7 @@ size_t DivPlatformK007232::getSampleMemUsage(int index) {
bool DivPlatformK007232::isSampleLoaded(int index, int sample) {
if (index!=0) return false;
if (sample<0 || sample>255) return false;
if (sample<0 || sample>32767) return false;
return sampleLoaded[sample];
}
@ -566,8 +566,8 @@ const DivMemoryComposition* DivPlatformK007232::getMemCompo(int index) {
void DivPlatformK007232::renderSamples(int sysID) {
memset(sampleMem,0xc0,getSampleMemCapacity());
memset(sampleOffK007232,0,256*sizeof(unsigned int));
memset(sampleLoaded,0,256*sizeof(bool));
memset(sampleOffK007232,0,32768*sizeof(unsigned int));
memset(sampleLoaded,0,32768*sizeof(bool));
memCompo=DivMemoryComposition();
memCompo.name="Sample ROM";
@ -636,3 +636,17 @@ void DivPlatformK007232::quit() {
delete oscBuf[i];
}
}
// initialization of important arrays
DivPlatformK007232::DivPlatformK007232():
DivDispatch(),
k007232_intf(),
k007232(*this) {
sampleOffK007232=new unsigned int[32768];
sampleLoaded=new bool[32768];
}
DivPlatformK007232::~DivPlatformK007232() {
delete[] sampleOffK007232;
delete[] sampleLoaded;
}

View file

@ -63,8 +63,8 @@ class DivPlatformK007232: public DivDispatch, public k007232_intf {
val(v) {}
};
FixedQueue<QueuedWrite,256> writes;
unsigned int sampleOffK007232[256];
bool sampleLoaded[256];
unsigned int* sampleOffK007232;
bool* sampleLoaded;
int delay;
unsigned char lastLoop, lastVolume, oscDivider;
@ -110,10 +110,8 @@ class DivPlatformK007232: public DivDispatch, public k007232_intf {
void renderSamples(int chipID);
int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit();
DivPlatformK007232():
DivDispatch(),
k007232_intf(),
k007232(*this) {}
DivPlatformK007232();
~DivPlatformK007232();
};
#endif

View file

@ -160,7 +160,7 @@ void DivPlatformK053260::tick(bool sysTick) {
unsigned int start=0;
unsigned int length=0;
if (sample>=0 && sample<parent->song.sampleLen) {
start=sampleOffK053260[sample];
start=sampleOff[sample];
length=(s->depth==DIV_SAMPLE_DEPTH_ADPCM_K)?s->lengthK:s->length8;
if (chan[i].reverse) {
start+=length;
@ -470,7 +470,7 @@ size_t DivPlatformK053260::getSampleMemUsage(int index) {
bool DivPlatformK053260::isSampleLoaded(int index, int sample) {
if (index!=0) return false;
if (sample<0 || sample>255) return false;
if (sample<0 || sample>32767) return false;
return sampleLoaded[sample];
}
@ -481,8 +481,8 @@ const DivMemoryComposition* DivPlatformK053260::getMemCompo(int index) {
void DivPlatformK053260::renderSamples(int sysID) {
memset(sampleMem,0,getSampleMemCapacity());
memset(sampleOffK053260,0,256*sizeof(unsigned int));
memset(sampleLoaded,0,256*sizeof(bool));
memset(sampleOff,0,32768*sizeof(unsigned int));
memset(sampleLoaded,0,32768*sizeof(bool));
memCompo=DivMemoryComposition();
memCompo.name="Sample ROM";
@ -491,7 +491,7 @@ void DivPlatformK053260::renderSamples(int sysID) {
for (int i=0; i<parent->song.sampleLen; i++) {
DivSample* s=parent->song.sample[i];
if (!s->renderOn[0][sysID]) {
sampleOffK053260[i]=0;
sampleOff[i]=0;
continue;
}
@ -501,7 +501,7 @@ void DivPlatformK053260::renderSamples(int sysID) {
length=MIN(65535,s->getEndPosition(DIV_SAMPLE_DEPTH_ADPCM_K));
actualLength=MIN((int)(getSampleMemCapacity()-memPos-1),length);
if (actualLength>0) {
sampleOffK053260[i]=memPos-1;
sampleOff[i]=memPos-1;
memCompo.entries.push_back(DivMemoryEntry(DIV_MEMORY_SAMPLE,"Sample",i,memPos,memPos+actualLength+1));
for (int j=0; j<actualLength; j++) {
sampleMem[memPos++]=s->dataK[j];
@ -512,7 +512,7 @@ void DivPlatformK053260::renderSamples(int sysID) {
length=MIN(65535,s->getEndPosition(DIV_SAMPLE_DEPTH_8BIT));
actualLength=MIN((int)(getSampleMemCapacity()-memPos-1),length);
if (actualLength>0) {
sampleOffK053260[i]=memPos-1;
sampleOff[i]=memPos-1;
memCompo.entries.push_back(DivMemoryEntry(DIV_MEMORY_SAMPLE,"Sample",i,memPos,memPos+actualLength+1));
for (int j=0; j<actualLength; j++) {
sampleMem[memPos++]=s->data8[j];
@ -555,3 +555,17 @@ void DivPlatformK053260::quit() {
delete oscBuf[i];
}
}
// initialization of important arrays
DivPlatformK053260::DivPlatformK053260():
DivDispatch(),
k053260_intf(),
k053260(*this) {
sampleOff=new unsigned int[32768];
sampleLoaded=new bool[32768];
}
DivPlatformK053260::~DivPlatformK053260() {
delete[] sampleOff;
delete[] sampleLoaded;
}

View file

@ -46,8 +46,8 @@ class DivPlatformK053260: public DivDispatch, public k053260_intf {
bool isMuted[4];
int chipType;
unsigned char curChan;
unsigned int sampleOffK053260[256];
bool sampleLoaded[256];
unsigned int* sampleOff;
bool* sampleLoaded;
unsigned char* sampleMem;
size_t sampleMemLen;
@ -89,10 +89,8 @@ class DivPlatformK053260: public DivDispatch, public k053260_intf {
virtual void renderSamples(int chipID) override;
virtual int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags) override;
virtual void quit() override;
DivPlatformK053260():
DivDispatch(),
k053260_intf(),
k053260(*this) {}
DivPlatformK053260();
~DivPlatformK053260();
private:
void chWrite(unsigned char ch, unsigned int addr, unsigned char val);
};

View file

@ -385,7 +385,7 @@ size_t DivPlatformMSM6295::getSampleMemUsage(int index) {
bool DivPlatformMSM6295::isSampleLoaded(int index, int sample) {
if (index!=0) return false;
if (sample<0 || sample>255) return false;
if (sample<0 || sample>32767) return false;
return sampleLoaded[sample];
}
@ -395,12 +395,12 @@ const DivMemoryComposition* DivPlatformMSM6295::getMemCompo(int index) {
}
void DivPlatformMSM6295::renderSamples(int sysID) {
unsigned int sampleOffVOX[256];
unsigned int* sampleOffVOX=new unsigned int[32768];
memset(adpcmMem,0,16777216);
memset(sampleOffVOX,0,256*sizeof(unsigned int));
memset(sampleLoaded,0,256*sizeof(bool));
for (int i=0; i<256; i++) {
memset(sampleOffVOX,0,32768*sizeof(unsigned int));
memset(sampleLoaded,0,32768*sizeof(bool));
for (int i=0; i<32768; i++) {
bankedPhrase[i].bank=0;
bankedPhrase[i].phrase=0;
}
@ -510,6 +510,8 @@ void DivPlatformMSM6295::renderSamples(int sysID) {
memCompo.capacity=getSampleMemCapacity(0);
memCompo.used=adpcmMemLen;
delete[] sampleOffVOX;
}
void DivPlatformMSM6295::setFlags(const DivConfig& flags) {
@ -600,5 +602,16 @@ void DivPlatformMSM6295::quit() {
delete[] adpcmMem;
}
DivPlatformMSM6295::~DivPlatformMSM6295() {
// initialization of important arrays
DivPlatformMSM6295::DivPlatformMSM6295():
DivDispatch(),
vgsound_emu_mem_intf(),
msm(*this) {
bankedPhrase=new BankedPhrase[32768];
sampleLoaded=new bool[32768];
}
DivPlatformMSM6295::~DivPlatformMSM6295() {
delete[] bankedPhrase;
delete[] sampleLoaded;
}

View file

@ -52,7 +52,7 @@ class DivPlatformMSM6295: public DivDispatch, public vgsound_emu_mem_intf {
unsigned char* adpcmMem;
size_t adpcmMemLen;
bool sampleLoaded[256];
bool* sampleLoaded;
unsigned char sampleBank;
int delay, updateOsc;
@ -68,7 +68,7 @@ class DivPlatformMSM6295: public DivDispatch, public vgsound_emu_mem_intf {
bank(0),
phrase(0),
length(0) {}
} bankedPhrase[256];
}* bankedPhrase;
DivMemoryComposition memCompo;
@ -106,10 +106,7 @@ class DivPlatformMSM6295: public DivDispatch, public vgsound_emu_mem_intf {
virtual int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags) override;
virtual void quit() override;
DivPlatformMSM6295():
DivDispatch(),
vgsound_emu_mem_intf(),
msm(*this) {}
DivPlatformMSM6295();
~DivPlatformMSM6295();
};
#endif

View file

@ -531,7 +531,7 @@ size_t DivPlatformNDS::getSampleMemUsage(int index) {
bool DivPlatformNDS::isSampleLoaded(int index, int sample) {
if (index!=0) return false;
if (sample<0 || sample>255) return false;
if (sample<0 || sample>32767) return false;
return sampleLoaded[sample];
}
@ -542,8 +542,8 @@ const DivMemoryComposition* DivPlatformNDS::getMemCompo(int index) {
void DivPlatformNDS::renderSamples(int sysID) {
memset(sampleMem,0,16777216);
memset(sampleOff,0,256*sizeof(unsigned int));
memset(sampleLoaded,0,256*sizeof(bool));
memset(sampleOff,0,32768*sizeof(unsigned int));
memset(sampleLoaded,0,32768*sizeof(bool));
memCompo=DivMemoryComposition();
memCompo.name="Main Memory";
@ -629,3 +629,17 @@ void DivPlatformNDS::quit() {
delete oscBuf[i];
}
}
// initialization of important arrays
DivPlatformNDS::DivPlatformNDS():
DivDispatch(),
nds_sound_intf(),
nds(*this) {
sampleOff=new unsigned int[32768];
sampleLoaded=new bool[32768];
}
DivPlatformNDS::~DivPlatformNDS() {
delete[] sampleOff;
delete[] sampleLoaded;
}

View file

@ -50,8 +50,8 @@ class DivPlatformNDS: public DivDispatch, public nds_sound_intf {
bool isDSi;
int globalVolume;
int lastOut[2];
unsigned int sampleOff[256];
bool sampleLoaded[256];
unsigned int* sampleOff;
bool* sampleLoaded;
struct QueuedWrite {
unsigned short addr;
unsigned char size;
@ -104,10 +104,8 @@ class DivPlatformNDS: public DivDispatch, public nds_sound_intf {
virtual void setFlags(const DivConfig& flags) override;
virtual int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags) override;
virtual void quit() override;
DivPlatformNDS():
DivDispatch(),
nds_sound_intf(),
nds(*this) {}
DivPlatformNDS();
~DivPlatformNDS();
private:
void writeOutVol(int ch);
};

View file

@ -1039,7 +1039,7 @@ size_t DivPlatformNES::getSampleMemUsage(int index) {
bool DivPlatformNES::isSampleLoaded(int index, int sample) {
if (index!=0) return false;
if (sample<0 || sample>255) return false;
if (sample<0 || sample>32767) return false;
return sampleLoaded[sample];
}
@ -1050,7 +1050,8 @@ const DivMemoryComposition* DivPlatformNES::getMemCompo(int index) {
void DivPlatformNES::renderSamples(int sysID) {
memset(dpcmMem,0,getSampleMemCapacity(0));
memset(sampleLoaded,0,256*sizeof(bool));
memset(sampleOffDPCM,0,32768*sizeof(unsigned int));
memset(sampleLoaded,0,32768*sizeof(bool));
memCompo=DivMemoryComposition();
memCompo.name="DPCM";
@ -1156,5 +1157,13 @@ void DivPlatformNES::quit() {
}
}
DivPlatformNES::~DivPlatformNES() {
// initialization of important arrays
DivPlatformNES::DivPlatformNES() {
sampleOffDPCM=new unsigned int[32768];
sampleLoaded=new bool[32768];
}
DivPlatformNES::~DivPlatformNES() {
delete[] sampleOffDPCM;
delete[] sampleLoaded;
}

View file

@ -57,7 +57,7 @@ class DivPlatformNES: public DivDispatch {
int dacSample;
unsigned char* dpcmMem;
size_t dpcmMemLen;
bool sampleLoaded[256];
bool* sampleLoaded;
unsigned char dpcmBank;
unsigned char sampleBank;
unsigned char writeOscBuf;
@ -80,7 +80,7 @@ class DivPlatformNES: public DivDispatch {
xgm::I5E01_APU* e1_NP;
xgm::I5E01_DMC* e2_NP;
unsigned char regPool[128];
unsigned int sampleOffDPCM[256];
unsigned int* sampleOffDPCM;
DivMemoryComposition memCompo;
friend void putDispatchChip(void*,int);
@ -124,6 +124,7 @@ class DivPlatformNES: public DivDispatch {
void renderSamples(int chipID);
int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit();
DivPlatformNES();
~DivPlatformNES();
};

View file

@ -3243,7 +3243,7 @@ size_t DivPlatformOPL::getSampleMemUsage(int index) {
bool DivPlatformOPL::isSampleLoaded(int index, int sample) {
if (index!=0) return false;
if (sample<0 || sample>255) return false;
if (sample<0 || sample>32767) return false;
return sampleLoaded[sample];
}
@ -3261,9 +3261,9 @@ void DivPlatformOPL::renderSamples(int sysID) {
if (pcmChanOffs>=0 && pcmMem!=NULL) {
memset(pcmMem,0,4194304);
}
memset(sampleOffPCM,0,256*sizeof(unsigned int));
memset(sampleOffB,0,256*sizeof(unsigned int));
memset(sampleLoaded,0,256*sizeof(bool));
memset(sampleOffPCM,0,32768*sizeof(unsigned int));
memset(sampleOffB,0,32768*sizeof(unsigned int));
memset(sampleLoaded,0,32768*sizeof(bool));
memCompo=DivMemoryComposition();
memCompo.name="Sample Memory";
@ -3503,5 +3503,17 @@ void DivPlatformOPL::quit() {
}
}
DivPlatformOPL::~DivPlatformOPL() {
// initialization of important arrays
DivPlatformOPL::DivPlatformOPL():
pcmMemory(0x400000),
pcm(pcmMemory) {
sampleOffPCM=new unsigned int[32768];
sampleOffB=new unsigned int[32768];
sampleLoaded=new bool[32768];
}
DivPlatformOPL::~DivPlatformOPL() {
delete[] sampleOffPCM;
delete[] sampleOffB;
delete[] sampleLoaded;
}

View file

@ -123,9 +123,9 @@ class DivPlatformOPL: public DivDispatch {
size_t pcmMemLen;
DivOPLAInterface iface;
DivYMF278MemoryInterface pcmMemory;
unsigned int sampleOffB[256];
unsigned int sampleOffPCM[256];
bool sampleLoaded[256];
unsigned int* sampleOffB;
unsigned int* sampleOffPCM;
bool* sampleLoaded;
ymfm::adpcm_b_engine* adpcmB;
const unsigned char** slotsNonDrums;
@ -223,9 +223,7 @@ class DivPlatformOPL: public DivDispatch {
void renderSamples(int chipID);
int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit();
DivPlatformOPL():
pcmMemory(0x400000),
pcm(pcmMemory) {}
DivPlatformOPL();
~DivPlatformOPL();
};
#endif

View file

@ -747,7 +747,7 @@ size_t DivPlatformQSound::getSampleMemUsage(int index) {
bool DivPlatformQSound::isSampleLoaded(int index, int sample) {
if (index<0 || index>1) return false;
if (sample<0 || sample>255) return false;
if (sample<0 || sample>32767) return false;
if (index==1) return sampleLoadedBS[sample];
return sampleLoaded[sample];
}
@ -763,8 +763,10 @@ const DivMemoryComposition* DivPlatformQSound::getMemCompo(int index) {
void DivPlatformQSound::renderSamples(int sysID) {
memset(sampleMem,0,getSampleMemCapacity());
memset(sampleLoaded,0,256*sizeof(bool));
memset(sampleLoadedBS,0,256*sizeof(bool));
memset(offPCM,0,32768*sizeof(unsigned int));
memset(offBS,0,32768*sizeof(unsigned int));
memset(sampleLoaded,0,32768*sizeof(bool));
memset(sampleLoadedBS,0,32768*sizeof(bool));
memCompo=DivMemoryComposition();
memCompo.name="Sample ROM";
@ -880,3 +882,18 @@ void DivPlatformQSound::quit() {
delete oscBuf[i];
}
}
// initialization of important arrays
DivPlatformQSound::DivPlatformQSound() {
offPCM=new unsigned int[32768];
offBS=new unsigned int[32768];
sampleLoaded=new bool[32768];
sampleLoadedBS=new bool[32768];
}
DivPlatformQSound::~DivPlatformQSound() {
delete[] offPCM;
delete[] offBS;
delete[] sampleLoaded;
delete[] sampleLoadedBS;
}

View file

@ -53,13 +53,13 @@ class DivPlatformQSound: public DivDispatch {
size_t sampleMemLen;
size_t sampleMemLenBS;
size_t sampleMemUsage;
bool sampleLoaded[256];
bool sampleLoadedBS[256];
bool* sampleLoaded;
bool* sampleLoadedBS;
struct qsound_chip chip;
unsigned short regPool[512];
unsigned int offPCM[256];
unsigned int offBS[256];
unsigned int* offPCM;
unsigned int* offBS;
DivMemoryComposition memCompo;
@ -98,6 +98,8 @@ class DivPlatformQSound: public DivDispatch {
void renderSamples(int chipID);
int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit();
DivPlatformQSound();
~DivPlatformQSound();
};
#endif

View file

@ -420,7 +420,7 @@ size_t DivPlatformRF5C68::getSampleMemUsage(int index) {
bool DivPlatformRF5C68::isSampleLoaded(int index, int sample) {
if (index!=0) return false;
if (sample<0 || sample>255) return false;
if (sample<0 || sample>32767) return false;
return sampleLoaded[sample];
}
@ -431,8 +431,8 @@ const DivMemoryComposition* DivPlatformRF5C68::getMemCompo(int index) {
void DivPlatformRF5C68::renderSamples(int sysID) {
memset(sampleMem,0,getSampleMemCapacity());
memset(sampleOffRFC,0,256*sizeof(unsigned int));
memset(sampleLoaded,0,256*sizeof(bool));
memset(sampleOffRFC,0,32768*sizeof(unsigned int));
memset(sampleLoaded,0,32768*sizeof(bool));
memCompo=DivMemoryComposition();
memCompo.name="Sample Memory";
@ -497,3 +497,14 @@ void DivPlatformRF5C68::quit() {
delete oscBuf[i];
}
}
// initialization of important arrays
DivPlatformRF5C68::DivPlatformRF5C68() {
sampleOffRFC=new unsigned int[32768];
sampleLoaded=new bool[32768];
}
DivPlatformRF5C68::~DivPlatformRF5C68() {
delete[] sampleOffRFC;
delete[] sampleLoaded;
}

View file

@ -44,8 +44,8 @@ class DivPlatformRF5C68: public DivDispatch {
bool isMuted[8];
int chipType;
unsigned char curChan;
unsigned int sampleOffRFC[256];
bool sampleLoaded[256];
unsigned int* sampleOffRFC;
bool* sampleLoaded;
unsigned char* sampleMem;
size_t sampleMemLen;
@ -85,6 +85,8 @@ class DivPlatformRF5C68: public DivDispatch {
void renderSamples(int chipID);
int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit();
DivPlatformRF5C68();
~DivPlatformRF5C68();
private:
void chWrite(unsigned char ch, unsigned int addr, unsigned char val);
};

View file

@ -470,7 +470,7 @@ size_t DivPlatformSegaPCM::getSampleMemUsage(int index) {
bool DivPlatformSegaPCM::isSampleLoaded(int index, int sample) {
if (index!=0) return false;
if (sample<0 || sample>255) return false;
if (sample<0 || sample>32767) return false;
return sampleLoaded[sample];
}
@ -509,9 +509,9 @@ void DivPlatformSegaPCM::renderSamples(int sysID) {
size_t memPos=0;
memset(sampleMem,0,2097152);
memset(sampleLoaded,0,256*sizeof(bool));
memset(sampleOffSegaPCM,0,256*sizeof(unsigned int));
memset(sampleEndSegaPCM,0,256);
memset(sampleLoaded,0,32768*sizeof(bool));
memset(sampleOffSegaPCM,0,32768*sizeof(unsigned int));
memset(sampleEndSegaPCM,0,32768);
memCompo=DivMemoryComposition();
memCompo.name="Sample ROM";
@ -595,5 +595,15 @@ void DivPlatformSegaPCM::quit() {
delete sampleMem;
}
DivPlatformSegaPCM::~DivPlatformSegaPCM() {
// initialization of important arrays
DivPlatformSegaPCM::DivPlatformSegaPCM() {
sampleOffSegaPCM=new unsigned int[32768];
sampleEndSegaPCM=new unsigned char[32768];
sampleLoaded=new bool[32768];
}
DivPlatformSegaPCM::~DivPlatformSegaPCM() {
delete[] sampleOffSegaPCM;
delete[] sampleEndSegaPCM;
delete[] sampleLoaded;
}

View file

@ -78,9 +78,9 @@ class DivPlatformSegaPCM: public DivDispatch {
short oldWrites[256];
short pendingWrites[256];
unsigned int sampleOffSegaPCM[256];
unsigned char sampleEndSegaPCM[256];
bool sampleLoaded[256];
unsigned int* sampleOffSegaPCM;
unsigned char* sampleEndSegaPCM;
bool* sampleLoaded;
DivMemoryComposition memCompo;
@ -116,6 +116,7 @@ class DivPlatformSegaPCM: public DivDispatch {
const DivMemoryComposition* getMemCompo(int index);
int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit();
DivPlatformSegaPCM();
~DivPlatformSegaPCM();
};
#endif

View file

@ -966,7 +966,7 @@ size_t DivPlatformSNES::getSampleMemUsage(int index) {
bool DivPlatformSNES::isSampleLoaded(int index, int sample) {
if (index!=0) return false;
if (sample<0 || sample>255) return false;
if (sample<0 || sample>32767) return false;
return sampleLoaded[sample];
}
@ -977,8 +977,8 @@ const DivMemoryComposition* DivPlatformSNES::getMemCompo(int index) {
void DivPlatformSNES::renderSamples(int sysID) {
memset(copyOfSampleMem,0,65536);
memset(sampleOff,0,256*sizeof(unsigned int));
memset(sampleLoaded,0,256*sizeof(bool));
memset(sampleOff,0,32768*sizeof(unsigned int));
memset(sampleLoaded,0,32768*sizeof(bool));
memCompo=DivMemoryComposition();
memCompo.name="SPC/DSP Memory";
@ -1077,3 +1077,14 @@ void DivPlatformSNES::quit() {
delete oscBuf[i];
}
}
// initialization of important arrays
DivPlatformSNES::DivPlatformSNES() {
sampleOff=new unsigned int[32768];
sampleLoaded=new bool[32768];
}
DivPlatformSNES::~DivPlatformSNES() {
delete[] sampleOff;
delete[] sampleLoaded;
}

View file

@ -93,8 +93,8 @@ class DivPlatformSNES: public DivDispatch {
signed char sampleMem[65536];
signed char copyOfSampleMem[65536];
size_t sampleMemLen;
unsigned int sampleOff[256];
bool sampleLoaded[256];
unsigned int* sampleOff;
bool* sampleLoaded;
DivMemoryComposition memCompo;
unsigned char regPool[0x80];
SPC_DSP dsp;
@ -132,6 +132,8 @@ class DivPlatformSNES: public DivDispatch {
void renderSamples(int chipID);
int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit();
DivPlatformSNES();
~DivPlatformSNES();
private:
void updateWave(int ch);
void writeOutVol(int ch);

View file

@ -690,7 +690,7 @@ size_t DivPlatformSoundUnit::getSampleMemUsage(int index) {
bool DivPlatformSoundUnit::isSampleLoaded(int index, int sample) {
if (index!=0) return false;
if (sample<0 || sample>255) return false;
if (sample<0 || sample>32767) return false;
return sampleLoaded[sample];
}
@ -701,8 +701,8 @@ const DivMemoryComposition* DivPlatformSoundUnit::getMemCompo(int index) {
void DivPlatformSoundUnit::renderSamples(int sysID) {
memset(sampleMem,0,sampleMemSize?65536:8192);
memset(sampleOffSU,0,256*sizeof(unsigned int));
memset(sampleLoaded,0,256*sizeof(bool));
memset(sampleOffSU,0,32768*sizeof(unsigned int));
memset(sampleLoaded,0,32768*sizeof(bool));
memCompo=DivMemoryComposition();
memCompo.name="Sample RAM";
@ -770,5 +770,13 @@ void DivPlatformSoundUnit::quit() {
delete[] sampleMem;
}
DivPlatformSoundUnit::~DivPlatformSoundUnit() {
// initialization of important arrays
DivPlatformSoundUnit::DivPlatformSoundUnit() {
sampleOffSU=new unsigned int[32768];
sampleLoaded=new bool[32768];
}
DivPlatformSoundUnit::~DivPlatformSoundUnit() {
delete[] sampleOffSU;
delete[] sampleLoaded;
}

View file

@ -94,8 +94,8 @@ class DivPlatformSoundUnit: public DivDispatch {
unsigned char ilCtrl, ilSize, fil1;
unsigned char initIlCtrl, initIlSize, initFil1;
signed char echoVol, initEchoVol;
unsigned int sampleOffSU[256];
bool sampleLoaded[256];
unsigned int* sampleOffSU;
bool* sampleLoaded;
int cycles, curChan, delay, sysIDCache;
short tempL;
@ -140,6 +140,7 @@ class DivPlatformSoundUnit: public DivDispatch {
void renderSamples(int chipID);
int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit();
DivPlatformSoundUnit();
~DivPlatformSoundUnit();
};

View file

@ -513,7 +513,7 @@ size_t DivPlatformSupervision::getSampleMemUsage(int index) {
bool DivPlatformSupervision::isSampleLoaded(int index, int sample) {
if (index!=0) return false;
if (sample<0 || sample>255) return false;
if (sample<0 || sample>32767) return false;
return sampleLoaded[sample];
}
@ -524,7 +524,7 @@ const DivMemoryComposition* DivPlatformSupervision::getMemCompo(int index) {
void DivPlatformSupervision::renderSamples(int sysID) {
memset(sampleMem,0,getSampleMemCapacity(0));
memset(sampleLoaded,0,256*sizeof(bool));
memset(sampleLoaded,0,32768*sizeof(bool));
memCompo=DivMemoryComposition();
memCompo.name="Sample Memory";
@ -603,5 +603,13 @@ void DivPlatformSupervision::quit() {
}
}
DivPlatformSupervision::~DivPlatformSupervision() {
// initialization of important arrays
DivPlatformSupervision::DivPlatformSupervision() {
sampleOff=new unsigned int[32768];
sampleLoaded=new bool[32768];
}
DivPlatformSupervision::~DivPlatformSupervision() {
delete[] sampleOff;
delete[] sampleLoaded;
}

View file

@ -56,9 +56,9 @@ class DivPlatformSupervision: public DivDispatch {
int tempR[32];
int coreQuality;
unsigned char regPool[64];
unsigned int sampleOff[256];
unsigned int sampleLen[256];
bool sampleLoaded[256];
unsigned int* sampleOff;
unsigned int* sampleLen;
bool* sampleLoaded;
DivMemoryComposition memCompo;
unsigned char* sampleMem;
size_t sampleMemLen;
@ -98,6 +98,7 @@ class DivPlatformSupervision: public DivDispatch {
bool getDCOffRequired();
int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit();
DivPlatformSupervision();
~DivPlatformSupervision();
};

View file

@ -1001,7 +1001,7 @@ size_t DivPlatformX1_010::getSampleMemUsage(int index) {
bool DivPlatformX1_010::isSampleLoaded(int index, int sample) {
if (index!=0) return false;
if (sample<0 || sample>255) return false;
if (sample<0 || sample>32767) return false;
return sampleLoaded[sample];
}
@ -1012,8 +1012,8 @@ const DivMemoryComposition* DivPlatformX1_010::getMemCompo(int index) {
void DivPlatformX1_010::renderSamples(int sysID) {
memset(sampleMem,0,16777216);
memset(sampleOffX1,0,256*sizeof(unsigned int));
memset(sampleLoaded,0,256*sizeof(bool));
memset(sampleOffX1,0,32768*sizeof(unsigned int));
memset(sampleLoaded,0,32768*sizeof(bool));
memCompo=DivMemoryComposition();
memCompo.name="Sample ROM";
@ -1081,5 +1081,16 @@ void DivPlatformX1_010::quit() {
delete[] sampleMem;
}
DivPlatformX1_010::~DivPlatformX1_010() {
// initialization of important arrays
DivPlatformX1_010::DivPlatformX1_010():
DivDispatch(),
vgsound_emu_mem_intf(),
x1_010(*this) {
sampleOffX1=new unsigned int[32768];
sampleLoaded=new bool[32768];
}
DivPlatformX1_010::~DivPlatformX1_010() {
delete[] sampleOffX1;
delete[] sampleLoaded;
}

View file

@ -117,8 +117,8 @@ class DivPlatformX1_010: public DivDispatch, public vgsound_emu_mem_intf {
bool isBanked=false;
unsigned int bankSlot[8];
unsigned int sampleOffX1[256];
bool sampleLoaded[256];
unsigned int* sampleOffX1;
bool* sampleLoaded;
DivMemoryComposition memCompo;
@ -159,10 +159,7 @@ class DivPlatformX1_010: public DivDispatch, public vgsound_emu_mem_intf {
const char** getRegisterSheet();
int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit();
DivPlatformX1_010():
DivDispatch(),
vgsound_emu_mem_intf(),
x1_010(*this) {}
DivPlatformX1_010();
~DivPlatformX1_010();
};

View file

@ -1991,7 +1991,7 @@ size_t DivPlatformYM2608::getSampleMemUsage(int index) {
bool DivPlatformYM2608::isSampleLoaded(int index, int sample) {
if (index!=0) return false;
if (sample<0 || sample>255) return false;
if (sample<0 || sample>32767) return false;
return sampleLoaded[sample];
}
@ -2002,8 +2002,8 @@ const DivMemoryComposition* DivPlatformYM2608::getMemCompo(int index) {
void DivPlatformYM2608::renderSamples(int sysID) {
memset(adpcmBMem,0,getSampleMemCapacity(0));
memset(sampleOffB,0,256*sizeof(unsigned int));
memset(sampleLoaded,0,256*sizeof(bool));
memset(sampleOffB,0,32768*sizeof(unsigned int));
memset(sampleLoaded,0,32768*sizeof(bool));
memCompo=DivMemoryComposition();
memCompo.name="ADPCM";
@ -2148,5 +2148,16 @@ void DivPlatformYM2608::quit() {
delete[] adpcmBMem;
}
DivPlatformYM2608::~DivPlatformYM2608() {
// initialization of important arrays
DivPlatformYM2608::DivPlatformYM2608():
DivPlatformOPN(2, 6, 9, 15, 16, 9440540.0, 72, 32, false, 16),
prescale(0x2d),
isCSM(0) {
sampleOffB=new unsigned int[32768];
sampleLoaded=new bool[32768];
}
DivPlatformYM2608::~DivPlatformYM2608() {
delete[] sampleOffB;
delete[] sampleLoaded;
}

View file

@ -67,8 +67,8 @@ class DivPlatformYM2608: public DivPlatformOPN {
unsigned char* adpcmBMem;
size_t adpcmBMemLen;
DivYM2608Interface iface;
unsigned int sampleOffB[256];
bool sampleLoaded[256];
unsigned int* sampleOffB;
bool* sampleLoaded;
DivPlatformAY8910* ay;
unsigned char sampleBank;
@ -124,10 +124,7 @@ class DivPlatformYM2608: public DivPlatformOPN {
int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void setCSM(bool isCSM);
void quit();
DivPlatformYM2608():
DivPlatformOPN(2, 6, 9, 15, 16, 9440540.0, 72, 32, false, 16),
prescale(0x2d),
isCSM(0) {}
DivPlatformYM2608();
~DivPlatformYM2608();
};
#endif

View file

@ -75,14 +75,14 @@ class DivPlatformYM2610Base: public DivPlatformOPN {
size_t adpcmBMemLen;
DivYM2610Interface iface;
unsigned int sampleOffA[256];
unsigned int sampleOffB[256];
unsigned int* sampleOffA;
unsigned int* sampleOffB;
unsigned char sampleBank;
bool extMode, noExtMacros;
bool sampleLoaded[2][256];
bool* sampleLoaded[2];
unsigned char writeADPCMAOff, writeADPCMAOn;
int globalADPCMAVolume;
@ -214,7 +214,7 @@ class DivPlatformYM2610Base: public DivPlatformOPN {
bool isSampleLoaded(int index, int sample) {
if (index<0 || index>1) return false;
if (sample<0 || sample>255) return false;
if (sample<0 || sample>32767) return false;
return sampleLoaded[index][sample];
}
@ -226,9 +226,10 @@ class DivPlatformYM2610Base: public DivPlatformOPN {
void renderSamples(int sysID) {
memset(adpcmAMem,0,getSampleMemCapacity(0));
memset(sampleOffA,0,256*sizeof(unsigned int));
memset(sampleOffB,0,256*sizeof(unsigned int));
memset(sampleLoaded,0,256*2*sizeof(bool));
memset(sampleOffA,0,32768*sizeof(unsigned int));
memset(sampleOffB,0,32768*sizeof(unsigned int));
memset(sampleLoaded[0],0,32768*sizeof(bool));
memset(sampleLoaded[1],0,32768*sizeof(bool));
memCompoA=DivMemoryComposition();
memCompoA.name="ADPCM-A";
@ -365,7 +366,18 @@ class DivPlatformYM2610Base: public DivPlatformOPN {
}
DivPlatformYM2610Base(int ext, int psg, int adpcmA, int adpcmB, int chanCount):
DivPlatformOPN(ext,psg,adpcmA,adpcmB,chanCount,9440540.0, 72, 32, false, 16) {}
DivPlatformOPN(ext,psg,adpcmA,adpcmB,chanCount,9440540.0, 72, 32, false, 16) {
sampleOffA=new unsigned int[32768];
sampleOffB=new unsigned int[32768];
sampleLoaded[0]=new bool[32768];
sampleLoaded[1]=new bool[32768];
}
~DivPlatformYM2610Base() {
delete[] sampleOffA;
delete[] sampleOffB;
delete[] sampleLoaded[0];
delete[] sampleLoaded[1];
}
};
#endif

View file

@ -449,7 +449,7 @@ size_t DivPlatformYMZ280B::getSampleMemUsage(int index) {
bool DivPlatformYMZ280B::isSampleLoaded(int index, int sample) {
if (index!=0) return false;
if (sample<0 || sample>255) return false;
if (sample<0 || sample>32767) return false;
return sampleLoaded[sample];
}
@ -460,8 +460,8 @@ const DivMemoryComposition* DivPlatformYMZ280B::getMemCompo(int index) {
void DivPlatformYMZ280B::renderSamples(int sysID) {
memset(sampleMem,0,getSampleMemCapacity());
memset(sampleOff,0,256*sizeof(unsigned int));
memset(sampleLoaded,0,256*sizeof(bool));
memset(sampleOff,0,32768*sizeof(unsigned int));
memset(sampleLoaded,0,32768*sizeof(bool));
memCompo=DivMemoryComposition();
memCompo.name="Sample ROM";
@ -570,3 +570,14 @@ void DivPlatformYMZ280B::quit() {
delete oscBuf[i];
}
}
// initialization of important arrays
DivPlatformYMZ280B::DivPlatformYMZ280B() {
sampleOff=new unsigned int[32768];
sampleLoaded=new bool[32768];
}
DivPlatformYMZ280B::~DivPlatformYMZ280B() {
delete[] sampleOff;
delete[] sampleLoaded;
}

View file

@ -44,8 +44,8 @@ class DivPlatformYMZ280B: public DivDispatch {
DivDispatchOscBuffer* oscBuf[8];
bool isMuted[8];
int chipType;
unsigned int sampleOff[256];
bool sampleLoaded[256];
unsigned int* sampleOff;
bool* sampleLoaded;
unsigned char* sampleMem;
size_t sampleMemLen;
@ -86,6 +86,8 @@ class DivPlatformYMZ280B: public DivDispatch {
void setFlags(const DivConfig& flags);
int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit();
DivPlatformYMZ280B();
~DivPlatformYMZ280B();
private:
void writeOutVol(int ch);
};