Performance adjusts

This commit is contained in:
cam900 2022-08-28 09:59:56 +09:00
parent f73d1bd82c
commit a411e34a62
13 changed files with 24 additions and 22 deletions

View File

@ -60,14 +60,16 @@ enum DivInstrumentType: unsigned short {
DIV_INS_SU=30, DIV_INS_SU=30,
DIV_INS_NAMCO=31, DIV_INS_NAMCO=31,
DIV_INS_OPL_DRUMS=32, DIV_INS_OPL_DRUMS=32,
DIV_INS_MSM6258=33, //33
DIV_INS_MSM6295=34, //34
DIV_INS_ADPCMA=35, DIV_INS_MSM6258=35,
DIV_INS_ADPCMB=36, DIV_INS_MSM6295=36,
DIV_INS_SEGAPCM=37, DIV_INS_ADPCMA=37,
DIV_INS_QSOUND=38, DIV_INS_ADPCMB=38,
DIV_INS_YMZ280B=39, DIV_INS_SEGAPCM=39,
DIV_INS_RF5C68=40, DIV_INS_QSOUND=40,
DIV_INS_YMZ280B=41,
DIV_INS_RF5C68=42,
DIV_INS_MAX, DIV_INS_MAX,
DIV_INS_NULL DIV_INS_NULL
}; };

View File

@ -95,8 +95,8 @@ void DivPlatformAmiga::acquire(short* bufL, short* bufR, size_t start, size_t le
} }
} else { } else {
DivSample* s=parent->getSample(chan[i].sample); DivSample* s=parent->getSample(chan[i].sample);
if (s->getEndPosition()>0) { if (s->samples>0) {
if (chan[i].audPos<(unsigned int)s->getEndPosition()) { if (chan[i].audPos<s->samples) {
writeAudDat(s->data8[chan[i].audPos++]); writeAudDat(s->data8[chan[i].audPos++]);
} }
if (s->isLoopable() && chan[i].audPos>=MIN(131071,(unsigned int)s->getLoopEndPosition())) { if (s->isLoopable() && chan[i].audPos>=MIN(131071,(unsigned int)s->getLoopEndPosition())) {

View File

@ -90,7 +90,7 @@ void DivPlatformAY8910::acquire(short* bufL, short* bufR, size_t start, size_t l
int prev_out = chan[i].dac.out; int prev_out = chan[i].dac.out;
while (chan[i].dac.period>rate && !end) { while (chan[i].dac.period>rate && !end) {
DivSample* s=parent->getSample(chan[i].dac.sample); DivSample* s=parent->getSample(chan[i].dac.sample);
if (s->getEndPosition()<=0) { if (s->samples<=0) {
chan[i].dac.sample=-1; chan[i].dac.sample=-1;
rWrite(0x08+i,0); rWrite(0x08+i,0);
end=true; end=true;

View File

@ -94,7 +94,7 @@ void DivPlatformAY8930::acquire(short* bufL, short* bufR, size_t start, size_t l
int prev_out = chan[i].dac.out; int prev_out = chan[i].dac.out;
while (chan[i].dac.period>rate && !end) { while (chan[i].dac.period>rate && !end) {
DivSample* s=parent->getSample(chan[i].dac.sample); DivSample* s=parent->getSample(chan[i].dac.sample);
if (s->getEndPosition()<=0) { if (s->samples<=0) {
chan[i].dac.sample=-1; chan[i].dac.sample=-1;
rWrite(0x08+i,0); rWrite(0x08+i,0);
end=true; end=true;

View File

@ -49,7 +49,7 @@ void DivPlatformMMC5::acquire(short* bufL, short* bufR, size_t start, size_t len
dacPeriod+=dacRate; dacPeriod+=dacRate;
if (dacPeriod>=rate) { if (dacPeriod>=rate) {
DivSample* s=parent->getSample(dacSample); DivSample* s=parent->getSample(dacSample);
if (s->getEndPosition()>0) { if (s->samples>0) {
if (!isMuted[2]) { if (!isMuted[2]) {
rWrite(0x5011,((unsigned char)s->data8[dacPos]+0x80)); rWrite(0x5011,((unsigned char)s->data8[dacPos]+0x80));
} }

View File

@ -76,7 +76,7 @@ void DivPlatformNES::doWrite(unsigned short addr, unsigned char data) {
dacPeriod+=dacRate; \ dacPeriod+=dacRate; \
if (dacPeriod>=rate) { \ if (dacPeriod>=rate) { \
DivSample* s=parent->getSample(dacSample); \ DivSample* s=parent->getSample(dacSample); \
if (s->getEndPosition()>0) { \ if (s->samples>0) { \
if (!isMuted[4]) { \ if (!isMuted[4]) { \
unsigned char next=((unsigned char)s->data8[dacPos]+0x80)>>1; \ unsigned char next=((unsigned char)s->data8[dacPos]+0x80)>>1; \
if (dacAntiClickOn && dacAntiClick<next) { \ if (dacAntiClickOn && dacAntiClick<next) { \

View File

@ -61,7 +61,7 @@ void DivPlatformPCE::acquire(short* bufL, short* bufR, size_t start, size_t len)
chan[i].dacPeriod+=chan[i].dacRate; chan[i].dacPeriod+=chan[i].dacRate;
if (chan[i].dacPeriod>rate) { if (chan[i].dacPeriod>rate) {
DivSample* s=parent->getSample(chan[i].dacSample); DivSample* s=parent->getSample(chan[i].dacSample);
if (s->getEndPosition()<=0) { if (s->samples<=0) {
chan[i].dacSample=-1; chan[i].dacSample=-1;
continue; continue;
} }

View File

@ -50,7 +50,7 @@ void DivPlatformPCMDAC::acquire(short* bufL, short* bufR, size_t start, size_t l
output=(chan.ws.output[chan.audPos]^0x80)<<8; output=(chan.ws.output[chan.audPos]^0x80)<<8;
} else { } else {
DivSample* s=parent->getSample(chan.sample); DivSample* s=parent->getSample(chan.sample);
if (s->getEndPosition()>0) { if (s->samples>0) {
if (chan.audDir) { if (chan.audDir) {
if (s->isLoopable()) { if (s->isLoopable()) {
switch (s->loopMode) { switch (s->loopMode) {

View File

@ -36,7 +36,7 @@ void DivPlatformSegaPCM::acquire(short* bufL, short* bufR, size_t start, size_t
for (int i=0; i<16; i++) { for (int i=0; i<16; i++) {
if (chan[i].pcm.sample>=0 && chan[i].pcm.sample<parent->song.sampleLen) { if (chan[i].pcm.sample>=0 && chan[i].pcm.sample<parent->song.sampleLen) {
DivSample* s=parent->getSample(chan[i].pcm.sample); DivSample* s=parent->getSample(chan[i].pcm.sample);
if (s->getEndPosition()<=0) { if (s->samples<=0) {
chan[i].pcm.sample=-1; chan[i].pcm.sample=-1;
oscBuf[i]->data[oscBuf[i]->needle++]=0; oscBuf[i]->data[oscBuf[i]->needle++]=0;
continue; continue;

View File

@ -57,7 +57,7 @@ void DivPlatformSwan::acquire(short* bufL, short* bufR, size_t start, size_t len
dacPeriod+=dacRate; dacPeriod+=dacRate;
while (dacPeriod>rate) { while (dacPeriod>rate) {
DivSample* s=parent->getSample(dacSample); DivSample* s=parent->getSample(dacSample);
if (s->getEndPosition()<=0) { if (s->samples<=0) {
dacSample=-1; dacSample=-1;
continue; continue;
} }

View File

@ -58,7 +58,7 @@ void DivPlatformVERA::acquire(short* bufL, short* bufR, size_t start, size_t len
size_t pos=start; size_t pos=start;
DivSample* s=parent->getSample(chan[16].pcm.sample); DivSample* s=parent->getSample(chan[16].pcm.sample);
while (len>0) { while (len>0) {
if (s->getEndPosition()>0) { if (s->samples>0) {
while (pcm_is_fifo_almost_empty(pcm)) { while (pcm_is_fifo_almost_empty(pcm)) {
short tmp_l=0; short tmp_l=0;
short tmp_r=0; short tmp_r=0;

View File

@ -54,7 +54,7 @@ void DivPlatformVRC6::acquire(short* bufL, short* bufR, size_t start, size_t len
chan[i].dacPeriod+=chan[i].dacRate; chan[i].dacPeriod+=chan[i].dacRate;
if (chan[i].dacPeriod>rate) { if (chan[i].dacPeriod>rate) {
DivSample* s=parent->getSample(chan[i].dacSample); DivSample* s=parent->getSample(chan[i].dacSample);
if (s->getEndPosition()<=0) { if (s->samples<=0) {
chan[i].dacSample=-1; chan[i].dacSample=-1;
chWrite(i,0,0); chWrite(i,0,0);
continue; continue;

View File

@ -34,9 +34,9 @@ void DivPlatformZXBeeper::acquire(short* bufL, short* bufR, size_t start, size_t
if (curSample>=0 && curSample<parent->song.sampleLen) { if (curSample>=0 && curSample<parent->song.sampleLen) {
if (--curSamplePeriod<0) { if (--curSamplePeriod<0) {
DivSample* s=parent->getSample(curSample); DivSample* s=parent->getSample(curSample);
if (s->getEndPosition()>0) { if (s->samples>0) {
sampleOut=(s->data8[curSamplePos++]>0); sampleOut=(s->data8[curSamplePos++]>0);
if (curSamplePos>=(unsigned int)s->getEndPosition()) curSample=-1; if (curSamplePos>=s->samples) curSample=-1;
// 256 bits // 256 bits
if (curSamplePos>2047) curSample=-1; if (curSamplePos>2047) curSample=-1;